LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Start up Gnome Desktop from Remote Terminal? (https://www.linuxquestions.org/questions/linux-newbie-8/start-up-gnome-desktop-from-remote-terminal-743184/)

fish_hawk 07-27-2009 02:27 PM

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,

neonsignal 07-27-2009 08:09 PM

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.

fish_hawk 07-28-2009 08:28 AM

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!!

fish_hawk 07-28-2009 02:00 PM

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!

jefro 07-28-2009 05:14 PM

I have a dumb question, would telinit command work?

neonsignal 07-28-2009 06:35 PM

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
You could try splitting up the process to try to figure out where this is failing:
Code:

sudo /etc/init.d/gdm stop
sudo /etc/init.d/gdm start

The message that followed is simply telling you that you were starting gdm/X a second time (because of the restart failure), so the second X could not grab the display:
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
sudo rm /tmp/.X0-lock

just to make sure everything is back to where you started, and then attempt to start again (using gdm or startx).

neonsignal 07-28-2009 06:40 PM

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.

fish_hawk 09-16-2009 07:47 AM

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!

prasanta 09-16-2009 08:48 AM

@ 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.