I needed to have some defaults available in my i3 configuration and was using LightDM. I asked in the i3 github discussion pages if people knew why it was failing. It appears Debian stripped some functionality. So how do you solve this?

Answer

You want to have your own session wrapper for lightdm. I stole this recipe from Ubuntu:

#!/usr/bin/sh

for file in "/etc/profile" "$HOME/.profile" "/etc/xprofile" "$HOME/.xprofile"; do
  [ ! -f "$file" ] && continue
  . $file
done

/etc/X11/Xsession $@

I install this in /usr/local/bin/lightdm-session. And then dpkg-divert the Debian version of lightdm.conf:

sudo dpkg-divert --divert /etc/lightdm/lightdm.conf.dpkg-divert \
  --rename /etc/lightdm/lightdm.conf

After which you install your own version of lightdm.conf in /etc/lightdm/lightdm.conf:

# See /etc/lightdm/lightdm.conf.dpkg-divert for a complete list of options
[Seat:*]
session-wrapper=/usr/local/bin/lightdm-session

LightDM also use a .d style configuration, so you might want to try that out first before playing with dpkg-divert. This approach has worked for me.

For those who have an ansible playbook
- name: Install /usr/bin/lightdm-session
  become: true
  copy:
    src: lightdm-session
    dest: /usr/local/bin/lightdm-session
    mode: 0555
    owner: root
    group: root

- name: Divert configuration
  become: true
  community.general.dpkg_divert:
    path: "{{ item }}"
    divert: "{{ item + '.dpkg-divert' }}"
    rename: yes
    state: present
  with_items:
    - /etc/lightdm/lightdm.conf
    - /etc/lightdm/lightdm-greeter.conf

- name: Install lightdm configuration
  become: true
  copy:
    src: "{{ 'files/' + item }}"
    dest: "{{ '/etc/lightdm/' + item }}"
    mode: 0444
    owner: root
    group: root
  with_items:
    - lightdm.conf
    - lightdm-greeter.conf

# We don't start lightdm, it might interfere with one of our users sessions
# Also, during testing it might interfere with your own session if you run
# lightdm, which we do, because.. this role.. amirite or what?
- name: Enable lightdm
  become: true
  service:
    name: lightdm
    enabled: true

And for those wondering, the lightdm-greeter.conf is overriden because I use a custom font:

[greeter]
font-name=Inter Medium

See also: