Page MenuHomePhabricator

Error while enabling symlinked units on stretch systemd
Closed, ResolvedPublic

Description

I was testing stretch + swift in labs and came across this failure for statsite unit:

Debug: Executing '/bin/systemctl is-active statsite@8125'
Debug: Executing '/bin/systemctl is-enabled statsite@8125'
Debug: Executing '/bin/systemctl enable statsite@8125'
Error: Could not enable statsite@8125: 
Error: /Stage[main]/Role::Statsite/Statsite::Instance[8125]/Service[statsite@8125]/enable: change from false to true failed: Could not enable statsite@8125:

And indeed systemctl enable fails for a symlinked unit

root@swift-stretch-ms-fe01:~# systemctl  enable statsite@8125
Failed to enable unit: Refusing to operate on linked unit file statsite@8125.service
root@swift-stretch-ms-fe01:~# ls -la /lib/systemd/system/statsite@8125.service 
lrwxrwxrwx 1 root root 37 May 26 14:57 /lib/systemd/system/statsite@8125.service -> /lib/systemd/system/statsite@.service

Note however that despite the failure the @8125 unit is enabled and will start at boot:

root@swift-stretch-ms-fe01:~# systemctl status statsite@8125
● statsite@8125.service - statsite (instance 8125)
   Loaded: loaded (/lib/systemd/system/statsite@.service; disabled; vendor preset: enabled)
   Active: active (running) since Fri 2017-05-26 15:19:33 UTC; 11min ago
 Main PID: 1563 (statsite)
   CGroup: /system.slice/system-statsite.slice/statsite@8125.service
           └─1563 /usr/bin/statsite -f /etc/statsite/8125.ini

So I suspect this will require a puppet-level fix of some sort

Event Timeline

Change 356038 had a related patch set uploaded (by Filippo Giunchedi; owner: Filippo Giunchedi):
[operations/puppet@production] Don't symlink systemd service instances

https://gerrit.wikimedia.org/r/356038

Change 356038 merged by Filippo Giunchedi:
[operations/puppet@production] Don't symlink systemd service instances

https://gerrit.wikimedia.org/r/356038

fgiunchedi claimed this task.

All done, verified on jessie/stretch that systemctl still DTRTs