::can’t start X

23 08 2006

There’s a problem I see posted to the Ubuntu forums on a fairly regular basis that has to do with not being able to start an X session.  A user will report an error message that reads something like “no write access to /home/user/.ICEauthority…”

How does this happen?

You’ll get this error when you improperly run some graphical applications as Root.  Say you want to move some files to or from a directory in which you don’t have write access.  You fire up for favorite file manager as Root, do your stuff, and all is right with the world. 

If you’re like a lot of users, it might be days or weeks before you log out of your current X session, in which case you don’t remember performing the unhappy action above. The issue could be lurking for quite a long time, waiting for the next time you log in.

Well fear not, we can fix this in a jiffy.

From your login screen, either drop to a console session or log into failsafe.  You’ll be able to login here, but all you’ll have is a command prompt. From here, you’ll want to check the ownership of your files and try to see what Root has gone and taken ownership of.

$ ls -al |less

ls will list the contents of your directory (home, in this case), with two switches thrown in for flavor.  -a lists all files, and l (or -l if you want to do it all by itself) will give you the ownership and permissions.  Piping the command through less will pause the output a screen at time so you can actually see what you’re looking at. 

Depending on the application you ran as Root, there may be one or more files that is now owned by root.  You can take ownership of them individually, or you can reclaim ownership of all files in the directory at once.  Kind of like a dog pissing on his favorite tree.  Either way, the command is almost the same.

To reclaim ownership of an individual file:

sudo chown yourusername:yourusername filename (or in my case, something like sudo chown jim:jim .ICEauthority)

chown allows you change ownership of a file, with the first yourusername setting the user and the second yourusername setting the group. 

If you want to piss on the tree and make sure everyone knows that the whole yard is yours, simply modify the command like this:

sudo chown yourusername:yourusername *.*

Either entry will prompt you for your password–and remember–Ubuntu doesn’t enable the Root account by default, so you enter your username.

You should return to your command prompt without error.  Now you should be able to log out and log back in to your favorite X session.

And all is right with the world.

or something.

But sometimes I really want to run a graphical app as Root, what do I do?

You don’t have to fix files every time you want or need to run a graphical app as root.  If you’re using KDE, you will replace use of sudo with kdesu.  If you’re running Gnome, you’ll use gksudo instead of sudo.

so there it is…my first technical post.  Couple questions for those of you unlucky enough to come across my blog and bored enough to have read all the way down to this point:

1) Was it helpful?  If you came across this entry because you’re actually having this error, did it help you fix the problem?  Do you think it might help you in the future?

2) Was it easy to understand?

3) Was it easy to tell what was a command and what wasn’t?  Did you know what you had to enter at the command line, or did you have to muddle through the bold, italics, and bold italics until you figured out what was what?

4) What’s your favorite color?

Sometime in the next few days I’ll update the blog with some helpful links and resources I’ve found.  I know you’re giddy with anticipation now. 

kisses,

jimbo

Advertisements

Actions

Information

11 responses

24 08 2006
jimbo

I’d really like to hear from folks on the format of this entry, and how it worked for you. Please let me know, even if you didn’t have to use it, if it was easy to understand.

kisses,

jimbo

6 09 2006
daniel

Hi

I have this problem, and found your page through google. I’m gonna try to solve the problem following your directions as soon as I get home. As far as the format of the entry, I found it really easy to understand, thanks for your help.

I’ll let you know how it went.

Thanks again

14 11 2006
::got root? « ::another Ubuntu blog

[…] I’ve mentioned it before, but it’s worth mentioining again.  If you need to run a graphical application as root to, for example, update a configuration file or something, you don’t want to use sudo, as this will cause permissions problems later on that will prevent you from logging into your X session.  […]

5 01 2007
Ashish

Hi,
I read your post. I have a similar issue but on Suse Ent server 10.0. I’ll try it out to see if it fixes it on my setup. Thanks. Instructions are clear.

27 01 2007
pantor

Help

Tryed the ls -al |less
and preformed the chown
still when i start kde it stops to ask my login on a black screen
when i start to put my login name and password it starts to get brighter
after i put my password the screen lights bright
it then brings me to pantor@pantor-desktop:~ I type startx
the screen says remove tmp XO-lock
I run sudo dpkg-reconfigure xserver-xorg
and after startx and the kde works again
I am using 6.10
Any sugggestions

18 03 2007
choco

Thank you!

I have a workstation at my house with Ubuntu. Since I am the only user (with my father occassionally playing a few games or going online), I use su quite often — security isn’t a huge issue to me.

Today I was attempting to install an Eclipse plug-in and during the installation it asked for me to give it the Eclipse installation directory. When I did that it errored saying it didn’t have permission to access the directory.

I tried su, but that whined because the installer is graphical.

I didn’t know about kdesu, and every now and then I’d get the error:
Xlib: connection to “:0.0” refused by server
Xlib: Invalid MIT-MAGIC-COOKIE-1 key

Now I finally know how to fix it! 🙂

20 12 2007
Jason

my error message when at startx is X is missing form /etc/X11
the X file is missing.. i did a sudo apt-get install initx
what did i missed out??

8 01 2008
Raymond B.

Hello,

To answer your questions:

Was it helpful? Yes, thanks to your instructions KDE works again for my user.

Was it easy to understand? Absolutely. I appreciated your giving additional hints about the probable source of the problem (right on the spot in my case) and sustainable workarounds, rather than just throwing a few shell commands at the reader.

Was it easy to tell what was a command and what wasn’t? Yes, no problem here.

4) What’s your favorite color? Red 😉

Thanks for sharing this and greetings from Switzerland,
Raymond

3 08 2009
Animadoras Sexo

ehh. strange 🙂

2 05 2011
Zero

You’re an idiot for implying that this is the only possible reason for X to malfunction. I’m typing this in Lynx because X crashed and refuses to restart but this post has nothing to do with my issues.

2 05 2011
jimbo

And you’re an idiot for relying on a post that’s more than two years old for technical support. Do the Linux community a favor and go back to windows, douche bag.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: