cannot enable vnc by systemd

This forum is for discussion about general software issues.

cannot enable vnc by systemd

Postby itarill » Fri Jun 05, 2020 11:50 pm

Hello,

I am trying to follow this guide for VNC sessions:
https://wiki.archlinux.org/index.php/Ti ... _(Arch_ARM)

I have installed lxqt and if I issue "vncserver" in ssh, there is a VNC session I can connect to. However, I cannot seem to make it work automatically on ssh session:

$this->bbcode_second_pass_code('', '$ sudo systemctl start vncserver@:1.service
Failed to start vncserver@:1.service: Unit vncserver@:1.service not found.')

or

$this->bbcode_second_pass_code('', '$ sudo systemctl start vncserver@:1.service --user
Failed to connect to bus: No such file or directory')

All the help is appreciated.
itarill
 
Posts: 5
Joined: Wed Jun 03, 2020 11:28 pm

Re: cannot enable vnc by systemd

Postby moonman » Sat Jun 06, 2020 3:00 am

Did you create the .service file as described in the wiki? The errors indicate the .service file does not exist.
Pogoplug V4 | GoFlex Home | Raspberry Pi 4 4GB | CuBox-i4 Pro | ClearFog | BeagleBone Black | Odroid U2 | Odroid C1 | Odroid XU4
-----------------------------------------------------------------------------------------------------------------------
[armv5] Updated U-Boot | [armv5] NAND Rescue System
moonman
Developer
 
Posts: 3388
Joined: Sat Jan 15, 2011 3:36 am

Re: cannot enable vnc by systemd

Postby itarill » Sat Jun 06, 2020 8:48 am

Turns out I needed to restart my raspberry. Maybe a systemd refresh would have been sufficient, but I did not want to look it up.

Now system mode work with this unit:
/etc/systemd/system/vncserver@:1.service

However, user mode still does not autostart on ssh session. I have these units:

/etc/systemd/user/vncserver@:1.service
~/.config/systemd/user/vncserver@:1.service

systemctl --user enable vncserver@:1.service:
$this->bbcode_second_pass_code('', '
Created symlink /home/marlonbrando/.config/systemd/user/multi-user.target.wants/vncserver@:1.service -> /home/marlonbrando/.config/systemd/user/vncserver@:1.service.
')

Then I start the service: systemctl --user start vncserver@:1.service, but it still will not autostart on SSH session. Also, I had to remove user and home directory reference from the unit, otherwise it was throwing an error:

systemctl --user start vncserver@:1.service
Job for vncserver@:1.service failed because the control process exited with error code.
$this->bbcode_second_pass_code('', 'See "systemctl --user status vncserver@:1.service" and "journalctl --user -xe" for details.')
and
systemctl --user status vncserver@:1.service
$this->bbcode_second_pass_code('', '* vncserver@:1.service - Remote desktop service (VNC)
Loaded: loaded (/etc/xdg/systemd/user/vncserver@:1.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2020-06-04 15:04:15 CEST; 1min 47s ago
Process: 559 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill :1 > /dev/null 2>&1 || : (code=exited, status=216/GROUP)

Jun 04 15:04:15 archpi systemd[519]: Starting Remote desktop service (VNC)...
Jun 04 15:04:15 archpi systemd[559]: vncserver@:1.service: Failed to determine supplementary groups: Operation not permitted
Jun 04 15:04:15 archpi systemd[559]: vncserver@:1.service: Failed at step GROUP spawning /bin/sh: Operation not permitted
Jun 04 15:04:15 archpi systemd[519]: vncserver@:1.service: Control process exited, code=exited, status=216/GROUP
Jun 04 15:04:15 archpi systemd[519]: vncserver@:1.service: Failed with result 'exit-code'.
Jun 04 15:04:15 archpi systemd[519]: Failed to start Remote desktop service (VNC).')

I guessed sudo might help with the permissions, but I was wrong:
sudo systemctl --user enable vncserver@:1.service:
$this->bbcode_second_pass_code('', 'Failed to connect to bus: No such file or directory')
itarill
 
Posts: 5
Joined: Wed Jun 03, 2020 11:28 pm

Re: cannot enable vnc by systemd

Postby graysky » Sat Jun 06, 2020 12:08 pm

The user service is started by you, NOT root. Do not sudo systemctl ...

$this->bbcode_second_pass_code('', 'systemctl --user start vncserver@:1')

Also https://wiki.archlinux.org/index.php/TigerVNC#User_mode and https://wiki.archlinux.org/index.php/Sy ... _instances
graysky
Developer
 
Posts: 1876
Joined: Sun Jun 26, 2011 6:56 am
Location: /run/user/1000

Re: cannot enable vnc by systemd

Postby itarill » Sat Jun 06, 2020 12:31 pm

I figured I should run it as user, but I gave sudo a try. You know, like more brute force :roll:

Your links do not help me as I am working from the tigervnc wiki and I already have the unit in ~/.config/systemd/user/mpd.service but I must be overlooking or misunderstanding something - that is why I came to the forums.

Can you please be specific? systemctl --user start vncserver@:1.service without sudo still gives
$this->bbcode_second_pass_code('', 'Job for vncserver@:1.service failed because the control process exited with error code.
CODE: SELECT ALL
See "systemctl --user status vncserver@:1.service" and "journalctl --user -xe" for details.')

with the previously provided status information.
itarill
 
Posts: 5
Joined: Wed Jun 03, 2020 11:28 pm

Re: cannot enable vnc by systemd

Postby graysky » Sat Jun 06, 2020 1:42 pm

Does vncserver run as your user calling it without systemd?

Study the service to see what it calls:
$this->bbcode_second_pass_code('', 'cat /usr/lib/systemd/user/vncserver@.service')

Make sure it isn't running.
Make sure your calls via sudo did not ***** up the permissions on your user files (~/.vnc).
Try running it as your user: vncserver :1

Does it start? If not, what do the logs in ~/.vnc tell you?
graysky
Developer
 
Posts: 1876
Joined: Sun Jun 26, 2011 6:56 am
Location: /run/user/1000

Re: cannot enable vnc by systemd

Postby itarill » Sat Jun 06, 2020 9:06 pm

I think I took a wrong turn somewhere and ended up deep in the forest :roll:
Since it was a fresh install I ended up re-doing it. And it just works :lol:

Thanks for your efforts though! :)
itarill
 
Posts: 5
Joined: Wed Jun 03, 2020 11:28 pm


Return to General

Who is online

Users browsing this forum: No registered users and 22 guests