Better Session Detection in MDM 2.0
by clem 16

The upcoming version of MDM, which will be featured as an upgrade in Betsy and as default in Linux Mint 17.2, received important changes today.

At first sight, you probably won’t notice much difference, that “lambda” sign in your login screen might switch to a little “Ci” or “M”, indicating that MDM corrected your session selection. Under the hood though, the way things work in regards to sessions was completely redesigned.

Warning: This post is quite technical :)

The way it worked

Prior to version 2.0, if MDM didn’t find a valid session in your ~/.dmrc it would run a generic built-in default session which ended up running whatever /etc/alternatives/x-session-manager pointed to. That worked just fine but it meant that, in the absence of a .dmrc file, MDM didn’t actually really know what you were running… and that’s an issue because even though it didn’t really need to know, it meant that your session was a tiny bit different depending on whether you selected a session or ran the default one.

For instance, if you didn’t select any session in MDM, you would see the following:

  • “ps –ef –forest” would report x-session-manager as being your session manager
  • “env” would report DESKTOP_SESSION as being equal to “default”

If you selected the Cinnamon session in MDM, you would see the following:

  • “ps -ef –forest” would report cinnamon-session as being your session manager
  • “env” would report DESKTOP_SESSION as being equal to “cinnamon”

In both cases, you’re running the exact same session… it looks the same, it’s Cinnamon, the same settings are applied etc etc..  but there are tiny differences which are important. Although x-session-manager basically runs cinnamon-session, we lose information here. If a script or a program wanted to detect if Cinnamon was running.. and if that script relied on the DESKTOP_SESSION variable or the cinnamon-session process name… it would fail.

Now.. there are a lot of scripts and programs upstream which try to detect things a certain way in an effort to run in some environments and not others. Many of them rely on DESKTOP_SESSION.

So, the main reasons to redesign session management in MDM were to:

  • Make the environment more consistent (i.e. no difference between a session chosen by the user and one selected by default)
  • Provide more information to the environment (i.e. have the session manager clearly visible in the process list, and DESKTOP_SESSION reflect the target session)

As added bonuses:

  • MDM became more configurable
  • Session management worked much better than before
  • As a result of reviewing the code and redesigning it, we got rid of more than a thousand lines (that’s important for a big project like MDM)

The way it works now

Screenshot from 2015-03-17 23:48:25

MDM now only ever uses x-session-manager as a last resort, when it’s unable to find a valid session it looks at the following and stops as soon as it finds one:

  • Your ~/.dmrc file
  • The value of “DefaultSession” in the MDM configuration (ignored if set to “auto”)
  • The value of “DefaultSessions” in the MDM configuration. This is a coma-delimited list, where sessions are checked one after the other and the first one to be valid is selected.

This, along with the fact that MDM now supports /usr/share/mdm/distro.conf, allows distributions to define which sessions are detected and in which order of preferences when shipping with multiple environments.

16 thoughts on “Better Session Detection in MDM 2.0

  1. sizonov_stas Mar 17,2015 23:10

    How can I test the new feature?

  2. clem Mar 18,2015 08:13

    You’d have to build from Git..

    Launch mintsources, tick “Enable source code repositories”, open up a terminal and type:
    – apt update
    – apt build-dep mdm
    – apt install git dpkg-dev debhelper
    – cd
    – mkdir -p Sandbox
    – cd Sandbox
    – rm -rf *.deb
    – git clone https://github.com/linuxmint/mdm.git
    – cd mdm
    – dpkg-buildpackage
    – sudo dpkg -i ../*.deb

    Then, when you’re ready you can re-launch MDM with “sudo service mdm restart” (in Mint) or “sudo /etc/init.d/mdm restart” (in Betsy).

    The configuration is available at (in order of priority):

    – ~/.dmrc
    – /etc/mdm/mdm.conf
    – /usr/share/mdm/distro.conf
    – /user/share/mdm/defaults.conf

    You can also enable debug in “sudo mdmsetup”, and that makes MDM output debug info in /var/log/syslog.

    PS: If things go wrong, reinstall the MDM version from the repositories (for instance if you’re running Rebecca you can do “apt install mdm=1.8.3+rebecca”). If in doubt as to what versions are in the repositories, you can type “apt policy mdm”.

    Warning: This is git master and thus pre-2.0. It should normally be labeled as MDM 1.9.x and it is considered unstable.

  3. Pierre Mar 18,2015 19:06

    Will MDM 2.0 address the issue with the account image when the home directory of the users are encrypted ?

    I have a stupid question but I don’t know where I can find the answer, so I try here (sorry):
    I use the Default Mint-X html theme which rotates the defaults linux mint wallpapers (v17.1). I would like to remove some wallpapers (or eventually to add a few custom ones). How can I do this ?

    Thanks !

    • clem Mar 18,2015 20:00

      Hi Pierre:

      – I’m planning to work on the encrypted home dir compatibility. The ~/.face picture can’t be read and neither can .dmrc. That makes MDM unable to show your picture, but also unable to detect your language and your last session. Upstream developers solved that issue with something called AccountsService… we’ll have to see if that’s something we want to use, but in any case we’ll definitely work on these issues.

      – You cannot configure the wallpaper slideshow (although that’s been talked about as well and it might land in MDM 2.0). What you can do though is edit the file it’s using… it’s /usr/share/mdm/html-themes/Mint-X/slideshow.conf.

      • Pierre Mar 19,2015 17:32

        Hi Clem,

        I’m glad this problem is already in your todo list !

        PS: Thanks for the location of the slideshow.conf : it’s now configured as I want :)

      • Pierre Jul 6,2015 16:40

        I just upgraded to Linux Mint 17.2 and I confirm the compatibility problems with the encrypted home directories are solved !

        Thanks for the very good job, it’s really appreciated ! :-)

  4. Rob Parker Mar 22,2015 00:05

    …no reply, but I wanted to thank Clem and the entire Mint dev team for their indefatigable efforts to keep a demanding end-user community happy!

    Warm regards,

    Rob

  5. Arndt Mar 24,2015 10:01

    Hello Clem,

    nice work that you are doing on Linux Mint. I love it! :)

    I have a question regarding newer USB sticks that are marked as hard drives for Windows 8 certification issues. mintstick is not able to recognize becaus UDisks send removable = 0 indead of 1. Is there a way that this gets a fix in a newer version of mintstick? I don’t want to use dd all the time for bootable USB sticks. :)

    Keep up the good work all of you!
    Arndt

    Edit by Clem: Should be fixed in git master as of today. We also worked on “mint-dev-tools” which allows you to quickly run git master versions in Mint and LMDE today, I’ll post about this soon.

  6. josh Mar 25,2015 11:47

    How’s cinnamon play with systemd these days?

    Edit by Clem: It decides whether to play with systemd or consolekit/upower at compilation time, rather than runtime. This should change in 2.6 hopefully. I’m not sure whether you’re asking in relation to Mint or another distro.. if so, we’re using cinnamon-screensaver in consolekit mode in both LMDE 2 and Mint 17, and we’re using cinnamon-session/cinnamon-settings-daemon in logind mode in LMDE 2 and in consolekit/upower mode in Mint 17.

  7. josh Mar 26,2015 13:44

    Thanks Clem! I actually meant to say, How does MDM play with systemd these days? I use LMDE2 and Arch with cinnamon, Arch uses systemd and logging in and out with mdm on it can be very slow. I pretty much turned my Arch into Linux Mint Arch Edition, but I ended up switching to lightdm cuz mdm didn’t play nice.

    • clem Mar 27,2015 14:31

      MDM doesn’t communicate with logind, it uses consolekit. We’re considering adding logind support to it at the moment but that’s not done yet.

  8. Josh Mar 27,2015 14:38

    Thanks Clem!

  9. belahcene Apr 6,2015 14:56

    Hi,

    Supports remote login ( thru XDMCP)

    Is it possible to do it with new MDM, in previous mdm, it is not done !!

    If so where to configure it.

    I want to enter from a local machine running to a remote server using XDMCP.

    I want to configure the mdm in order to get in the menu of the login window of mdm the remote servers running XDMCP?

    on one word : I want to add a remote XDMCP login to my menu in window login

    thanks for help
    best regards

  10. Anand Apr 7,2015 05:48

    http://segfault.linuxmint.com/2013/09/mdm-lost-10-pounds/#comment-2944 > Please check here for previous discussion on XDMCP.

  11. Dan Saint-Andre Apr 10,2015 16:39

    I want to use my laptop fingerprint reader for LOGIN and UNLOCK and related authorization and authentication. However, when I enable and configure this, all sorts of other “user password” features (like ‘sudo’) break. [I suspect a problem with ‘pam’ and ‘auth’ and friends.] Will MDM 2x address use of fingerprints and other forms of end-user authentication beyond passwords?

    While not specifically and MDM & login posting, my thinking groups all things password and biometric authorization and authentication with the login-screen suite. I’ve always thought that when apps ask for passwords, a fingerprint utility would scan, map the print to secure stored data, then pass that data to fullfill the password request.

  12. Jan K Oct 13,2015 05:57

    I had long been wondering what these strange glyphs are next to the flag at login. Thank you for this glimpse under the hood into the complexities that you (Clem and team) smooth out for us end users.

Comments are closed.