Problem applying gsettings settings as sudo

Hello all,

So, I am tweaking my install script so I can set up EOS quickly when I install it on bare metal. One of the things in the script set’s up my Nemo preferences with gsettings like:

gsettings set org.nemo.compact-view all-columns-have-same-width true

That works without problems. I also want to do this as sudo so that when I open a Nemo window as root, the preferences are the same. This used to work as follows on Manjaro:

sudo gsettings set org.nemo.compact-view all-columns-have-same-width true

But here I get the following error:

(process:2076): dconf-WARNING **: 13:11:15.336: failed to commit changes to dconf: Error spawning command line “dbus-launch --autolaunch=fcf07a1de16b4743aa2c36b78bd69fd3 --binary-syntax --close-stderr”: Child process exited with code 1

After some googling I found something that seemed to work initially since it did not gave a error:

DISPLAY=0:sudo gsettings set org.nemo.compact-view all-columns-have-same-width true

But alas, no settings have changed.

Does anyone know why I can’t just use sudo and have it work? Seems I am missing a package that enables for that to work but I don’t know which.

Try with sudo su gdm, as suggested in first answer, i think that should work

2 Likes

When I try the command with ’ sudo su gdm’ I get the following:

su: user gdm does not exist or the user entry does not contain all the required fields

Also tried it as root and then I get:

/usr/bin/gsettings: /usr/bin/gsettings: cannot execute binary file

This seemed to work:

sudo su root -c 'gsettings set org.nemo.preferences show-hidden-files true'

But nothing changed and running the command again gave the dconf-warning error. So strange.

Edit: since I am still a new user and got a reply cooldown, I managed to find the working solution a few posts later. The following command works for applying the gsettings as root:

sudo -u root dbus-launch gsettings set org.nemo.compact-view all-columns-have-same-width true
1 Like

Double sudo?? :crazy_face:

Just to be extra sure!

But seems a error on my end, a single sudo works just fine as well. Edited my original post.

Thanks for the heads up.

Sure, i feel you! It’s not enough to be JUST god, it’s so mainstream this days :laughing:

Good info though, thx!
I wondered myself some time ago, if it’s possible at all for gsettings to go sudo, turns out yes :slight_smile:

1 Like