I switched to Arch for a while and got very used to booting to the terminal, logging in, and running "startx" to start my WM. I, of course, could change which WM or DE to run in the ~/.xinitrc file.

Now I am back to Ubuntu and am wondering how using a display manager handles this. When the display manager begins, it runs X. Then the user is given options of which WM or DE they wish to run.

So when the display manager starts, does it simply run "startx"? After that, what configuration in what file gets changed when the user selects the WM/DE they want to run? Basically I just want to know the steps that take place from the display manager starting to the WM/DE beginning.

I know this isn't Ubuntu-specific, but since I am back on Ubuntu, I figured I could just ask here.

  • 1
    Here on Ask Ubuntu there is very little questions of the "how does it work" type, which I believe is a shame. Here, have a +1 for asking such a thing, this is definitely going to be helpful for other interested individuals! – Rafał Cieślak Oct 11 '13 at 18:54

The sessions available to log in to are set using .desktop config files stored in /usr/share/xsessions. The way the DM initializes the desktop can vary depending on the DE, but this directory is where the DM looks, and the files specify how to start it.

Different DMs handle desktop selection differently. In Ubuntu (using the default LightDM), you can click the Ubuntu icon in the upper right of the "login pane" to change DEs:

Click the Ubuntu Logo here... ...to select a DE here.

Most DMs will provide a configuration file, where a system default session can be selected. It may also store the last used session for each user, e.g. to allow one user to always login to Gnome instead of Unity.

When you log in, the DM simply looks at if you have a preference stored, then runs the .desktop file for the session in your preference or the system default.

  • Thanks, definitely a helpful reply. So what does the DM use to start X? And why doesn't it run .xinitrc after you login? – Sterling Oct 14 '13 at 17:29
  • I'm certainly not an expert in this type of software, but my research leads me to believe that the DM transfers control of its own X Server to the user logging in. It's then up to whatever command the DM runs to initialize the desktop components. – Ian Santopietro Oct 14 '13 at 17:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.