Bug 14865

Summary: systemd-fstab-generator[11101]: Failed to create unit file /run/systemd/generator/-.mount, as it already exists.
Product: [Runtime] General Runtime Reporter: Yi Zhao <yi.zhao>
Component: General RuntimeAssignee: Ross Burton <ross.burton>
Status: VERIFIED FIXED QA Contact: Yi Zhao <yi.zhao>
Severity: normal    
Priority: High CC: akuster808, jay.shen.teoh, randy.macleod, ross.burton, yi.zhao
Version: 4.1   
Target Milestone: 4.1 M4   
Hardware: BeagleBone   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: Regression (Used to work)
Verified: Documentation change: No (bug/feature does not impact docs)

Description Yi Zhao 2022-07-22 07:38:47 UTC
Git rev: master/899979696f68ff4414cebf7782b37d7bae27144b
Image Location: https://autobuilder.yocto.io/pub/releases/yocto-4.1_M2.rc1/machines/beaglebone-yocto/


There is warning for systemd-fstab-generator when system boot up:
systemd-fstab-generator[11101]: Failed to create unit file /run/systemd/generator/-.mount, as it already exists. Duplicate entry in /etc/fstab?
systemd-fstab-generator[11210]: Failed to create unit file /run/systemd/generator/-.mount, as it already exists. Duplicate entry in /etc/fstab?


This issue only happens on wic image. The root cause is there are two root entries in /etc/fstab:
root@beaglebone-yocto:~# cat /etc/fstab 
# stock fstab - you probably want to override this with a machine specific one

/dev/root            /                    auto       defaults              1  1
proc                 /proc                proc       defaults              0  0
devpts               /dev/pts             devpts     mode=0620,ptmxmode=0666,gid=5      0  0
tmpfs                /run                 tmpfs      mode=0755,nodev,nosuid,strictatime 0  0
tmpfs                /var/volatile        tmpfs      defaults              0  0

# uncomment this if your device has a SD/MMC/Transflash slot
#/dev/mmcblk0p1       /media/card          auto       defaults,sync,noauto  0  0

UUID=B16E-1552  /boot   vfat    defaults        0       0
UUID=888f76b8-b681-412a-98bb-5972b8d86b93       /       ext4    defaults        0       0
root@beaglebone-yocto:~# 
root@beaglebone-yocto:~# 

This issue is introduced by commit 875db2bc9d20e0e0a6fe30997a99f1252f896073

commit 875db2bc9d20e0e0a6fe30997a99f1252f896073
Author: Tobias Schmidl <tobiasschmidl@siemens.com>
Date:   Wed May 25 14:25:26 2022 +0200

    wic/plugins/images/direct: Allow changes in fstab on rootfs
    
    Allow wic to also manipulate the rootfs entry in fstab, which it
    currently refuses to write. Reasons one might want to do that include
    using systemd-growfs via --fsoptions on /
    With this change / is now handled exactly the same as other
    mountpoints, the former exception seemingly was not even documented.
    
    (From OE-Core rev: 20d43a2599d7622b96e2fb0da87a886da1a3794a)
    
    Signed-off-by: Tobias Schmidl <tobiasschmidl@siemens.com>
    Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
    Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Comment 1 Ross Burton 2022-07-27 19:00:21 UTC
Patch on the list by Markus, "wic/direct.py: ignore root mountpoint in fstab updater"
Comment 2 Randy MacLeod 2022-07-28 14:37:56 UTC
We're tempted to revert Tobias's patch but first Ross is going to reply on the email list and CC Tobias.

Yi, or anyone, could this test be automated and added to the automatic YP QA tests?
Comment 3 akuster 2022-09-19 19:35:12 UTC
Is this the fix?

https://git.yoctoproject.org/poky/commit/scripts/lib/wic?id=37b4fa7a102f1212843411bd1d97202ba9da0e19

We are getting clarification from QA if the test is still failing.
Comment 4 Ross Burton 2022-09-21 15:13:39 UTC
With current master, there are still two / mounts in beaglebone-yocto images:

# stock fstab - you probably want to override this with a machine specific one

/dev/root            /                    auto       defaults              1  1
proc                 /proc                proc       defaults              0  0
devpts               /dev/pts             devpts     mode=0620,ptmxmode=0666,gid=5      0  0
tmpfs                /run                 tmpfs      mode=0755,nodev,nosuid,strictatime 0  0
tmpfs                /var/volatile        tmpfs      defaults              0  0

# uncomment this if your device has a SD/MMC/Transflash slot
#/dev/mmcblk0p1       /media/card          auto       defaults,sync,noauto  0  0

UUID=9F3E-1BB7	/boot	vfat	defaults	0	0
UUID=998ab32a-d1ad-4f5f-963a-fc6db677b999	/	ext4	defaults	0	0
Comment 5 Ross Burton 2022-09-27 16:56:56 UTC
Patch on the list to revert.
Comment 6 Ross Burton 2022-09-28 14:39:31 UTC
Reverted in 4a7b3ef0a69b7e08030519b712a6fe4dd199c571.
Comment 7 Yi Zhao 2022-10-10 02:16:19 UTC
Verified with master rev: 5200799866b92259e855051112520006e1aaaac0