LightDM doesn't show the user background

Mmm, so either this is an issue that is specific to 16.10 (I know LightDM has changed the way its conf files are handled but I don’t know when) or it’s specific to my setup, but it happens both on my main PC and my laptop (which has a fresh install of Ubuntu Mate).

I’ll try on 16.04 in a VM to see how it goes.

I should add, if it is in the user/share/backgrounds folder the greeter picks the file up as well. So, in other words, as long as it is in my main OS partition, it is picked up. The reason I referred specifically to my home folder was because of extra, personal backgrounds I may decide to use. This is on 16.04 64 bit

So, I’ve tried Ubuntu Mate 17.04 alpha 2 (in case the issue was with LightDM and it had been updated) and 16.04.1 (up to date). In both cases, the issue is present.

Are you using an alternative greeter or Ubuntu Mate’s default one? In the latter case, have you updated the conf file? I’m asking this because the one from Mate specifically disable the user background in its conf file (but it doesn’t work better for me by changing this option).

I am using the default one and have made no edits to any conf files for it

for clarity:

Release 16.04.1 LTS (Xenial Xerus) 64-bit

Kernel Linux 4.4.0-59-lowlatency x86_64

MATE 1.12.1

Just to be sure: you simply set a picture as desktop background and it appears on the login screen, you don’t set it in the LightDM GTK+ system settings?

No. To set the desktop background I use the normal background chooser. See below:

To set the Greeter background, I use the greeter settings. See below:

Oh, ok. So that confirms it’s not my issue.

The thing is that you shouldn’t have to set the background in the LightDM GTK+ Greeter settings at all, LightDM is supposed to set the user background with the option “Use user wallpaper if available” (which is supposed to be on by default, I assume you unchecked it, or maybe it’s because of Mate’s default conf file), which overrides the background set in the configuration.

My problem is that however the settings are tweaked, the desktop background is not used instead of the LightDM background, whatever greeter is used. It works fine on Xubuntu (and probably other DEs) but not on Ubuntu Mate for reasons that are a complete mystery to me. My best guess is that LightDM is unable to get the path to the background due to the way Mate stores its settings.

Ah…right. I didn’t realise that was supposed to be a feature. I have always set the backgrounds independently, even if it was the same background being used.

I’ve just installed xubuntu-desktop on my main PC alongside Mate. After setting a desktop background in Xfce, it appears fine on the LightDM login page, so it seems to confirm that the issue is LightDM being unable to get the background file path from Mate.

Ok, I’ve found where the issue is via a similar bug in Cinnamon: mate-settings-daemon doesn’t use AccountsService, or doesn’t have a specific plugin to manage the background with it. Basically, the daemon is supposed to update the file /var/lib/AccountsService/users/username through gsettings to add/update the background in the User section. This value is then used by LightDM to fetch the user background and display it as expected.

I’ve updated a bug report I had opened on Launchpad.
EDIT: opened one too on GitHub for msd.

(cc @Wimpy)

1 Like

I’ve managed to make a script that fixes the issue. It might be a quick a dirty hack, but it works. Hopefully, the functionnality will be properly integrated in mate-settings-daemon at some point.

#!/bin/bash

function setuserbackground(){
	export USERBACKGROUND=`gsettings get org.mate.background picture-filename | tr -d "'"`
	dbus-send --system --type=method_call --print-reply --dest=org.freedesktop.Accounts /org/freedesktop/Accounts/User`id -u` org.freedesktop.Accounts.User.SetBackgroundFile string:"$USERBACKGROUND"
}

setuserbackground

dbus-monitor --profile "type='signal',interface='ca.desrt.dconf.Writer',path='/ca/desrt/dconf/Writer/user',arg0path='/org/mate/desktop/background/'" |
while read -r line; do
	setuserbackground
done

Put it in /usr/bin (I called it msd-background-helper), make it executable and run it at session start. You can put the following msd-background-helper.desktop in /etc/xdg/autostart so that it’s started on each session automatically:

[Desktop Entry]
Type=Application
Name=MATE Settings Daemon Background Helper
Comment=Sets the user background in AccountsService on MATE
Exec=/usr/bin/msd-background-helper
OnlyShowIn=MATE;
X-MATE-Autostart-enabled=true

I’ll try to make a proper deb package for easier distribution and installation.

Note that the default Ubuntu Mate LightDM GTK greeter disables the user background option, so you’ll have to activate it through the LightDM GTK+ Greeter Settings that’s in System → Administration (“use user wallpaper if available”).

1 Like

@Wimpy: do you think this could/should be added directly in Ubuntu MATE?

I’m thinking about it. The script needs cleaning up a little, might be better to run it periodically than perpetually.

If I’m not mistaken, the content of the loop triggers only when dbus-monitor sends a signal when the background is changed.

Yeah, but there is a perpetual bash process running to provide it.

Do you have a cleaner solution (besides checking every few seconds rather than constantly)? I’ve been looking for some documentation to setup an event listener with dbus in bash or Python but couldn’t find relevant informations.

Just in case somebody uses my script, I’ve noticed a bug in it. Here is a small update (that would also fix another issue specific to Ubuntu MATE 17.10):

#!/bin/bash

function setuserbackground(){
	export USERBACKGROUND=`gsettings get org.mate.background picture-filename | tail -c +2 | head -c -2`
	dbus-send --system --type=method_call --print-reply --dest=org.freedesktop.Accounts /org/freedesktop/Accounts/User`id -u` org.freedesktop.Accounts.User.SetBackgroundFile string:"$USERBACKGROUND"
}

setuserbackground

dbus-monitor --profile "type='signal',interface='ca.desrt.dconf.Writer',path='/ca/desrt/dconf/Writer/user',arg0path='/org/mate/desktop/background/'" |
while read -r line; do
	setuserbackground
done

The change is in the line that sets the USERBACKGROUND variable: it would remove single quotes in the whole path and thus wouldn’t work with wallpapers that have one. As for UM 17.10, it seems that bash changed the gsettings output to being between double quotes instead of single ones. The command now removes the first and last characters (the quotes) rather than quotes in the path.

New version of my script to be compatible with the new way LightDM handles user backgrounds starting with Ubuntu MATE 18.04:

#!/bin/bash
#
# Sets the following:
# [org.freedesktop.DisplayManager.AccountsService]
# BackgroundFile
# [User]
# Background
# in /var/lib/AccountsService/users/$USER

function setuserbackground(){
	export USERBACKGROUND=`gsettings get org.mate.background picture-filename | tail -c +2 | head -c -2`

	dbus-send --system --print-reply \
	--dest=org.freedesktop.Accounts \
	--type=method_call \
	/org/freedesktop/Accounts/User`id -u` \
	org.freedesktop.Accounts.User.SetBackgroundFile string:"$USERBACKGROUND"

	dbus-send --system --print-reply \
	--dest=org.freedesktop.Accounts \
	/org/freedesktop/Accounts/User`id -u` \
	org.freedesktop.DBus.Properties.Set \
		string:org.freedesktop.DisplayManager.AccountsService \
		string:BackgroundFile \
		variant:string:"$USERBACKGROUND"
}

setuserbackground

dbus-monitor --profile "type='signal',interface='ca.desrt.dconf.Writer',path='/ca/desrt/dconf/Writer/user',arg0path='/org/mate/desktop/background/'" |
while read -r line; do
	setuserbackground
done

I’ve put a deb on a Dropbox account if you want to install/uninstall it easily: https://www.dropbox.com/s/zmf5sf7t11v0zdv/msd-background-helper_0.7_all.deb?dl=0

It’s probably badly made and might trigger Lintian errors but it works. Before installing it, delete the script in /usr/bin and the .desktop in /etc/xdg/autostart if you used the previous version.

I wanted to create a script that would apply the Nitrogen background to the display manager. Your script helped me accomplish this, more than any other resource I could find. You can find it at this little github repo of mine:

It also has a script to apply changes to gtk 2 cursor, gtk, and icon themes to other relevant places, since LXAppearance doesn't seem to do all that I want.

I'm using these as part of an Openbox enviornment that I'm setting up for myself.

Hi, is there any fix for this issue other than using the script?

What process/application is involved in setting the background and what is supposed to update /var/lib/AccountsService/users/<username> file? As mentioned, this lightdm background change works fine in Xfce. I could see each time I change background, the BackgroundFile key is updated from within Xfce but not when in MATE.

[org.freedesktop.DisplayManager.AccountsService]
BackgroundFile='/usr/share/backgrounds/ubuntu-mate-groovy/groovy-gorilla-green.jpg'

The mate settings daemon background 'active' key is enabled.

sai@sai-HP-Laptop-14-bs0xx:~$ gsettings get org.mate.SettingsDaemon.plugins.background active
true

What is it that is missing in MATE?