LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.

Notices


Reply
  Search this Thread
Old 09-14-2012, 08:59 AM   #1
sanaz
Member
 
Registered: Aug 2012
Posts: 76

Rep: Reputation: Disabled
virt-manager


Hi all,

when I'm trying to work with virt-manager on a remote host(ssh -X host) I got the error:
Code:
#virt-manager
Traceback (most recent call last):
  File "/usr/share/virt-manager/virt-manager.py", line 386, in <module>
    main()
  File "/usr/share/virt-manager/virt-manager.py", line 287, in main
    raise gtk_error
RuntimeError: could not open display
then I reinstall libvirt polkit policycore, log out and ssh again, this time result was:
Code:
#virt-manager
X11 connection rejected because of wrong authentication.
Traceback (most recent call last):
  File "/usr/share/virt-manager/virt-manager.py", line 386, in <module>
    main()
  File "/usr/share/virt-manager/virt-manager.py", line 287, in main
    raise gtk_error
RuntimeError: could not open display
But sometimes when I'm not the root user and run virt-manager, the virtual machine manager will appear, but it gives me the error:
in console:
Code:
Gtk-Message: Failed to load module "canberra-gtk-module"
and in virt-manager window:
Code:
Unable to connect to libvirt.

authentication failed: Authorization requires authentication but no agent is available.

Libvirt URI is: qemu:///system

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/connection.py", line 1027, in _open_thread
    self.vmm = self._try_open()
  File "/usr/share/virt-manager/virtManager/connection.py", line 1009, in _try_open
    flags)
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 102, in openAuth
    if ret is None:raise libvirtError('virConnectOpenAuth() failed')
libvirtError: authentication failed: Authorization requires authentication but no agent is available.
Code:
Unable to connect to libvirt.

Cannot recv data: /etc/ssh/ssh_config: line 62: Bad configuration option: X11UseLocalhost
/etc/ssh/ssh_config: terminating, 1 bad configuration options
: Connection reset by peer

Verify that the 'libvirtd' daemon is running
on the remote host.

Libvirt URI is: qemu+ssh://root@bu.edu/system

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/connection.py", line 1027, in _open_thread
    self.vmm = self._try_open()
  File "/usr/share/virt-manager/virtManager/connection.py", line 1009, in _try_open
    flags)
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 102, in openAuth
    if ret is None:raise libvirtError('virConnectOpenAuth() failed')
libvirtError: Cannot recv data: /etc/ssh/ssh_config: line 62: Bad configuration option: X11UseLocalhost
/etc/ssh/ssh_config: terminating, 1 bad configuration options
: Connection reset by peer
I googled it a lot. But nothing worked. any help is appreciated.

Last edited by sanaz; 09-18-2012 at 11:54 AM.
 
Old 09-14-2012, 09:59 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
It looks like much of what it is complaining about is the X-Windows (X11) stuff.

It is often helpful to open a simple program like xterm first to verify it can display back to your local system. If not then you know to focus on generic X stuff rather than the program you're trying to run.

You don't say what your local workstation is.
Is it Linux? If so is the ssh -X you're running from within a term session of your X-Windows (Gnome or other) desktop?
Is it MS-Windows? If so are you running an X-Window emulator like Cygwin/X or Hummingbird Exceed?

After you do the ssh -X are you doing a "su" to switch users on the remote system? If so have you set the DISPLAY for the switched user to what your initial remote user's was? Have you set XAUTHORITY to point to the .Xauthority in the initial remote user's home directory and insured the switched user has permission to access that file?
 
Old 09-14-2012, 11:43 AM   #3
sanaz
Member
 
Registered: Aug 2012
Posts: 76

Original Poster
Rep: Reputation: Disabled
This is the result of xterm:

Code:
# xterm
X11 connection rejected because of wrong authentication.
Warning: This program is an suid-root program or is being run by the root user.
The full text of the error or warning message cannot be safely formatted
in this environment. You may get a more descriptive message by running the
program as a non-root user or by removing the suid bit on the executable.
xterm: Xt error: Can't open display: %s
when I'm trying to run xterm, while not being root user, it worked without any problem.
My local machine is Scientific linux and remote one is Fedora. I did not get the question "s the ssh -X you're running from within a term session of your X-Windows (Gnome or other) desktop? " . I'm sshing from my terminal.

and this the result of display, both in root user and regular user.
Code:
# echo $DISPLAY
localhost:10.0
#export DISPLAY=root
echo $DISPLAY
root
# xhost +local:
xhost:  unable to open display "root"
in addition when I'm root user:

Code:
# startx
xauth:  file /root/.serverauth.12897 does not exist
xauth:  file /root/.Xauthority does not exist
xauth:  file /root/.Xauthority does not exist


X.Org X Server 1.12.3
Release Date: 2012-07-09
X Protocol Version 11, Revision 0
Build Operating System:  2.6.32-279.2.1.el6.x86_64 
Current Operating System: Linux 3.5.3-1.fc17.x86_64 #1 SMP Wed Aug 29 18:46:34 UTC 2012 x86_64
Kernel command line: BOOT_IMAGE=/vmlinuz-3.5.3-1.fc17.x86_64 root=/dev/mapper/vg1-lv1 ro rd.md=0 rd.dm=0 rd.lvm.lv=vg1/lv3 rd.lvm.lv=vg1/lv1 KEYTABLE=us printk.time=0 rd.luks=0 SYSFONT=True LANG=en_US.UTF-8 rhgb quiet
Build Date: 20 August 2012  02:12:31AM
Build ID: xorg-x11-server 1.12.3-1.fc17 
Current version of pixman: 0.24.4
	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: Fri Sep 14 12:43:52 2012
(==) Using system config directory "/usr/share/X11/xorg.conf.d"

Fatal server error:
no screens found

Please consult the Fedora Project support 
	 at http://wiki.x.org
 for help. 
Please also check the log file at "/var/log/Xorg.0.log" for additional information.

Server terminated with error (1). Closing log file.
xinit: giving up
xinit: unable to connect to X server: Connection refused
xinit: server error

Last edited by sanaz; 09-18-2012 at 11:54 AM.
 
Old 09-14-2012, 11:57 AM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Just so we're clear on a few items:

When you say "local machine" and "terminal" I assume you mean you're on the console of the Scientific machine?

My question about terminal inside X windows deals with the fact that on a Linux console you can run in a non-GUI environment (virtual console) but usually default to an X environment. (e.g. If you hit "Ctrl-Alt-F1" on RHEL5 you'd end up in a non-GUI window on tty1. If you then hit Ctrl-F7 you'd go back to the GUI environment on tty7.) I was trying to insure you were actually in a GUI environment. If it works as a non-root user when you do "ssh -X <nonrootuser>@<centosbox>" then it confirms you're in a GUI environment.

So the next question is did you "ssh -X root@<centosbox> to become root on the CentOS machine or did you instead do 2 steps?:
ssh -X root@<centosbox>
su - (or sudo su -)

If you did the latter 2 steps it means the .Xauthority that was opened by the ssh -X was NOT created for the root user but rather for the non-root user. Root can use it but you have to set the variable to tell it where the .Xauthority is which would be the home directory of the non-root user.
export XAUTHORITY=~<nonrootuser>/.Xauthority

You also have to insure the DISPLAY variable is the same for the root/non-root users but you've already done that.

If instead you're doing the first method (ssh -X root@...) then you'd need to investigate why /root/.Xauthority isn't being created. This may have to do with your sshd_config file settings specifically prohibiting root from doing this.
 
1 members found this post helpful.
Old 09-14-2012, 01:03 PM   #5
sanaz
Member
 
Registered: Aug 2012
Posts: 76

Original Poster
Rep: Reputation: Disabled
Thanks a lot for your help.

I did:

Code:
# export XAUTHORITY=~root/.Xauthority

AND NOW

Code:
# echo $XAUTHORITY 
/root/.Xauthority
# echo $DISPLAY 
root
I'm not still sure about changing the DISPLAY. But anyway still running virt-manager:
Code:
# virt-manager
Traceback (most recent call last):
  File "/usr/share/virt-manager/virt-manager.py", line 386, in <module>
    main()
  File "/usr/share/virt-manager/virt-manager.py", line 287, in main
    raise gtk_error
RuntimeError: could not open display

I also have another question when I'm not root and I run virt-manager, it will open with an error, which is:
Code:
Unable to connect to libvirt.

authentication failed: Authorization requires authentication but no agent is available.

Libvirt URI is: qemu:///system

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/connection.py", line 1027, in _open_thread
    self.vmm = self._try_open()
  File "/usr/share/virt-manager/virtManager/connection.py", line 1009, in _try_open
    flags)
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 102, in openAuth
    if ret is None:raise libvirtError('virConnectOpenAuth() failed')
libvirtError: authentication failed: Authorization requires authentication but no agent is available.
Does this mean, that I need to be root and work with virt-manager?
 
Old 09-14-2012, 02:44 PM   #6
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
If you do "ssh -X <user>" then use that user for your X stuff you shouldn't need to set XAUTHORITY - it will use the one in the user's home. I was saying if you SWITCHED USERS after login you'd have to explicitly set XAUTHORITY after the switch to be the ~<user>/.Xauthority of the user you initially were before the switch.

DISPLAY=root would not be a valid setting for that variable. DISPLAY tells it the host and geometry. As I noted in my prior post your original DISPLAY looked OK since it was same for both root and the non-root user.

Again I'd suggest testing "xterm" rather the the virt-manager command to be sure your X setup is OK. Once you get a valid xterm then you know any issue after that is with the virt-manager command you're running but until then it may have nothing to do with the virt-manager command itself.

So lets start over. When you are on your Scientific box exactly what exact command (full command not just 'ssh -X') are you typing? e.g. "ssh -X root@host" or just "ssh -X host" or "ssh nonrootuser@host"?

Yes - it appears you need to be root to run virt-manager. You do not have to be root to run xterm. The discussion above is basically questioning more than once how you are becoming root as THAT MAKES A DIFFERENCE.

Last edited by MensaWater; 09-14-2012 at 02:47 PM.
 
1 members found this post helpful.
Old 09-14-2012, 03:53 PM   #7
sanaz
Member
 
Registered: Aug 2012
Posts: 76

Original Poster
Rep: Reputation: Disabled
OK.

here is what I exactly do:

Code:
#ssh -X host

[myusername@host]$xterm   (it will open the xterm window without any problem)

[myusername@host]$xauth list
host/unix:14  MIT-MAGIC-COOKIE-1  e12df9e17ef88acd38a3053d8aa4b959
host/unix:15  MIT-MAGIC-COOKIE-1  4771565ffe6ab19943b6dfb1a644d5f1
host/unix:12  MIT-MAGIC-COOKIE-1  3e1d343095bb8467b1ea1bd281d4e68e
host/unix:11  MIT-MAGIC-COOKIE-1  47de1da27e14a104b2a5e1d3f0d4861a
host/unix:10  MIT-MAGIC-COOKIE-1  0c0c85cc834830224b024e02589eef7a

[myusername@host]$sudo -s

[root@host myusername]#echo $XAUTHORITY 
(nothing is displayed)

[root@host myusername]#xterm
X11 connection rejected because of wrong authentication.
Warning: This program is an suid-root program or is being run by the root user.
The full text of the error or warning message cannot be safely formatted
in this environment. You may get a more descriptive message by running the
program as a non-root user or by removing the suid bit on the executable.
xterm: Xt error: Can't open display: %s

[root@host myusername]#export XAUTHORITY=~root/.Xauthority

[root@host myusername]#echo $XAUTHORITY 
/root/.Xauthority

[root@host myusername]#xauth list
(nothing is displayed)

[root@host myusername]#xauth list|grep `uname -n`
(nothing is displayed)
I guess I have to add root manually to xauth, but I don't know exactly how as I don't know my hexkey
 
Old 09-14-2012, 04:13 PM   #8
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
After the "sudo -s" you have effectively switched user from myusername to root.

Therefore do NOT do:

export XAUTHORITY=~root/.Xauthority

Instead DO:

export XAUTHORITY=~myusername/.Xauthority

This is because the authority was granted to myusername on login and NOT to root. By telling root to use myusername's .Xauthority root will have the same authority myusername was granted. Since it IS root doing it you shouldn't need to worry about permissions on ~myusername/.Xauthority.
 
Old 09-14-2012, 04:18 PM   #9
sanaz
Member
 
Registered: Aug 2012
Posts: 76

Original Poster
Rep: Reputation: Disabled
I did that, but still

Code:
#xterm
X11 connection rejected because of wrong authentication.
Warning: This program is an suid-root program or is being run by the root user.
The full text of the error or warning message cannot be safely formatted
in this environment. You may get a more descriptive message by running the
program as a non-root user or by removing the suid bit on the executable.
xterm: Xt error: Can't open display: %s

Code:
# startx
xauth:  file /root/.serverauth.41250 does not exist
xauth:  timeout in locking authority file myusername/.Xauthority
xauth:  timeout in locking authority file myusername/.Xauthority
xauth:  timeout in locking authority file myusername/.Xauthority
xauth:  timeout in locking authority file myusername/.Xauthority

X.Org X Server 1.12.3
Release Date: 2012-07-09
X Protocol Version 11, Revision 0
Build Operating System:  2.6.32-279.2.1.el6.x86_64 
Current Operating System: Linux 3.5.3-1.fc17.x86_64 #1 SMP Wed Aug 29 18:46:34 UTC 2012 x86_64
Kernel command line: BOOT_IMAGE=/vmlinuz-3.5.3-1.fc17.x86_64 root=/dev/mapper/vg1-lv1 ro rd.md=0 rd.dm=0 rd.lvm.lv=vg1/lv3 rd.lvm.lv=vg1/lv1 KEYTABLE=us printk.time=0 rd.luks=0 SYSFONT=True LANG=en_US.UTF-8 rhgb quiet
Build Date: 20 August 2012  02:12:31AM
Build ID: xorg-x11-server 1.12.3-1.fc17 
Current version of pixman: 0.24.4
	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: Fri Sep 14 17:17:16 2012
(==) Using system config directory "/usr/share/X11/xorg.conf.d"

Fatal server error:
no screens found

Please consult the Fedora Project support 
	 at http://wiki.x.org
 for help. 
Please also check the log file at "/var/log/Xorg.0.log" for additional information.

Server terminated with error (1). Closing log file.
xinit: giving up
xinit: unable to connect to X server: Connection refused
xinit: server error

xauth:  timeout in locking authority file myusername/.Xauthority
Code:
# virt-manager
X11 connection rejected because of wrong authentication.
Traceback (most recent call last):
  File "/usr/share/virt-manager/virt-manager.py", line 386, in <module>
    main()
  File "/usr/share/virt-manager/virt-manager.py", line 287, in main
    raise gtk_error
RuntimeError: could not open display

Last edited by sanaz; 09-18-2012 at 11:55 AM.
 
Old 09-17-2012, 08:43 AM   #10
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Code:
xauth:  timeout in locking authority file myusername/.Xauthority
No ~ in above? Or actual path to user's home (e.g. /home/myusername/.Xauthority)? If so that is the problem.

At this point you'll need to actually post the output of:
whoami
who am i
echo $DISPLAY
echo $XAUTHORITY

Put the REAL output and not obfuscated output. Clearly you're not getting what I'm telling you using fake information and I'm not willing to try to figure out which is obfuscation and which is literal on your part any longer. If you're not willing to share the REAL information on a public forum then you'll have to figure it out for yourself.
 
Old 09-18-2012, 11:42 AM   #11
sanaz
Member
 
Registered: Aug 2012
Posts: 76

Original Poster
Rep: Reputation: Disabled
OK here is the results, when I'm root:

Code:
# whoami
root

# who am i
sana pts/0        2012-09-14 17:15 (sana.bu.edu)

# echo $DISPLAY 
localhost:10.0

# echo $XAUTHORITY 
/home/sana/.Xauthority
I did not want to hide anything just to be more clear what is sana(myusername)

Quote:
Originally Posted by MensaWater View Post
Code:
xauth:  timeout in locking authority file myusername/.Xauthority
No ~ in above? Or actual path to user's home (e.g. /home/myusername/.Xauthority)? If so that is the problem.

At this point you'll need to actually post the output of:
whoami
who am i
echo $DISPLAY
echo $XAUTHORITY

Put the REAL output and not obfuscated output. Clearly you're not getting what I'm telling you using fake information and I'm not willing to try to figure out which is obfuscation and which is literal on your part any longer. If you're not willing to share the REAL information on a public forum then you'll have to figure it out for yourself.
 
Old 09-18-2012, 03:46 PM   #12
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
What does "ls -l /home/sana/.Xauthority" show?
 
Old 09-18-2012, 06:53 PM   #13
sanaz
Member
 
Registered: Aug 2012
Posts: 76

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by MensaWater View Post
What does "ls -l /home/sana/.Xauthority" show?
Thanks a lot for your help. Actually my main problem was that I could not run virt-manager, now I solved the problem from here(too simple)
http://aruljohn.com/info/x11forwarding/

Although it gives me the error:
Gtk-Message: Failed to load module "canberra-gtk-module"
It completely worked.
Also xterm and xclock work fine.

But still startx does not work, error is:
xauth: file /root/.serverauth.6402 does not exist
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
virt-manager sanaz Linux - Newbie 1 09-13-2012 08:19 PM
LXer: Hacking libvirt/virsh/virt-manager/virt-install at Xen 4.0 Dom0 on top of Ubunt LXer Syndicated Linux News 0 05-06-2010 02:50 PM
LXer: Virt-install&Virt-manager at Xen 4.0-rc8 (2.6.32.10 pvops) Dom0 on top Ubuntu K LXer Syndicated Linux News 0 03-26-2010 09:41 PM
Debian 5.0 Network-Manager interfers with vnet0 bridging to eth0 for virt-manager coolphive Debian 5 05-29-2009 02:02 PM
Debian 5.0 Network-Manager interfers with vnet0 bridging to eth0 for virt-manager coolphive Linux - Newbie 2 05-28-2009 08:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 06:05 PM.

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