Problems running some commands with sudo

New to Debian (Or Linux in general)? Ask your questions here!

Problems running some commands with sudo

Postby Ashde » 2020-04-06 14:53

Hi, I've tried everything I can find and I don't know where to go from here.

Running Debian 10

Running 'sudo virt-manager' results in the following:
Code: Select all
No protocol specified
Unable to init server: Could not connect: Connection refused
No protocol specified
Unable to init server: Could not connect: Connection refused
No protocol specified
Unable to init server: Could not connect: Connection refused

(virt-manager:11107): Gtk-WARNING **: 11:22:57.950: cannot open display: :0


Something similar also happens with 'sudo nautilus'
Code: Select all
** (nautilus:11210): WARNING **: 11:25:23.016: Error on getting connection: Failed to load SPARQL backend: Error spawning command line ?dbus-launch --autolaunch=b96e71e6e1714e77a7498f75a0399479 --binary-syntax --close-stderr?: Child process exited with code 1

(nautilus:11210): GLib-GIO-CRITICAL **: 11:25:23.017: g_dbus_connection_signal_unsubscribe: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(nautilus:11210): GLib-GObject-CRITICAL **: 11:25:23.017: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

(nautilus:11210): GLib-GObject-CRITICAL **: 11:25:23.017: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
No protocol specified
Unable to init server: Could not connect: Connection refused

(nautilus:11210): Gtk-WARNING **: 11:25:23.021: cannot open display: :0


...and finally running 'sudo seahorse'
Code: Select all
No protocol specified
Unable to init server: Could not connect: Connection refused
seahorse: Cannot open display:


These are the only three I've found that have this problem. Included them together because they seem like they may be caused by the same problem.
Running without sudo works normally.
Ashde
 
Posts: 2
Joined: 2020-04-06 14:22

Re: Problems running some commands with sudo

Postby Head_on_a_Stick » 2020-04-06 15:14

Ashde wrote:this problem

It's not a "problem", those applications are forbidden from running as root by design. I presume this is the GNOME desktop?

They can be made to work under sudo:

Image

But I'm not telling you how I did that :P

Why do you want to run those programs as root anyway? What is it you are trying to do with them?
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 12764
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Problems running some commands with sudo

Postby CwF » 2020-04-06 15:32

virt-manager will run fine on a root desktop. Never does it need sudo. The regular user doesn't need root or sudo, just be in the right group.
CwF
 
Posts: 808
Joined: 2018-06-20 15:16

Re: Problems running some commands with sudo

Postby Ashde » 2020-04-06 15:33

Head_on_a_Stick wrote:Why do you want to run those programs as root anyway? What is it you are trying to do with them?


When selecting my ISO for a new VM (which is on a different drive) I get "The emulator may not have search permissions for the path '/pathto/.iso/'" and asks to correct that. It can't actually change the permissions though, and I was told to try running virt-manager with sudo and then doing the same thing.

And yes, GNOME desktop.
Ashde
 
Posts: 2
Joined: 2020-04-06 14:22

Re: Problems running some commands with sudo

Postby CwF » 2020-04-06 15:38

Ashde wrote:'/pathto/.iso/'"

from wherver the iso is link it to the standard directory
Example of a thunar custom action
Code: Select all
sudo ln -s --target-directory=/var/lib/libvirt/images %f

Then select the iso from the default storage pool.
CwF
 
Posts: 808
Joined: 2018-06-20 15:16

Re: Problems running some commands with sudo

Postby Head_on_a_Stick » 2020-04-06 16:06

Ashde wrote:I was told to try running virt-manager with sudo

Whoever told you that is an idiot, don't listen to them.
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 12764
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Problems running some commands with sudo

Postby None1975 » 2020-04-11 12:22

Ashde wrote:Running 'sudo virt-manager'

But why? Why do you need sudo privileges? Bad habit, or you came from Windows land? Anyway, don't do that! I'd facepalm, but we're not supposed to touch our faces any more.

I was told to try running virt-manager with sudo and then doing the same thing.

Maybe this guy is an idiot, or maybe he’s a cyber criminal ...who knows...
OS: Debian 10.3 Buster / WM: xmonad
Debian Wiki | DontBreakDebian, My config files on github
User avatar
None1975
 
Posts: 1019
Joined: 2015-11-29 18:23
Location: Lithuania, Vilnius

Re: Problems running some commands with sudo

Postby stevepusser » 2020-04-12 00:25

Head_on_a_Stick wrote:
Ashde wrote:I was told to try running virt-manager with sudo

Whoever told you that is an idiot, don't listen to them.


Some morons think sudo is like bacon--it makes everything better.
MX Linux packager and developer
User avatar
stevepusser
 
Posts: 12131
Joined: 2009-10-06 05:53


Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 7 guests

fashionable