Não é possível iniciar o rc-local.service: Falha ao conectar-se ao X Server

0

Como estou usando o 16.04, tenho que iniciar manualmente o serviço rc.local , para que os comandos em /etc/rc.local possam ser executados na inicialização. No entanto, estou tendo problemas para iniciar o serviço:

sunqingyao@sunqingyao-MacBookAir:~$ sudo service rc.local start 
Job for rc-local.service failed because the control process exited with error code. See "systemctl status rc-local.service" and "journalctl -xe" for details.

Aqui está a saída de systemctl status rc-local.service :

sunqingyao@sunqingyao-MacBookAir:~$ systemctl status rc-local.service 
● rc-local.service - /etc/rc.local Compatibility
   Loaded: loaded (/lib/systemd/system/rc-local.service; static; vendor preset: enabled)
  Drop-In: /lib/systemd/system/rc-local.service.d
           └─debian.conf
   Active: failed (Result: exit-code) since Fri 2017-07-14 23:52:04 CST; 2min 13s ago
  Process: 2420 ExecStart=/etc/rc.local start (code=exited, status=1/FAILURE)

Jul 14 23:52:04 sunqingyao-MacBookAir systemd[1]: Starting /etc/rc.local Compatibility...
Jul 14 23:52:04 sunqingyao-MacBookAir rc.local[2420]: Failed to connect to X Server.
Jul 14 23:52:04 sunqingyao-MacBookAir systemd[1]: rc-local.service: Control process exited, code=exited status=1
Jul 14 23:52:04 sunqingyao-MacBookAir systemd[1]: Failed to start /etc/rc.local Compatibility.
Jul 14 23:52:04 sunqingyao-MacBookAir systemd[1]: rc-local.service: Unit entered failed state.
Jul 14 23:52:04 sunqingyao-MacBookAir systemd[1]: rc-local.service: Failed with result 'exit-code'.

e para journalctl -xe :

Jul 14 23:52:04 sunqingyao-MacBookAir sudo[2390]: sunqingyao : TTY=pts/0 ; PWD=/home/sunqingyao ; USER=root ; COMMAND=/usr/sbin/service rc.local start
Jul 14 23:52:04 sunqingyao-MacBookAir sudo[2390]: pam_unix(sudo:session): session opened for user root by (uid=0)
Jul 14 23:52:04 sunqingyao-MacBookAir systemd[1]: Starting /etc/rc.local Compatibility...
-- Subject: Unit rc-local.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit rc-local.service has begun starting up.
Jul 14 23:52:04 sunqingyao-MacBookAir rc.local[2420]: Failed to connect to X Server.
Jul 14 23:52:04 sunqingyao-MacBookAir systemd[1]: rc-local.service: Control process exited, code=exited status=1
Jul 14 23:52:04 sunqingyao-MacBookAir systemd[1]: Failed to start /etc/rc.local Compatibility.
-- Subject: Unit rc-local.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit rc-local.service has failed.
-- 
-- The result is failed.
Jul 14 23:52:04 sunqingyao-MacBookAir systemd[1]: rc-local.service: Unit entered failed state.
Jul 14 23:52:04 sunqingyao-MacBookAir systemd[1]: rc-local.service: Failed with result 'exit-code'.
Jul 14 23:52:04 sunqingyao-MacBookAir sudo[2390]: pam_unix(sudo:session): session closed for user root
    
por nalzok 14.07.2017 / 17:47

1 resposta

1

Obrigado @ bodhi.zazen pela gentil instrução nos comentários à minha pergunta!

Para responder minha pergunta:

O problema é causado pelos comandos em rc.local , que contém a seguinte linha para ativar a rolagem natural:

/usr/bin/synclient VertTwoFingerScroll=1
/usr/bin/synclient HorizTwoFingerScroll=1
/usr/bin/synclient VertScrollDelta=-150
/usr/bin/synclient HorizScrollDelta=-150

No entanto, a execução desse comando requer conexão com o X Server, do qual todos os aplicativos gráficos dependem. No entanto, rc.local é executado antes de o servidor X ser iniciado e, portanto, o erro Failed to connect to X Server .

Para corrigir isso, basta remover essa linha de rc.local e sudo service rc.local start funcionaria bem.

Para responder à minha pergunta real:

A remoção dessa linha não habilita a rolagem natural. Para fazer isso, você precisa colocar a configuração em um arquivo de configuração do Xorg.

Adicione as seguintes linhas a /usr/share/X11/xorg.conf.d/60-synaptics-options.conf , observe que você não precisa chmod a+x .

# Synaptic options
Section "InputClass"
    Identifier "touchpad"
    Driver "synaptics"
    MatchIsTouchpad "on"
        # Enable natural scrolling
        Option "VertTwoFingerScroll" "1"
        Option "HorizTwoFingerScroll" "1"
        Option "VertScrollDelta" "-150"
        Option "HorizScrollDelta" "-150"
EndSection

reinicialize e a rolagem natural está ativada!

    
por nalzok 15.07.2017 / 03:25