[systemd-bugs] [Bug 84689] New: "Failed to determine block device of root file system: No such file or directory" on boot

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sun Oct 5 09:44:04 PDT 2014


https://bugs.freedesktop.org/show_bug.cgi?id=84689

            Bug ID: 84689
           Summary: "Failed to determine block device of root file system:
                    No such file or directory" on boot
           Product: systemd
           Version: unspecified
          Hardware: All
                OS: Linux (All)
            Status: NEW
          Severity: normal
          Priority: medium
         Component: general
          Assignee: systemd-bugs at lists.freedesktop.org
          Reporter: maxtram95 at gmail.com
        QA Contact: systemd-bugs at lists.freedesktop.org

Created attachment 107360
  --> https://bugs.freedesktop.org/attachment.cgi?id=107360&action=edit
The test program which reproduces bug in systemd-gpt-auto-generator

I boot without initrd, my root partition is btrfs on GPT. At boot I see the
following message:

systemd-gpt-auto-generator[84]: Failed to determine block device of root file
system: No such file or directory

And systemd-gpt-auto-generator fails with error code 1.

I've made some debugging and found out that in function
get_btrfs_block_device() (in file src/gpt-auto-generator/gpt-auto-generator.c)
on line 633 we try to stat /dev/root, but /dev/root does not exist at the
moment, and it leads to failure:

if (stat((char*) di.path, &st) < 0)

If someone runs this code when booting with initrd, it stats /dev/sda2 and runs
successfully. But when I boot without initrd, my root filesystem is shown in
/etc/mtab as /dev/root (instead of /dev/sda2), because it was mounted from
kernel (not from userspace like in case of initrd), and
systemd=gpt-auto-generator fails.

Also if someone runs this code after fsck'ing and remounting root, it also runs
successfully, because after remount root filesystem is shown as /dev/sda2 in
/etc/mtab.

I'm attaching a test program, it contains two functions copied from systemd
(get_block_device and get_btrfs_block_device) with some debug output added.
When I run it as init, it shows the following:

/dev/root on / type btrfs (ro,relatime,space_cache)
devtmpfs on /dev type devtmpfs
(rw,relatime,size=1029996k,nr_inodes=220674,mode=755)
proc on /proc type proc (rw,relatime)
lstat
major
statfs
open
ioctl
ioctl in loop
stat in loop: '/dev/root'
-2

And when I run in from booted system (after remounting /), it shows the
following:

/dev/sda2 on / type btrfs (rw,noatime,compress=lzo,space_cache,autodefrag)
devtmpfs on /dev type devtmpfs
(rw,relatime,size=1029996k,nr_inodes=220674,mode=755)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620)
tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup
(rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs
(rw,relatime,fd=21,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
tmpfs on /tmp type tmpfs (rw)
/dev/sda3 on /build type btrfs (rw,noatime,compress=lzo,space_cache,autodefrag)
/dev/sda4 on /home type btrfs (rw,noatime,compress=lzo,space_cache,autodefrag)
tmpfs on /run/user/0 type tmpfs
(rw,nosuid,nodev,relatime,size=206044k,mode=700)
lstat
major
statfs
open
ioctl
ioctl in loop
stat in loop: '/dev/sda2'
S_ISBLK in loop
major in loop
good in loop
1

I'm on Gentoo, my systemd version is 216.

The desired effect: systemd-gpt-auto-generator should not fail when the system
is booted without initrd.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-bugs/attachments/20141005/334ef2a1/attachment-0001.html>


More information about the systemd-bugs mailing list