On 15/09/10 20:10, YoYo Siska wrote: > On Wed, Sep 15, 2010 at 08:34:33AM +1000, Jake Moe wrote: >> On 15/09/10 04:28, YoYo Siska wrote: >>> On Fri, Sep 10, 2010 at 07:29:01AM -0400, David Relson wrote: >>>> On Fri, 10 Sep 2010 11:05:12 +0200 >>>> J. Roeleveld wrote: >>>> >>>>> On Friday 10 September 2010 10:43:30 Jake Moe wrote: >>>>>> On 10/09/2010 5:27 PM, Maciej Grela wrote: >>>>>>> 2010/9/10 Jake Moe<jakesaddr...@gmail.com>: >>>>>>>> Hello all, >>>>>>>> >>>>>>>> I've been thinking about creating a Gentoo USB stick for install >>>>>>>> and rescue purposes (and, of course, just to see if I could). >>>>>>>> I've mostly followed the Gentoo handbook (I used a single 4GB >>>>>>>> partition for the whole system, and no swap). I've used >>>>>>>> genkernel for the kernel (so I can have a multi-system capable >>>>>>>> kernel). I've gotten GRUB installed and working. My problem >>>>>>>> comes in after what I believe is the init process: >>>>>>>> * Checking root filesystem ... >>>>>>>> >>>>>>>> fsck.ext2: No such file or directory while trying to >>>>>>>> open /dev/sda1 /dev/sda1: >>>>>>>> The superblock could not be read or does not describe a correct >>>>>>>> ext2 filesystem. If the device is valid and it really contains >>>>>>>> an ext2 filesystem (and not swap or ufs or something else), then >>>>>>>> the superblock >>>>>>>> >>>>>>>> is corrupt, and you might try running e2fsck with an alternate >>>>> superblock: >>>>>>>> e2fsck -b 8193<device> >>>>>>>> >>>>>>>> * Filesystem couldn't be >>>>>>>> fixed :( [ >>>>>>>> >>>>>>>> !! ] >>>>>>>> Give root password for maintenance >>>>>>>> (or type Control-D to continue): >>>>>>>> >>>>>>>> >>>>>>>> If I give the root password, I can find no /dev/sda1. However, >>>>>>>> mount shows /dev/sda1 on /, and there *is* a /sys/block/sda >>>>>>>> folders, with a sda1 folder in that as well. It's almost like >>>>>>>> it had /dev/sda1, but then lost it somehow. >>>>>>>> >>>>>>>> Does anyone have any idea what's going on here? Any help would >>>>>>>> be appreciated. >>>>>>> Have you seen http://www.sysresccd.org/Main_Page ? It's based on >>>>>>> Gentoo, you could check what they did to boot from a usb stick. >>>>>>> >>>>>>> Br, >>>>>>> Maciej Grela >>>>>> Excellent, thanks for that, I hadn't found it in my previous >>>>>> searches. I'll have a look there. >>>>>> >>>>>> Jake Moe >>>>> Had a similar issue a while ago when I was playing around with this >>>>> myself. >>>>> >>>>> Take a look at the linux boot parameters. >>>>> >>>>> The 'theoretical' part is: You need to let the kernel initialize the >>>>> USB-stick before trying to access it. (This can take some time) >>>>> >>>>> There is a delay-option, just can't remember the proper name off-hand. >>>>> >>>>> -- >>>>> Joost >>>> I've got USB booting working in a syslinux environment. A delay of 12 >>>> seconds is working for me. The syslinux.cfg stanza I use is: >>>> >>>> LABEL usb >>>> KERNEL linux >>>> APPEND rootdelay=12 root=/dev/sda2 >>> The usual way for linux on removable usb sticks / disks is to use LABEL >>> or UUID to identify the disks and not the device names, because they >>> will be different in different computers ;) The downside is that you >>> need an initrd to mount the root partition... I think that the usual >>> initrd generated by genkernel works... >>> >>> If you created the rootfs with: >>> mkfs.ext2 -j -LUSBGentoo /dev/sdXY >>> >>> then you can change the kernel parameter to >>> root=LABEL=USBGentoo >>> >>> and your fstab to: >>> LABEL=USBGentoo / ext3 ... >>> >>> You can also use the uuid of the filesystem, find it out with >>> dumpe2fs -h /dev/sdb2 | grep UUID >>> and then use UUID=XXX instead of LABEL=XXX >>> >>> I never really played around with grub and USB booting, so I use >>> syslinux. I create a small FAT partition with syslinux, kernel and >>> initrd image (it gets also pretty handy when you sometimes need to copy >>> something from a windows machine ;) and a second "regular" ext3 >>> partition for the rootfs. >>> >>> Basically you would do: >>> - partition the stick, mark the FAT partition as bootable/active >>> - format the partitions: >>> - mkfs.vfat -nUSBData /dev/sdX1 >>> - mkfs.ext2 -j -LUSBGentoo /dev/sdX2 >>> - install syslinux (on the FAT partition): >>> - syslinux /dev/sdX1 >>> - mount /dev/sdX2, install gentoo in the usual way >>> - compile the kernel and initrd, make sure required USB stuff is in the >>> kernel >>> (theoretically it could be as modules in initrd... but in-kernel is >>> safer :) >>> if you are in a hurry, or don't know how to create them, get them from >>> a gentoo livecd ;) don't forget to also copy the modules >>> (/lib/modules-XXX/...) from the livecd to the rootfs. >>> - put the kernel and initrd on the FAT partition (I name them vmlinuz.img >>> and initrd.img) >>> - edit syslinux.cfg (on the FAT partition), see >>> >>> http://syslinux.zytor.com/wiki/index.php/SYSLINUX#How_do_I_Configure_SYSLINUX.3F >>> a very simple one from my USB disk: >>> >>> DEFAULT linux >>> LABEL linux >>> SAY Now booting USBGentoo >>> KERNEL vmlinuz.img >>> APPEND root=LABEL=USBGentoo initrd=initrd.img >>> >>> you might also add rootdelay=10 to the options if the usb stick/disk isn't >>> detected quick enough >>> >>> umount, reboot, set the computer to boot from usb, enjoy... ;) >>> Xorg without a config seems to work pretty well on most computers these >>> days, IIRC the alsa modules for soundcards are also autoloaded, so you >>> don't need any fancy hw detection to have a desktop running from USB >>> stick ;) >>> >>> >>> yoyo >>> >>> >>> >>> BTW there is also a "manual" way to boot even without an initrd: use >>> LABEL=XXX in your fstab, on the kernel command line use root=/dev/sda2 >>> (or whatever you think will be more probable on you machines ;) >>> then try to boot it, if it is wrong, you can enter the corrent >>> "root=/dev/sdX2" param in the syslinux prompt (you can either look up the >>> correct device in the boot messages, or just try sda, sdb, sdc, ... ;) >>> You could also create menu options for the usual cases... (sda...sdf >>> shoud be more than enough... ;) >>> You can however accidentally mount a rootfs from one of the disks on the >>> computer and thus booting the system on the computer, just with your >>> kernel... >>> >>> >>> >>> >> Thanks for that. I originally tried with "LABEL=UsbRoot" in both >> GRUB and fstab, but it couldn't find it, so I put it in a system >> that I'd pulled the hard drive from, so I could test if it'd work >> with /dev/sda instead. Neither method works; it just doesn't seem >> to see the USB storage in /dev. When I try by label, I get what's >> in the attached error. >> >> I've had a quick look at SYSLINUX (and it's counterpart, EXTLINUX), >> and it appears to really be nothing more than another bootloader >> like LILO or GRUB. Is that the case? If so, I might try and >> overwrite GRUB with EXTLINUX and see if that works; it appears that >> it should be that easy. Most of the USB booting doco I can find >> seems to want SYSLINUX anyway; maybe I'll give it a try. I had >> thought that a USB storage device is storage like anything else, so >> a "standard" install should work. Maybe it doesn't... > Yes, syslinux is just another "bootloader" ;) It his however > specifically created for removable disks. I don't know how exactly grub > works and how it handles "removable" disk (ie when the disk appears at > different places) when finding devices for its root partition and the > root option for kernel... > >> Jake Moe >>>> Activiating mdev >>>> Determining root device... >> /init: line 477: blkid: not found\ > seems like your initrd is missing the blkid program (used to determine > the labels and uuids of disks...) > Looking at the genkernel help it seems to ethis option: > --disklabel Include disk label and uuid support in your > ramdisk > >> !! Could not find the root block device in LABEL=UsbRoot. >> Please specify another value or: press Enter for hte same, type "shell" >> for a >> shell, or "q" to skip... >> root block device(LABEL=UsbRoot) :: /dev/sda1 >>>> Mounting root... >>>> Booting (initramfs).. >> INIT: version 2.87 booting >> >> Gentoo Linux; http://www.gentoo.org/ >> Copyright 1999-2009 Gentoo Foundation; Distributed under teh GPLv2 >> >> Press I to enter interactive boot mode >> >> * Mounting proc at /proc ... [ >> ok ] >> * Mounting sysfs at /sys ... [ >> ok ] >> * Mounting /dev ... [ >> ok ] >> * Starting udevd ... [ >> ok ] >> * Populating /dev with existing devices through uevents ... [ >> ok ] >> * Waiting for uevents to be processed ... [ >> ok ] >> * Mounting devpts at /dev/pts ... [ >> ok ] >> * Checking root filesystem ... >> fsck.ext2: Unable to resolve 'LABEL=UsbRoot' > This means fsck was unable to find the filesystem with that label. > You can use dumpe2fs /dev/yourpartition to check if the filesystem > really has the cooret label (look for "Filesystem volume name" at the > top) > >> * Filesystem couldn't be fixed :( [ >> !! ] >> Give root password for maintenance >> (or type Control-D to continue): > yoyo > Thanks for that, I'll rebuild the genkernel with blkid support.
As to the second suggestion, there is *no* /dev/sda1 (the partition in question). It just doesn't exist for some reason. However, fstab shows that it's mounted, and /sys/block has entries for the disk, so I'm not sure why it's dropped out. I'm guessing it has something to do with udevd, or uevents? Because shortly before that, I tell it to find the root partition at /dev/sda1, and it starts to boot, but then it loses it. Jake Moe