Tag: Linux
Guruplug Server Plus — Booting from eSATA
by errr on May.29, 2010, under Hardware, Linux
Ive been doing a lot of testing with the guruplug plus lately. Since this thing is a loaner I dont want to make changes to the default settings if I dont have to. This has led me to do all my testing on USB thumbdrives, and on eSATA connected drives. This is a pretty simple thing to setup. Below I will walk you through what you need to do in order to boot from an eSATA connected device.
The first thing you need to is get connected to the guruplug through the jtag connector. Instructions for connecting using the jtag connector can be found here. Once connected power up the guru plug and allow it to boot up. Log in as the root user. If you have not yet, plug in and power up your eSATA drive. When I plugged mine in I got the following:
sheevaplug-debian:~# ata1: exception Emask 0×10 SAct 0×0 SErr 0×4010000 action 0xe frozen
ata1: edma_err_cause=00000010 pp_flags=00000000, dev connect
ata1: SError: { PHYRdyChg DevExch }
ata1: hard resetting link
ata1: link is slow to respond, please be patient (ready=0)
ata1: SATA link up 1.5 Gbps (SStatus 113 SControl F300)
ata1.00: ATA-7: WDC WD2000JS-00MHB0, 02.01C03, max UDMA/133
ata1.00: 390721968 sectors, multi 0: LBA48
ata1.00: configured for UDMA/133
ata1: EH complete
scsi 0:0:0:0: Direct-Access ATA WDC WD2000JS-00M 02.0 PQ: 0 ANSI: 5
sd 0:0:0:0: Attached scsi generic sg2 type 0
sd 0:0:0:0: [sdc] 390721968 512-byte logical blocks: (200 GB/186 GiB)
sd 0:0:0:0: [sdc] Write Protect is off
sd 0:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn’t support DPO or FUA
sdc: sdc1
sd 0:0:0:0: [sdc] Attached SCSI disk
Next I need to create a partition on my disk. Normally I would use fdisk for this task but when I try I get:
sheevaplug-debian:~# fdisk /dev/sdc
WARNING: GPT (GUID Partition Table) detected on ‘/dev/sdc’! The util fdisk doesn’t support GPT. Use GNU Parted.
This means I need to install parted.
apt-get install parted
Next I can get a partition set up.
parted /dev/sdc
Now I already have 1 partition on this drive. We can see that by typing print
parted /dev/sdc
GNU Parted 1.8.8
Using /dev/sdc
Welcome to GNU Parted! Type ‘help’ to view a list of commands.
(parted) print
Model: ATA WDC WD2000JS-00M (scsi)
Disk /dev/sdc: 200GB
Sector size (logical/physical): 512B/512B
Partition Table: gptNumber Start End Size File system Name Flags
1 17.4kB 10.2GB 10.2GB ext2 primary boot
I dont want to mess with this first partition so Im going to make a new one. The first partition was created from 0 to 10240 so I need to go from 10241 to 20481 to make another 10.2G partition.
(parted) mkpart primary ext2 10241 20481
(parted) print
Model: ATA WDC WD2000JS-00M (scsi)
Disk /dev/sdc: 200GB
Sector size (logical/physical): 512B/512B
Partition Table: gptNumber Start End Size File system Name Flags
1 17.4kB 10.2GB 10.2GB ext2 primary boot
2 10.2GB 20.5GB 10.2GB ext3 primary
Next I want to toggle the boot flag so I type toggle and hit enter
(parted) toggle
Partition number? 2
Flag to Invert? boot/hidden/raid/lvm/hp-service/msftres/bios_grub? boot
(parted) print
Model: ATA WDC WD2000JS-00M (scsi)
Disk /dev/sdc: 200GB
Sector size (logical/physical): 512B/512B
Partition Table: gptNumber Start End Size File system Name Flags
1 17.4kB 10.2GB 10.2GB ext2 primary boot
2 10.2GB 20.5GB 10.2GB ext3 primary boot
OK. Now Ill type q to quit, and then make a file system on the new partition.
mke2fs /dev/sdc2
… … …
This filesystem will be automatically checked every 30 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
Now to mount this new partition.
mount /dev/sdc2 /media/usb1/
Now a couple of cp commands will fill this disk with everything you need. This first cp will take a few minutes go grab a drink or something…
cp -avp / /media/usb1
Now to grab dev too. If you look in /media/usb1/dev you will notice it is empty. This would cause a kernel panic if we tried to boot into it now.
cp -ax /dev/ /media/usb1/
Now we are just about ready to reboot and start using our eSATA disk. All we need to do now is to give this new system a different name than the default install so its easy to tell them apart. To do this simply edit a configuration file.
echo "errr-esata" > /media/usb1/etc/hostname
Now we are ready to reboot. Type reboot and wait for the Marvell count down to appear and hit any key to stop the autoboot.
Now at the Marvell command prompt type
set x_bootargs_root root=/dev/sdc2 rootdelay=10
Be sure to use the correct root= line for your drive. This may be sda1 or sdb1 or even sdc1.
Next type boot and hit enter
If you get a kernel panic like so:
VFS: Cannot open root device “sdc2″ or unknown-block(8,34)
Please append a correct “root=” boot option; here are the available partitions:
1f00 1024 mtdblock0 (driver?)
1f01 4096 mtdblock1 (driver?)
1f02 519168 mtdblock2 (driver?)
0800 195360984 sda driver: sd
0801 9999983 sda1
0802 10000976 sda2
Kernel panic – not syncing: VFS: Unable to mount root fs on unknown-block(8,34)
[] (unwind_backtrace+0×0/0xd4) from [ ] (panic+0×48/0×134)
[] (panic+0×48/0×134) from [ ] (mount_block_root+0×1c4/0×20c)
[] (mount_block_root+0×1c4/0×20c) from [ ] (prepare_namespace+0×168/0×1cc)
[] (prepare_namespace+0×168/0×1cc) from [ ] (kernel_init+0xd4/0×108)
[] (kernel_init+0xd4/0×108) from [ ] (kernel_thread_exit+0×0/0×8)
This means that you have told Marvell to boot from the wrong partition. In this case its telling me that sdc2 is unknown but it shows me there is an sda1 and sda2 so Im going to try sda2 instead.
Next you will get to this:
Bluetooth: vendor=0×2df, device=0×9105, class=255, fn=2
btmrvl_sdio mmc0:0001:2: firmware: requesting sd8688_helper.bin
btmrvl_sdio_download_helper: request_firmware(helper) failed, error code = -2
btmrvl_sdio_download_fw: Failed to download helper!
btmrvl_sdio_probe: Downloading firmware failed!
This same thing happens every time on the default file system too it just blows past it instead of waiting.. You can hit ctrl+c here or just wait and it will go on past.
Once it has finished booting we will see we are on our eSATA drive by looking at its host name:
Bluetooth: SCO (Voice Link) ver 0.6
Bluetooth: SCO socket layer initialized
Agent registeredDebian GNU/Linux 5.0 errr-esata ttyS0
errr-esata login:
Now I can log in and do what ever to this system and when I reboot unless I intervene it will boot back up in default mode on the default internal flash drive, since what we have done here doesnt last a reboot. I hope this helps some of you out there.
Guru Plug Server Plus — My First Look
by errr on May.12, 2010, under Hardware, Linux
So my boss Robert got a Guru Plug Server Plus, and to my great surprise and joy he sent it home with me to play with. Getting connected to it was simple, once it was plugged in it showed up in my wireless access point list on windows.

Once connected to the access point I got my network info and tried to ssh to the gateway. I was able to log in as root with a clever default root password. I was greeted with a familiar sight. 
Debian GNU/Linux 5.0 I connected the device to the internet and tried to apt-get update but found that didnt work. In the /etc/apt/sources.list file there was an entry for a private internal mirror. I had to comment that out and ran dpkg –configure -a since the system suggested it. Once I did that apt-get update worked and so I did an apt-get upgrade Upgraded everything that needed it. Next I installed less, and ntp. I went through the list of pre installed packages, it was pretty long. Some of the packages that stood out were Lighttpd, PERL, PHP5, Python 2.5, MySQL server and client, exim4, udhcpd, and samba 3.2.5. So for dirt you get a pretty powerful cheap ready to rock LAMP stack and File server and Wireless AP. Not so shabby. This puppy supports booting using all kinds of methods. If you are connected to it though the JTAG you will have the option to keep the system from booting. You will be given a prompt:
Hit any key to stop autoboot: 0
Marvell>> help
This will return a nice long list of options. You can choose between USB, TFTP, NFS, and many others. Im looking forward to the next couple of days of playing. I want to try out quagga and maybe asterisk. Check back soon for an update of what I do.
Red Hat Enterprise Linux 6 Beta – My First look
by errr on Apr.28, 2010, under Linux
I spent a few hours tonight playing around with Red Hat Enterprise Linux 6 Beta release tonight. So far it seems really nice. I had no issues getting flash-plugin installed from Adobe. I installed irssi and setup my network to use a static IP. All tasks were very familiar feeling from past releases. I mostly messed around with desktop stuff tonight. Tomorrow I hope to get to setup Apache PHP and MySQL, and maybe a few days later I will step through a mail server as well with Postfix.
Rename Files Fast from the Linux CLI
by errr on Jan.14, 2010, under Linux
So today I moved our web root from this OLD system to our new server. First things first I tried to hit some of the links and I was served given the option to d/l the file… Well I could go to the Web server config file and tell it to parse these files as php, or how about we ditch the .php3 for something this decade… like .php So I go to our web root and look for all the files that end in .php3
find . -iname “*.php3″ -print
Nice. Now I have a huge list of files here.. How on earth can I rename them with out this taking all day… I used rename like so:
find . -iname “*.php3″ -print |xargs rename -n ’s/\.php3/\.php/’
This command will NOT actually change ANYTHING on your system. The -n flag says to run through as a test and tell me what you would be doing if I wanted it done… I can see from this output that I do indeed want to run this command.
find . -iname “*.php3″ -print |xargs rename -v ’s/\.php3/\.php/’
Now this time it did go though and rename and it printed to the screen what it did (thats what the -v flag does verbose). Now I can go though and edit the index file that pointed to these php3 files and remove that 3. Simple and now I dont have that silly 3 on the file names any more.
Export xBase/dBase files into MySQL
by errr on Jan.04, 2010, under Database, Linux
If you have an application that uses xBase/dBase files to store data you may at some point need to export that data into a real database, like MySQL. This is a really simple task thanks to a nifty app called dbf2mysql. For my example I was using some CRM software called ACT. They used dBase III files to store their data. So I just went to the windows box that was holding my dBase file. I used winscp to move it to my Linux box. Next I used:
dbf2mysql -vvv -c -f -d dbname -r -U dbuser -P dbuserpass CustomerInfo.dbf
What this does is turns up the verbose logging to my screen, next the -c will create a table in my database named “test” (this is default and can be changed with the -t flag) -f makes all the field named from the dbf file be changed to lower case, next the -d, -U, and -P seem pretty obvious, and that leaves us with the -r which will Trim trailing and leading white space from CHAR type fields. All this info and more can be found in the man page. Here is the trail end of what I got from the output of my command:
fields in dbh 71, allocated mem for query 4293, query size 2156
Inserting records
Inserting record 0
Inserting record 100
Inserting record 200
Inserting record 300
Inserting record 400
Inserting record 500
Inserting record 600
Inserting record 700
Inserting record 800
Closing up….
Now I can log into phpmyadmin and verify that all my data has been moved successfully.
