launch x11vnc on bootup

11,547

I found this thread which shows a similar task of setting up x11vnc as a Systemd service. The thread is titled: Index» Newbie Corner» how to enable x11vnc at startup using systemd ?.

From a comment in that thread

  1. Create the file: /etc/systemd/system/x11vnc.service

    [Unit]
    Description=VNC Server for X11
    Requires=display-manager.service
    After=display-manager.service
    
    [Service]
    Type=forking
    ExecStart=/usr/bin/x11vnc -norc -forever -shared -bg -rfbauth /etc/x11vnc.pass -allow 192.168.1. -autoport 5900 -o /var/log/x11vnc.log
    
  2. Create the file: /etc/systemd/system/graphical.target

    #  This file is part of systemd.
    #
    #  systemd is free software; you can redistribute it and/or modify it
    #  under the terms of the GNU Lesser General Public License as published by
    #  the Free Software Foundation; either version 2.1 of the License, or
    #  (at your option) any later version.
    
    [Unit]
    Description=Graphical Interface
    Documentation=man:systemd.special(7)
    Requires=multi-user.target
    After=multi-user.target
    Conflicts=rescue.target
    Wants=display-manager.service
    Wants=x11vnc.service
    AllowIsolate=yes
    
    [Install]
    Alias=default.target
    
  3. Enable Systemd service

    $ sudo systemctl enable graphical.target
    

    This should create a link like this:

    /etc/systemd/system/default.target -> /etc/systemd/system/graphical.target

  4. Reboot

Share:
11,547

Related videos on Youtube

zeena
Author by

zeena

Updated on September 18, 2022

Comments

  • zeena
    zeena over 1 year

    I am using archlinux version 3.10.27-1-ARCH on my remote PC and I would like it to launch x11vnc server on successful bootup. Though i can start the x11vnc server manually, I am having trouble starting it up automatically. The configuration of /etc/systemd/system/x11vnc.service is as follows


    [Unit]
    Description=VNC Server for X11
    Requires=graphical.target
    After=graphical.target
    
    [Service]
    ExecStart=/usr/bin/x11vnc -display :0 -nopw
    


    The status of the service using command:systemctl status x11vnc

    x11vnc.service - VNC Server for X11
       Loaded: loaded (/etc/systemd/system/x11vnc.service; enabled)
       Active: inactive (dead)
    


    And the dBus output of command: dmesg|grep x11vnc

    [    5.467201] systemd[1]: Found dependency on x11vnc.service/start
    [    5.467285] systemd[1]: Breaking ordering cycle by deleting job x11vnc.service/start
    [    5.467335] systemd[1]: Job x11vnc.service/start deleted to break ordering cycle starting with graphical.target/start
    

    I do feel from the dmesg output there is a cyclic dependency, but I am not able to understand what.

  • zeena
    zeena over 10 years
    Thanks for your answer. Though I did see the link earlier during my google searches, I did not try it for some reason. I edited my x11vnc.service with yours as starting point, and now the x11vnc server starts up automatically on bootup
  • slm
    slm over 10 years
    @zeena - That wonderful news, glad this resolved your issue, thanks for the Q!