Sudo issues & opening display

Operating System: Debian GNU/Linux 11.x - SID

KDE Plasma Version: 5.25.5
KDE Frameworks Version: 5.98.0
Qt Version: 5.15.6
Kernel Version: 5.19.0-2-amd64 (64-bit)
Graphics Platform: X11
Processors: 16 × 11th Gen Intel® Core™ i7-11800H @ 2.30GHz
Memory: 15.3 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics
Graphics Processor: Nvidia RTX 3070 GPU
Manufacturer: ASUSTeK COMPUTER INC.
Product Name: ROG Zephyrus M16 GU603HE_GU603HE
System Version: 1.0

Hi

I am having a few troubles with something probably pretty basic here.

1. When I go to run various apps - say ‘grub-customizer’ - via the CLI as ROOT user, I get the following message:

**(grub-customizer:16632): Gtk-WARNING : 15:30:55.264: cannot open display:

I know this has something to do with what I initially did when first used the system. Unlike most; I for decades have been using ‘su -’’ command to access root user mode to run apps from the CLI that required it WHILE IN PLASMA/KDE. I have not gotten used to the ‘sudo n9nu’ (n9nu = user name) option and when it asked me for my own password I entered it and it wouldn’t accept it -

n9nu@debian:~$ sudo n9nu
[sudo] password for n9nu:
n9nu is not in the sudoers file.

Should I be listed (as a user) in any of the files below:

/etc/sudo.conf
/etc/sudoers
/etc/sudoers.d
/etc/sudo_loginsrvd.conf

Thank You

ARS N9NU
Tim

Welcome @n9nu ,
Yes you have to have your name in the /etc/sudoers file before sudo will work
There is a special editor called visudo which you should use, rather than an ordinary text editor like vi
This may help

https://www.digitalocean.com/community/tutorials/how-to-edit-the-sudoers-file

Personally I would not bother with sudo, I just use su to root, then mske sure I come out when finished. It is your choice.

Another thing I noticed is that you are using grub-customiser
Some people will tell you that is undesirable… bstter to learn how to configure grub by hand. Agsin it is your choice.

I think the cannot open display message is because something is not defined in your root environment. Most likely the DISPLAY variable

Regards
Neville

2 Likes

Hi

I completely agree with you on the grub-customizer deal. I just used that as an example. I used to use it, however, always use the CLI for anything that I can do either way.

Very well on the sudo and visudo. Yeah I prefer the ol su - command…like you.

I will check the root DISPLAY entry as well then.

Now it’s time to tackle the Intel / Nvidia switching :slight_smile: fun fun

Tim

Hi Tim,
Yeah, root often has a different environment to a user.
Things to check

  • is root a different shell? On my system (Void) user is bash but root is sh. That can stop things that are bash dependent
  • environment variables like DISPLAY and PATH
  • privileges on files

Have fun with your video drivers… not my area. Are you running 2 monitors? That computer has some impressive specs. It should handle KDE like a breeze

Cheers
Neville

Some distros have root set up with a pretty minimal environment, because they believe you should not use root for anything. On these, it’s quite normal to get that error - running GUI apps as root is considered dangerous so they make it very hard.

2 Likes

Have you actually tried running it WITHOUT sudo?

I don’t know this grub customiser thing - but - tools lke gparted are smart enough to ask you for your password when you fire them up as a regular user…

Others only ask you for your creds when you go to change something like in the Ubuntu “disks” app…