You are not logged in.

#1 2020-05-27 10:48:43

tomsk
Member
Registered: 2016-12-17
Posts: 224

Could not connect to D-Bus server

Hello,

I use this code inside my file called `test_vm`:

#!/bin/bash

# Turn on presentation mode (disable sleeping)
inhibit_cookie=$(qdbus org.freedesktop.PowerManagement.Inhibit /org/freedesktop/PowerManagement/Inhibit org.freedesktop.PowerManagement.Inhibit.Inhibit "VM" "because") 

and I start it using sudo like: `sudo ./test_vm`

then I get error:

[tomsk@tomsk-PC ~]$ sudo ./test_vm 
Could not connect to D-Bus server: org.freedesktop.DBus.Error.NotSupported: Using X11 for dbus-daemon autolaunch was disabled at compile time, set your DBUS_SESSION_BUS_ADDRESS instead

When I run that command using command line it works, but I need to start it using file and using sudo, because I use that in my other script which is starting by sudo.


I use several linux distros like: Archlinux, Ubuntu, Fedora, Linux Mint

Offline

#2 2020-05-27 11:39:08

loqs
Member
Registered: 2014-03-06
Posts: 19,063

Re: Could not connect to D-Bus server

If you invoke other script without using sudo and instead have it call sudo internally for the operations that need it?

Offline

Board footer

Powered by FluxBB