You are not logged in.
Hello everybody,
I try to use proxydriver which tries to set my gnome proxy settings as root via NetworkManager dispatcher script.
The script uses dbus-launch which fails with the following message:
Autolaunch requested, but X11 support not compiled in.
Cannot continue.
#(...)
While searching I found the following bug which stated not to use dbus-launch at all:
https://bugs.archlinux.org/task/50659
But what to use instead of it?
Best Regards
Volker
Offline
$ cat /usr/lib/systemd/system/NetworkManager-dispatcher.service
[Unit]
Description=Network Manager Script Dispatcher Service
[Service]
Type=dbus
BusName=org.freedesktop.nm_dispatcher
ExecStart=/usr/lib/NetworkManager/nm-dispatcher
# We want to allow scripts to spawn long-running daemons, so tell
# systemd to not clean up when nm-dispatcher exits
KillMode=process
[Install]
Alias=dbus-org.freedesktop.nm-dispatcher.service
A D-Bus bus name has already been acquired, so you should not need to use 'dbus-launch', or any replacement of it, in the scripts run after that.
In the examples given in https://wiki.archlinux.org/index.php/Ne … dispatcher there are no dbus-launch used.
So try to remove them in the scripts you use.
Offline
The scrips are from the program https://aur.archlinux.org/packages/proxydriver/
The relevant code in the dispatcher script is:
# (...)
for user in `users | tr ' ' '\n' | sort --unique`
do
logger -p user.notice -t $log_tag "setting configuration for '$user'"
cat <<EOS | su -l "$user" &> /var/log/proxydriver.log
export \$(DISPLAY=':0.0' dbus-launch --autolaunch="$machineid")
# active or not
gconftool-2 --type bool --set /system/http_proxy/use_http_proxy "$enabled"
gsettings set org.gnome.system.proxy.http enabled "$enabled"
# (...)
The question is. How to run gsettings for a specified user from a script running as root?
Offline
Online
thanks, I adopted it as follows:
# (...)
cat <<EOS | su -l "$user" &> /var/log/proxydriver.log
export LC_ALL=C
pid=\$(pgrep -t tty\$(fgconsole) xinit)
pid=\$(pgrep -P \$pid -n)
import_environment() {
(( pid )) && for var; do
IFS='=' read key val < <(egrep -z "\$var" /proc/\$pid/environ)
printf -v "\$key" %s "\$val"
[[ \${!key} ]] && export "\$key"
done
}
import_environment XAUTHORITY USER DISPLAY
#export \$(DISPLAY=':0.0' dbus-launch --autolaunch="$machineid")
# active or not
gconftool-2 --type bool --set /system/http_proxy/use_http_proxy "$enabled"
gsettings set org.gnome.system.proxy.http enabled "$enabled"
# (...)
but from /var/log/proxydriver.log:
ouldn't get a file descriptor referring to the console
pgrep: not a number: -n
-bash: line 25: kwriteconfig: command not found
-bash: line 32: kwriteconfig: command not found
-bash: line 42: kwriteconfig: command not found
-bash: line 48: kwriteconfig: command not found
-bash: line 54: kwriteconfig: command not found
-bash: line 64: kwriteconfig: command not found
-bash: line 69: kwriteconfig: command not found
-bash: line 73: kwriteconfig: command not found
Failed to open connection to "session" message bus: Using X11 for dbus-daemon autolaunch was disabled at compile time, set your DBUS_SESSION_BUS_ADDRESS instead
Offline
You should probably add DBUS_SESSION_BUS_ADDRESS to import_environment.
You might also be interested in xpub, it should extract the necessary dbus and xorg environment if you want to write your own scripts.
https://aur.archlinux.org/packages/xpub/
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline