[systemd-devel] Help! Reached target Local File Systems order is incorrect

Tony Rodriguez unixpro1970 at gmail.com
Mon Oct 9 19:07:03 UTC 2023


Created a service that invokes a "systemctl daemon-reload". Goal is for 
a reload to occur early in the boot process, before other user made 
services are invoked.  During additional testing, sometimes it is 
correct and other times it is out of order (incorrect -  See steps C).  
It may work for 5 or 6 times after each reboot/shutdown, then randomly 
become incorrect. How can I make this more consistent? Already tried 
various keyword combinations (wants,before,after, etc) within the unit 
file, all without luck.
Thought about something like "After=var.mount, etc" as well, but that is 
inflexible because I will not know filesystems users may create.

A) Unit file

[Unit]
Description=Systemctl-Reload
Wants=local-fs.target
DefaultDependencies=yes

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/systemctl daemon-reload

[Install]
WantedBy=local-fs.target


B)  Correct order: ** Reached target Local File Systems is after all 
mounting is done. Sometimes it works.

eg:
journalctl --boot=0 | grep -E 'Mounting |Mounted |Local File'
Oct 09 11:21:39 rocky8-linux-build systemd[1]: Mounting Kernel 
Configuration File System...
Oct 09 11:21:39 rocky8-linux-build systemd[1]: Mounted Kernel 
Configuration File System.
Oct 09 11:21:40 rocky8-linux-build systemd[1]: Reached target Local File 
Systems (Pre).
Oct 09 11:21:40 rocky8-linux-build systemd[1]: Reached target Local File 
Systems.
Oct 09 11:21:40 rocky8-linux-build systemd[1]: Mounting /sysroot...
Oct 09 11:21:40 rocky8-linux-build kernel: XFS (dm-0): Mounting V5 
Filesystem
Oct 09 11:21:40 rocky8-linux-build systemd[1]: Mounted /sysroot.
Oct 09 11:21:41 rocky8-linux-build systemd[1]: Mounting /sysroot/usr...
Oct 09 11:21:41 rocky8-linux-build kernel: XFS (dm-2): Mounting V5 
Filesystem
Oct 09 11:21:41 rocky8-linux-build systemd[1]: Mounted /sysroot/usr.
Oct 09 11:21:41 rocky8-linux-build systemd[1]: Stopped target Local File 
Systems.
Oct 09 11:21:41 rocky8-linux-build systemd[1]: Stopped target Local File 
Systems (Pre).
Oct 09 11:21:41 rocky8-linux-build systemd[1]: Mounted POSIX Message 
Queue File System.
Oct 09 11:21:41 rocky8-linux-build systemd[1]: Mounted Kernel Debug File 
System.
Oct 09 11:21:41 rocky8-linux-build systemd[1]: Mounted Huge Pages File 
System.
Oct 09 11:21:42 rocky8-linux-build systemd[1]: Mounting FUSE Control 
File System...
Oct 09 11:21:42 rocky8-linux-build systemd[1]: Mounted FUSE Control File 
System.
Oct 09 11:21:42 rocky8-linux-build systemd[1]: Reached target Local File 
Systems (Pre).
Oct 09 11:21:42 rocky8-linux-build systemd[1]: Mounting /boot...
Oct 09 11:21:42 rocky8-linux-build systemd[1]: Mounting /tmp...
Oct 09 11:21:42 rocky8-linux-build systemd[1]: Mounting /var...
Oct 09 11:21:42 rocky8-linux-build kernel: XFS (vda2): Mounting V5 
Filesystem
Oct 09 11:21:42 rocky8-linux-build kernel: XFS (dm-3): Mounting V5 
Filesystem
Oct 09 11:21:42 rocky8-linux-build systemd[1]: Mounting /home...
Oct 09 11:21:42 rocky8-linux-build kernel: XFS (dm-4): Mounting V5 
Filesystem
Oct 09 11:21:42 rocky8-linux-build kernel: XFS (dm-5): Mounting V5 
Filesystem
Oct 09 11:21:42 rocky8-linux-build systemd[1]: Mounted /tmp.
Oct 09 11:21:43 rocky8-linux-build systemd[1]: Mounted /boot.
Oct 09 11:21:43 rocky8-linux-build systemd[1]: Mounting /boot/efi...
Oct 09 11:21:43 rocky8-linux-build systemd[1]: Mounted /boot/efi.
Oct 09 11:21:43 rocky8-linux-build systemd[1]: Mounted /home.
Oct 09 11:21:43 rocky8-linux-build systemd[1]: Mounted /var.
*** Oct 09 11:21:43 rocky8-linux-build systemd[1]: Reached target Local 
File Systems.  <<--- This is correct
Oct 09 11:21:43 rocky8-linux-build systemd[1]: Mounting RPC Pipe File 
System...
Oct 09 11:21:43 rocky8-linux-build systemd[1]: Mounted RPC Pipe File System.

C)  Other times a mount is randomly out of order:
eg:
journalctl --boot=0 | grep -E 'Mounting |Mounted |Local File'
Oct 09 11:21:39 rocky8-linux-build systemd[1]: Mounting Kernel 
Configuration File System...
Oct 09 11:21:39 rocky8-linux-build systemd[1]: Mounted Kernel 
Configuration File System.
Oct 09 11:21:40 rocky8-linux-build systemd[1]: Reached target Local File 
Systems (Pre).
Oct 09 11:21:40 rocky8-linux-build systemd[1]: Reached target Local File 
Systems.
Oct 09 11:21:40 rocky8-linux-build systemd[1]: Mounting /sysroot...
Oct 09 11:21:40 rocky8-linux-build kernel: XFS (dm-0): Mounting V5 
Filesystem
Oct 09 11:21:40 rocky8-linux-build systemd[1]: Mounted /sysroot.
Oct 09 11:21:41 rocky8-linux-build systemd[1]: Mounting /sysroot/usr...
Oct 09 11:21:41 rocky8-linux-build kernel: XFS (dm-2): Mounting V5 
Filesystem
Oct 09 11:21:41 rocky8-linux-build systemd[1]: Mounted /sysroot/usr.
Oct 09 11:21:41 rocky8-linux-build systemd[1]: Stopped target Local File 
Systems.
Oct 09 11:21:41 rocky8-linux-build systemd[1]: Stopped target Local File 
Systems (Pre).
Oct 09 11:21:41 rocky8-linux-build systemd[1]: Mounted POSIX Message 
Queue File System.
Oct 09 11:21:41 rocky8-linux-build systemd[1]: Mounted Kernel Debug File 
System.
Oct 09 11:21:41 rocky8-linux-build systemd[1]: Mounted Huge Pages File 
System.
Oct 09 11:21:42 rocky8-linux-build systemd[1]: Mounting FUSE Control 
File System...
Oct 09 11:21:42 rocky8-linux-build systemd[1]: Mounted FUSE Control File 
System.
Oct 09 11:21:42 rocky8-linux-build systemd[1]: Reached target Local File 
Systems (Pre).
Oct 09 11:21:42 rocky8-linux-build systemd[1]: Mounting /boot...
Oct 09 11:21:42 rocky8-linux-build systemd[1]: Mounting /tmp...
Oct 09 11:21:42 rocky8-linux-build systemd[1]: Mounting /var...
Oct 09 11:21:42 rocky8-linux-build kernel: XFS (vda2): Mounting V5 
Filesystem
Oct 09 11:21:42 rocky8-linux-build kernel: XFS (dm-3): Mounting V5 
Filesystem
Oct 09 11:21:42 rocky8-linux-build systemd[1]: Mounting /home...
Oct 09 11:21:42 rocky8-linux-build kernel: XFS (dm-4): Mounting V5 
Filesystem
Oct 09 11:21:42 rocky8-linux-build kernel: XFS (dm-5): Mounting V5 
Filesystem
Oct 09 11:21:42 rocky8-linux-build systemd[1]: Mounted /tmp.
Oct 09 11:21:43 rocky8-linux-build systemd[1]: Mounted /boot.
Oct 09 11:21:43 rocky8-linux-build systemd[1]: Mounting /boot/efi...
Oct 09 11:21:43 rocky8-linux-build systemd[1]: Mounted /boot/efi.
Oct 09 11:21:43 rocky8-linux-build systemd[1]: Mounted /home.
** Oct 09 11:21:43 rocky8-linux-build systemd[1]: Reached target Local 
File Systems.  <<-- This is wrong, should be below /var mount.
Oct 09 11:21:43 rocky8-linux-build systemd[1]: Mounted /var.
Oct 09 11:21:43 rocky8-linux-build systemd[1]: Mounting RPC Pipe File 
System...
Oct 09 11:21:43 rocky8-linux-build systemd[1]: Mounted RPC Pipe File System.




More information about the systemd-devel mailing list