LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   GTK warning with init 4 but not with startx (https://www.linuxquestions.org/questions/slackware-14/gtk-warning-with-init-4-but-not-with-startx-4175489145/)

mostlyharmless 12-25-2013 01:51 PM

GTK warning with init 4 but not with startx
 
Merry Xmas!

I have been running init 3 and then running startx. Recently I changed to init 4, which works fine, but when I run qemu, I get the following:

(qemu-system-x86_64:2075): Gtk-WARNING **: cannot open display: :0

typing this:
export DISPLAY=:0

doesn't help
Of course typing init 3, then startx fixes the problem. What exactly is different between startx and init 4, or at least how do I address this issue?

saivinoba 12-25-2013 04:09 PM

I think that is :0.0 not just :0 as in
Code:

export DISPLAY=:0.0

ljb643 12-25-2013 07:14 PM

The error message shows that DISPLAY is correctly set (:0 is the same as :0.0), so the problem is likely the process does not have permission to connect to the X server to display a window. Assuming you are trying to run qemu as the same user who logged in with xdm, something probably went wrong with the session setup. What happens if you type "xauth list" at a shell prompt?

mostlyharmless 12-26-2013 07:56 AM

Thanks for responding!

Quote:

What happens if you type "xauth list" at a shell prompt?
As the user under init 4:

Code:

192.168.1.9:0  MIT-MAGIC-COOKIE-1  c8e9c2816807f3ee235b751fa0cf7886
[fe80::76d0:2bff:fe2a:817f]:0  MIT-MAGIC-COOKIE-1  c8e9c2816807f3ee235b751fa0cf7886
[fe80::76d0:2bff:fe2a:817f]:0  MIT-MAGIC-COOKIE-1  c8e9c2816807f3ee235b751fa0cf7886
[fe80::74bf:11ff:fe38:bb2c]:0  MIT-MAGIC-COOKIE-1  c8e9c2816807f3ee235b751fa0cf7886
animals/unix:0  MIT-MAGIC-COOKIE-1  c8e9c2816807f3ee235b751fa0cf7886

As root (after su -) under init 4:

Code:

slackware/unix:0  MIT-MAGIC-COOKIE-1  ea4dae9ba61da1ee04b397232a19ca41
I typically start qemu after su - as root because (1) I started that way (2) I get the following error as the mortal user:

Code:

qemu-system-x86_64: -net vde,sock=/var/run/kvm0.ctl,vlan=0: Device 'vde' could not be initialized
which presumably indicates I have to add the user to a group that allows me to initiate networking somewhere... currently
"groups" yields:

Code:

users lp floppy audio video cdrom plugdev power netdev scanner
As the user under init 3, xauth list is:

Code:

animals/unix:0  MIT-MAGIC-COOKIE-1  ed247fc6d15a3f2537027f35fac4679a
whereas root under init 3 is

Code:

animals/unix:0  MIT-MAGIC-COOKIE-1  ed247fc6d15a3f2537027f35fac4679a
So it looks like under init 4, the root user thinks the machine name is "slackware" instead of "animals", and I presume that is the problem. I haven't a clue how to fix that. Of course the immediate problem *might* also be solved if I knew why the mortal user can't start qemu.

ljb643 12-26-2013 07:24 PM

Sorry... I probably should not have asked for that - I think posting the xauth list output reveals the 'cookies' that lets anyone connect to your X server. Hopefully you have logged out and back in since then and have new cookies.

Yes if you run something after "su" you will typically get a failure to connect to the X server due to permissions. The permissions setup is different when using runlevel 4 (xdm) versus startx, so I'm not surprised it behaves differently. There are ways around it (with xhost, or xauth extract/xauth merge) but as you said, the right answer is to try to get the program working without needing to run it as root.

jtsn 12-26-2013 10:25 PM

Quote:

Originally Posted by ljb643 (Post 5087364)
Sorry... I probably should not have asked for that - I think posting the xauth list output reveals the 'cookies' that lets anyone connect to your X server. Hopefully you have logged out and back in since then and have new cookies.

The listing only contains RFC 1918 and IPv6 link-local addresses, so in reality nobody can connect to his X server (without being directly connected to the machine). And the "/unix" entry describes the Unix Domain Socket for which you to be logged in on the machine itself.

For the hostname, I would check the content of /etc/HOSTNAME and /etc/hosts and execute the hostname utility. (Don't change the 127.0.0.1 entry to anything other than localhost.)

mostlyharmless 12-29-2013 08:31 AM

Quote:

For the hostname, I would check the content of /etc/HOSTNAME and /etc/hosts and execute the hostname utility.
Both of those files say "animals". Clearly, "xauth list" under init 4 gives "slackware" based on something else, but what?

[EDIT] as a work around, I did this:

Code:

COOKIE=$(su "$USERNAME" -c "xauth list | cut -f 5 -d\" \"")
xauth add "animals/unix:0" MIT-MAGIC-COOKIE-1 $COOKIE

but I'd rather not do that every time.

ljb643 12-29-2013 02:34 PM

The "slackware" hostname entry seems to be from root's authorization file (~root/.Xauthority), not your user account's file. Assuming you normally log in as a user then "su" to root once running X, that entry could be left over from a long time ago.

mostlyharmless 12-29-2013 03:44 PM

So, if I login as root, would that automatically change my /root/.Xauthority? I don't run X as root, and the installation is recent without any hostname changes.

[EDIT] Post #7 seems to have permanently SOLVED the issue


All times are GMT -5. The time now is 06:49 AM.