Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to get VNC Server to start when Gentoo starts?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
raid517
l33t
l33t


Joined: 06 Mar 2003
Posts: 946

PostPosted: Fri May 19, 2006 11:16 am    Post subject: How to get VNC Server to start when Gentoo starts? Reply with quote

Hi I have two VNC packages installaed net-isc/xf4vnc net-misc/vnc (which I think is a variant of realvnc).

The question I have is I hope simple.

How do I get my vnc server to start when Gentoo starts?

I thought the obvious thing to do would of course be:

Code:
 rc-update add vnc default


But that didn't work - as it fails with the error:

Code:
/sbin/rc-update: /etc/init.d/vnc not found; aborting


I tried with various variations of this, using the term vncserver, tightvnc etc - but the bottom line is that I don't have anything at all in /etc/init.d called 'vnc' even anything similar to it.

I'm guessing therefore that I need some kind of script in there to start my vncserver. the question is, what is this script and where can I get it?

GJ
Back to top
View user's profile Send private message
lesourbe
l33t
l33t


Joined: 24 Nov 2005
Posts: 710
Location: Champagne !

PostPosted: Fri May 19, 2006 12:29 pm    Post subject: Reply with quote

take a look at that
_________________
Is that a banhammer ?
LeSourbe, Member of EPowerforce.
Back to top
View user's profile Send private message
raid517
l33t
l33t


Joined: 06 Mar 2003
Posts: 946

PostPosted: Fri May 19, 2006 12:53 pm    Post subject: Reply with quote

Thanks... But I don't think that's quite what I'm after. I am not asking how to get VNC server to work - it already works very well - all I am asking is how to get it to start when Gentoo starts. That's all. nothing more.

GJ
Back to top
View user's profile Send private message
lesourbe
l33t
l33t


Joined: 24 Nov 2005
Posts: 710
Location: Champagne !

PostPosted: Fri May 19, 2006 1:12 pm    Post subject: Reply with quote

I think the name of the init script is vncserver and not vnc (I am not on a gentoo box right now).

If that's so, it would be
Code:
rc-update add vncserver default


If not, you could check in /etc/init.d/ to find the init script corresponding to vnc server
_________________
Is that a banhammer ?
LeSourbe, Member of EPowerforce.
Back to top
View user's profile Send private message
raid517
l33t
l33t


Joined: 06 Mar 2003
Posts: 946

PostPosted: Fri May 19, 2006 1:17 pm    Post subject: Reply with quote

Well yes, that would be the obvious thing to do as i said. However as I also pointed out, I don't have anything in init.d that relates to vnc, be that vnc. vnc server, tightvnc, or whatever. There is no reference to vnc in init.d at all.

GJ
Back to top
View user's profile Send private message
lesourbe
l33t
l33t


Joined: 24 Nov 2005
Posts: 710
Location: Champagne !

PostPosted: Fri May 19, 2006 1:24 pm    Post subject: Re: How to get VNC Server to start when Gentoo starts? Reply with quote

raid517 wrote:
Hi I have two VNC packages installaed net-isc/xf4vnc net-misc/vnc (which I think is a variant of realvnc).


sorry I did not read carrefully enough your post

net-isc/xf4vnc : Description: VNC (remote desktop viewer) derived from tightvnc but cooler :-)
net-misc/vnc : Description: Remote desktop viewer display system

2 viewers but no server here.
_________________
Is that a banhammer ?
LeSourbe, Member of EPowerforce.
Back to top
View user's profile Send private message
raid517
l33t
l33t


Joined: 06 Mar 2003
Posts: 946

PostPosted: Fri May 19, 2006 1:43 pm    Post subject: Reply with quote

Well i must have some kind of VNC server installed. Sorry I'm running from one of those (now increasingly avaiable) prebuilt Gentoo distros - so (after reading the docs) I am not exactly clear what it came with. All I do know is if I type vncserver at the command line, it gives me a default vnc name/address - and I can connect to it without difficulty. So the server part is there.

However as I said, you would expect that if it could be autostated normally, that there would be a reference to it in /etc/init.d - but as far as i can see, there is currently no reference to anything to do with vnc in init.d at all.

GJ
Back to top
View user's profile Send private message
overkll
Veteran
Veteran


Joined: 21 Sep 2004
Posts: 1249
Location: Austin, Texas

PostPosted: Fri May 19, 2006 2:34 pm    Post subject: Reply with quote

Try
Code:
emerge -s vnc

to determine which vnc package(s) you have installed.

lesourbe wrote:
take a look at that

You may want to check out the xinetd section. Some services DON'T use an init script. Instead they use the xinetd superdaemon to start services. You may want to check your /etc/xinet.d/ directory for some sort of existing vnc/xinetd config file. Make sure that "disabled = no" to ensure it starts then issue /etc/init.d/xinetd start to start it.
Back to top
View user's profile Send private message
raid517
l33t
l33t


Joined: 06 Mar 2003
Posts: 946

PostPosted: Fri May 19, 2006 3:06 pm    Post subject: Reply with quote

No, sadly, again, there is nothing there.

Code:
# ls /etc/xinetd.d

cups-lpd cvsperver proftpd swat telenettd


Couldn't I just add a small script to my startup srcipts in /etc/init.d that would start it at boot?

If so, what would such a script look like?

GJ
Back to top
View user's profile Send private message
Jfr0
n00b
n00b


Joined: 19 Dec 2005
Posts: 72

PostPosted: Fri May 19, 2006 3:14 pm    Post subject: Reply with quote

equery list vnc
will tell you what vnc you have installed. I am guessing realvnc.
If you dont want to make an init script then you could just try /etc/conf.d/local.start
Back to top
View user's profile Send private message
raid517
l33t
l33t


Joined: 06 Mar 2003
Posts: 946

PostPosted: Fri May 19, 2006 3:29 pm    Post subject: Reply with quote

Thanks - that looks like a possible candiadate. unfortunately the syntax to enter in this script to start the vnc server is still confusing me slightly. (I do appologise I am in no way a programmer - and in reality I only have about one or two hours that I can set aside for learning linux each week).

At the moment all I do know is that the command to start the vnc server is simple enough, as it is just 'vncserver'. How would I add this to this script to ensure that the VNC server started automatically at each boot?

GJ
Back to top
View user's profile Send private message
raid517
l33t
l33t


Joined: 06 Mar 2003
Posts: 946

PostPosted: Fri May 19, 2006 6:53 pm    Post subject: Reply with quote

No takers? :(

GJ
Back to top
View user's profile Send private message
overkll
Veteran
Veteran


Joined: 21 Sep 2004
Posts: 1249
Location: Austin, Texas

PostPosted: Fri May 19, 2006 10:45 pm    Post subject: Reply with quote

lesourbe posted a link to a nice gentoo specific howto - http://gentoo-wiki.com/HOWTO_Xvnc_terminal_server
Did you try that?

I don't use vnc. I was only pointing out the xinetd issue. You may need to create your own /etc/xinetd.d/vncserver file as suggested in the howto OR just put "vncserver" in your /etc/conf.d/local.start file...

Code:
# /etc/conf.d/local.start

# This is a good place to load any misc programs
# on startup ( use 1>&2 to hide output)
/usr/bin/vncserver

Make sure that /etc/init.d/local is set to startup at boot.

To restart the local service, just issue "/etc/init.d/local restart"
Back to top
View user's profile Send private message
raid517
l33t
l33t


Joined: 06 Mar 2003
Posts: 946

PostPosted: Fri May 19, 2006 10:58 pm    Post subject: Reply with quote

Cool, that's exactly what I have done! The thing that was confusing me is that there are quite a few other things put in there by the developer - and to the untrained eye such as mine, it didn't make much sense. But now hopefully, I have it figured out. Thanks!

GJ
Back to top
View user's profile Send private message
raid517
l33t
l33t


Joined: 06 Mar 2003
Posts: 946

PostPosted: Sat May 20, 2006 10:30 pm    Post subject: Reply with quote

Actually that didn't work. The system now just demands that I type a password before agreeing to startX - and I still have to type 'vncserver' at the rootprompt if I want my vncserver to start when my computer starts.

GJ
Back to top
View user's profile Send private message
thedangerouscrew
Tux's lil' helper
Tux's lil' helper


Joined: 03 Nov 2004
Posts: 110

PostPosted: Mon May 22, 2006 1:59 am    Post subject: Reply with quote

How do you startx?
do you type 'startx' it in the prompt?

if so you need to add it to your .xinitrc file

example:

vncserver &
path to window manager

if you use kde just add it to your autostart dir

I hope this helps you.

edit: If you want to start Xvnc without starting a real Xsesion than let me know
this is how I have mine

check this link out http://linuxgazette.net/issue72/chung.html
replace startx with vncviewer in the .bash_profile section
Back to top
View user's profile Send private message
armin76
Retired Dev
Retired Dev


Joined: 24 Apr 2006
Posts: 174

PostPosted: Mon May 29, 2006 11:40 am    Post subject: Reply with quote

I use this script:
Code:
#!/sbin/runscript
# Copyright 2003-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License, v2
# $Header: /var/cvsroot/gentoo-x86/net-ftp/vsftpd/files/vsftpd.init.d,v 1.6 200$

start() {
        ebegin "Starting vnc"
        su - armin -c "vncserver :1"
        eend $?
}

stop() {
        ebegin "Stopping vnc"
        su - armin -c "vncserver -clean -kill :1"
        eend $?
}


The vncserver is started as username 'armin'. Stolen from the vsftpd script, of course :)
Back to top
View user's profile Send private message
raid517
l33t
l33t


Joined: 06 Mar 2003
Posts: 946

PostPosted: Mon May 29, 2006 11:47 am    Post subject: Reply with quote

Thanks
Back to top
View user's profile Send private message
raid517
l33t
l33t


Joined: 06 Mar 2003
Posts: 946

PostPosted: Mon May 29, 2006 1:03 pm    Post subject: Reply with quote

Code:
 #!/sbin/runscript
 # Copyright 2003-2004 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License, v2
 # $Header: /var/cvsroot/gentoo-x86/net-ftp/vsftpd/files/vsftpd.init.d,v 1.6 200$
 
 start() {
         ebegin "Starting vnc"
         su - raid517 -c "vncserver :1"
         eend $?
 }
 
 stop() {
         ebegin "Stopping vnc"
         su - raid517 -c "vncserver -clean -kill :1"
         eend $?
 }


Hi as I said thanks. That would have been nice, if it had worked - unfortunately it didn't.

I can't add 'vncserver' to my xsession or x startup or xinitrc as if I do so this seems to cause some kind of infinite loop, where x never really fully starts up and my disk just goes crazy with the system swapping endlessly - so I think what I need really is some kind of start up script.

I have no idea why the above script didn't work.

Possibly I got the method for adding it wrong?

I moved it to my /etc/init.d and made it executable. I then opened a console and typed (as root):

Code:
rc-update add vnc default


The system gave me a claen message about adding the script to the default run level. (as you can see I called the script vnc).
[/i]
As for what I wish to achieve, I simply wish to maintain the status quo. I am happy with whatever version of 'vncserver' I have installed and I don't really wnat to change it. [i] don't want vncserver to start in place of x, or to use a vncserver that allows me to share a desktop session.

All I really want is for it to start up when Gentoo starts, without my needing to always manually start it by typing 'vncserver' at a command line.

If anyone can help me achieve this, I would be extremely grateful.

GJ
Back to top
View user's profile Send private message
thedangerouscrew
Tux's lil' helper
Tux's lil' helper


Joined: 03 Nov 2004
Posts: 110

PostPosted: Mon May 29, 2006 6:45 pm    Post subject: Reply with quote

xdm, gdm, kdm

all of these graphical logins can listen for a vnc request

could be another alternative for you.



it sounds like the nusts and bolts method in this article is what you want

http://linuxgazette.net/issue72/chung.html

it lets you autologin your user and autostart X when logged in
this is how i tweaked it to my needs

I replaced: if [ -z "$DISPLAY" ] && [ $(tty) == /dev/tty1 ]; then
startx
fi

With: if [ -z "$DISPLAY" ] && [ $(tty) == /dev/tty1 ]; then
vncserver
fi

in the .bash_profile part of the howto

I hope this helps
Back to top
View user's profile Send private message
raid517
l33t
l33t


Joined: 06 Mar 2003
Posts: 946

PostPosted: Wed May 31, 2006 11:33 am    Post subject: Reply with quote

Actually I retract that. The above script works great. There was an extra gap introduced by the straight copy and pasting I did into the bash script that I made and as soon as I eliminted this things worked as expected.

Thanks guys!

GJ
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum