Bug #3300
openRunning Xvnc from TigerVNC package through the INETD daemon in TCP WAIT mode fails hard
0%
Description
System environment:
root@dragonflybsd /home/adrian # uname -a DragonFly dragonflybsd.v-zone.lan.dac 6.0-RELEASE DragonFly v6.0.1-RELEASE #1: Thu Oct 14 18:25:27 CEST 2021 adrian@dragonflybsd.v-zone.lan.dac:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64
Running DragonFlyBSD inside a Debian KVM virtualization as a guest with hardware acceleration,
I can't run Xvnc (from the TigerVNC package) in WAIT mode using the INETD daemon supplied with the base system.
Running XVnc from INETD in NOWAIT mode works fine though! It is only about the WAIT mode, and I would like to use the WAIT mode, to have a long lasting Xorg session.
Here is my stanza from /etc/inetd.conf, to reproduce the error.
At first, the working stanza — in NOWAIT mode:
5916 stream tcp nowait adrian /usr/libexec/tcpd /usr/local/bin/Xvnc :16 -inetd -desktop dragonflybsd.v-zone.lan.dac:16 -query localhost -once -geometry 1680x1050 -depth 24 -rfbauth /home/adrian/.vnc/passwd -rfbport 5916 -Log *:syslog:30
Now, the NOT working stanza, in WAIT mode:
5916 stream tcp wait adrian /usr/libexec/tcpd /usr/local/bin/Xvnc :16 -inetd -desktop dragonflybsd.v-zone.lan.dac:16 -query localhost -once -geometry 1680x1050 -depth 24 -rfbauth /home/adrian/.vnc/passwd -rfbport 5916 -Log *:syslog:30
Running the second command through the INETD daemon, /var/log/messages gets flooded by the constantly restarting Xvnc with this:
Oct 25 18:51:01 dragonflybsd Xvnc[10132]: warning: can't get client address: Socket is not connected Oct 25 18:51:01 dragonflybsd inetd[9859]: /usr/libexec/tcpd[10132]: exited, status 1 Oct 25 18:51:01 dragonflybsd Xvnc[10133]: warning: can't get client address: Socket is not connected Oct 25 18:51:02 dragonflybsd inetd[9859]: /usr/libexec/tcpd[10133]: exited, status 1 Oct 25 18:51:02 dragonflybsd Xvnc[10134]: warning: can't get client address: Socket is not connected Oct 25 18:51:02 dragonflybsd inetd[9859]: /usr/libexec/tcpd[10134]: exited, status 1 Oct 25 18:51:02 dragonflybsd Xvnc[10135]: warning: can't get client address: Socket is not connected Oct 25 18:51:02 dragonflybsd inetd[9859]: /usr/libexec/tcpd[10135]: exited, status 1 Oct 25 18:51:02 dragonflybsd Xvnc[10136]: warning: can't get client address: Socket is not connected Oct 25 18:51:02 dragonflybsd inetd[9859]: /usr/libexec/tcpd[10136]: exited, status 1 Oct 25 18:51:02 dragonflybsd inetd[9859]: 5916/tcp server failing (looping), service terminated
Removing /usr/libexec/tcpd in beforehand of Xvnc, the error is this:
Oct 25 18:52:11 dragonflybsd :16[10424]: TcpSocket: unable to get peer name for socket Oct 25 18:52:11 dragonflybsd :16[10424]: Connections: closed: ::0 Oct 25 18:52:11 dragonflybsd :16[10426]: TcpSocket: unable to get peer name for socket Oct 25 18:52:11 dragonflybsd :16[10426]: TcpSocket: unable to get peer name for socket Oct 25 18:52:11 dragonflybsd :16[10426]: Connections: accepted: ::0 Oct 25 18:52:11 dragonflybsd :16[10426]: TcpSocket: unable to get peer name for socket Oct 25 18:52:11 dragonflybsd :16[10426]: TcpSocket: unable to get peer name for socket Oct 25 18:52:11 dragonflybsd :16[10426]: Connections: closed: ::0 Oct 25 18:52:11 dragonflybsd :16[10439]: TcpSocket: unable to get peer name for socket Oct 25 18:52:11 dragonflybsd :16[10439]: TcpSocket: unable to get peer name for socket Oct 25 18:52:11 dragonflybsd :16[10439]: Connections: accepted: ::0 Oct 25 18:52:11 dragonflybsd :16[10439]: TcpSocket: unable to get peer name for socket
As you can see, INETD is constantly respawning Xvnc.
Thank you for noticing this issue.
Sincerely,
Adrian Kieß
Updated by saper 7 months ago
- Status changed from New to Feedback
Hi Adrian, I think the main problem is you need to add one more work in your command line. The reason for this is how launching the process works - /usr/local/bin/Xvnc is the process to start and the argument 0 should be what the name that process should get, the manpage suggests "Xvnc" but can be pretty much anything.
This way your "-inetd" parameter gets eaten up and ends up not being used at all.
I have made it work on FreeBSD by doing two things:
as root add the service to /etc/services- printf "myvnc\t5916/tcp\n" >> /etc/services
add the following line to /etc/inetd.conf
myvnc stream tcp wait saper /usr/local/bin/Xvnc Xvnc -inetd -PasswordFile /home/saper/.vnc/passwd :16
Tabs are given like this (where \t is a tab character):
- ed /etc/inetd.conf
6839
$
myvnc stream tcp wait saper /usr/local/bin/Xvnc Xvnc -inetd -PasswordFile /home/saper/.vnc/passwd :16
l
myvnc\tstream\ttcp\twait\tsaper\t/usr/local/bin/Xvnc\tXvnc -inetd -PasswordFile /home/saper/.vnc/passwd :16$
q
$ l and q are the commands given to the ed editor
After this, it does what you wanted - I can connect with "vncviewer :16" to get a black blank screen.
I just start something there from the terminal like running for example "xterm -display :16"
I'd recommend doing this before going for using -query option, but maybe you'll get it working anyway.
To sum up:
myvnc stream tcp wait saper /usr/local/bin/Xvnc Xvnc -inetd -PasswordFile /home/saper/.vnc/passwd :16
^^ program to run ^
^parameters^
argv0 argv1 argv2 .....
argv0 is usually a program name and is not used a "real" parameter.
Updated by saper 7 months ago
Sorry the formating for the last one is wrong:
To sum up:
myvnc stream tcp wait saper /usr/local/bin/Xvnc Xvnc -inetd -PasswordFile /home/saper/.vnc/passwd :16
^^ program to run ^
^ parameters ^
argv0 argv1 argv2 .....
argv0 is usually a program name and is not used a "real" parameter.
Updated by adrian 5 months ago
saper wrote in #note-4:
Sorry the formating for the last one is wrong:
To sum up:
[...]
argv0 is usually a program name and is not used a "real" parameter.
Hello Saper,
thank you for your input.
I changed my inetd.conf stanza line in the way you suggested, but I can still only get the 'nowait' mode to run,
'wait' mode still fails with:
Jul 11 19:50:19 dragonflybsd Xvnc4697: TcpSocket: unable to get peer name for socket
Jul 11 19:50:19 dragonflybsd Xvnc4697: TcpSocket: unable to get peer name for socket
Jul 11 19:50:19 dragonflybsd Xvnc4697: Connections: accepted: ::0
Jul 11 19:50:19 dragonflybsd Xvnc4697: TcpSocket: unable to get peer name for socket
Jul 11 19:50:19 dragonflybsd Xvnc4697: VNCSConnST: Failed to flush remaining socket data on close: write: Broken pipe (32)
Jul 11 19:50:19 dragonflybsd Xvnc4697: Connections: closed: ::0
Jul 11 19:50:19 dragonflybsd inetd4149: 5916/tcp server failing (looping), service terminated
Thank you.
Sincerely,
Adrian Kieß