Friday, April 26, 2013

scp or rsync with plain password using sshpass

Sometimes i don't care with security, i just want to put my password inside my script (hard code), why? Because i need to run that script automatically. If you face same problem with me, then you lucky came to my blog. The solution is simple, use sshpass, download and compile it, then run it.

Using with scp (not like rsync, scp does not support plain password)
sshpass -p yourpassword scp username@server.com:/path/to/file/singlefile .

Using with ssh
sshpass -p yourpassword ssh username@server.com

Monday, April 15, 2013

[SOLVED] HighPoint RocketRAID 620 - 88SE9125 SATA Controller

After several days of fighting with the mysterious 88SE9125 SATA Controller from HighPoint RocketRAID 620, finally I found the easiest way to solve this problem, this problem has been much discussed in many forums. But most of the discussion only on how to install the driver from the HighPoint, I've tried but still failed, even I get Slackware upgrade from version 12 to 14, but still failed. until finally I decided to do a kernel recompile from scratch. and successfully. and here is my journey.

HighPoint RocketRAID 620 - 88SE9125 SATA Controller
HighPoint RocketRAID 620 - 88SE9125 SATA Controller






Download latest kernel and extract it.
cd /tmp
wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.8.7.tar.xz
tar -xvf linux-3.8.7.tar.xz -C /usr/src/linux

Remove the old symlink
rm -f /usr/src/linux
cd /usr/src
ln -s linux-3.8.7 linux

To begin to compile the kernel, I need a config file, but I do not want to start from scratch by doing a check one by one the options in menuconfig, I could just take the config from kernel-smp-3.2.9 but I do not want it, because that kernel does not able to detect the SATA controller, so I decided to take the config file from Slax kernel 7.0, because slax 7.0 using kernel-3.8.2 and able to detect the SATA Controller.

Get config file from slax 7.0
cd /tmp
wget http://ftp.slax.org/Slax-7.x-development/sources/Slax-7.0-sources/kernel/.config-i486
cp -v .config-i486 .config /usr/src/linux/.config

Now Let's start compiling kernel, Run make oldconfig in the kernel source directory, so processes will use config from the .config file you just copied.

Compiling kernel
cd /usr/src/linux
make oldconfig
make menuconfig # if you want change something do it now, but i don't touch it and it worked for me.

Now, start the build of kernel and modules, and install them to the proper places.
make bzImage modules # compile the kernel and the modules
make modules_install # installs the modules to /lib/modules/

Copying file to correct director
cp -v arch/x86/boot/bzImage /boot/vmlinuz-3.8.6-10.04.13-diantokam # copy the new kernel file
cp -v System.map /boot/System.map-3.8.6-10.04.13-diantokam # copy the System.map (optional)
cp -v .config /boot/config-3.8.6-10.04.13-diantokam # backup copy of your kernel config

Fixing some symlink on /boot directory
cd /boot
rm -f System.map # delete the old link
ln -s System.map-3.8.6-10.04.13-diantokam System.map # create a new link
ln -s vmlinuz-3.8.6-10.04.13-diantokam vmlinuz # create a new kernel link

Updating initrd
In case your kernel does not include the driver for your root filesystem, or a driver for your SATA bus, or other stuff that is only built as modules, your kernel will panic if it boots and can not access the necessary disks, partitions and/or files
cd /boot
wget http://www.slackware.com/~alien/tools/mkinitrd_command_generator.sh
sh mkinitrd_command_generator.sh

#
# mkinitrd_command_generator.sh revision 1.45
#
# This script will now make a recommendation about the command to use
# in case you require an initrd image to boot a kernel that does not
# have support for your storage or root filesystem built in
# (such as the Slackware 'generic' kernels').
# A suitable 'mkinitrd' command will be:

mkinitrd -c -k 3.8.6-10.04.13-diantokam -f ext3 -r /dev/sda1 -m usbhid:uhci-hcd:ext3 -u -o /boot/initrd.gz

Now finally we must change rc.module symlink
cd /etc/rc.d/
rm -f rc.modules
ln -s rc.modules-3.8.6-10.04.13-diantokam rc.modules

Now reboot your computer and may pinguin with yo

BUT after rebooting, i still got alot of trouble, because i use 8 SATA and 1 PATA at once, the system always recognize my hardisk with different sequence when i swap out one or maybe some disk for testing, that way i suggest all of you to using UUID on grub menu.lst, 

And here is my menu.lst:
cat /boot/grub/menu.lst
timeout 10
color light-gray/red black/light-gray
title Slackware 14.0 on (/dev/sda1)
root (hd0,0)
kernel /boot/vmlinuz root=UUID=6eaf2751-c81d-48ca-b896-4d7ff530da5e ro vga=791 raid=noautodetect
initrd /boot/initrd.gz

And here is my disks after finall booting
root:# lshw -short -C disk
H/W path Device Class Description
================================================
/0/2/0.0.0 /dev/sda disk 3TB WDC WD30EZRS-00J <--SATA Controller 88SE1925 Gen2 signaling speed (3.0Gb/s)
/0/3/0.0.0 /dev/sdb disk 3TB WDC WD30EZRS-00J <--SATA Controller 88SE1925 Gen2 signaling speed (3.0Gb/s)
/0/5/0.0.0 /dev/sdc disk 3TB WDC WD30EZRS-00J <--SATA Controller 88SE1925 Gen2 signaling speed (3.0Gb/s)
/0/6/0.0.0 /dev/sdd disk 1TB WDC WD10EADS-00M <--SATA Controller 88SE1925 Gen2 signaling speed (3.0Gb/s)
/0/7/0.0.0 /dev/sde disk 80GB ST380021A <--PATA on MotherBoard
/0/8/0.0.0 /dev/sdf disk 3TB ST3000DM001-1CH1 <--SATA on MotherBoard Gen3 signaling speed (6.0Gb/s)
/0/8/0.1.0 /dev/sdg disk 3TB ST3000DM001-1CH1 <--SATA on MotherBoard Gen3 signaling speed (6.0Gb/s)
/0/9/0.0.0 /dev/sdh disk 3TB ST3000DM001-1CH1 <--SATA on MotherBoard Gen3 signaling speed (6.0Gb/s)
/0/9/0.1.0 /dev/sdi disk 3TB ST3000DM001-1CH1 <--SATA on MotherBoard Gen3 signaling speed (6.0Gb/s)