I take it back. Its working now with the realVNC client, pointing to 5901 as per the ss -alnp | grep Xvnc-core output
So it looks like the install process is somehow borked by some of the settings in the dietpi.txt or by some clash of installs of the chosen software in that. I will try to narrow down the cause tomorrow and report back.
If anyone can see anything in the dietpi.txt I posted in the OP that would be great!
dietpi.txt doesn’t do anything. The installation will be triggered due to software code you enter. At the end installation process should be same independent on the way triggered. I will do some testing on my RPi3B+ with your settings
That’s was my expectation too. I don’t think software installed manually or via dietpi.txt should make any difference. So it must be something to do with other settings. Let me know if you find anything. I will do likewise.
ok it took a while but I found the issue on your config. It’s basically one of the VNC server settings you changed
SOFTWARE_VNCSERVER_SHARE_DESKTOP=1
Sorry that I did not spotted it before but if you set it to 1, the xserver seems not to start. You would need to set it to 0. I guess it should be 0 as there is no other desktop running except VNC.
Next to that I have seen you enabled AUTO_SETUP_AUTOSTART_TARGET_INDEX=7. Any reason for this? I guess you are running a headless system. So setting could be default. No need to change it.
Thanks Joulinar. I have also found some strange behaviour when mariadb is installed. I’m currently trying to see if that was a one off gremlin or reproducable.
Ok, so the gremlins were more to do with the choice of VNC server. I was testing both TigerVNC and RealVNC. For some reason TigerVNC keeps shutting down when you disconnect from a session, where as RealVNC keeps running so you can connect/disconnect/connect as many times as you like
Perhaps my next question is for another thread, but now that I an reliably connect to a desktop session, I’ve been mucking around with trying to get the session I connect to be something other than the root login. I’ve tried multiple things and configurations, but nothing seems to work.
Goal is to create a new administrative user and be logged into the desktop as that user when I connect to RealVNC. Is this achievable? I’ve seen other folks struggling with it too.
I’m able to login as user dietpi without issues, however inside VNC i’m user root. I guess this happen because the VNC session was started as root. See picture attached.
- On the VNC Server Information, you see that I’m login as dietpi
- On the LXTermianl you see that I’m root on CLI level
So I’m in the exact same situation. Can get connected to the session fine (as root or another user, but giving the other user permissions to connect). However, when connected to the session I need it to be a different unix user (one that has the correct file permissions on network attached drives etc)
I’ve tried loads of different things to try and have the desktop session autologged in as a different user, but when I try those, I lose ability to make the connection through vnc at all.
What is the reason for being a different user on VNC?
So you have a network mount with specific permission attached to your DietPi system?
Yeah, ultimately I would like to have multiple users connect to the Pi and haver their own environment to work with.
well I’m not sure if vnc is the right solution because a vnc server has the permissions of the user who runs it. That means for each user you would need to ran an own instance of vncserver with an own display index. That would looks like this on process level
root@raspberrypi-emby:~# ps -ef |grep vnc
root 416 1 0 21:59 ? 00:00:00 /usr/bin/vncserver-x11-serviced -fg
root 418 1 0 21:59 ? 00:00:00 /usr/bin/vncserver-virtuald -fg
root 429 416 0 21:59 ? 00:00:00 /usr/bin/vncserver-x11-core -service
root 737 1 0 21:59 ? 00:00:00 /usr/bin/vncserver :1 -geometry 1280x720 -depth 16
dietpi 739 1 0 21:59 ? 00:00:00 /usr/bin/vncserver :2 -geometry 1280x720 -depth 16
root 742 737 0 21:59 ? 00:00:00 /usr/bin/Xvnc-core :1 -auth /root/.Xauthority -pn -geometry 1280x720 -depth 16
dietpi 743 739 0 21:59 ? 00:00:00 /usr/bin/Xvnc-core :2 -auth /home/dietpi/.Xauthority -pn -geometry 1280x720 -depth 16
root 744 743 0 21:59 ? 00:00:00 /usr/bin/Xvnc -rootHelper 1000 4
root 775 737 0 21:59 ? 00:00:00 /bin/sh /etc/vnc/xstartup
dietpi 776 739 0 21:59 ? 00:00:00 /bin/sh /etc/vnc/xstartup
root 800 1 0 21:59 ? 00:00:00 /usr/bin/vncserverui virtual 13
dietpi 809 1 0 21:59 ? 00:00:00 /usr/bin/vncserverui virtual 14
root 846 800 0 21:59 ? 00:00:00 /usr/bin/vncserverui -statusicon 5
dietpi 847 809 0 21:59 ? 00:00:00 /usr/bin/vncserverui -statusicon 5
root 1276 1204 0 22:00 pts/0 00:00:00 grep vnc
root@raspberrypi-emby:~#
you see, user root is running usr/bin/vncserver :1 while user dietpi us running /usr/bin/vncserver :2
and finally you can connect to user dietpi environment by using yourIP:2 on RealVNC client. see attached
That looks like a workable solution. Can you point me in the direction of configuration guidance for that?
you would need to double vncserver.service as well as dietpi vncserver config
/etc/systemd/system/vncserver.service
/usr/local/bin/vncserver
like this
root@raspberrypi-emby:~# ls -la /etc/systemd/system |grep vnc
-rw-r--r-- 1 root root 319 Apr 30 21:41 vncserver2.service
-rw-r--r-- 1 root root 308 Apr 29 15:10 vncserver.service
root@raspberrypi-emby:~#
root@raspberrypi-emby:~# ls -la /usr/local/bin/
-rwxr-xr-x 1 root root 1838 Apr 29 15:10 vncserver
-rwxr-xr-x 1 root root 1840 Apr 30 21:42 vncserver2
root@raspberrypi-emby:~#
that’s the service file vncserver2.service
[Unit]
Description=Manage VNC Server (DietPi)
Before=xrdp.service xrdp-sesman.service
After=dietpi-boot.service
[Service]
RemainAfterExit=yes
User=dietpi
PAMName=login
Environment=HOME=/home/dietpi
ExecStart=/usr/local/bin/vncserver2 start
ExecStop=/usr/local/bin/vncserver2 stop
[Install]
WantedBy=multi-user.target
within vnc server config file /usr/local/bin/vncserver2 you would need to replace 2 times the following line at the bottom
DISPLAY=$(sed -n '/^[[:blank:]]*SOFTWARE_VNCSERVER_DISPLAY_INDEX=/{s/^[^=]*=//p;q}' /DietPi/dietpi.txt)
change it to
DISPLAY=2
and enable service for autostart
systemctl enable vncserver2.service
Magic. I’ll give that a go. Does that mean that to change the first vncserver config you would simply edit the first instance of both files and change to an alternate user?
theoretically yes, if you don’t need a root instance. or you are going to deactivate the initial first vnc service and manage all users in their own separate files. this way you will keep the possibility to have a root instance if needed
worked perfectly for me. Thanks for all the help Joulinar! 
Your welcome. Good that we found a solution for your challenge.
Hi,
just another option to play around would be using TigerVNC + xRDP. This will allow to use Windows RPD Client. Looks like it allows Multi-User scenario out of the box. 