Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED]Booting from USB without initramfs
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
tert
n00b
n00b


Joined: 18 May 2016
Posts: 11

PostPosted: Wed May 18, 2016 11:34 pm    Post subject: [SOLVED]Booting from USB without initramfs Reply with quote

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
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2977
Location: Germany

PostPosted: Thu May 19, 2016 12:08 am    Post subject: Reply with quote

with GPT partition table, the kernel supports PARTUUID without initramfs...
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6780

PostPosted: Thu May 19, 2016 7:40 am    Post subject: Reply with quote

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
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54834
Location: 56N 3W

PostPosted: Thu May 19, 2016 5:29 pm    Post subject: Reply with quote

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
View user's profile Send private message
tert
n00b
n00b


Joined: 18 May 2016
Posts: 11

PostPosted: Thu May 19, 2016 10:03 pm    Post subject: Reply with quote

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
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54834
Location: 56N 3W

PostPosted: Thu May 19, 2016 10:33 pm    Post subject: Reply with quote

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
View user's profile Send private message
tert
n00b
n00b


Joined: 18 May 2016
Posts: 11

PostPosted: Thu May 19, 2016 11:38 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum