Skip to content

Commit

Permalink
Enabled and disable services by using systemd.presets
Browse files Browse the repository at this point in the history
By using systemd.presets we can implement our own policy
which services needs to be enabled or disabled on boot-time.

This issue was initially triggered by a problem with the
wpa_supplicant@*.service which failed on boot with an
"Dependency failed for WPA supplicant daemon
(interface-specific version)" error.

See: http://paste.grml.org/2862/
  • Loading branch information
jkirk committed Nov 19, 2016
1 parent 3085643 commit 5cd3431
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 27 deletions.
@@ -0,0 +1,17 @@
# enable TTY logins
enable getty@tty*.service.d

# disable unwanted services
disable cron.service
disable lvm2-lvmetad.service
disable lvm2-lvmetad.socket
disable lvm2-lvmpolld.socket
disable lvm2-monitor.service
disable mdadm-raid.service
disable smartd.service
disable ssh.service
disable swap.target
disable systemd-timesyncd.service
disable wpa_supplicant.service
disable wpa_supplicant@.service
disable uuidd.service
27 changes: 0 additions & 27 deletions etc/grml/fai/config/scripts/GRMLBASE/15-initsetup
Expand Up @@ -21,14 +21,6 @@ systemd_setup() {
echo "Enabling user '$USERNAME' for autologin"
sed -i "s/\$USERNAME/$USERNAME/" "$target"/etc/systemd/system/getty@tty*.service.d/override.conf

# enable TTY logins
local service
for file in "${target}"/etc/systemd/system/getty@tty*.service.d ; do
service=$(basename "$file" .d)
$ROOTCMD systemctl enable "$service" || echo "failed to enable $service"
done
unset service

# FIXME - ssh-keygen isn't executed yet before ssh-bootoption + ssh services
$ROOTCMD systemctl enable ssh-bootoption.service || echo "failed to enable ssh-bootoption.service"
$ROOTCMD systemctl enable ssh-keygen.service || echo "failed to enable ssh-keygen.service"
Expand All @@ -37,25 +29,6 @@ systemd_setup() {
# "Failed to unmount transient /etc/machine-id file in our private namespace: Invalid argument"
$ROOTCMD systemctl mask systemd-machine-id-commit.service || echo "failed to mask $systemd-machine-id-commit.service"

# disable unwanted services
local service
for service in \
cron.service \
lvm2-lvmetad.service \
lvm2-lvmetad.socket \
lvm2-lvmpolld.socket \
lvm2-monitor.service \
mdadm-raid.service \
smartd.service \
ssh.service \
swap.target \
systemd-timesyncd.service \
uuidd.service
do
$ROOTCMD systemctl disable ${service} || echo "failed to disable $service"
done
unset service

# TODO ->

# * *proper* integration for grml-autoconfig
Expand Down

0 comments on commit 5cd3431

Please sign in to comment.