A unidade de usuário Systemd falha ao iniciar na inicialização: a solicitação de início é repetida muito rapidamente

0

Quando ativar systemd user unit, por exemplo redshift.service , este serviço falha ao iniciar na inicialização com erro 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.

Quando eu inicio manualmente via systemctl --user start redshift.service , o redshift é iniciado e funciona:

$ 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

No entanto, redshift.service falhou ao iniciar a inicialização do sistema - este erro ocorre:

$ 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

Alguém poderia ajudar, por favor, existe uma maneira de resolver este problema?

    
por spvkgn 18.07.2017 / 14:43

1 resposta

1

Esta é uma limitação conhecida . Seu arquivo de unidade deve estar localizado na mesma partição que seu sistema de arquivos raiz. Veja 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).
    
por Gunar Gessner 29.03.2018 / 19:30