canonical / lightdm

Display Manager
GNU General Public License v3.0
813 stars 137 forks source link

Can't get VNC server to listen to IPv6 : Error binding to address [::]:5900: Address already in use #266

Open Apteryks opened 1 year ago

Apteryks commented 1 year ago

Hi,

Per the documentation, I'm trying to have the VNC server to listen both for IPv4 and IPv6 address by leaving the VNCServer listen-address option unspecified. Curiously, this is what I see in the logs:

[+0.00s] DEBUG: Logging to /var/log/lightdm/lightdm.log
[+0.00s] DEBUG: Starting Light Display Manager 1.32.0, UID=0 PID=225
[+0.00s] DEBUG: Loading configuration dirs from /gnu/store/br6l1aacxz7jw6wxafdh55xgxraqf3p5-hicolor-icon-theme-0.17/share/lightdm/lightdm.conf.d
[+0.00s] DEBUG: Loading configuration dirs from /gnu/store/k08mricv2fn1cj79y6n664ac2mrjyj0f-gnome-themes-extra-3.28/share/lightdm/lightdm.conf.d
[+0.00s] DEBUG: Loading configuration dirs from /gnu/store/clrr4yq5qszfz2g30d7qa3q5mh04acgm-adwaita-icon-theme-40.1.1/share/lightdm/lightdm.conf.d
[+0.00s] DEBUG: Loading configuration dirs from /gnu/store/ybrk59cl77x0qv8c3zajvg834mdhp7xs-lightdm-gtk-greeter-2.0.8/share/lightdm/lightdm.conf.d
[+0.00s] DEBUG: Loading configuration dirs from /gnu/store/3zm47gwhf81632x8jyh46d14nymmmmq4-lightdm-1.32.0/share/lightdm/lightdm.conf.d
[+0.00s] DEBUG: Loading configuration dirs from /gnu/store/4nwcmr0ywkkcjpi3whf7p53p1cjnwy39-etc-lightdm/lightdm/lightdm.conf.d
[+0.00s] DEBUG: Loading configuration from /gnu/store/3c6zqy7dkx5fzs0n8c8qmflpd5qgdxxy-lightdm.conf
[+0.00s] DEBUG: Registered seat module local
[+0.00s] DEBUG: Registered seat module xremote
[+0.00s] DEBUG: Using D-Bus name org.freedesktop.DisplayManager
[+0.02s] DEBUG: _g_io_module_get_default: Found default implementation local (GLocalVfs) for ‘gio-vfs’
[+0.02s] DEBUG: Monitoring logind for seats
[+0.02s] DEBUG: New seat added from logind: seat0
[+0.02s] DEBUG: Seat seat0: Loading properties from config section Seat:*
[+0.02s] DEBUG: Seat seat0 has property CanMultiSession=no
[+0.02s] DEBUG: Seat seat0: Starting
[+0.02s] DEBUG: Seat seat0: Creating greeter session
[+0.04s] DEBUG: Seat seat0: Creating display server of type x
[+0.06s] DEBUG: Could not run plymouth --ping: Failed to execute child process “plymouth” (No such file or directory)
[+0.06s] DEBUG: Using VT 7
[+0.07s] DEBUG: Seat seat0: Starting local X display on VT 7
[+0.07s] DEBUG: XServer 0: Logging to /var/log/lightdm/x-0.log
[+0.07s] DEBUG: XServer 0: Writing X server authority to /var/run/lightdm/root/:0
[+0.07s] DEBUG: XServer 0: Launching X Server
[+0.07s] DEBUG: Launching process 241: /gnu/store/x4lnp1i6affsp759w3spvrd0p8vidmdb-startx :0 -seat seat0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch
[+0.07s] DEBUG: XServer 0: Waiting for ready signal from X server :0
[+0.08s] DEBUG: Acquired bus name org.freedesktop.DisplayManager
[+0.08s] DEBUG: Registering seat with bus path /org/freedesktop/DisplayManager/Seat0
[+0.08s] DEBUG: Starting XDMCP server on UDP/IP port 177
[+0.09s] DEBUG: Starting VNC server on TCP/IP port 5900
[+0.09s] WARNING: Failed to create IPv6 VNC socket: Error binding to address [::]:5900: Address already in use
[+1.06s] DEBUG: Loading users from org.freedesktop.Accounts
[+1.06s] DEBUG: User /org/freedesktop/Accounts/User1000 added
[+3.61s] DEBUG: Got signal 10 from process 241
[+3.61s] DEBUG: XServer 0: Got signal from X server :0
[+3.61s] DEBUG: XServer 0: Connecting to XServer :0
[+3.63s] DEBUG: Seat seat0: Display server ready, starting session authentication
[+3.63s] DEBUG: Session pid=280: Started with service 'lightdm-greeter', username 'lightdm'
[+3.81s] DEBUG: Session pid=280: Authentication complete with return value 0: Success
[+3.81s] DEBUG: Seat seat0: Session authenticated, running command
[+3.81s] DEBUG: Session pid=280: Running command /gnu/store/ybrk59cl77x0qv8c3zajvg834mdhp7xs-lightdm-gtk-greeter-2.0.8/bin/lightdm-gtk-greeter
[+3.81s] DEBUG: Creating shared data directory /var/lib/lightdm-data/lightdm
[+3.81s] DEBUG: Session pid=280: Logging to /var/log/lightdm/seat0-greeter.log
[+3.85s] DEBUG: Activating VT 7
[+3.85s] DEBUG: Activating login1 session c1
[+3.85s] DEBUG: Seat seat0 changes active session to c1
[+3.85s] DEBUG: Session c1 is already active
[+6.09s] DEBUG: Greeter connected version=1.32.0 api=1 resettable=false
[+9.39s] DEBUG: Greeter start authentication for alice
[+9.40s] DEBUG: Session pid=311: Started with service 'lightdm', username 'alice'
[+9.61s] DEBUG: Session pid=311: Got 1 message(s) from PAM
[+9.61s] DEBUG: Prompt greeter with 1 message(s)

I've reviewed the source and it looks fine to my untrained eye, so I'm at a lost. Any ideas?

Thanks!

comburent commented 1 year ago

This is very likely a symptom of the code binding to IPv4 before IPv6. It should happen in the other way, as binding to [::] will automatically imply bind to 0.0.0.0 unless a specific kernel setting is toggled to decouple this behavior.

Apteryks commented 1 year ago

@comburent thanks for suggesting, it works! A PR has been opened and I'll apply the patch to the Guix lightdm package in the mean time.

Artiom-M commented 5 months ago

I have seen this as well. Any chance to have this PR merged? Also if I specify a listen address it also fails (issue discussed here: https://github.com/canonical/lightdm/issues/87 ) could it be the same fix for both?