[systemd-devel] [PATCH] Generate a fake systemd-fsck-root.service in the initramfs

Harald Hoyer harald.hoyer at gmail.com
Wed May 6 07:57:35 PDT 2015


On 06.05.2015 15:58, Zbigniew Jędrzejewski-Szmek wrote:
> On Wed, May 06, 2015 at 03:50:08PM +0200, Harald Hoyer wrote:
>> Works for me... booted with "ro" on the kernel cmdline:
>>
>> $ systemctl status systemd-fsck-root.service
>> ● systemd-fsck-root.service - File System Check on Root Device
>>    Loaded: loaded (/usr/lib/systemd/system/systemd-fsck-root.service; static;
>> vendor preset: disabled)
>>    Active: inactive (dead) since Mi 2015-05-06 15:37:58 CEST; 1min 44s ago
>>      Docs: man:systemd-fsck-root.service(8)
>>  Main PID: 144 (code=exited, status=0/SUCCESS)
>>    CGroup: /system.slice/systemd-fsck-root.service
>>
>>
>>
>> [    1.440568]  systemd[1]: Starting Root File System Check Placeholder...
>> [    1.445484]  systemd[1]: Started Root File System Check Placeholder.
>> […]
>> [    1.786864]  systemd[1]: Starting File System Check on /dev/gpt-auto-root...
>> [    1.804183]  systemd[1]: Started File System Check on /dev/gpt-auto-root.
>> [    2.015962]  systemd[1]: Mounting /sysroot...
>> […]
>> [    2.294428]  systemd[1]: Switching root.
>> […]
>> [    2.570286]  systemd[1]: Stopped Switch Root.
>> […]
>> [    2.571714]  systemd[1]: Stopped File System Check on Root Device.
>> [    2.571859]  systemd[1]: Stopping File System Check on Root Device...
>> […]
>> [    2.624669]  systemd[1]: Started Remount Root and Kernel File Systems.
>>
>>
>> Although "Stopping File System Check on Root Device" is strange...
> Hm, that's strange. This would suggest that sd-fsck-root.service is not
> wanted by anything in your system. I wonder if this is because you
> have gpt-auto-root, and I'm using plain old fstab.
> 
> $ systemctl show -p WantedBy,RequiredBy,RequiredByOverridable systemd-fsck-root
> RequiredBy=
> RequiredByOverridable=
> WantedBy=local-fs.target
> 
> Zbyszek

Yeah, strange... changed the cmdline and fstab to UUID.

# cat /proc/cmdline
initrd=\9e3d4b6532ff41e1ab40d6b4e5609907\4.1.0-0.rc2.git0.1.fc23.x86_64\initrd
quiet libahci.ignore_sss=1 raid=noautodetect selinux=0 rhgb plymouth.enable=0
rd.plymouth=0 rw root=UUID=d5e53483-30bc-4119-8c0c-841d47a2f76b
rootflags=noatime,compress=lzo,ssd,discard,space_cache,autodefrag,inode_cache,subvol=root:foo:hoyer.harald.OS:x86_64
resume=UUID=03ea4b3f-94fd-40c8-81e8-802734082be8 ro

# cat /etc/fstab
UUID=d5e53483-30bc-4119-8c0c-841d47a2f76b	/ 	btrfs
subvol=root:foo:hoyer.harald.OS:x86_64,noatime,compress=lzo,ssd,discard,space_cache,autodefrag,inode_cache
	0 0
UUID=d5e53483-30bc-4119-8c0c-841d47a2f76b 	/usr 	btrfs 	
subvol=usr:hoyer.harald.OS:x86_64,noatime,compress=lzo,ssd,discard,space_cache,autodefrag,inode_cache
	0 0
UUID=d5e53483-30bc-4119-8c0c-841d47a2f76b 	/home/harald 	btrfs 	
subvol=harald,noatime,compress=lzo,ssd,discard,space_cache,autodefrag,inode_cache
	0 0
UUID=03ea4b3f-94fd-40c8-81e8-802734082be8 swap swap defaults 0 0

# systemctl show -p WantedBy,RequiredBy,RequiredByOverridable systemd-fsck-root
RequiredBy=
RequiredByOverridable=
WantedBy=

# systemctl status systemd-fsck-root.service
● systemd-fsck-root.service - File System Check on Root Device
   Loaded: loaded (/usr/lib/systemd/system/systemd-fsck-root.service; static;
vendor preset: disabled)
   Active: inactive (dead) since Mi 2015-05-06 16:43:58 CEST; 6min ago
     Docs: man:systemd-fsck-root.service(8)
 Main PID: 142 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/systemd-fsck-root.service


# journalctl -b -o short-monotonic |fgrep Root
[    0.110026]  kernel: ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-fe])
[    1.434239]  systemd[1]: Starting Root File System Check Placeholder...
[    1.439182]  systemd[1]: Started Root File System Check Placeholder.
[    2.149291]  systemd[1]: Reached target Initrd Root File System.
[    2.149580]  systemd[1]: Starting Initrd Root File System.
[    2.150506]  systemd[1]: Starting Reload Configuration from the Real Root...
[    2.223119]  systemd[1]: Started Reload Configuration from the Real Root.
[    2.287822]  systemd[1]: Reached target Switch Root.
[    2.287926]  systemd[1]: Starting Switch Root.
[    2.288312]  systemd[1]: Starting Switch Root...
[    2.570400]  systemd[1]: Stopped Switch Root.
[    2.573577]  systemd[1]: Stopped target Switch Root.
[    2.573613]  systemd[1]: Stopping Switch Root.
[    2.573926]  systemd[1]: Stopped target Initrd Root File System.
[    2.573941]  systemd[1]: Stopping Initrd Root File System.
[    2.604283]  systemd[1]: Stopped File System Check on Root Device.
[    2.604324]  systemd[1]: Stopping File System Check on Root Device...
[    2.604843]  systemd[1]: Starting Remount Root and Kernel File Systems...
[    2.614664]  systemd[1]: Started Remount Root and Kernel File Systems.


Anyway, after forcing it in:

# ll /lib/systemd/system/local-fs.target.wants/systemd-fsck-root.service
lrwxrwxrwx 1 root root 28  6. Mai 16:53
/lib/systemd/system/local-fs.target.wants/systemd-fsck-root.service ->
../systemd-fsck-root.service

I get
# systemctl status systemd-fsck-root.service
● systemd-fsck-root.service - File System Check on Root Device
   Loaded: loaded (/usr/lib/systemd/system/systemd-fsck-root.service; static;
vendor preset: disabled)
   Active: active (exited) since Mi 2015-05-06 16:54:22 CEST; 36s ago
     Docs: man:systemd-fsck-root.service(8)
 Main PID: 143 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/systemd-fsck-root.service

[…]

So, the patch is working as expected... ACK'ed by me...


More information about the systemd-devel mailing list