Start up Gnome Desktop from Remote Terminal?
I looked around for threads addressing this issue and some have come close to answering it, but I have yet to see a definitive yes or no. Anyway - Here's my issue:
Background: I can SSH into my home computer (Ubuntu 9.04 running Gnome) from work (Win XP Pro) using RealVNC via Putty tunnels. This has been working flawlessly for me for awhile now. I was messing around in the terminal window and accidentally rebooted the linux box (home computer) while I was at work. No big deal I thought. So I re-start the Putty connection, and it is back up in no time. Then I try to start the VNC connection, and no go, connection refused. I remember seeing that in order for the VNC connection to work, I had to be logged into the Gnome desktop already on the Ubuntu box. Question: Is it possible to log in and start up a Gnome desktop session from the terminal command line in Putty so I can get the VNC connection back? Your help is much appreciated! Thanks, |
This can be done. I don't have an Ubuntu system here to fully test these, but here are some ideas (and there will be other ways to skin the cat too).
(1) You can set up gdm to autologin a particular user; this goes in /etc/X11/custom.conf: [daemon] TimedLoginEnable=true TimedLogin=your_username TimedLoginDelay=0 And then you can restart gdm: sudo /etc/init.d/gdm restart You might want to remove the autologin when you have finished so it doesn't happen every time you boot the machine. (2) You can bypass the display manager altogether, and just run 'startx' or 'xinit' directly. To do this, you will have to allow non-console (ie remote) users to start X, in /etc/X11/Xwrapper.config: allowed_users = anybody Kill the display manager: sudo killall gdm And restart X (do not sudo): startx There are security implications with allowing remote terminals to start X, so again, you can revert the Xwrapper.config when you have finished. |
Thank you!!
Thank you so much for the response neonsignal! I'm going to give this a try today to see if it works.
I forgot to mention that I'm out of town for a week, so this will be a lifesaver if I can get it to work. Thanks again for the help!! |
Results
Here's the results I got from Option #1:
X: warning; process set to priority -1 instead of requested priority 0 Fatal server error: Server is already active for display 0 If this server is no longer running, remove /tmp/.X0-lock and start again. Please consult the The X.Org Foundation support at http://wiki.x.org for help. ddxSigGiveUp: Closing log Invalid MIT-MAGIC-COOKIE-1 keygiving up. xinit: Resource temporarily unavailable (errno 11): unable to connect to X ser ver xinit: No such process (errno 3): Server error. And results for Option #2: xauth: /home/matt/.Xauthority not writable, changes will be ignored xauth: error in locking authority file /home/matt/.Xauthority xauth: error in locking authority file /home/matt/.Xauthority xauth: error in locking authority file /home/matt/.Xauthority X.Org X Server 1.6.0 Release Date: 2009-2-25 X Protocol Version 11, Revision 0 Build Operating System: Linux 2.6.24-23-server i686 Ubuntu Current Operating System: Linux HH1 2.6.28-13-generic #45-Ubuntu SMP Tue Jun 30 19:49:51 UTC 2 009 i686 Build Date: 09 April 2009 02:10:02AM xorg-server 2:1.6.0-0ubuntu14 (buildd@rothera.buildd) Before reporting problems, check http://wiki.x.org to make sure that you have the latest version. Markers: (--) probed, (**) from config file, (==) default setting, (++) from command line, (!!) notice, (II) informational, (WW) warning, (EE) error, (NI) not implemented, (??) unknown. (==) Log file: "/var/log/Xorg.0.log", Time: Tue Jul 28 14:54:00 2009 (==) Using config file: "/etc/X11/xorg.conf" (WW) SIS: No matching Device section for instance (BusID PCI:0@0:0:0) found Do you know what I'm doing wrong here? I tried to VNC into the machine after each of these options, and both resulted in "Connection Refused" errors in the VNC viewer. Thanks! |
I have a dumb question, would telinit command work?
|
Sorry, it is hard for me to test specifically for Ubuntu. I'm trying it out on a Debian system running Gnome, which is a slightly different setup.
The first warning indicates some issue with being restarted from the wrong user: Code:
X: warning; process set to priority -1 instead of requested priority 0 Code:
sudo /etc/init.d/gdm stop Code:
Server is already active for display 0 As to the second option, the fact that .Xauthority is not writable again says that ownership of the X does not work on Ubuntu quite as I expected. You can do 'ls -l .Xauthority' to see whether you own it. However, it looks like X actually did start. I am not sure why the SIS driver gave the error "No matching Device section", which seems to indicate that again, the driver couldn't grab the display (perhaps because X was already running, and it didn't get killed earlier). But perhaps this relates to the authority file issue. Incidentally, do you have the vncserver setup to run automatically on your home machine? If not, you will also need to start it after X is going, I believe something like 'vncserver :1'? I also should have said to use an '&' on startx, so that you could keep using the terminal while X was running ('startx &'), but that is no big deal. --- I'm not sure how much this is helping you. If you get stuck, you can forcefully kill all the X related processes: Code:
sudo killall gdm startx xinit |
Oh, and regarding the 'telinit' comment from jefro - I would steer clear of this, because at best you will reset the machine, and at worst you will end up without sshd running or accessible and will not be able to remotely access the machine at all.
|
Just an update on this - I never did get the desktop to start up remotely. I always need to make sure I log in to the machine before leaving for work to make sure I can get the desktop to come up remotely. Luckily I can always get to the terminal via putty. Good thing I don't have to restart this thing ALL the time like a windows box!!
Thanks again for the help neosignal - much appreciated! |
@ fish_hawk
I have used VNC all the time for this, as you have done. The problem looks interesting and I did a bit of Google search and got this link, http://www.linux-tip.net/cms/content/view/302/26/ Have not tested it out myself. Regards, -- Prasanta |
All times are GMT -5. The time now is 01:08 AM. |