View previous topic :: View next topic |
Author |
Message |
tert n00b
Joined: 18 May 2016 Posts: 11
|
Posted: Wed May 18, 2016 11:34 pm Post subject: [SOLVED]Booting from USB without initramfs |
|
|
I tried to setup gentoo to boot from a usb flash-drive and resulting with semi-success. This might be helpful for people trying to do similar setup without initramfs.
Usually if gentoo is setup with a usb drive as with a hdd drive, there is a kernel panic because the kernel naively assumes that the root partition is readily usable when it is initiated which is not the case for usb drives. This can be solved by passing "rootwait" parameter to the kernel. As the name suggests, the kernel would then wait (indefinitely) for the root partition to be ready. Alternatively there is "rootdelay" but it requires some tweaking with the delay time and is therefore less applicable.
For information about these parameters: https://www.kernel.org/doc/Documentation/kernel-parameters.txt
So pretty straightforward. Just pass the parameter through GRUB or any bootloader and as usual set the boot partition to sda* and it boots.
Unless the usb drive got its name wrong...
This happens if there is any other scsi device attached, usually a regular hard drive. It is likely to take over sda and the usb drive would be assigned to another name and kernel panic again.
One simple solution is to not attach any other scsi device, which works well given the fact that any one booting from usb probably prefer to work with the usb for its flexibility or price advantage and so on. But avoiding the problem sounds little sub-optimal for a general setup, therefore the question:
How to map a usb device to a specific device name?
I had some preliminary clues for this one which involves udev rules, but just would like to check with the more knowledgeable before I tweak with my boot setup because when it fails, it's real pain.
Last edited by tert on Sat Oct 10, 2020 5:45 am; edited 3 times in total |
|
Back to top |
|
|
frostschutz Advocate
Joined: 22 Feb 2005 Posts: 2977 Location: Germany
|
Posted: Thu May 19, 2016 12:08 am Post subject: |
|
|
with GPT partition table, the kernel supports PARTUUID without initramfs... |
|
Back to top |
|
|
mv Watchman
Joined: 20 Apr 2005 Posts: 6780
|
Posted: Thu May 19, 2016 7:40 am Post subject: |
|
|
frostschutz wrote: | with GPT partition table, the kernel supports PARTUUID without initramfs... |
Even with MSDOS partition table, the kernel supports PARTUUID by some magic. |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54834 Location: 56N 3W
|
Posted: Thu May 19, 2016 5:29 pm Post subject: |
|
|
tert,
Welcome to Gentoo.
In your opening post, you really mean root partition when you say Quote: | Usually if gentoo is setup as with a hdd drive, there is a kernel panic because the kernel naively assumes that the boot partition is readily usable when it is initiated which is not the case for usb drives. |
You use the term root correctly elsewhere.
As others have said, root=PARTUUID= is the way to go on the kernel command line. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
tert n00b
Joined: 18 May 2016 Posts: 11
|
Posted: Thu May 19, 2016 10:03 pm Post subject: |
|
|
Thanks for the replies!
Sorry for the typo, it's correct now.
I will try the PARTUUID method and report back. I thought it was GPT only, but the kernel is evolving. |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54834 Location: 56N 3W
|
Posted: Thu May 19, 2016 10:33 pm Post subject: |
|
|
tert,
With MSDOS disk lables PARTUUID has worked for some time
It uses the 32 bit Volume ID followed by a two digit partition number to form the PARTUUID.
For primary partitions -01 ... -04, this is stable enough.
For logical partitions, be very careful if you delete a partition with a lower number than your root partition.
Your root partition will get renumbered and your box won't boot.
Of course, this makes a mess of fstab too. Its just one more thing to remember to fix. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
tert n00b
Joined: 18 May 2016 Posts: 11
|
Posted: Thu May 19, 2016 11:38 pm Post subject: |
|
|
Works like magic!
There are instructions on: https://wiki.gentoo.org/wiki/GRUB
Need to improve my google skill.
No recompiling the kernel, no woofy GPT, it just works. Now root simply shows up as /dev/root by kernel magic.
My only complain would be that grub2-mkconfig would insist on /dev/sd* scheme, so grub.cfg needs some tweaking. But I suppose that's expected. |
|
Back to top |
|
|
|