[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Little OT] grub and udev root device

Hemlock wrote:
> Hello,
> I'm wondering if its possible to rename my / device with udev and get grub 
> to see it and boot it?
> Here's what I tried:
> kernel 2.6.17
> /etc/udev/rules.d/010local.rules
> BUS="scsi", ID="0:0:0:0", NAME="sata%n"
> I have one partition on my sata drive so I edited fstab
> to mount / on to /dev/sata1 instead of /dev/sda1
> I then edited grub and changed root=/dev/sda1 to root=/dev/sata1
> I also made a new initrd image just in case:
> # mkinitrd -o /boot/initrd.img-2.6.17sata -r /dev/sata1
>      (I edited the grub menu too to use the new initrd.img)
> If I reboot, I get a kernel panic, something about cannot open dev/console
>    attempted to kill init
> If I reboot again and edit the grub boot loader and point the root back 
> to /dev/sda1, the system boots fine, although a 
> # df -h 
> shows / mounted to /dev/sata1
> Is it even possible to boot off a customly named root device?
> Thanks
> Mike


I can't see how this would work.  Grub is passing your root string to
the kernel when it loads and boots the kernel.  Since nothing else is
running (especially udev), the only namespace that the kernel has for
devices is its own.  Until the udev daemons get started, there is no
/dev/sata1.  Something of a chicken and egg problem.

Since the answer to all booting chicken and egg problems is the initrd,
it should be possible to do what you want using that.  You would have to
have enough of a system to get udev running on your initrd, then you
could transfer the your root device to /dev/sata1.  I've seen that basic
process used to keep the root filesystem encrypted on the hard drive
before.  If you search for "encrypted root filesystem" you should get
some information, and you might be able to adapt that hack to what you
are trying to accomplish.

Good luck.


Reply to: