oio11: (Default)
[personal profile] oio11

Invalid MIT-MAGIC-COOKIE-1 key and cannot open display: :0.0

If you arelogged in as a normal user and are attempting to launch any application that requires root permission and the application does not show up after you give permission. The issue you may be experiencing maybe related with xauth/xhost. The xhost program is used to authorize remote hosts and user names that can make connections to your X server. The xauth program is used to display and edit authorizations that you have that is used to connect to your X server.
An example of error that may be shown to you if you run an application that requires root permission and after you enter your password it may simply disappear:

Invalid MIT-MAGIC-COOKIE-1 key
(synaptic:3245): Gtk-WARNING **: cannot open display: :0.0

This error usually resolves itself. You can continue to use your computer system and try back in a few minutes to see if it is no longer a problem. If after a few minutes the error is still there. You can try to restart your computer system. If after restarting your computer system the error is still occurring you try the following solution.
A possible solution to the above problem is to enter the following command as a normal user:
xhost local:root
After you enter the above command you can go ahead and launch whatever application you were attempting to launch. Once the prompt for root permission is needed you can enter your root password. After you hit enter the application should appear.
http://easytofu.com/05062011150909-mit-magic-cookie-cannot-open-display-error

You can also add it to .bashrc to get executed after login.
Code:

echo "xhost local:root > /dev/null" >> ~/.bashrc


http://ubuntuforums.org/showthread.php?t=1014700&page=2

http://www.mepis.org/docs/en/index.php?title=XHost_errors_when_trying_to_run_programs_as_root

http://www.leidinger.net/X/xhost.html

...
Quote:
Originally Posted by jcconegundes View Post
I don't have /root/.bashrc (nor /home/root/.bashrc). I'm using Debian etch. What could I do?
in case you return to read this and are not yet clear: just add /root/.bashrc
You can create it with just that one line that was suggested for this problem:
Code:
export XAUTHORITY=/home/name/.Xauthority
or you can add other commands, aliases etc. that you might want to have as well. Check out http://www.faqs.org/docs/abs/HTML/files.html for information on what this and the related files do. Basically they are where you configure systemwide [/etc/.bashrc and /etc/.profile] and user-specific [$HOME/.bashrc and $HOME/.bash_profile] functions and aliases (for bash shell only).

This means you, as the administrator of your computer, get to decide what all goes in them. Typically, users would decide what goes in their own $HOME/.bashrc and $HOME/.bash_profile - most likely that is also you. My main point is that they are there for your convenience, rather than being some untouchable and necessarily mysterious file of the "us mortals shall not touch" category.

This link explains more clearly the difference between these different files: http://www.linuxquestions.org/questi...bashrc-273992/

Note: $HOME refers to your home directory, for example it might be /home/kiel2155/.bashrc

http://www.linuxquestions.org/questions/linux-software-2/xlib-connection-to-0-0-refused-by-server-331779/

October 2025

S M T W T F S
   1234
567891011
12131415161718
19202122 232425
262728293031 

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Feb. 3rd, 2026 06:41 am
Powered by Dreamwidth Studios