# X11vnc + systemd on rocky9

**URL:** <https://forums.rockylinux.org/t/x11vnc-systemd-on-rocky9/8671>\
**Category:** Rocky Linux Help & Support\
**Created:** [January 25, 2023, 9:42am UTC](https://forums.rockylinux.org/t/x11vnc-systemd-on-rocky9/8671 "2023-01-25T09:42:06Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![acte28](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@acte28](https://forums.rockylinux.org/u/acte28)\
**Post date:** [January 25, 2023, 9:42am UTC](https://forums.rockylinux.org/t/x11vnc-systemd-on-rocky9/8671/1 "2023-01-25T09:42:06Z")

</div>

Anyone have luck getting x11vnc running on Rocky 9 as a systemd service? I’ve scoured the web and have not seen an article for this on Rocky, mostly for Ubuntu/Debian.

My goal is to have x11vnc working, even at the login screen.

I’m able to get x11vnc running manually while logged in using the command below:

`/usr/bin/x11vnc -passwd 1234 -display :1 -auth /run/user/1000/gdm/Xauthority -forever -bg -shared`

However, when setting up the systemd service, the application will not start up

```auto
[Unit]
Description=x11vnc server
After=multi-user.target network.target

[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -passwd 1234 -forever -bg -shared -auth guess

[Install]
WantedBy=multi-user.target

```

If I tweak the ExecStart to include the display, it will throw out an SELinux warning

```auto
Jan 25 17:49:56 localhost setroubleshoot[2344]: SELinux is preventing /usr/bin/xauth from append access on the unix_stream_socket unix_stream_socket. For complete SELinux messages run: sealert -l bf083e83-d316-4ca3-998a-9f3c1204c1f0

```

In my previous Centos7 build, this was the systemd config and worked flawlessly

```auto
/usr/bin/x11vnc -inetd -o /var/log/x11vnc.log -display :0 -auth /var/gdm/:0.Xauth -passwd 1234 -forever -bg

```

---

<div class="post-metadata">

**Author:** ![acte28](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@acte28](https://forums.rockylinux.org/u/acte28)\
**Post date:** [January 27, 2023, 7:44am UTC](https://forums.rockylinux.org/t/x11vnc-systemd-on-rocky9/8671/2 "2023-01-27T07:44:57Z")

</div>

I’ve been able to get the systemd service running, however it does not appear to be accepting connections. The service has to be running as the GDM user.

The issue now is something about systemd socket access, I am not sure how to fix. Any help would be great!

```auto
Jan 27 16:38:57 localhost x11vnc[2128]: 27/01/2023 16:38:57
Jan 27 16:38:57 localhost x11vnc[2128]: 27/01/2023 16:38:57 Unable to establish connection with systemd socket
Jan 27 16:38:57 localhost x11vnc[2128]: 27/01/2023 16:38:57 setsockopt failed: can't set TCP_NODELAY flag, non TCP socket?: Socket operation on non-socket

```

```auto
[Unit]
Description=Start x11vnc server at startup.
After=multi-user.target network.target

[Service]
Type=simple
User=gdm
Group=gdm
ExecStart=/usr/bin/x11vnc -inetd -passwd 1234 -forever -shared -bg -display :0 -auth /run/user/42/gdm/Xauthority

[Install]
WantedBy=multi-user.target

```

---

<div class="post-metadata">

**Author:** ![acte28](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@acte28](https://forums.rockylinux.org/u/acte28)\
**Post date:** [February 6, 2023, 6:29am UTC](https://forums.rockylinux.org/t/x11vnc-systemd-on-rocky9/8671/3 "2023-02-06T06:29:02Z")

</div>

Seems to be an issue with rocky9 in itself, xinetd will run with no issues on rocky8.

---

<div class="post-metadata">

**Author:** ![iwalker](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/iwalker/32/2599_2.png) [@iwalker](https://forums.rockylinux.org/u/iwalker)\
**Post date:** [February 6, 2023, 9:54am UTC](https://forums.rockylinux.org/t/x11vnc-systemd-on-rocky9/8671/4 "2023-02-06T09:54:28Z")

</div>

If it relies on the UI being available, since you are using gdm, and also X that means you would probably want to add:

```auto
After=graphical.target

```

assuming of course that the ExecStart command when ran manually from the console does listen and work as expected.

---

<div class="post-metadata">

**Author:** ![mariusz.przeklasa](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/mariusz.przeklasa/32/2773_2.png) [@mariusz.przeklasa](https://forums.rockylinux.org/u/mariusz.przeklasa)\
**Post date:** [February 19, 2023, 7:48pm UTC](https://forums.rockylinux.org/t/x11vnc-systemd-on-rocky9/8671/5 "2023-02-19T19:48:14Z")

</div>

I tested this right after Rocky Linux 9 was released - the problem is that the x11vnc package requires X11 display server and Rocky Linux 9 uses Wayland display server by default - x11vnc works fine on Rocky Linux 9 Mate which still uses X11 display server.

> **[Obrazy Alternatywne | Rocky Linux](https://rockylinux.org/pl/alternative-images)**
>
> Rocky Linux is an open enterprise Operating System designed to be 100% bug-for-bug compatible with Enterprise Linux.

---

<div class="post-metadata">

**Author:** ![acte28](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@acte28](https://forums.rockylinux.org/u/acte28)\
**Post date:** [February 20, 2023, 2:32am UTC](https://forums.rockylinux.org/t/x11vnc-systemd-on-rocky9/8671/6 "2023-02-20T02:32:25Z")

</div>

Hi, thank you for replying!

Do you mind sharing your configuration?

The closest I was able to get was by disabling wayland, I could get x11vnc to start on launch at the login screen level. However, once logged in, it would only display a black window through VNC. If the service is stopped and restarted after the login has happened, then it would be fine, but I can’t get a seemless x11vnc configuration that operates, regardless of who is logged in. Been stumped on this one for a while.

---

<div class="post-metadata">

**Author:** ![mariusz.przeklasa](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/mariusz.przeklasa/32/2773_2.png) [@mariusz.przeklasa](https://forums.rockylinux.org/u/mariusz.przeklasa)\
**Post date:** [February 20, 2023, 7:10am UTC](https://forums.rockylinux.org/t/x11vnc-systemd-on-rocky9/8671/7 "2023-02-20T07:10:52Z")

</div>

Sure!

The content of the service file (x11vnc.service) is attached below.

```auto
[Unit]
Description=VNC server for the current X11 session
After=display-manager.service

[Service]
ExecStart=/usr/bin/x11vnc -auth guess -cursor arrow -display :0 -forever -loop -noallinput -nobell -nodpms -noipv6 -nomodtweak -nopw -norc -nossl -noxdamage -noxfixes -noxkb -noxrecord -o /var/log/x11vnc.log -reopen -repeat -rfbauth /root/.vnc/x11vnc.passwd -rfbport 5900 -rfbversion 3.8 -shared
Restart=on-failure
RestartSec=3

[Install]
WantedBy=graphical.target

```

---

<div class="post-metadata">

**Author:** ![acte28](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@acte28](https://forums.rockylinux.org/u/acte28)\
**Post date:** [February 21, 2023, 3:39am UTC](https://forums.rockylinux.org/t/x11vnc-systemd-on-rocky9/8671/8 "2023-02-21T03:39:21Z")

</div>

> [@acte28](#):
>
> I was able to get was by disabling wayland, I could get x11vnc to start on launch at the login screen level. However, once logged in, it would only display a black window through VNC. If the service is stopped and restarted

Thanks for reply and for providing your systemd info - unfortunately it still does not work.

I’ve disabled wayland, and when I run x11vnc manually via the GUI, connections are accepted, so it is not a firewall issue.

the service appears to be running, however when attempting to connect, nothing happens and just times out.

Besides disabling wayland, the config is very much vanilla.

```auto
[root@hostname ~]# uname -r
5.14.0-162.12.1.el9_1.0.2.x86_64

```

```auto
[root@hostname~]# sudo systemctl status vnc.service
● vnc.service - VNC server for the current X11 session
     Loaded: loaded (/etc/systemd/system/vnc.service; enabled; vendor preset: disabled)
     Active: active (running) since Tue 2023-02-21 12:35:19 JST; 1min 29s ago
   Main PID: 1464917 (x11vnc)
      Tasks: 1 (limit: 818975)
     Memory: 3.1M
        CPU: 3.471s
     CGroup: /system.slice/vnc.service
             └─1464917 /usr/bin/x11vnc -auth guess -cursor arrow -display :0 -forever -loop -noallinput -nobell -nodpms -noipv6 -nomodtweak -nopw -norc -nossl -noxdamage -noxfixes -noxkb -noxrecord -o /var/log/x11vnc.log -reopen -repeat -rfbauth /root/.vnc/x11vnc.passwd>

Feb 21 12:36:39 hostname x11vnc[1464917]: --- x11vnc loop: sleeping 2000 ms ---
Feb 21 12:36:41 hostname x11vnc[1464917]: --- x11vnc loop: 33 ---
Feb 21 12:36:42 hostname x11vnc[1464917]: --- x11vnc loop: waiting for: 1468574
Feb 21 12:36:42 hostname x11vnc[1464917]: --- x11vnc loop: sleeping 2000 ms ---
Feb 21 12:36:44 hostname x11vnc[1464917]: --- x11vnc loop: 34 ---
Feb 21 12:36:44 hostname x11vnc[1464917]: --- x11vnc loop: waiting for: 1468688
Feb 21 12:36:44 hostname x11vnc[1464917]: --- x11vnc loop: sleeping 2000 ms ---
Feb 21 12:36:46 hostname x11vnc[1464917]: --- x11vnc loop: 35 ---
Feb 21 12:36:47 hostname x11vnc[1464917]: --- x11vnc loop: waiting for: 1468802
Feb 21 12:36:47 hostname x11vnc[1464917]: --- x11vnc loop: sleeping 2000 ms ---

```

---

<div class="post-metadata">

**Author:** ![mariusz.przeklasa](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/mariusz.przeklasa/32/2773_2.png) [@mariusz.przeklasa](https://forums.rockylinux.org/u/mariusz.przeklasa)\
**Post date:** [February 22, 2023, 7:39pm UTC](https://forums.rockylinux.org/t/x11vnc-systemd-on-rocky9/8671/9 "2023-02-22T19:39:09Z")

</div>

@acte28  
As I can see your x11vnc service is in a loop and therefore no client can connect to it.

---

<div class="post-metadata">

**Author:** ![acte28](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@acte28](https://forums.rockylinux.org/u/acte28)\
**Post date:** [February 24, 2023, 2:51am UTC](https://forums.rockylinux.org/t/x11vnc-systemd-on-rocky9/8671/10 "2023-02-24T02:51:11Z")

</div>

it’s a copy/paste of service file that you sent, which also include the -loop option

I tested your suggestion of running Rocky9 on MATE, and x11vnc seems to work fine! Really appreciate it. It’s a shame since MATE shows an antiquated UI, but we’ll take it! I suppose the limitation comes from the default gnome within Rocky9.

---

<div class="post-metadata">

**Author:** ![brian](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/brian/32/5777_2.png) [@brian](https://forums.rockylinux.org/u/brian)\
**Post date:** [August 25, 2023, 3:23am UTC](https://forums.rockylinux.org/t/x11vnc-systemd-on-rocky9/8671/11 "2023-08-25T03:23:47Z")

</div>

Closed on August 25, 2023, 3:23am UTC


