I am trying to change some gconf settings in Ubuntu 12.10. I would like to change the lightdm greeter background.

I have discovered that while logged in to unity as a user while running X server, I am able to do this with:

sudo xhost +SI:localuser:lightdm
gsettings set com.canonical.unity-greeter background "'/usr/share/backgrounds/micros-background.png'"

The problem is that this requires me to login as a user under X. So that entire window manager needs to be running. But I want to use chroot to change these settings without any X server running. I just want to mount the partitions and change gsettings without having the full window manager running.

Is there a way to directly change gsettings without being logged into X and Unity?

Or alternatively... is there a way to bring up the X server and Unity in the background so that I can make the changes without having a full windowed display come up on my monitor?


It's possible to run gsettings without X11 using dbus-launch --exit-with-session:

dbus-launch --exit-with-session gsettings set com.canonical.unity-greeter background "'/usr/share/backgrounds/micros-background.png'"
  • Thank you for this! I used this to set settings for another user not logged in like this sudo -u "username" dbus-launch --exit-with-session gsettings set org.gnome.settings-daemon.plugins.power lid-close-ac-action 'nothing' – HarlemSquirrel Mar 3 '15 at 19:20
  • If you prepend the line 5cdhn suggests with sudo, you can edit root's dconf (when using dconf-editor and gsettings with sudo/gksu throw this error). Another way to do this is with 'sudo/gksu dbus-launch gsetttnigs/dconf-editor' as Paco Porras suggests. – Que Quotion Sep 14 '16 at 16:33
  • This does not appear to work when you have a session currently running. For example, I want to change keyboard layout when I plug/unplug the keyboard. Running gsettings inside a udev script, even using dbus-launch, does not apply the settings for the currently running session. – Ben Davis Aug 9 '19 at 18:45
  • 1
    “No protocol specified” on attempt to test this. – realkstrawn93 Sep 30 '19 at 20:53

Some people says that you must precede the "gsettings" command by the "dbus-launch" word, but I haven't tried it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.