Sunday, May 5, 2024
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 3909  / 2 Years ago, tue, march 1, 2022, 1:34:34

Is there a way to set a dconf key by command line, without logging into X?

I'd like to use this from Puppet.



If I try (from SSH, as the normal user) a simple



dconf write /desktop/gnome/remote-access/enabled true


I get



error: Command line `dbus-launch --autolaunch=e4d2b270bd8471627460e57c000007f1 --binary-syntax --close-stderr' exited with non-zero exit status 1:
Autolaunch error: X11 initialization failed.



While if I try



DISPLAY=:0 dconf write /desktop/gnome/remote-access/enabled true


I get



error: Command line `dbus-launch --autolaunch=e4d2b270bd8471627460e57c000007f1 --binary-syntax --close-stderr' exited with non-zero exit status 1:
Invalid MIT-MAGIC-COOKIE-1 keyInvalid MIT-MAGIC-COOKIE-1 keyAutolaunch error: X11 initialization failed.



If I remove $HOME/.Xauthority



error: Command line `dbus-launch --autolaunch=e4d2b270bd8471627460e57c000007f1 --binary-syntax --close-stderr' exited with non-zero exit status 1:
No protocol specified
No protocol specified
Autolaunch error: X11 initialization failed.



I'm testing on Xubuntu 12.04



(My question is similar to this one but in that case the user is logged in)


More From » command-line

 Answers
1

I managed to solve the problem:



define dconf::key($value) {
exec { "Setting dconf $title":
path => "/bin:/usr/bin",
command => "/bin/sh -c 'eval `dbus-launch --auto-syntax` && dconf write $title $value'",
user => "user_name",
group => "user_name",
unless => "dconf read $title | grep $value",
require => Package["dconf-tools"]
}
}

[#35149] Thursday, March 3, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
earxcept

Total Points: 310
Total Questions: 115
Total Answers: 111

Location: Japan
Member since Sat, Oct 2, 2021
3 Years ago
;