<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - "Failed to determine block device of root file system: No such file or directory" on boot"
href="https://bugs.freedesktop.org/show_bug.cgi?id=84689">84689</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>"Failed to determine block device of root file system: No such file or directory" on boot
</td>
</tr>
<tr>
<th>Product</th>
<td>systemd
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux (All)
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Component</th>
<td>general
</td>
</tr>
<tr>
<th>Assignee</th>
<td>systemd-bugs@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>maxtram95@gmail.com
</td>
</tr>
<tr>
<th>QA Contact</th>
<td>systemd-bugs@lists.freedesktop.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=107360" name="attach_107360" title="The test program which reproduces bug in systemd-gpt-auto-generator">attachment 107360</a> <a href="attachment.cgi?id=107360&action=edit" title="The test program which reproduces bug in systemd-gpt-auto-generator">[details]</a></span>
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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the QA Contact for the bug.</li>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>