gitbls / RPiVNCHowTo

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

Black screen after connecting via VNC Viewer #11

Open peterjdann opened 1 year ago

peterjdann commented 1 year ago

I am getting only a black screen after connecting via VNC Viewer. I have installed lightdm and icewm.

The location of my lightdm.conf is: /etc/init/lightdm.conf

Here are its contents:

LightDM - light Display Manager

#

The display manager service manages the X servers running on the

system, providing login and auto-login services

#

based on gdm upstart script

description "LightDM Display Manager" author "Robert Ancell robert.ancell@canonical.com"

start on ((filesystem and runlevel [!06] and started dbus and plymouth-ready) or runlevel PREVLEVEL=S)

stop on runlevel [016]

respawn respawn limit 2 15

emits login-session-start emits desktop-session-start emits desktop-shutdown

script if [ -n "$UPSTART_EVENTS" ] then

Check kernel command-line for inhibitors, unless we are being called

    # manually
    for ARG in $(cat /proc/cmdline); do
        if [ "$ARG" = "text" ]; then
    plymouth quit || : 
            stop
    exit 0
        fi
    done

[ ! -f /etc/X11/default-display-manager -o "$(cat /etc/X11/default-display-manager 2>/dev/null)" = "/usr/bin/lightdm" -o "$(cat /etc/X11/default-display-manager 2>/dev/null)" = "/usr/sbin/lightdm" ] || { stop; exit 0; }

if [ "$RUNLEVEL" = S -o "$RUNLEVEL" = 1 ]
then
    # Single-user mode
    plymouth quit || :
    exit 0
fi
fi

exec lightdm

end script

post-start script sleep 5 clear > /dev/tty7 end script

post-stop script clear > /dev/tty7 sleep 1 if [ "$UPSTART_STOP_EVENTS" = runlevel ]; then initctl emit desktop-shutdown fi end script

[XDMCPServer] enabled=true port=177

======

I will attach my diagnostics file

diagnostics.txt

gitbls commented 1 year ago

As far as I know, the lightdm package does not include the file /etc/init.d/lightdm.conf at all, so I'm not sure what you've got there for that file.

But, adding the lines

[XDMCPServer]
enabled=true
port=177

to that file is most definitely incorrect.

Those lines must be in /etc/lightdm/lightdm.conf. Please re-read the installation directions and correct your configuration to accurately follow the directions. Once you've done that, reboot and VNC should work.

If it still doesn't work, please provide updated diagnostics.

EDIT: Just noticed in the logs: grep: /etc/lightdm/lightdm.conf: No such file or directory. I've not tested this at all with Ubuntu 22.04, but it looks like Ubuntu has mucked with the standard file locations for lightdm. However, the log you provided shows lightdm looking for that file (/etc/lightdm/lightdm.conf), so either your configuration is mucked, or something else is going on.

Did you delete the file /etc/lightdm/lightdm.conf? Also, is your system running with Wayland or X11 on the system display?

peterjdann commented 1 year ago

Thankyou, Benn, for such a prompt reply, which I very much appreciate.

There certainly is a /etc/init.d/lightdm.conf file in my system which I had no hand in creating.

Your instructions imply that there is already, in a virgin install, a file /etc/lightdm/lightdm.conf which already has an XDMCPServer section. In my case, there is no such file in the native installation of lighted, which is why I thought perhaps I should add that content to the only file in my system called “lightdm,conf”.

Anyway, I have now removed my edit from /etc/init.d/lightdm.conf, and have created a file /etc/init.d/lightdm.conf with the content you have specified.

After rebooting, I still have my original problem.

I have re-run your diagnostic script. I have attached the contents.

With kind regards,

Peter Dann

On 7 Jul 2023, at 11:51 pm, Benn @.***> wrote:

As far as I know, the lightdm package does not include the file /etc/init.d/lightdm.conf at all, so I'm not sure what you've got there for that file.

But, adding the lines

[XDMCPServer] enabled=true port=177 to that file is most definitely incorrect.

Those lines must be in /etc/lightdm/lightdm.conf. Please re-read the installation directions and correct your configuration to accurately follow the directions. Once you've done that, reboot and VNC should work.

If it still doesn't work, please provide updated diagnostics.

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

gitbls commented 1 year ago

I'll have to install Ubuntu 22.04 and see what the wizards have done to lightdm. Stay tuned....

gitbls commented 1 year ago

I installed Ubuntu 22.04 today and found that it doesn't even run X11 by default, it uses Wayland. Of course, VNC only works with X11.

At the moment I have enough other things to suck up all my available time, so I won't be able to help you sort this out further. Based on a quick search, it appears that it's possible to run X11 on 22.04, you might have a go with that.

For now, I'm going to update the README for this project to note that X11 is required, and an unknown amount of work is necessary to get it running on systems using Wayland. Until I can test and see it with my own eyes, I can't claim support for it .

That said, if you are able to get X11 running and can provide a link to a credible guide (or your own notes), I would be willing to investigate further.

Sorry I don't have better news for you on this.

peterjdann commented 1 year ago

Benn,

You have been very generous with your time. Thank you so much.

It’s not easy to find decent instructions on the web for what I was trying to do. I finally came across the following, which I could easily adapt: https://junsun.net/wordpress/2021/01/set-up-ubuntu-xfce4-on-headless-raspberry-pi-4-via-vnc/

Hope the following summary, written somewhat in shorthand, explains the steps I undertook which succeeded. I should note I’m using a RaspberryPi 4 with 8GB RAM and a 64GB microSD card.

Raspberry Pi imager. “Choose OS” > “Other general-purpose OS” > “Ubuntu”. Choose “Ubuntu 22.04 (64-bit)”. NOTE CAREFULLY: NOT LTS

Set hostname to raspberrypi.local Enable ssh with password authentication. Set up wifi credentials. Insert SD microcard in RP and boot.

=======

Log into RP via ssh.

sudo apt update sudo apt dist-upgrade sudo apt install xfce4 xfce4-goodies sudo apt install tigervnc-standalone-server novnc firefox


sudo nano /etc/lightdm/lightdm.conf

Enter the following content:

[Seat:*] allow-guest=false autologin-user=ubuntu user-session=xfce

greeter-session=unity-greeter

xserver-command=/etc/X11/xinit/xserverrc


sudo vncpasswd /etc/vncpasswd

I set my password to 1234567

sudo nano /etc/X11/xinit/xserverrc

Set content to the following:

!/bin/sh

ARG=echo $@ | sed -e "s#vt. -novtswitch##" GEOMETRY="1600x1000" DEPTH="24"

single client mode; VNC password auth; TLS encryption optional;

exec Xvnc -desktop ubuntu -SecurityTypes "VncAuth,TLSVnc" -NeverShared -DisconnectClients -geometry $GEOMETRY -depth $DEPTH -rfbauth /etc/vncpasswd $ARG

NOTE: I commented out previous contents below shebang, which did read:

exec /usr/bin/X -nolisten tcp "$@"


Use the following connection string in VNC Viewer: raspberrypi.local:5900

Enter vnc password (1234567) when prompted.

With kind regards,

Peter Dann

On 9 Jul 2023, at 9:30 am, Benn @.***> wrote:

I installed Ubuntu 22.04 today and found that it doesn't even run X11 by default, it uses Wayland. Of course, VNC only works with X11.

At the moment I have enough other things to suck up all my available time, so I won't be able to help you sort this out further. Based on a quick search, it appears that it's possible to run X11 on 22.04, you might have a go with that.

For now, I'm going to update the README for this project to note that X11 is required, and an unknown amount of work is necessary to get it running on systems using Wayland. Until I can test and see it with my own eyes, I can't claim support for it .

That said, if you are able to get X11 running and can provide a link to a credible guide (or your own notes), I would be willing to investigate further.

Sorry I don't have better news for you on this.

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

gitbls commented 1 year ago

Peter, great that you were able to sort this out!

I don't know Ubuntu versions very well. Does the version you installed start in console or graphical mode? And, was this different than the version you were first working on, trying to get the VNC described on this github working?

peterjdann commented 1 year ago

Thanks Benn.

The version I have successfully installed starts in graphical mode after following all the steps I have listed.

The version I have successfully installed differs from the version I was first working on. The article I cited indicated the version I was initially using would not work (although I have not verified that this is the case).

I was initially using Ubuntu Server 22.04.2 LTS (64 bit).

The version I am now using successfully is Ubuntu Server 23.04 (64 bit).

I have not tried using the new instructions with Ubuntu Server 22.04.2 LTS (64 bit).

With best wishes,

Peter Dann

On 10 Jul 2023, at 11:48 pm, Benn @.***> wrote:

Peter, great that you were able to sort this out!

I don't know Ubuntu versions very well. Does the version you installed start in console or graphical mode? And, was this different than the version you were first working on, trying to get the VNC described on this github working?

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

peterjdann commented 1 year ago

Hi Benn,

I’ve just realised I’ve indicated the wrong Ubuntu version in the steps I listed below.

Below, I listed “Ubuntu 22.04 (64-bit)”. This should be “Ubuntu Server 23.04 (64-bit)”.

Peter Dann

Begin forwarded message:

From: Peter Dann @.> Subject: Re: [gitbls/RPiVNCHowTo] Black screen after connecting via VNC Viewer (Issue #11) Date: 10 July 2023 at 5:57:52 pm AEST To: gitbls/RPiVNCHowTo @.>

Benn,

You have been very generous with your time. Thank you so much.

It’s not easy to find decent instructions on the web for what I was trying to do. I finally came across the following, which I could easily adapt: https://junsun.net/wordpress/2021/01/set-up-ubuntu-xfce4-on-headless-raspberry-pi-4-via-vnc/

Hope the following summary, written somewhat in shorthand, explains the steps I undertook which succeeded. I should note I’m using a RaspberryPi 4 with 8GB RAM and a 64GB microSD card.

Raspberry Pi imager. “Choose OS” > “Other general-purpose OS” > “Ubuntu”. Choose “Ubuntu 22.04 (64-bit)”. NOTE CAREFULLY: NOT LTS

Set hostname to raspberrypi.local Enable ssh with password authentication. Set up wifi credentials. Insert SD microcard in RP and boot.

=======

Log into RP via ssh.

sudo apt update sudo apt dist-upgrade sudo apt install xfce4 xfce4-goodies sudo apt install tigervnc-standalone-server novnc firefox


sudo nano /etc/lightdm/lightdm.conf

Enter the following content:

[Seat:*] allow-guest=false autologin-user=ubuntu user-session=xfce

greeter-session=unity-greeter

xserver-command=/etc/X11/xinit/xserverrc


sudo vncpasswd /etc/vncpasswd

I set my password to 1234567

sudo nano /etc/X11/xinit/xserverrc

Set content to the following:

!/bin/sh

ARG=echo $@ | sed -e "s#vt. -novtswitch##" GEOMETRY="1600x1000" DEPTH="24"

single client mode; VNC password auth; TLS encryption optional;

exec Xvnc -desktop ubuntu -SecurityTypes "VncAuth,TLSVnc" -NeverShared -DisconnectClients -geometry $GEOMETRY -depth $DEPTH -rfbauth /etc/vncpasswd $ARG

NOTE: I commented out previous contents below shebang, which did read:

exec /usr/bin/X -nolisten tcp "$@"


Use the following connection string in VNC Viewer: raspberrypi.local:5900

Enter vnc password (1234567) when prompted.

With kind regards,

Peter Dann

On 9 Jul 2023, at 9:30 am, Benn @.***> wrote:

I installed Ubuntu 22.04 today and found that it doesn't even run X11 by default, it uses Wayland. Of course, VNC only works with X11.

At the moment I have enough other things to suck up all my available time, so I won't be able to help you sort this out further. Based on a quick search, it appears that it's possible to run X11 on 22.04, you might have a go with that.

For now, I'm going to update the README for this project to note that X11 is required, and an unknown amount of work is necessary to get it running on systems using Wayland. Until I can test and see it with my own eyes, I can't claim support for it .

That said, if you are able to get X11 running and can provide a link to a credible guide (or your own notes), I would be willing to investigate further.

Sorry I don't have better news for you on this.

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