Bug 22439

Summary: Autostart of x11vnc that works in Mageia 5 does not work in Mageia 6
Product: Mageia Reporter: keith ericson <mageia>
Component: RPM PackagesAssignee: All Packagers <pkg-bugs>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: Normal CC: basesystem, cjw, davidwhodgins, guillomovitch, marja11, mhrambo3501
Version: 6   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Source RPM: x11vnc, systemd CVE:
Status comment:

Description keith ericson 2018-01-22 06:38:34 CET
Description of problem: using systemctl in Mageia 6 to autostart x11vnc at boot-up does not work whereas it does in Mageia 5

For Mageia 5 I adapted the instructions from this webpage

    http://c-nergy.be/blog/?p=8984

which worked as advertised. The only change from the instructions found there is with regard to installing x11vnc. Using the procedure will successfully configured autostarting x11vnc server on Mageia 5 at boot-up; no local (or remote ssh) login is required to start it. Using the same setup on Mageia 6 fails.

Installing the systemctl control file "x11vnc.service" in /usr/lib/systemd/system on Mageia 6 gets x11vnc running at boot-up (as reported by "ps") but refusing to accept connections.

For both Mageia 5 and 6 the file /usr/lib/systemd/system/x11vnc.service contains the following:

     [Unit]
     Description=Start x11vnc at startup.
     After=multi-user.target

     [Service]
     Type=simple
     ExecStart=/usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /etc/x11vnc.pass -rfbport 5900 -shared

     [Install]
     WantedBy=multi-user.target

After enabling and reloading the daemons for systemctl and restarting the server, the command

     ps ax | grep x11vnc

returns output similar to the following for both 5 and 6:

          23129 ?        Ss     0:00 /usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /etc/x11vnc.pass -rfbport 5900 -shared

The test of functionality is to logon to the console of the server and try to telnet to port 5900:

     telnet localhost 5900

The result on the Mageia 6 machine will be 

    Trying 127.0.0.0...
    telnet: connect to 127.0.0.1: Connection refused

If that(those) daemon(s) is(are) killed ("kill -9 <x11vnc process number(s)>") and the x11vnc server started up manually:

     /usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /etc/x11vnc.pass -rfbport 5900 -shared

then the the same attempt to connect using telnet from the local console is successful.
Attempts to connect from a remote vnc client mirror these responses: failure if started from systemctl and success if started manually.

Additionally, "netstat -an | grep 5900" validates this performance. When started manually port 5900 is listening for connections. When started from systemctl no such instances are reported.
Comment 1 Marja Van Waes 2018-01-22 08:26:15 CET
Assigning to all packagers collectively, since there is no registered maintainer for x11vnc.

CC'ing the basesystem maintainers, because systemd is involved. Also CC'ing some x11vnc committers.

CC: (none) => basesystem, cjw, guillomovitch, marja11, mrambo
Assignee: bugsquad => pkg-bugs
Source RPM: (none) => x11vnc, systemd

Comment 2 Dave Hodgins 2018-01-23 02:46:26 CET
In the Unit section for the systemd service, try adding the line ...
After=network.target

CC: (none) => davidwhodgins

Comment 3 keith ericson 2018-03-17 22:25:05 CET
The suggested change, to add that line to the systemd service file, fixed the problem. Thank you very much!

Status: NEW => RESOLVED
Resolution: (none) => WORKSFORME

Comment 4 David Walser 2018-03-18 23:43:08 CET
Rather than closing the bug, you might want to leave it open so that it can be fixed in the package.  However, the better way to run x11vnc is to SSH into the machine and create an SSH tunnel and then run x11vnc only listening on localhost, that way only you can connect to it, encrypted, through your SSH tunnel, at the times you want to use it, rather than leaving a globally open listener on your machine all the time.