gitbls / RPiVNCHowTo

How to install efficient VNC on RasPiOS / Raspbian
MIT License
121 stars 7 forks source link

VNC session does not start #12

Closed softpol closed 1 year ago

softpol commented 1 year ago

Setup: VNC (local) connection from iMac (Ventura 13.5) to headless Raspberry (Bullseye), using "connect with server" from the Finder menu. After selecting the server (vnc://192.168.1.130:5901), a window pops up, asking for the password. However, nothing happens after entering a password, until a timer expires. Looks to be a problem with xdm, as shown in the diagnostics file: rpivnchowto-diagnostics.txt

gitbls commented 1 year ago

I'm out of pocket for a couple of days, will get back to you on this when I'm able to.

In the meantime, could you confirm the name of the system that you're trying to install this on? Is it 'www'?

softpol commented 1 year ago

It is a mystery to me where this display name "www:1" is coming from… The system’s hostname has nothing to do with it:

@.***:~ $ hostname pi4.softpol.net

There are no users with this name:

@.***:~ $ getent passwd | grep www www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin ispapps:x:5001:5002::/var/www/apps:/bin/bash

nor user groups: @.***:~ $ cat /etc/group | grep www www-data:x:33: ispapps:x:5002:www-data ispconfig:x:5003:www-data

As this is a web server, there is a folder /var/www: @.***:~ $ ls -l /var/www totaal 8 drwxr-xr-x 5 www-data www-data 4096 5 sep 13:35 html drwxr-xr-x 3 root root 4096 17 sep 2021 php-fcgi-scripts

pvg

Op 5 sep. 2023, om 16:26 heeft Benn @.***> het volgende geschreven:

I'm out of pocket for a couple of days, will get back to you on this when I'm able to.

In the meantime, could you confirm the name of the system that you're trying to install this on? Is it 'www'?

— Reply to this email directly, view it on GitHub https://github.com/gitbls/RPiVNCHowTo/issues/12#issuecomment-1706728218, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQGOTOBGY5R2OZXATGL352TXY4ZAHANCNFSM6AAAAAA4K2XUGI. You are receiving this because you authored the thread.

gitbls commented 1 year ago

I see you're running dnsmasq on this system. Is it possible that you have the hostname www defined in dnsmasq or /etc/hosts?

If it's there, I'd guess it's defined as your host IP address, or perhaps more likely 127.0.0.1. Only your hostname should be there. Why? Depending on how things are set up, and how xdm looks up and uses hostnames (I have no clue), I could see this error being the result.

If this isn't it, then we'll need to do a deeper dive.

softpol commented 1 year ago

I had a look into the configuration files for dnsmasq en system-resolve, moved and removed some lines to make it more consistent, in particular:

@.***:~ $ cat /etc/hosts 127.0.0.1 localhost

127.0.1.1 pi-4

192.168.1.130 www.softpol.net

192.168.1.130 mail.softpol.net

::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters

and this has indeed some impact, although the iMac can still not setup a VNC connection:

*** /var/log/xdm.log (…) Tue Sep 5 21:07:51 2023 xdm info (pid 486): Starting X server on www:1 Tue Sep 5 21:07:55 2023 xdm info (pid 486): Starting X server on www:1 Tue Sep 5 21:09:15 2023 xdm error (pid 27041): server open failed for www:1, giving up Tue Sep 5 21:09:15 2023 xdm error (pid 486): Display www:1 cannot be opened Tue Sep 5 21:09:15 2023 xdm error (pid 486): Display www:1 is being disabled Wed Sep 6 12:47:21 2023 xdm info (pid 486): Starting X server on 192.168.1.130:1 0 items in XFree86_VT property! Wed Sep 6 12:47:22 2023 xdm info (pid 2561): sourcing /etc/X11/xdm/Xsetup Wed Sep 6 12:47:25 2023 xdm error (pid 2561): fatal IO error 11 (Resource temporarily unavailable) Wed Sep 6 12:47:26 2023 xdm info (pid 486): Starting X server on 192.168.1.130:1 0 items in XFree86_VT property! Wed Sep 6 12:47:26 2023 xdm info (pid 2602): sourcing /etc/X11/xdm/Xsetup Wed Sep 6 12:48:55 2023 xdm error (pid 2602): fatal IO error 11 (Resource temporarily unavailable) Wed Sep 6 12:53:00 2023 xdm info (pid 486): Shutting down Wed Sep 6 12:53:00 2023 xdm info (pid 486): Exiting (…)

This is the latest diagnostics file: 

pvg

Op 5 sep. 2023, om 18:43 heeft Benn @.***> het volgende geschreven:

I see you're running dnsmasq on this system. Is it possible that you have the hostname www defined in dnsmasq or /etc/hosts?

If it's there, I'd guess it's defined as your host IP address, or perhaps more likely 127.0.0.1. Only your hostname should be there. Why? Depending on how things are set up, and how xdm looks up and uses hostnames (I have no clue), I could see this error being the result.

If this isn't it, then we'll need to do a deeper dive.

— Reply to this email directly, view it on GitHub https://github.com/gitbls/RPiVNCHowTo/issues/12#issuecomment-1706960411, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQGOTOD6HKQ5QJE4W52RIVTXY5JDLANCNFSM6AAAAAA4K2XUGI. You are receiving this because you authored the thread.

gitbls commented 1 year ago

Add a line in your /etc/hosts with

192.168.1.xxx pi4 pi4.softpol.net

where xxx is the actual last octet of the IP address

Also, correct the 127.0.1.1 line, since the host is pi4 this line should have pi4 on it, not pi-4

Then try ping pi4 and it should ping the current host system. When that is working correctly, THEN try vnc.

If your network configuration is not correct, then networking utilities such as vnc may fail in strange and wondrous ways.

softpol commented 1 year ago

I am pretty sure that the network configuration is correct. This Raspberry PI-4 runs a web server, a DNS, and a SAMBA server (as well as a local mailserver). Before the upgrade from Duster to Bullkseye, it was also running a VNC server (realVNC) without any problem.

I left realVNC, because it didn’t support anymore VNC 3.3 (used by the iMac) and it requires licensing.

Besides, the hostname is not “pi4” but “pi4.softpol.net http://pi4.softpol.net/”. The Linux prompt shows the short name (/h in the bash script), not the full name (/H). I cannot set pi4 (or pi4.softpol.net http://pi4.sogftpol.net/) to 127.0.1.1, because this will confuse any other machine on my local network (addressing itself).

The DNS entries are not in /etc/hosts but in /etc/dnsmasq.conf. One of them is the one you are suggesting: address=/pi4.softpol.net/192.168.1.130 http://pi4.softpol.net/192.168.1.130

“pi4” cannot be pinged from another machine on the local network. This is the result on the raspberry PI-4 itself: @.***:~ $ ping pi4 PING pi4(fe80::e463:87ff:fe1a:e382%bond0 (fe80::e463:87ff:fe1a:e382%bond0)) 56 data bytes 64 bytes from fe80::e463:87ff:fe1a:e382%bond0 (fe80::e463:87ff:fe1a:e382%bond0): icmp_seq=1 ttl=64 time=0.126 ms (…)

Pinging “pi4.softpol.net http://pi4.softpol.net/” is possible from every machine on the local network, example: [iMac-M1:~] pol% ping pi4.softpol.net PING pi4.softpol.net (192.168.1.130): 56 data bytes 64 bytes from 192.168.1.130: icmp_seq=0 ttl=64 time=4.890 ms (…)

Anyway, I think that your former suggestions were helpfull. X-server is now started, but there is somewhere a resource problem.

pvg

Op 6 sep. 2023, om 18:59 heeft Benn @.***> het volgende geschreven:

Add a line in your /etc/hosts with

192.168.1.xxx pi4 pi4.softpol.net where xxx is the actual last octet of the IP address

Also, correct the 127.0.1.1 line, since the host is pi4 this line should have pi4 on it, not pi-4

Then try ping pi4 and it should ping the current host system. When that is working correctly, THEN try vnc.

If your network configuration is not correct, then networking utilities such as vnc may fail in strange and wondrous ways.

— Reply to this email directly, view it on GitHub https://github.com/gitbls/RPiVNCHowTo/issues/12#issuecomment-1708770411, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQGOTOEHM7JV5ZFZ6QYXLRLXZCTW7ANCNFSM6AAAAAA4K2XUGI. You are receiving this because you authored the thread.

gitbls commented 1 year ago

I would argue that if you can't ping yourself correctly with an IPV4 result, there is a problem with your network config. I haven't looked at dnsmasq in quite some time, but my recollection is that it either expects /etc/hosts to be correct, or it maintains it itself. Or, maybe your dnsmasq config is incorrect. But, on a properly configured DNS network you should be able to use both the shortname and the fqdn for all hosts from all hosts.

I run a DNS/DHCP server on my network using bind(named) and isc-dhcp-server, with the configs managed by https://github.com/gitbls/ndm. My suggestions for you are based on my real-world experience with my network. I added dnsmasq support to ndm a couple of years ago, but I don't use it. I've been using bind/isc-dhcp-server since about 1999, and I've never had DNS issues. I built ndm because I got tired of manually editing yet more config files. It just works.

I apologize for giving you an incorrect /etc/hosts suggestion. The line in your /etc/hosts on the DNS server system (presumably your pi4) should be:

IPADDR    pi4.softpol.net     pi4

There MUST be a way to resolve the hostname to the IP address, both the shortname and the fqdn. Seems to me that dnsmasq should be able to provide both the shortname and the fqdn as well.

On my network, on the DNS server, I can do:

rpisrv1~# hostname
pisrv1
pisrv1~# hostname -f
pisrv1.mydomain.com

pisrv1~# grep pisrv1 /etc/hosts
192.168.92.3    pisrv1.mydomain.com                       pisrv1

# ping the shortname on DNS server itself
pisrv1~# ping pisrv1
PING pisrv1.mydomain.com (192.168.92.3) 56(84) bytes of data.
64 bytes from pisrv1.mydomain.com (192.168.92.3): icmp_seq=1 ttl=64 time=0.160 ms
64 bytes from pisrv1.mydomain.com (192.168.92.3): icmp_seq=2 ttl=64 time=0.103 ms
64 bytes from pisrv1.mydomain.com (192.168.92.3): icmp_seq=3 ttl=64 time=0.087 ms
64 bytes from pisrv1.mydomain.com (192.168.92.3): icmp_seq=4 ttl=64 time=0.098 ms

--- pisrv1.mydomain.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3008ms
rtt min/avg/max/mdev = 0.087/0.112/0.160/0.028 ms

# ping the fqdn on DNS server itself

pisrv1~# ping pisrv1.mydomain.com
PING pisrv1.mydomain.com (192.168.92.3) 56(84) bytes of data.
64 bytes from pisrv1.mydomain.com (192.168.92.3): icmp_seq=1 ttl=64 time=0.181 ms
64 bytes from pisrv1.mydomain.com (192.168.92.3): icmp_seq=2 ttl=64 time=0.135 ms
64 bytes from pisrv1.mydomain.com (192.168.92.3): icmp_seq=3 ttl=64 time=0.094 ms
64 bytes from pisrv1.mydomain.com (192.168.92.3): icmp_seq=4 ttl=64 time=0.104 ms

--- pisrv1.mydomain.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3049ms
rtt min/avg/max/mdev = 0.094/0.128/0.181/0.033 ms
pisrv1~# 

# Using nslookup, which I know does real DNS lookups. Shortname on the DNS server itself:
pisrv1~# nslookup
> pisrv1
Server:         127.0.0.1
Address:        127.0.0.1#53

# fqdn on the DNS server itself:
Name:   pisrv1.mydomain.com
Address: 192.168.92.3
> pisrv1.mydomain.com
Server:         127.0.0.1
Address:        127.0.0.1#53

Name:   pisrv1.mydomain.com
Address: 192.168.92.3

# Using the shortname on another pi on my network:

p84/ssd/work# nslookup
> pisrv1
Server:         192.168.92.3
Address:        192.168.92.3#53

Name:   pisrv1.mydomain.com
Address: 192.168.92.3

# Using the fqdn on another pi on my network:
p84/ssd/work# nslookup
> pisrv1.mydomain.com
Server:         192.168.92.3
Address:        192.168.92.3#53

Name:   pisrv1.mydomain.com
Address: 192.168.92.3

Note that when I reference the shortname (pisrv1) it gets the fqdn, and the IPV4 address. I typically only use the shortname for referencing all my hosts.

It appears that you cannot reference both the shortname and the fqdn for pi4 ON pi4, as well as from other hosts. I'd suggest that a) something might be mis-configured in your DNS server, and b) you're typing way too much if you always have to type the fqdn.

So, I'd ask that you humor me and add the line to your /etc/hosts with the format I suggested above. You might consider checking the dnsmasq documentation to see how they suggest handling shortname and fqdn.

Without you providing me more information about your network configuration, this is the best I can do. If you get stuck and want to send me your dnsmasq config file, you can email it to me at gitbls@outlook.com and we can collaborate offline on this.

gitbls commented 1 year ago

Another note: You mentioned you're using systemd-resolved, have you configured it (or /etc/resolveconf.conf so that the proper search domain is set? I just realized that this may be the reason that your domain isn't being properly defaulted.

Aside: I didn't think about this initially because ndm (previously mentioned) takes care this for me.

gitbls commented 1 year ago

I'm closing this as OP did not provide me with sufficient information to sort out the problem he's having. OP is welcome to re-open this issue, or start a new one, if he is able to provide the requested information.