View previous topic :: View next topic |
Author |
Message |
Adel Ahmed Veteran
Joined: 21 Sep 2012 Posts: 1523
|
Posted: Sat Mar 01, 2014 9:30 am Post subject: setting up tigervnc under systemd |
|
|
I've emerged tigervnc with the server use flag set, I'm having trouble starting or enabling the service under systemd though, I've tried creating a script myself that would run the vncserver command but I end up with an xterm session instead of my default xfce session(I'm also using xorg module to share screens), should I create a service script or is there one already available?
thanks
workaround: xfce sartup scripts from the user account
script: (I used the echo to test the script, you can remove both lines)
#!/bin/bash
#check if the vncserver has already been started
ps aux | grep vnc | head -n1 | grep Xvnc
if [ $? -eq 0 ]
then
echo true
else
echo false
vncserver
fi
Last edited by Adel Ahmed on Sat Mar 08, 2014 6:03 am; edited 1 time in total |
|
Back to top |
|
|
Adel Ahmed Veteran
Joined: 21 Sep 2012 Posts: 1523
|
Posted: Thu Mar 06, 2014 4:52 am Post subject: |
|
|
any help? |
|
Back to top |
|
|
fpemud Guru
Joined: 15 Feb 2012 Posts: 349
|
|
Back to top |
|
|
Adel Ahmed Veteran
Joined: 21 Sep 2012 Posts: 1523
|
Posted: Fri Mar 07, 2014 5:54 am Post subject: |
|
|
Failed to issue method call: Unit vncserver.service failed to load: No such file or directory.
I'm clueless so far |
|
Back to top |
|
|
SirRobin2318 Apprentice
Joined: 24 Apr 2004 Posts: 241 Location: Strasbourg, france.
|
Posted: Fri Mar 07, 2014 9:01 am Post subject: |
|
|
Did you set User= in the file?
What display did you enable it for? |
|
Back to top |
|
|
Adel Ahmed Veteran
Joined: 21 Sep 2012 Posts: 1523
|
Posted: Fri Mar 07, 2014 11:29 am Post subject: |
|
|
here's my user line:
DISPLAYS="adel:1" |
|
Back to top |
|
|
SirRobin2318 Apprentice
Joined: 24 Apr 2004 Posts: 241 Location: Strasbourg, france.
|
Posted: Fri Mar 07, 2014 12:39 pm Post subject: |
|
|
Can you show me your vncserver.service file, and how you enabled it, the name of the symlink in /etc. |
|
Back to top |
|
|
Adel Ahmed Veteran
Joined: 21 Sep 2012 Posts: 1523
|
Posted: Fri Mar 07, 2014 2:02 pm Post subject: |
|
|
Ihere's my service file:
[Unit]
Description=Remote desktop service (VNC)
After=network.target
[Service]
Type=forking
User=
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=-/usr/bin/vncserver -kill %i
ExecStart=/usr/bin/vncserver %i
ExecStop=/usr/bin/vncserver -kill %i
[Install]
WantedBy=multi-user.target
this service fails to start due to the following error(s):
Process: 1555 ExecStart=/usr/bin/vncserver %i (code=exited, status=2)
Process: 1553 ExecStartPre=/usr/bin/vncserver -kill %i (code=exited, status=2)
Mar 07 16:54:45 localhost vncserver[1553]: vncserver: The HOME environment variable is not set.
Mar 07 16:54:45 localhost vncserver[1555]: vncserver: The HOME environment variable is not set.
Mar 07 16:54:45 localhost systemd[1]: tigervnc.service: control process exited, code=exited status=2
Mar 07 16:54:45 localhost systemd[1]: Failed to start Remote desktop service (VNC).
Mar 07 16:54:45 localhost systemd[1]: Unit tigervnc.service entered failed state.
I enabled the service using:
#systemctl enable tigervnc.service
here's the result
ln -s '/etc/systemd/system/tigervnc.service' '/etc/systemd/system/multi-user.target.wants/tigervnc.service'
thanks |
|
Back to top |
|
|
Adel Ahmed Veteran
Joined: 21 Sep 2012 Posts: 1523
|
Posted: Fri Mar 07, 2014 2:10 pm Post subject: |
|
|
If I try running vncserver here's what I get when I connect to the server:
http://postimg.org/image/lzblox3hl/
If I run using the root account, I can connect to an xfce session(the screen is not shared though)
If that problem can be fixed, I suppose I can use the bashrc file to start the vnc service |
|
Back to top |
|
|
Adel Ahmed Veteran
Joined: 21 Sep 2012 Posts: 1523
|
Posted: Fri Mar 07, 2014 2:19 pm Post subject: |
|
|
I've copied over the xstartup file from the root account to the user account and Now I can start an xfce session when I connect to the server
the screen is not shared though, and I'm still having problems with the startup script |
|
Back to top |
|
|
SirRobin2318 Apprentice
Joined: 24 Apr 2004 Posts: 241 Location: Strasbourg, france.
|
Posted: Fri Mar 07, 2014 2:26 pm Post subject: |
|
|
You have to set the User= line in the service file.
Then disable the service, and enable in with the display you want to use:
systemctl enable tigervnc@:1.sevice |
|
Back to top |
|
|
Adel Ahmed Veteran
Joined: 21 Sep 2012 Posts: 1523
|
Posted: Fri Mar 07, 2014 2:36 pm Post subject: |
|
|
is there a specific place where I should use the 'User' variable?
or should I place it at the beginning of the file? |
|
Back to top |
|
|
SirRobin2318 Apprentice
Joined: 24 Apr 2004 Posts: 241 Location: Strasbourg, france.
|
Posted: Fri Mar 07, 2014 2:41 pm Post subject: |
|
|
You said you were using this service file:
Code: | [Unit]
Description=Remote desktop service (VNC)
After=network.target
[Service]
Type=forking
User=
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=-/usr/bin/vncserver -kill %i
ExecStart=/usr/bin/vncserver %i
ExecStop=/usr/bin/vncserver -kill %i
[Install]
WantedBy=multi-user.target |
Edit that file, on the 7th line add your user. |
|
Back to top |
|
|
Adel Ahmed Veteran
Joined: 21 Sep 2012 Posts: 1523
|
Posted: Fri Mar 07, 2014 2:51 pm Post subject: |
|
|
Oh sorry didn't notice that
localhost system # systemctl enable tigervnc@:1.service
Failed to issue method call: No such file or directory
when I start the regular tigervnc.service I get the following:
systemctl status tigervnc.service
tigervnc.service - Remote desktop service (VNC)
Loaded: loaded (/etc/systemd/system/tigervnc.service; enabled)
Active: failed (Result: exit-code) since (null); 4s ago
Process: 1536 ExecStart=/usr/bin/vncserver %i (code=exited, status=2)
Process: 1518 ExecStartPre=/usr/bin/vncserver -kill %i (code=exited, status=0/SUCCESS)
Mar 07 17:50:14 localhost vncserver[1518]: New 'localhost:3 (adel)' desktop is localhost:3
Mar 07 17:50:14 localhost vncserver[1518]: Starting applications specified in /home/adel/.vnc/xstartup
Mar 07 17:50:14 localhost vncserver[1518]: Log file is /home/adel/.vnc/localhost:3.log
Mar 07 17:50:14 localhost vncserver[1536]: usage: vncserver [:<number>] [-name <desktop-name>] [-depth <depth>]
Mar 07 17:50:14 localhost vncserver[1536]: [-geometry <width>x<height>]
Mar 07 17:50:14 localhost vncserver[1536]: [-pixelformat rgbNNN|bgrNNN]
Mar 07 17:50:14 localhost vncserver[1536]: [-fp <font-path>]
Mar 07 17:50:14 localhost systemd[1]: tigervnc.service: control process exited, code=exited status=2
Mar 07 17:50:14 localhost systemd[1]: Failed to start Remote desktop service (VNC).
Mar 07 17:50:14 localhost systemd[1]: Unit tigervnc.service entered failed state. |
|
Back to top |
|
|
SirRobin2318 Apprentice
Joined: 24 Apr 2004 Posts: 241 Location: Strasbourg, france.
|
Posted: Fri Mar 07, 2014 3:10 pm Post subject: |
|
|
Try enabling it this way then:
ln -s '/etc/systemd/system/tigervnc.service' '/etc/systemd/system/multi-user.target.wants/tigervnc@:1.service' |
|
Back to top |
|
|
Adel Ahmed Veteran
Joined: 21 Sep 2012 Posts: 1523
|
Posted: Fri Mar 07, 2014 4:34 pm Post subject: |
|
|
nope nothing, I'm giving up the whole screen sharing idea, I'll just be trying to get the vnc server to start automatically, so if all else fails we can use bashrc
thanks for your help so far |
|
Back to top |
|
|
SirRobin2318 Apprentice
Joined: 24 Apr 2004 Posts: 241 Location: Strasbourg, france.
|
Posted: Fri Mar 07, 2014 4:49 pm Post subject: |
|
|
Oh we can make this work. I'm guessing something is missing in tigervnc's config. I just wanted to do things one step at a time and first validate that the systemd side was correct (service file, how it's enabled, etc).
If you change your mind and want to continue, try the following:
remove the link we added:
rm '/etc/systemd/system/multi-user.target.wants/tigervnc@:1.service'
mv /etc/systemd/system/tigervnc.service /etc/systemd/system/tigervnc@.service
sytsemctl enable tigervnc@:1.service
does that work better?
if it does:
sytsemctl start tigervnc@:1.service
and then give me:
journalctl -u tigervnc |
|
Back to top |
|
|
Adel Ahmed Veteran
Joined: 21 Sep 2012 Posts: 1523
|
Posted: Fri Mar 07, 2014 7:35 pm Post subject: |
|
|
well, the vnc server starts but when I connect all I get is a black screen.
here's my journalctl since the last reboot:
Mar 07 20:11:28 localhost systemd[1]: Starting Remote desktop service (VNC)...
Mar 07 20:11:32 localhost vncserver[1283]: New 'localhost:1 (adel)' desktop is localhost:1
Mar 07 20:11:32 localhost vncserver[1283]: Starting applications specified in /home/adel/.vnc/xstartup
Mar 07 20:11:32 localhost vncserver[1283]: Log file is /home/adel/.vnc/localhost:1.log
Mar 07 20:11:32 localhost vncserver[1413]: usage: vncserver [:<number>] [-name <desktop-name>] [-depth <depth>]
Mar 07 20:11:32 localhost vncserver[1413]: [-geometry <width>x<height>]
Mar 07 20:11:32 localhost vncserver[1413]: [-pixelformat rgbNNN|bgrNNN]
Mar 07 20:11:32 localhost vncserver[1413]: [-fp <font-path>]
Mar 07 20:11:32 localhost vncserver[1413]: [-cc <visual>]
Mar 07 20:11:32 localhost vncserver[1413]: [-fg]
Mar 07 20:11:32 localhost vncserver[1413]: [-autokill]
Mar 07 20:11:32 localhost vncserver[1413]: <Xvnc-options>...
Mar 07 20:11:32 localhost vncserver[1413]: vncserver -kill <X-display>
Mar 07 20:11:32 localhost vncserver[1413]: vncserver -list
Mar 07 20:11:32 localhost systemd[1]: tigervnc.service: control process exited, code=exited status=2
Mar 07 20:11:32 localhost systemd[1]: Failed to start Remote desktop service (VNC).
Mar 07 20:11:32 localhost systemd[1]: Unit tigervnc.service entered failed state.
thanks |
|
Back to top |
|
|
Adel Ahmed Veteran
Joined: 21 Sep 2012 Posts: 1523
|
Posted: Sat Mar 08, 2014 5:42 am Post subject: |
|
|
I've used the xfce autostart to run a script that checks for running vnc servers and runs if no servers are started
I suppose I found what I was looking for. thanks alot for your help SirRobin |
|
Back to top |
|
|
SirRobin2318 Apprentice
Joined: 24 Apr 2004 Posts: 241 Location: Strasbourg, france.
|
Posted: Sat Mar 08, 2014 11:00 am Post subject: |
|
|
So everything is working now? Good |
|
Back to top |
|
|
|