[systemd-devel] Preset/enable issues

Dan Nicholson nicholson at endlessm.com
Wed Mar 23 13:21:50 UTC 2016


At Endless, we compose a system from debian packages which enable
services based on package policy. However, when we compose our whole
system, we run systemctl preset-all (in a chroot) with our preset file
to get the services setup exactly as we want for images.

After upgrading from 215 to 229, we're seeing some issues.

1. preset-all fails with ELOOP if there are any symlinks in
/etc/systemd/system pointing to /usr/lib/systemd/system. However,
systemd itself has created these symlinks when units define an Alias
and have already been enabled. This seems like broken behavior as even
if I forcefully clean things up, running preset-all again returns the
same issue.

# find /etc/systemd/system -maxdepth 1 -type l -delete
# systemctl preset-all
Created symlink /etc/systemd/system/display-manager.service, pointing
to /usr/lib/systemd/system/gdm.service.
Created symlink /etc/systemd/system/ctrl-alt-del.target, pointing to
/usr/lib/systemd/system/exit.target.
Created symlink
/etc/systemd/system/dbus-org.freedesktop.ModemManager1.service,
pointing to /usr/lib/systemd/system/ModemManager.service.
Created symlink /etc/systemd/system/eos-updater.service, pointing to
/usr/lib/systemd/system/eos-autoupdater.service.
Created symlink
/etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service,
pointing to /usr/lib/systemd/system/NetworkManager-dispatcher.service.
Created symlink /etc/systemd/system/kbrequest.target, pointing to
/usr/lib/systemd/system/rescue.target.
Created symlink /etc/systemd/system/dbus-org.bluez.service, pointing
to /usr/lib/systemd/system/bluetooth.service.
Created symlink /etc/systemd/system/eos-updater.timer, pointing to
/usr/lib/systemd/system/eos-autoupdater.timer.
Created symlink
/etc/systemd/system/dbus-org.freedesktop.Avahi.service, pointing to
/usr/lib/systemd/system/avahi-daemon.service.
# systemctl preset-all
Operation failed: Too many levels of symbolic links

Weirdly, using a preset with one of the above real names sometimes
works even though it would have the exact same issue, and sometimes it
returns EEXIST for reasons I don't understand.

I guess this all comes back to commit 0ec0deaa, which tries to
consider syminks in /etc as user configuration. But then why are alias
symlinks, which are not user configuration, created in /etc?

https://github.com/systemd/systemd/issues/2298 has been open for a
while with no comments.

2. Enable does not seem to be escaping the names of the wants
directories correctly.

# systemctl enable "dev-disk-by\x2dlabel-eos\x2dswap.swap"
Created symlink
/etc/systemd/system/dev-disk-byx2dlabel-eosx2dswap.device.wants/dev-disk-by\x2dlabel-eos\x2dswap.swap,
pointing to /usr/lib/systemd/system/dev-disk-by\x2dlabel-eos\x2dswap.swap.

The directory is created as
dev-disk-byx2dlabel-eosx2dswap.device.wants, but I'm pretty sure the
x's should be escaped with \. At least, that's what the unit names do,
and that's how the directories used to be named by enable.

Any ideas on these issues?

--
Dan Nicholson  |  +1.206.437.0833  |  Endless


More information about the systemd-devel mailing list