Bug 5950 - Root file system not checked when using systemd
Summary: Root file system not checked when using systemd
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 1.6
Hardware: x86 Multiple
: Medium normal
Target Milestone: 1.6
Assignee: Jonathan Liu
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2014-03-12 06:20 UTC by Jonathan Liu
Modified: 2014-03-23 04:45 UTC (History)
3 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Liu 2014-03-12 06:20:46 UTC
The root file system is not checked on startup when using systemd because /etc/fstab contains:
rootfs               /                    auto       defaults              1  1

In systemd 210, the following message is shown by journalctl:
systemd-fstab-generator[68]: Checking was requested for "rootfs", but it is not a device.

If /etc/fstab is corrected to be the proper root filesystem device instead of "rootfs", then the following message is shown by journalctl:
systemd[1]: Started File System Check on Root Device.
Comment 1 Jonathan Liu 2014-03-12 06:36:15 UTC
Also, if the "ro" flag is not passed to the kernel to mount the root filesystem readonly on startup, systemd will not run fsck against the root filesystem.

You can verify this by running:
journalctl | grep fsck

If the root filesystem was checked, it should show output similar to:
systemd-fsck[79]: /dev/mmcblk0p2: clean, 2451/967680 files, 227258/7739392 blocks
Comment 2 Saul Wold 2014-03-18 00:53:30 UTC
This is likely an upstream issue.
Comment 3 Khem Raj 2014-03-18 21:55:24 UTC
systemd-fsck presumes that devices are mounted under /dev/ and /sys and the 'rootfs'
keyword in /etc/fstab is not known to it.
Comment 4 Khem Raj 2014-03-18 22:36:02 UTC
I think we have /etc/fstab problem here


root@qemuarm:~# cat /etc/fstab 
rootfs               /                    auto       defaults              1  1
...


'rootfs' is incorrect here. as per /ets/fstab manpages It could either be one of LABEL, UUID or kernel device name and to specify label the syntax is LABEL=... so that option is out and its clearly not uuid or kernel device name.


root@qemuarm:~# ./lsblk -f
NAME FSTYPE LABEL UUID                                 MOUNTPOINT
sda  ext3         9a4ad0c2-3381-4b8c-a03b-26c13fb11f8d /


root@qemuarm:~# cat /proc/cmdline 
root=/dev/sda rw console=ttyAMA0,115200 console=tty ip=192.168.7.2::192.168.7.1:255.255.255.0 mem=128M highres=off  console=ttyS0

since we specify root= in kernel cmdline it finds the boot device but since we also have /et/fstab lying around it gets priority when mounting and when generator is trying to generate systemd units out of it for systemd.mount
it rightly doesnt know about 'rootfs'
Comment 5 Jonathan Liu 2014-03-19 00:17:53 UTC
I replaced rootfs with /dev/root in /etc/fstab and it now checks the root filesystem on startup (using systemd 211).
Comment 6 Khem Raj 2014-03-19 22:31:40 UTC
(In reply to comment #5)
> I replaced rootfs with /dev/root in /etc/fstab and it now checks the root
> filesystem on startup (using systemd 211).

OK thats reasonable, please submit a patch for this change to OE-Core.