On Wed, May 1, 2024 at 6:13 PM Alban Browaeys <alban.browa...@gmail.com> wrote:
> So you were right that reverting commit ccecd9c9 would fix your issue,
> but not because gdm added a bug but because it stopped hiding an
> underlying "bug" (well wrong default PATH value in systemd for Debian).
> It could be that systemd maintainers thing this is gdm job to overwrite
> their value, though it looks more correct to me to bug them first as
> they are the one setting the wrong default for Debian (or so I believe,
> I have not checked extensively if the wrong PATH default value could be
> fine at the systemd level and be changed afterwards).
Thanks again! I finally found some time to further investigate this.
I have reassigned this bug report to the systemd package,
but it looks like base-files and libpam-modules are the packages
involved.

My Debian system was installed in 2022-10. To be sure this wasn't
just a misconfigured system in 2022, I checked again with a fresh
Debian 12.5 install and found that the same defaults are present.

> The Debian specific defaults are shown in /etc/profile
Reading that made me check Ubuntu's defaults:
/etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
/etc/profile
(no mention of PATH)

It looks like Ubuntu sets PATH in /etc/environment through libpam-modules
and /usr/lib/environment.d/99-environment.conf is symlinked to it.
Debian sets PATH in /etc/profile through base-files and its
/usr/lib/environment.d/99-environment.conf
is symlinked to an empty /etc/environment also created by libpam-modules.

Ubuntu's libpam-modules runs a postinst script:
# Add PATH to /etc/environment if it's not present there or in
# /etc/security/pam_env.conf
if [ "$1" = "configure" ] && dpkg --compare-versions "$2" lt
1.3.1-5ubuntu5; then
    if ! grep -qs ^PATH "$DPKG_ROOT"/etc/security/pam_env.conf; then
        if ! grep -qs ^PATH= "$DPKG_ROOT"/etc/environment; then
            echo
'PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"'
>> "$DPKG_ROOT"/etc/environment
        fi
    fi
fi

Debian's libpam-modules postinst:
if dpkg --compare-versions "$2" lt 0.99.9.0-1 && ! [ -f
"$DPKG_ROOT"/etc/environment ]
then
     touch "$DPKG_ROOT"/etc/environment
fi

I think we can narrow this down to base-files and/or libpam-modules.
I'm not sure if doing the same thing as the Ubuntu package would be
the right thing
so I'm CC'ing the maintainers for both packages and the debian-desktop
mailing list
for advice instead of reassigning the bug report again.

Reply via email to