[systemd-devel] Strange issue with mount/automount units and ConditionKernelCommandLine

Albert Strasheim fullung at gmail.com
Sat Oct 22 03:37:19 PDT 2011


Hello all

I'm trying to set up an environment kind of like what
/lib/systemd/fedora-readonly does, but with a few mount and automount
units.

Additionally, if I boot my system without a certain kernel command
line argument, I don't want the setup to happen.

My two mount and automount units look as follows:

# cat /etc/systemd/system/var-lib-stateless-state.mount
[Unit]
ConditionKernelCommandLine=|foo
ConditionKernelCommandLine=|bar
BindTo=dev-disk-by\x2dlabel-FOO\x2dstate.device
After=dev-disk-by\x2dlabel-FOO\x2dstate.device
[Mount]
What=LABEL=FOO-state
Where=/var/lib/stateless/state

# cat /etc/systemd/system/var-lib-stateless-state.automount
[Unit]
ConditionKernelCommandLine=|foo
ConditionKernelCommandLine=|bar
[Automount]
Where=/var/lib/stateless/state
[Install]
WantedBy=local-fs.target

# cat /etc/systemd/system/var-log.mount
[Unit]
ConditionKernelCommandLine=|foo
ConditionKernelCommandLine=|bar
Requires=var-lib-stateless-state.mount
After=var-lib-stateless-state.mount
[Mount]
What=/var/lib/stateless/state/var/log
Where=/var/log
Type=bind
Options=bind

# cat /etc/systemd/system/var-log.automount
[Unit]
ConditionKernelCommandLine=|foo
ConditionKernelCommandLine=|bar
Requires=var-lib-stateless-state.mount
After=var-lib-stateless-state.mount
[Automount]
Where=/var/log
[Install]
WantedBy=local-fs.target

/etc/systemd/system/local-fs.target.wants contains symlinks to
var-lib-stateless-state.automount and var-log.automount.

I then boot the system without the foo or bar kernel command line arguments.

If the system doesn't have a file system with a FOO-state label,
systemd does the following at boot:

[  100.972850] systemd[1]: Job
dev-disk-by\x2dlabel-FOO\x2dstate.device/start timed out.
[  100.990142] systemd[1]: Job var-log.automount/start failed with
result 'dependency'.
[  101.007278] systemd[1]: Job var-lib-stateless-state.mount/start
failed with result 'dependency'.
[  101.016552] systemd[1]: Job
dev-disk-by\x2dlabel-FOO\x2dstate.device/start failed with result
'timeout'.

and if I try to start one of the mounts by hand, I get

# systemctl start var-lib-stateless-state.mount
A dependency job failed. See system logs for details.
# systemctl status var-lib-stateless-state.mount
var-lib-stateless-state.mount - /var/lib/stateless/state
          Loaded: loaded
(/etc/systemd/system/var-lib-stateless-state.mount; static)
          Active: inactive (dead)
           Where: /var/lib/stateless/state
            What: LABEL=FOO-state
          CGroup: name=systemd:/system/var-lib-stateless-state.mount

However, if I boot it on the system that *does* have a file system
with a FOO-state label (still booting without foo on the kernel
command line argument), systemd doesn't try to start the device and my
boot finishes in the normal time.

Also, systemd prevents me from starting the mount manually (as expected):

# systemctl start var-lib-stateless-state.mount
# systemctl status var-lib-stateless-state.mount
var-lib-stateless-state.mount - /var/lib/stateless/state
          Loaded: loaded
(/etc/systemd/system/var-lib-stateless-state.mount; static)
          Active: inactive (dead)
                  start condition failed at Sat, 22 Oct 2011 10:32:15
+0000; 2s ago
           Where: /var/lib/stateless/state
            What: LABEL=FOO-state
          CGroup: name=systemd:/system/var-lib-stateless-state.mount

Any thoughts?

I'm running systemd-37-1.fc16.x86_64.

Regards

Albert


More information about the systemd-devel mailing list