On 16.04.4, I changed grub to boot into CLI instead of GUI by changing GRUB_CMDLINE_LINUX=”quiet_splash" to GRUB_CMDLINE_LINUX=”text”. I also ran a multi-user.target systemctl command (like this answer), but I am not appending this setting to the kernel as suggested here.

Now if I run startx, I get a blank desktop background with the X cursor (as another user shared in this comment). The response is to run sudo systemctl start lightdm, which will start the default desktop, but this loads as though I had just started the computer in GUI mode (and prompts me for a login). Is it possible to configure startx to run such that it loads the normal desktop GUI as if I'm already logged in, since I'm already logged in?

Notes in case it helps:

  • I haven't run the GRUB_TERMINAL=console for the black & white screen printing because it's not a priority to sterilize the startup that much yet.
  • The goal is to run a desktop OS on a 'mostly headless' system, but keep the option to run startx in the event a user is seated in front of it. [Yes, I could just have the user run the long 'lightdm' command, but startx is just so nice and convenient, not to mention legacy-friendly, and so it would be a great opportunity to educate users about startx and help them as we transition into a more linux-populated environment.]

At least on my 16.04 VM, I was able to start a unity session manually using

startx /usr/bin/unity

It's not entirely satisfactory since without the display manager, it doesn't appear to provide any logout button - you can exit the session by pkill unity but bear in mind it won't do any cleanup such as waiting for applications to close gracefully.

The process hierarchy seems to be

$ pstree -sp $(pgrep -n unity)
systemd(1)───login(1222)───bash(19282)───startx(8133)───xinit(8155)───unity(8160)───sh(8180)───compiz(8181)─┬─{dconf worker}(8183)

You can create a minimal ~/.xsession for the command if you want to be able to type startx alone.

See also How to start X and Unity, without gdm?

  • Hmmm, that definitely works, although as you said - without the display manager. How can I add or start a display manager? – user3.1415927 Jul 2 '18 at 18:36
  • ... also, why did startx unity work, but just unity didn't? (I've seen unity mentioned in other answers, so I tried it - along with gnome-shell and unity-2d-shell (<< askubuntu.com/a/148721/182241) – user3.1415927 Jul 2 '18 at 18:38
  • @user3.1415927 you can start the default display manager using sudo systemctl isolate graphical.target - but then you will need to log in again graphically. I don't think there's a mechanism to both log in directly to a user-session and start a display manager – steeldriver Jul 2 '18 at 19:26

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.