0

When enable systemd user unit, e.g. redshift.service, this service fails to start on boot with error redshift.service: Start request repeated too quickly.

$ systemctl --user enable redshift.service
Created symlink /home/pavel/.config/systemd/user/default.target.wants/redshift.service → /usr/lib/systemd/user/redshift.service.

When I start it manually via systemctl --user start redshift.service, redshift launches and works:

$ systemctl --user status redshift.service
● redshift.service - Redshift display colour temperature adjustment
   Loaded: loaded (/usr/lib/systemd/user/redshift.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2017-07-18 17:12:31 +05; 13min ago
     Docs: http://jonls.dk/redshift/
 Main PID: 23289 (redshift)
   CGroup: /user.slice/user-1000.slice/[email protected]/redshift.service
           └─23289 /usr/bin/redshift

However, redshift.service failed to start on system boot - this error occurs:

$ journalctl --user-unit redshift.service
-- Logs begin at Tue 2017-07-18 15:15:04 +05, end at Tue 2017-07-18 16:42:26 +05. --
июл 18 15:15:27 ubuntu-pc systemd[1603]: Started Redshift display colour temperature adjustment.
июл 18 15:15:27 ubuntu-pc redshift[1620]: `RANDR Query Version' returned error -1
июл 18 15:15:27 ubuntu-pc systemd[1603]: redshift.service: Main process exited, code=exited, status=1/FAILURE
июл 18 15:15:27 ubuntu-pc systemd[1603]: redshift.service: Unit entered failed state.
июл 18 15:15:27 ubuntu-pc systemd[1603]: redshift.service: Failed with result 'exit-code'.
июл 18 15:15:27 ubuntu-pc systemd[1603]: redshift.service: Service hold-off time over, scheduling restart.
июл 18 15:15:27 ubuntu-pc systemd[1603]: Stopped Redshift display colour temperature adjustment.
июл 18 15:15:27 ubuntu-pc systemd[1603]: Started Redshift display colour temperature adjustment.
июл 18 15:15:27 ubuntu-pc systemd[1603]: redshift.service: Main process exited, code=exited, status=1/FAILURE
июл 18 15:15:27 ubuntu-pc systemd[1603]: redshift.service: Unit entered failed state.
июл 18 15:15:27 ubuntu-pc systemd[1603]: redshift.service: Failed with result 'exit-code'.
июл 18 15:15:27 ubuntu-pc systemd[1603]: redshift.service: Service hold-off time over, scheduling restart.
июл 18 15:15:27 ubuntu-pc systemd[1603]: Stopped Redshift display colour temperature adjustment.
июл 18 15:15:27 ubuntu-pc systemd[1603]: Started Redshift display colour temperature adjustment.
июл 18 15:15:27 ubuntu-pc systemd[1603]: redshift.service: Main process exited, code=exited, status=1/FAILURE
июл 18 15:15:27 ubuntu-pc systemd[1603]: redshift.service: Unit entered failed state.
июл 18 15:15:27 ubuntu-pc systemd[1603]: redshift.service: Failed with result 'exit-code'.
июл 18 15:15:28 ubuntu-pc systemd[1603]: redshift.service: Service hold-off time over, scheduling restart.
июл 18 15:15:28 ubuntu-pc systemd[1603]: Stopped Redshift display colour temperature adjustment.
июл 18 15:15:28 ubuntu-pc systemd[1603]: Started Redshift display colour temperature adjustment.
июл 18 15:15:28 ubuntu-pc systemd[1603]: redshift.service: Main process exited, code=exited, status=1/FAILURE
июл 18 15:15:28 ubuntu-pc systemd[1603]: redshift.service: Unit entered failed state.
июл 18 15:15:28 ubuntu-pc systemd[1603]: redshift.service: Failed with result 'exit-code'.
июл 18 15:15:28 ubuntu-pc systemd[1603]: redshift.service: Service hold-off time over, scheduling restart.
июл 18 15:15:28 ubuntu-pc systemd[1603]: Stopped Redshift display colour temperature adjustment.
июл 18 15:15:28 ubuntu-pc systemd[1603]: Started Redshift display colour temperature adjustment.
июл 18 15:15:28 ubuntu-pc systemd[1603]: redshift.service: Main process exited, code=exited, status=1/FAILURE
июл 18 15:15:28 ubuntu-pc systemd[1603]: redshift.service: Unit entered failed state.
июл 18 15:15:28 ubuntu-pc systemd[1603]: redshift.service: Failed with result 'exit-code'.
июл 18 15:15:28 ubuntu-pc systemd[1603]: redshift.service: Service hold-off time over, scheduling restart.
июл 18 15:15:28 ubuntu-pc systemd[1603]: Stopped Redshift display colour temperature adjustment.
июл 18 15:15:28 ubuntu-pc systemd[1603]: redshift.service: Start request repeated too quickly.
июл 18 15:15:28 ubuntu-pc systemd[1603]: Failed to start Redshift display colour temperature adjustment.
июл 18 15:15:28 ubuntu-pc systemd[1603]: redshift.service: Unit entered failed state.
июл 18 15:15:28 ubuntu-pc systemd[1603]: redshift.service: Failed with result 'exit-code'.

redshift.service file contains:

$ cat /usr/lib/systemd/user/redshift.service
[Unit]
Description=Redshift display colour temperature adjustment
Documentation=http://jonls.dk/redshift/
After=display-manager.service

[Service]
ExecStart=/usr/bin/redshift
Restart=always

[Install]
WantedBy=default.target

Ubuntu 17.04, systemd 232

$ systemd --version
systemd 232
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN
$ uname -a
Linux ubuntu-pc 4.10.0-24-generic #28-Ubuntu SMP Wed Jun 14 08:14:34 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 17.04
Release:        17.04
Codename:       zesty

Could anyone help, please, Is there a way to solve this issue?

1 Answer 1

1

This is a known limitation. Your unit file must be located in the same partition as your root file system. See man systemctl:

   link PATH...
       Link a unit file that is not in the unit file search paths into the
       unit file search path. This command expects an absolute path to a
       unit file. The effect of this may be undone with disable. The
       effect of this command is that a unit file is made available for
       commands such as start, even though it is not installed directly in
       the unit search path. The file system where the linked unit files
       are located must be accessible when systemd is started (e.g.
       anything underneath /home or /var is not allowed, unless those
       directories are located on the root file system).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .