20

I've taken a backup of the file where my dconf database is stored (~/.config/dconf/user which is a binary file), and now I need to move some keys from the backup to the dconf in use.

How can I view the content of the backed up dconf without putting it "in place" and view it with for example dconf-editor?

24

To view the content of that file you could rename it - e.g. test - place it under ~/.config/dconf/ and then have dconf read/dump the settings from that file.
By default, dconf reads the user-db found in $XDG_CONFIG_HOME/dconf/:

A "user-db" line specifies a user database.
These databases are found in $XDG_CONFIG_HOME/dconf/. The name of the file to open in that directory is exactly as it is written in the profile. This file is expected to be in the binary dconf database format. Note that XDG_CONFIG_HOME cannot be set/modified per terminal or session, because then the writer and reader would be working on different DBs (the writer is started by DBus and cannot see that variable).

As a result, you would need a custom profile that points to that particular db file - e.g. user-db:test and then instruct dconf to dump the data (using the custom profile) via the DCONF_PROFILE environment variable:

cd
cp /path_to_backup_dconf/user ~/.config/dconf/test
printf %s\\n "user-db:test" > db_profile
DCONF_PROFILE=~/db_profile dconf dump / > old_settings

The result is a file (old_settings) containing the settings from your backed up dconf file, e.g.:

[org/gnome/desktop/interface]
font-name='DejaVu Sans Oblique 10'
document-font-name='DejaVu Sans Oblique 10'
gtk-im-module='gtk-im-context-simple'
clock-show-seconds=true
icon-theme='HighContrast'
monospace-font-name='DejaVu Sans Mono Oblique 10'

[org/gnome/desktop/input-sources]
sources=@a(ss) []
xkb-options=@as []

[org/gnome/desktop/wm/preferences]
num-workspaces=4
titlebar-font='DejaVu Sans Bold Oblique 10'

.......

You could then remove those files:

rm -f ~/db_profile ~/.config/dconf/test

and load the old settings into the current database:

dconf load / < old_settings

If you want to dump only specific settings just provide the path:

DCONF_PROFILE=~/db_profile dconf dump /org/gnome/desktop/wm/preferences/
[/]
num-workspaces=4
titlebar-font='DejaVu Sans Bold Oblique 10'

but note that for each path you should have a different file and when you load it you should specify the path accordingly:

dconf load /org/gnome/desktop/wm/preferences/ < old_wm_settings

Also note that, due to upstream changes, older dconf databases might contain paths, keys and values that are invalid in newer versions so full compatibility between db-files created by different versions of dconf isn't always guaranteed. In that case, you would have to inspect the resulting old_settings file and manually remove or edit the entries that are invalid before loading it into your current database.

  • 15
    WTF? Who is responsible for this mess and who should be beaten because of this? (But: Thank you very much for this information, it helped me, too.) – Tino Oct 16 '15 at 8:16
  • 1
    @Tino gnome devs I believe :) But there should be some front-end tools – Anwar Aug 13 '17 at 14:12
  • The contributors are shown at gitlab.gnome.org/GNOME/dconf/graphs/master – Ben Creasy Aug 19 '18 at 6:58
-1

I think the first answer overly-complicated the matter, so let's try again, using /org/cinnamon/ as an example namespace to backup and restore:

To backup /org/cinnamon/:

From a terminal, run:

dconf dump /org/cinnamon/ > backup_of_my_cinnamon_settings

save the backup_of_my_cinnamon_settings file somewhere for later

To reset /org/cinnamon/ to defaults:

dconf reset -f /org/cinnamon/

Note, cinnamon may freeze or crash doing this

To restore all your settings for /org/cinnamon:

dconf load /org/cinnamon/ < backup_of_my_cinnamon_settings


The process would be the same for /org/gnome/terminal/, etc.

For best results, update app references when they are not running.

Thanks to Cinnamon docs for the tips.

  • 2
    I think you should try again: the question here is not how to backup and restore some settings but how to view (and maybe load) the settings from a saved binary file. – don_crissti Dec 26 '18 at 10:36

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.