public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Rich Freeman <rich0@gentoo.org>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] booting - I don't anystand how the (Linux) world works anymore
Date: Sat, 25 Jun 2016 15:46:21 -0400	[thread overview]
Message-ID: <CAGfcS_=sFnt5ZuPUgJicdaRL4e4d01AymTk2QauvHTxZQV3eoQ@mail.gmail.com> (raw)
In-Reply-To: <YseLVsRteFjBS+5CTTP64t@7zc0huhpDvqcKwT48Q8b0>

On Sat, Jun 25, 2016 at 2:33 PM, Helmut Jarausch <jarausch@skynet.be> wrote:
>
> I don't understand  the   'root=' option on the boot line like
> kernel /boot/vmlinuz-4.7.0-rc4 root=/dev/sda1
>

It is pretty simple.  If you're not using an initramfs, the kernel
attempts to find the device you list and mount it as /, and then it
runs whatever you pass in init=, or the canned list of init locations
it has stored inside if you don't pass that.  If you're using an
initramfs, the kernel mounts it as / and runs its init, passing the
root= parameter over to it.

>
> Having booted by SystemRescueCD from the cdrom device, my root device is
> labelled  /dev/sda1
>  BUT trying to use that on the kernel boot line fails (the kernel cannot
> find the root file system)
>
> By trial and error I've found that I have to use   root=/dev/sdb1
>
> but if I plug in an external drive (via USB) this doesn't work any more.

As you've no doubt figured out, the issue is that these device names
are assigned dynamically, and if your configuration changes (which I
suppose might even include changing the boot device depending on your
firmware), then these names can change.  The kernel's logic is pretty
basic and prone to these kinds of failures.

>
> So, I came up with    root=UUID=uuid_number of the root file system.
>
> But to my surprise I now got  a kernel panic
> syncing: VFS: unable to mount root fs on unknown block(0,0)
>
> So, please tell me what I'm missing?

The linux kernel doesn't have any concept of device UUIDs.  It can
only accept valid device names.

The bit you're missing is that the kernel only interprets the root=
parameter if you're not using an initramfs.  If you're using an
initramfs then the kernel just lets the initramfs mount root.  The
initramfs is basically a mini linux distro that can do just about
anything it wants, and most have a way to handle devices identified by
UUID.

I'd suggest using dracut, which seems to be the most robust initramfs
out there.  To use it (or any other initramfs) there are basically a
few steps:

1.  Create an initramfs image in /boot (the syntax varies by tool).
2.  Configure your bootloader to load the initramfs (the syntax varies
by bootloader)
3.  Pass an appropriate root= line to the kernel (the syntax varies by
initramfs implementation, but most handle the syntax you gave, as well
as the various udev paths that are based on UUIDs and labels and
such).

For dracut #1 is:
dracut "" version (ie dracut "" 4.7.0-rc4)

For grub1 #2 find the kernel line in your grub config file, and add a line:
initrd <filename>  (ie initrd initramfs-4.7.0-rc4.img)

Use the same path in that as your kernel, so if your kernel has some
kind of preceding directory path use the same for the initramfs.

While you can often get away without using an initramfs, in general
they tend to make the boot process more robust and they don't really
have any impact on the system once it is running.  They're loaded into
a ramfs, and they typically delete themselves out of ram right before
execing the real init.  They just give you a LOT more options while
booting (especially with dracut ; you'd probably be able to mount root
off of iscsi over a vpn using it).

-- 
Rich


  parent reply	other threads:[~2016-06-25 19:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-25 18:33 [gentoo-user] booting - I don't anystand how the (Linux) world works anymore Helmut Jarausch
2016-06-25 19:19 ` Jeremi Piotrowski
2016-06-25 20:08   ` Helmut Jarausch
2016-06-25 19:20 ` [gentoo-user] " James
2016-06-25 19:39 ` [gentoo-user] " David W Noon
2016-06-25 20:18   ` Helmut Jarausch
2016-06-25 21:06     ` David W Noon
2016-06-25 19:46 ` Rich Freeman [this message]
2016-06-25 20:23   ` Helmut Jarausch
2016-06-25 19:51 ` Alan McKinnon
2016-06-25 20:15   ` Rich Freeman
2016-06-25 20:19 ` Tom H
2016-06-25 20:24   ` Helmut Jarausch
2016-06-27 17:14     ` Tom H

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGfcS_=sFnt5ZuPUgJicdaRL4e4d01AymTk2QauvHTxZQV3eoQ@mail.gmail.com' \
    --to=rich0@gentoo.org \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox