Want to change the background wallpaper or just set another color for Ubuntu Gnome login screen? Here’s how to do the trick in Ubuntu 22.04!
As you may know, the GDM background is not easy to modify since GNOME hard-coded the CSS into a
.gresource file. Some scripts has been created in github to deal with it, but so far there’s no universal one that works on all Linux (or even all Ubuntu) editions.
I was waiting for the graphical GTK4 tool Login Manager, however, it never works and even breaks the login screen when I tried it in Fedora Workstation.
Change Login Screen Background in Ubuntu 22.04
For those still waiting for the maintainers to update their scripts, this one has been tested and works good in Ubuntu 22.04.
1. Firstly, press Ctrl+Alt+T on keyboard to open terminal. When it opens, run command to install the required library:
sudo apt install libglib2.0-dev-bin
2. Now, paste the command below and hit run to download the script via wget:
wget -qO - https://github.com/PRATAP-KUMAR/ubuntu-gdm-set-background/archive/main.tar.gz | tar zx --strip-components=1 ubuntu-gdm-set-background-main/ubuntu-gdm-set-background
3. OK, now use command to change login screen background image:
sudo ./ubuntu-gdm-set-background --image /PATH/TO/YOUR/IMAGE
Tip: instead of typing file path manually, you may just drag & drop image file into terminal to insert its path
Or set another background color via command (replace #aAbBcC to your desired value):
sudo ./ubuntu-gdm-set-background --color #aAbBcC
or set gradient color background via (replace
vertical as you want):
sudo ./ubuntu-gdm-set-background --gradient horizontal #aAbBcC #dDeEfF
As the terminal output indicates, press Ctrl+Alt+F1 (switch back via Ctrl+Alt+F2) to verify the changes or just restart your computer after saving your work.
Move the script to your PATH:
If you would like to use the script regularly, run the command below to move to “/usr/local/bin”:
sudo mv ~/ubuntu-gdm-set-background /usr/local/bin
Then, you may use the command at any time at any working directory via (change
sudo ubuntu-gdm-set-background --image /PATH/TO/IMAGE
As far as I know, it will NOT work if you do not type (or drop’n’drop) the FULL path to image. The last sudo command in previous picture didn’t work, as I navigated to image folder and type file name directly without path.
And if you use a remote image without pasting to local disk first, it may break your login screen so you’ll see the error screen as the bottom image shows.
How to Restore:
The script has a
--reset option to restore the original blank background. To use it, just run:
sudo ./ubuntu-gdm-set-background --reset
Or use this command if you’ve move it into your PATH:
sudo ubuntu-gdm-set-background --reset
If the login screen is broken with error “Oh, no! Something has gone wrong …”, press Ctrl+Alt+F3 (~ F6) (right Ctrl+F3 ~ F6 for Virtualbox VM) to get into tty console. Then type username and password one by one to login, and run the previous reset command to restore.