4

I found some old questions about this, yet not for 18.04.

We're deploying desktops via PXE/Preseed installations, and I'd like to change the default wallpaper. I found how to change the login screen wallpaper, but not yet how to change the default wallpaper for new users.

Any hint about this would be appreciated.

cl-netbox
  • 31,163
  • 7
  • 94
  • 131

3 Answers3

4

Posting as it took me some time to find a solution for Ubuntu 20.04, even though this is an old question, it might help others looking for this.

This is where I found the method: https://help.gnome.org/admin/system-admin-guide/stable/dconf-custom-defaults.html.en

What I tried and didn't work: I tried to edit the schemas folder directly (for people new to Ubuntu like me, the folder I'm referring to is found at /usr/share/glib-2.0/schemas/). The configuration file that I needed to edit was org.gnome.desktop.background.gschema.xml , yet for some reason, that wouldn't be applied to the new user, plus it is likely bad practice to edit these configuration files directly.

I then followed gnome.org 's guide and created a file here:

sudo nano /etc/dconf/db/local.d/01-background

Then add the following:

# dconf path
[org/gnome/desktop/background]

dconf key names and their corresponding values

picture-uri='file:///usr/share/backgrounds/your-own-wallpaper-here.jpg'

Make sure that your wallpaper is located at /usr/share/backgrounds/ and that you've edited either focal-wallpapers.xml or ubuntu-wallpapers.xml found at /usr/share/gnome-background-properties/ to include your wallpaper image (there are other posts that explain how to do this).

Lastly update dconf by running:

sudo dconf update

I would recommend rebooting, then creating a new user to test whether it's working. I hope this helps, it worked for me, let me know if you have better solutions or slightly improvements to this method.

Hugo
  • 41
  • This also works on almalinux, fedora, any distro with gnome... I use to deploy this on uni. Thanks! – Benyamin Limanto Apr 12 '23 at 07:41
  • You don't necessarily need to edit the existing XML files in /usr/share/gnome-background-properties. You can also add a new one; I am using -wallpapers.xml. That can make things easier when automating deployment of such a setup. – Kevin Keane Aug 27 '23 at 20:44
  • In Ubuntu 22.04, the settings in 01-background will be ignored because they are overridden in /usr/share/glib-2.0/schemas/10_ubuntu-settings.gschema.override . Create another schema override file with a higher number, then recompile the schema. See https://askubuntu.com/questions/1253238/how-do-i-change-default-settings-of-ubuntu for details. – Kevin Keane Aug 27 '23 at 21:45
2

The default wallpaper in Ubuntu 18.04 is warty-final-ubuntu.png, and the most easy approach to change it would be to convert (if necessary) your wallpaper to png format, rename it to warty-final-ubuntu.png, then rename the original default wallpaper and copy your wallpaper to the default location.

sudo mv /usr/share/backgrounds/warty-final-ubuntu.png /usr/share/backgrounds/warty-final-ubuntu-old.png  
sudo cp /<path-to-your-wallpaper>/warty-final-ubuntu.png /usr/share/backgrounds/warty-final-ubuntu.png  
cl-netbox
  • 31,163
  • 7
  • 94
  • 131
  • This works, indeed, but it's more a hack than a setting. After some searches, I could not find any other way, so I'll accept this answer. I tried with [org/gnome/desktop/background] picture-uri='file:///usr/share/mycompany/company-wallpaper.png' in /etc/dconf/db.ibus.01-mycompany.settings then dconf update but with no success : new users still get the Ubuntu's default wallpaper.. – Jean Coiron Aug 16 '18 at 14:31
  • @JeanCoiron I'd rather call it a workaround (the original background image still exists and each user can select it if he wants) ... changing the "hard-coded" default settings (somewhere "hidden" in the system) would be more a hack. The dconf method doesn't work, because every user can change the background individually - once you create a new user, he starts with the default wallpaper, which in Ubuntu 18.04 has the name warty-final-ubuntu.png. Anyway, I'm glad that I could help you to achieve what you wanted. :) – cl-netbox Aug 16 '18 at 15:47
0

The question is about Ubuntu 18.04, which is a bit dated. In Ubuntu 22.04, a few things have changed.

The settings in /etc/dconf/db/local.d/01-background will be ignored because they are overridden in the schema, specifically in /usr/share/glib-2.0/schemas/10_ubuntu-settings.gschema.override

To fix that, you have to add another, higher-numbered override file and recompile the schema. The process is described here: How do I change default settings Of Ubuntu?

  • Create a file named /usr/share/glib-2.0/schemas/20_my-settings.gschema.override. The content should be the same as described in the 01-background. You can also use 10_ubuntu-settings.gschema.override as a sample.
  • recompile with glib-compile-schemas /usr/share/glib-2.0/schemas/