Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 11-03-2009, 11:26 AM   #1
Registered: Jun 2009
Posts: 56

Rep: Reputation: 15
trouble trying to use xserver before gnome login

I have an application which must run at startup, without a user logging in, to manage this I have a user with limited permissions automatically logged on to tty7 and use sudo to run the application. I had this successfully configured once, but when trying to repeat the steps 'exactly' as before I'm running into trouble with the Xserver.

When I try running the application I get the message GTK-WARNING cannot open display. When I switch over to tty7 I see that neither DISPLAY nor Xauthority environmental variables are set.

I originally assumed this was due to not having authority to access the server. I don't know much about X server, but I have googled this and tried all the common suggestions. I've su to root and still can't access the program so the issue isn't with sudo, and I have tried creating an Xauthority file, setting Xauthority to look at root's xauth file, and changing the xhost settings. if I try running either the xhost + or xhost list commands I get errors that say unable to access display "" or display "0.0" (depending on if I try setting DISPLAY first).

I then tried hitting crtl alt f8 to switch back to the original login screen that came up when I booted up and logged in. When I switch to tty7 and run my app with sudo it works fine. So basically everything works so long as a user logs in to gnome, but if gnome isn't logged in I can't access the X server at all. I'm lead to assume that gnome starts something when it boots up that my application is using, or has the Xserver locked until it boots up? I'm suspecting that I'm doing something blatantly stupid here but I can't figure it out, and when I google I just find dozens of responses talking about setting Xhost permissions which I don't think is the problem...

so can someone either tell me what I'm missing or at least give me an idea where on what I should be googling to find the answers.
Old 11-03-2009, 02:26 PM   #2
Registered: Jun 2009
Posts: 56

Original Poster
Rep: Reputation: 15
just updating. it turns out it is an authority issue. I had been trying to copy the /root/.Xauthority file, instead the authority file with the magic number i needed was located in /var/gdm:0.Xauth. so I know that if I set XAUTHORITY=/var/gdm:0.Xauth and DISPLAY=:0.0 I can run my program without logging in.

The problem is I need generic installation instructions. I can't include a script that croppies /var/gdm/:0.Xauth because I don't know that file will exist on every computer. Is there another way to get the correct XAuthority file without hard coding that location?

I have considered trying to add xhost + into the boot up scripts to remove the problem. Unfortunately I don't know what point in the boot up process I would need to place the command, assuming it was possible at all. How horrible would the xhost + command run at boot up ruin a computers security?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
xserver connection trouble sofasurfer Debian 2 01-06-2008 05:55 PM
Trouble with GNOME login on Ubuntu 6.06 RavenOfOdin Linux - Software 1 06-04-2006 10:33 AM
Gnome login trouble! sfaae Linux - Newbie 1 01-26-2005 08:09 AM
Trouble installing xserver-xfree86 for Debian 3.0 newlinuxinmass Linux - Hardware 2 04-17-2004 11:08 AM
trouble installing xserver lrac Linux - Laptop and Netbook 1 09-05-2003 03:56 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:46 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration