Abstract - last modified 2022-03-03
How to fix LMDE 3 (Cindy), LMDE 4 (Debbie) and LMDE 5 (Elsie) not sourcing *profiles and not adding user directories to PATH on x-session startup (using the default lightdm display manager).
Use at your own risk - you have to read and accept the disclaimer
Although the tool (and the web page) is still named lmde3_fix_profile, it covers LMDE 3/4/5 versions.
According to reports from user's the missing profile-support does additionally affect the integration of applications installed via snap too. After applying the workaround/fix snap-packages started working as expected.
A more general issue
Updated-Version: As there are seemingly more debian-based distributions affected by the issue - the tool has been updated to allow overriding the distribution and versions-tests. Be aware: you still have to use lightdm as login manager with an unmodified wrapper-setup to be able to use the workaround (the setup will test for it and deny modifications otherwise)!
Long story short
This is a short summary for the experienced user, needing only the essential bits. If you are new user or interested in the details - skip this section!
You will need sudo-rights to be able to execute the installer. The fix does test for being used with an unmodified ligthdm installation.
Users of LMDE install the fix by:
source <(wget \ https://www.orcus.de/Entities/linux/lmde3-fix-profile.sh \ -O - )
After applying the fix you need to reboot, to get the modifications into effect.
People using a different debian based distribution - who want to override the LMDE x version-test have to run:
source <(wget \ https://www.orcus.de/Entities/linux/lmde3-fix-profile.sh \ -O - ) --disable-os-check
Motivation
Since version 3 (Cindy), LMDE profiles are not read on xsession startup and some typical user directories aren't added to the PATH environment of the xsession.
The issue is related to the usage of lightdm as new default DM for LMDE 3/4/4 (and some other debian-based distributions) which misses some required "bits" to be fully setup.
Affected files are:
- /etc/profile
- /etc/xprofile
- $HOME/.profile
- $HOME/.xprofile
Files being located at:
- /etc/profile.d
Objective
The workaround is meant to be used for installations, which are using the default DM lightdm. If you are using a different DM, the fix will not work for you - have a look at .xsessionrc and .xinitrc in that case.
The fix adds two missing files and sets a required option at the configuration of lightdm (lightdm.conf).
Remarks
Before applying any modifications at all, you should first check if you are (still) affected at all, or if there is a related update available already.
Although the fix should not break an actual installation and is tested keeping safety-first in mind: Backup important data BEFORE modifying your system by applying the fix (at least if your data is of any value to you).
Steps
1 - Test if being affected
There are several ways one could check if profiles get read/sourced on startup.
1.1 - append echo-output to file at /tmp
Add (temporarily) following lines to the header of each profile-file of interest:
# debugging x-profiles getting (not) sourced on x-session startup # comment or remove if not needed anymore (after debugging) date >>/tmp/pro-$USER.txt echo "PPID='$PPID' '$0' src '$BASH_SOURCE' for '$USER'" >>/tmp/pro-$USER.txt
Remarks: using /tmp/pro-$USER.txt does ensure the file(s) will be writable by the actual user(s) + having them at a single location. Adding (optional) the output of date does help to keep track of repeated calls from different consecutive tests using logout & login, or by switching to a login-shell. Due to be located at /tmp, the files will be removed on shutdown/reboot.
- $PPID - the process ID of the calling process
- $0 - the caller = the DM (lightdm) or a login-shell (bash)
- $BASH_SOURCE - the name of the actual profile-file
- $USER - account-name of the current user
If the according profile-file is read/sourced, /tmp/pro-*.txt -files will be available after logout/login and contain the according message. If this is the case, then you are NOT affected and could just remove/comment the according echo-statement(s) and stop right here.
For a working setup an according output will look similar to the following:
demo@lmde-3-cinnamon-64bit:~$ ls /tmp/pro* /tmp/pro-demo.txt demo@lmde-3-cinnamon-64bit:~$ cat /tmp/pro-demo.txt Tue Apr 9 01:01:19 CEST 2019 PPID='746' '/usr/sbin/lightdm-session' src '/etc/profile' for 'demo' Tue Apr 9 01:01:19 CEST 2019 PPID='746' '/usr/sbin/lightdm-session' src '/home/demo/.profile' for 'demo' Tue Apr 9 01:01:19 CEST 2019 PPID='746' '/usr/sbin/lightdm-session' src '/etc/xprofile' for 'demo' Tue Apr 9 01:01:19 CEST 2019 PPID='746' '/usr/sbin/lightdm-session' src '/home/demo/.xprofile' for 'demo' Tue Apr 9 01:34:30 CEST 2019 PPID='1863' '-bash' src '/etc/profile' for 'demo' Tue Apr 9 01:34:30 CEST 2019 PPID='1863' '-bash' src '/home/demo/.profile' for 'demo' demo@lmde-3-cinnamon-64bit:~$
Showing that the user has logged into the x-session and afterwards using a bash login-shell using a working setup => no need to apply the fix at all.
If /tmp/pro-*.txt -files do not get created (if only using the x-session), or would only contain according entries created by using a bash login-shell: your are affected.
1.2 - export and check for unique env-variable
Alternative: You can check if exported unique environment-variables will be available on the x-session by inspecting the output of env. Be sure to have some unique variable name in use, which does not get set anywhere else.
To cross-check that missing environment variables are exported in a proper way, one could switch to a console using CTRL+ALT+F1 (switch back to the GUI later using ALT+F7 ) and login there. As the bash shell does source /etc/profile and ~/.profile via (an unmodified/default) ~/.bashrc if being used as login-shell, defined env-variables should be available at the console-session ( /etc/xprofile and ~/.xprofile are not honored/sourced by a bash login-shell).
If extra/modified env-variables are visible only, using a bash login-shell: you are affected.
2 - Check for missing updates
If you did proof being affected, check next for offered updates related to lightdm (in case the fix got merged/accepted by mint devs in the meantime) and install available updates instead of using this fix.
Any related update/fix will require you to reboot to get into effect. Recheck afterwards again: If your issue is solved - remove/comment any extra edits on your profile-files.
3 - Install the fix
You will need to be member of sudo -group to be able to apply the required modifications. This will typically be the case for the primary user, who did install the machine. To check current user ids and groups use:
id
which will output a similar output (and should list sudo):
demo@lmde-3-cinnamon-64bit:~$ id uid=1000(demo) gid=1000(demo) groups=1000(demo),27(sudo) demo@lmde-3-cinnamon-64bit:~$
You should first check for last recent information supported by the tool itself. This will just display according technical information and wont start any action at all.
Copy/Paste the entire command, including the leading 'source' and the trailing 'VERINFO' at the end:
source <(wget \ https://www.orcus.de/Entities/linux/lmde3-fix-profile.sh \ -O - 2>/dev/null) VERINFO
Which will show an output similar/identical to (updated version to cover LMDE 3/4/5):
demo@lmde-5-cinnamon-64bit-beta:~$ source <(wget https://www.orcus.de/Entities/linux/lmde3-fix-profile.sh -O - 2>/dev/null) VERINFO lmde3-fix-profile.sh V005 - 2025-03-03 Add missing *profile support to LMDE 3/4/5 (and other debian based distributions) using lightdm ---------------------------------------------------------------------- general information lmde3-fix-profile.sh V005 - 2025-03-03 ---------------------------------------------------------------------- With LMDE 2 (betsy) mdm did care about sourcing "*profiles". Since LMDE 3 (cindy) did switch the default DM from mdm to lightdm. The compile time defaults used with lightdm at debian are set to ignore profile files (global and per user) the same as it doesn't add typical user related folders to the PATH environment. ---------------------------------------------------------------------- Thus defined export env-variables will not be usable with this files: /etc/profile /etc/xprofile /home/demo/.profile (aka $HOME/.profile) /home/demo/.xprofile (aka $HOME/.xprofile) Accordingly it is not possible to setup (install- or) user-specific environment variables in a common/expected way for the x-session. ---------------------------------------------------------------------- This workaround does - add missing/required files (lightdm-wrapper and a helper-file for error-/message-display) - adjust lightdm config to override a precompiled lightdm setting to honor/use the lightdm-wrapper. ---------------------------------------------------------------------- Remark: lightdm does use precompiled config-values, where defaults differ between the debian- and ubuntu-based versions regarding usage of lightdm-wrapper! ubuntu / mint 19.x, 20.x -version = active debian / LMDE 3,4,5 -version = inactive Thus an according config-option has to be set explicitly with LMDE to activate the usage of an available lightdm-wrapper. ---------------------------------------------------------------------- Before doing any modifications to the installation, the tool does test if - you are using a matching version of LMDE 3,4 or 5 - lightdm is used (a lightdm-session is running) at all - there are no other/previous versions of the required additional files present - the lightdm-wrapper setting is not configured If any of this tests wont match, the system will NOT get modified. ====================================================================== modifications done in detail add wrapper-file : /usr/sbin/lightdm-session create helper-dir: /usr/lib/lightdm add helper-file : /usr/lib/lightdm/config-error-dialog.sh adjust DM config : /etc/lightdm/lightdm.conf - replace : #session-wrapper=lightdm-session - with : session-wrapper=lightdm-session ---------------------------------------------------------------------- As long the debian-version of lightm does use a disabled precompiled value of 'session-wrapper' it is sufficient to comment the according line in the lightdm.conf file and reboot afterwards to disable the wrapper again. ---------------------------------------------------------------------- Besides sourcing the *profiles, the wrapper (based on the according version used at mint 19.0) does source further directories - see the wrapper-file for more information.
Applying the actual fix is quiet simple - by using the command without the VERINFO parameter:
source <(wget \ https://www.orcus.de/Entities/linux/lmde3-fix-profile.sh \ -O - 2>/dev/null)
The tool will in any case first check if your are using a matching and unmodified (in regards to lightdm-setup) installation. And will only in this case offer to apply the fix at all.
[click to enlarge]
If you decide to abort the fix using CTRL+C : Nothing has been modified or downloaded by the tool until now at all. Only thing left to do is: Remove/comment potential made debugging-modifications added to the *profile-files.
After using Enter to continue, you will get asked for YOUR password to perform the actual modifications. After successfully entering your pw, the tool downloads required files and adjust the setting of lightdm.conf to make use of it.
[click to enlarge]
As part of the installation there will be a file lmde3-fix-profile.txt created showing information about the used version of the fix, and some general information. Which you could inspect at a later time using:
cat lmde3-fix-profile.txt
which should return something similar to:
demo@lmde-5-cinnamon-64bit-beta:~$ cat lmde3-fix-profile.txt ---------------------------------------------------- lmde3-fix-profile.sh V005 - 2025-03-03 Add missing *profile support to LMDE 3/4/5 (and other debian based distributions) using lightdm applied at: Thu 03 Mar 2022 05:23:30 PM CET ---------------------------------------------------- finished without reported errors at: Thu 03 Mar 2022 05:23:31 PM CET
To get the modifications into effect a reboot of your machine is required.
You should check afterwards, that your profiles are getting sourced now by the x-session as expected. If everything is looking fine, you should remove/comment debug-changes made at your *profile -files.
4 - Further questions
If you have further questions - I often hang around as "orcus" at the #linuxmint-help support-channel at spotchat-irc.
Good luck - have fun