JP Vossen on 1 Mar 2010 22:31:41 -0800 |
SOLVED, FYI only because it's odd. Bottom line: Installing to a USB key FROM a USB key leaves the boot devices very confused, not surprisingly. I'm pretty sure the BIOS has something to do with it too. So first-boot after install didn't work, and the settings to finally get it to boot were counter-intuitive to say the least. I think that device order swaps itself between Grub and the initrd bootstrap. Details: -------- I asked about this a while ago, but am finally getting to it. I got a new machine (System76 Meerkat (not ION)) to use as a backup server. I want to install and boot the OS from a USB key [1], and leave the hard drive as data-only (well, and swap). After wasting a day or two trying to use a "bad" USB key [2], I got Debian Lenny installed on a USB key. It boots, Grub finds the initrd and loads that and the kernel, but then it can't find the root file system. That's kind of funny, because in order to find the initrd it has to be reading the root FS, there is no separate /boot. This is what the the installer wrote, but since the installer USB key is now gone, devices and boot order have changed (note hd2,0 is consistent with sdc1): # BROKEN, from installer root (hd2,0) kernel /boot/vmlinuz-2.6.26-2-amd64 root=/dev/sdc1 ro quiet initrd /boot/initrd.img-2.6.26-2-amd64 Lots of stuff goes by too fast to see, but there is mention of sda (boot USB drive) and sdb (hard drive). Here is how it ends up: [...] kinit: trying to resume from /dev/sda1 kinit: No resume image, doing normal boot [...] Begin: Running /scripts/init-bottom ... mount: mounting /dev on /root/dev failed: no such file or directory done. mount: mounting /sys on /root/sys failed: no such file or directory mount: mounting /proc on /root/proc failed: no such file or directory Target filesystem doesn't have /sbin/init No init found. Try passing init= bootarg. [drop to Busybox] I tried a rootdelay, but that seemed to have no effect when using /dev/sda1 (where the root FS really should have been according to Grub). If I use /dev/sdc1 (which doesn't exist), rootdelay takes effect and I see the "waiting for root filesystem" message, but then boot fails since sdc1 isn't really there. As noted this whole mess was caused because this machine does not have an optical drive, so I am booting from and successfully installing Debian Lenny from a Kingston DataTraveller USB key ONTO a second Kingston DataTraveller USB key [3]. So device and boot order is screwy on first-boot. No problem, I am using Grub's editing feature to fix it. I've also tried Grub's auto-complete feature to make sure that h0,0 and h1,0|1 are what I think they are. This is what actually worked, note hd0,0 is inconsistent with sdb1: # WORKED root (hd0,0) kernel /boot/vmlinuz-2.6.26-2-amd64 root=/dev/sdb1 ro rootdelay=10 initrd /boot/initrd.img-2.6.26-2-amd64 So it looks to me like the boot devices are swapping around DURING the boot, seemingly after Grub but before/during initrd. The USB key has only a single 2G partition containing '/' while the hard drive has 2 partitions, type 82 swap and type 83 Linux. So Using Grub tab-completion, it's pretty easy to tell them apart. AFAICT, Grub thinks: hd0,0 = /dev/sda1 # / hd1,0 = /dev/sdb1 # swap hd1,1 = /dev/sdb2 # /data BUT once booted I have this, and as noted to even boot at all I need to point the kernel at sdb1 (not sda1 as hd0,0 implies): /dev/sda1 = swap /dev/sda2 = /data /dev/sdb1 = / One other interesting thing is that on my first successful boot, /etc/fstab had "/dev/sdc1 /" and 'df' reported that as well but there *was* no /dev/sdc1 and '/' was *actually* mounted on /dev/sdb1! I don't even know how that worked; I guess the initrd overrode /etc/fstab, but 'df' used the "wrong" data in fstab for display. Anyway, I fixed /boot/grub/menu.lst and /etc/fstab and rebooted and this time it all worked. Hope this is useful, JP _________________________ Footnotes [1] The machine has front panel USB ports, but I was able to unscrew the PC-board and flip it, so the USB key is actually sticking out of the USB port inside the case. Nice. I'll post pics at some point. [2] The "bad" key is--wait for it--from Microsoft. Yup, I got it for free and thought it would be funny to install Debian on it, but the joke was on me as the key is such a PoS that it can't boot. All I get on the screen is a "j". That's it, nothing else from Grub or anything. Just a "j" in the top left... I finally gave up and used a Kingston DataTraveller, which works fine. [3] This is how I ended up making the installer USB key. USB-Creator isn't generic enough and UNetBootin seemed like it wasn't making them bootable right, but that may have been related to the bad Microsoft USB key. # >> http://www.debian.org/releases/lenny/i386/ch04s03.html.en # http://blogs.koolwal.net/2009/02/25/installing-linux-on-usb-part-7-install-debian-linux-from-usb-drive/ * cd /tmp * wget 'http://http.us.debian.org/debian/dists/stable/main/installer-amd64/current/images/hd-media/boot.img.gz' 'http://cdimage.debian.org/debian-cd/5.0.4/amd64/iso-cd/debian-504-amd64-netinst.iso' * zcat boot.img.gz > /dev/sdb # Only creates a 239M volume! * mount /dev/sdb /mnt/ * cp debian-504-amd64-netinst.iso /mnt * umount /dev/sdb ----------------------------|:::======|------------------------------- JP Vossen, CISSP |:::======| http://bashcookbook.com/ My Account, My Opinions |=========| http://www.jpsdomain.org/ ----------------------------|=========|------------------------------- "Microsoft Tax" = the additional hardware & yearly fees for the add-on software required to protect Windows from its own poorly designed and implemented self, while the overhead incidentally flattens Moore's Law. ___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug
|
|