Failed to open the X11 Display

This forum is dedicated to basic help and support :

Ask here your questions about basic installation and usage of Mageia. For example you may post here all your questions about getting Mageia isos and installing it, configuring your printer, using your word processor etc.

Try to ask your questions in the right sub-forum with as much details as you can gather. the more precise the question will be, the more likely you are to get a useful answer

Failed to open the X11 Display

Postby linuxdad » Mar 29th, '15, 02:46

Does anyone know why the sudo su - process does not set the Display?

Code: Select all
[aewhale@localhost ~]$ sudo su -
[root@localhost ~]# VirtualBox
Failed to open the X11 display!
Last edited by linuxdad on Mar 29th, '15, 17:56, edited 3 times in total.
Albert E. Whale, CEH CHS CISA CISSP
President - Chief Security Officer
IT Security, Inc. - http://www.IT-Security-inc.com
Pittsburgh, PA
Email: Albert.Whale@IT-Security-inc.com
linuxdad
 
Posts: 123
Joined: Nov 17th, '13, 21:14

Re: Failed to open the X11 Display

Postby doktor5000 » Mar 29th, '15, 11:17

Yes, because since quite some time it strips off some env variables, including DISPLAY.

Either use sudo -E to prevent that or adjust the relevant part of the sudoers:
Code: Select all
Defaults    env_reset
Defaults    env_keep =  "COLORS DISPLAY HOSTNAME HISTSIZE INPUTRC KDEDIR LS_COLORS"
Defaults    env_keep += "MAIL PS1 PS2 QTDIR USERNAME LANG LC_ADDRESS LC_CTYPE"
Defaults    env_keep += "LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES"
Defaults    env_keep += "LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE"
Defaults    env_keep += "LC_TIME LC_ALL LANGUAGE LINGUAS _XKB_CHARSET XAUTHORITY"
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18059
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Failed to open the X11 Display

Postby linuxdad » Mar 29th, '15, 17:47

Thank you!
Albert E. Whale, CEH CHS CISA CISSP
President - Chief Security Officer
IT Security, Inc. - http://www.IT-Security-inc.com
Pittsburgh, PA
Email: Albert.Whale@IT-Security-inc.com
linuxdad
 
Posts: 123
Joined: Nov 17th, '13, 21:14

Re: [Solved] - Failed to open the X11 Display

Postby linuxdad » Mar 29th, '15, 17:52

Maybe I was a bit premature?

Code: Select all
[aewhale@localhost ~]$ sudo -E su -
[root@localhost ~]# VirtualBox
Failed to open the X11 display!


I have not edited the sudoers file, but it has the following anyway.

Code: Select all
Defaults    requiretty

Defaults    env_reset
Defaults    env_keep =  "COLORS DISPLAY HOSTNAME HISTSIZE INPUTRC KDEDIR LS_COLORS"
Defaults    env_keep += "MAIL PS1 PS2 QTDIR USERNAME LANG LC_ADDRESS LC_CTYPE"
Defaults    env_keep += "LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES"
Defaults    env_keep += "LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE"
Defaults    env_keep += "LC_TIME LC_ALL LANGUAGE LINGUAS _XKB_CHARSET XAUTHORITY"

Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin
Albert E. Whale, CEH CHS CISA CISSP
President - Chief Security Officer
IT Security, Inc. - http://www.IT-Security-inc.com
Pittsburgh, PA
Email: Albert.Whale@IT-Security-inc.com
linuxdad
 
Posts: 123
Joined: Nov 17th, '13, 21:14

Re: Failed to open the X11 Display

Postby doktor5000 » Mar 29th, '15, 18:32

You should probably use
Code: Select all
sudo -E VirtualBox
- as doing su - and using sudo -E at the sime time goes for two things at the same time ...

Apart from that, what are you actually trying to achieve by running VirtualBox as root?
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18059
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Failed to open the X11 Display

Postby linuxdad » Mar 29th, '15, 19:07

So, that is a good question. Normally I am used to restricting access to everything, unlees you have root. Permitting a generic user to run VirtualBox is an interesting concept, and also begs the question, why?

So any unsuspecting user can get access tot he server, login and now create VMs with the intent of .... Do you see my point?

So I like the added benefit of security.

BTW, if the environment variables are already within the /etc/sudoers file, why dont the Environment parameters follow when you perform a sudo su -? (I have not had this issue on other flavors of *nix).
Albert E. Whale, CEH CHS CISA CISSP
President - Chief Security Officer
IT Security, Inc. - http://www.IT-Security-inc.com
Pittsburgh, PA
Email: Albert.Whale@IT-Security-inc.com
linuxdad
 
Posts: 123
Joined: Nov 17th, '13, 21:14

Re: Failed to open the X11 Display

Postby doktor5000 » Mar 29th, '15, 21:12

Hmmm, just tried either way, with sudo -E, without -E and with only su - and DISPLAY was always set and VirtualBox always launched.
So not sure what differs in your setup so that it doesn't work for you.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18059
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany


Return to Basic support

Who is online

Users browsing this forum: No registered users and 1 guest