[solved] Issue converting to headless multi-user boot

Running mate 17.04 on a amd64 box.

Once I have everything set up I went to run headless and only use graphical remote sessions.

I have done this on other linux desktop OS installs that use systemd.

sudo systemctl set-default multi-user.target

This should then boot to the prompt and also allow me to have remote x sessions. This kinda works but.

It boots but gets hung before the prompt. If I alt-f6 I can get to the login prompt and continue on but if so a

startx I get

could not acquire name on session bus

if I go back to graphical.target all is ok.

I suspect that something of X session is getting started that shouldn’t in the multiuser.target default. That’s why it hangs and that’s why when I startx that message is waiting for me???

Maybe related is if I do a shutdown from the prompt it goes to a mate graphical splash (and usually gets hung as well :9). There would be no reason to do this if no x session had been going on.

A bit related…

Alternatively I’d be happier with an unbuntu 17.04 install and then add the latest mate desktop. I don’t need the all the other user software but I do need basic graphical tools. So a couple tips to do that and I might try it. In the meantime if I can get the multi-user target to work that would be fine.

I’ll mention what I’ve done for years and currently running on 16.04 LTS.

  • Install Ubuntu Server with no desktop environment for files, mail, owncloud, etc.
  • Install a GUI like synaptic - it will bring along the minimal X components it needs.
  • Install gparted and a few other graphical tools.
  • Remotely, ssh -X works fine from my full desktop machines for these apps. A few glitches, like very basic theme appearance, but nothing major.

How’s that match? We may think of “headless” differently.


Bookmarked. I’ve ran headless Ubuntu servers before. Never logged in from a graphical remote session though. Interesting concept @Bill_MI.

To me “Headless” simply means no monitor attached to the server and all maintenance preformed remotely.

@steven No point in booting to a gui when the machine is only visited remotely. Client/Servers like nomachine will spawn an x session only when someone asks for a remote desktop session and can exit it afterwards. In general I mostly just use ssh to manipulate remote machines but lately like being able to remote in to a gui for more expansive work or if I have a noob who needs to do a few things. Thus it would be great if the mate community offered a minimal version (with all the end user software removed) and set up in “mult-user” by default and specially set up with the intention of remote gui session.

I’ve already switched to multi-user mode on RPI2/3 version and had no problems and if I removed the extraneous software I’d have that image…

but I am having issues with amd64 17.04 version which prompted this post.

1 Like

Please forgive my ignorance, remote GUI login is something I know very little about. So in the quote above, would this be a minimal Mate desktop set to boot to the command prompt, or a Ubuntu server with a minimal Mate desktop installed?

Ironically, I recently implemented multi-user target on a Mate desktop that I had installed on top of Ubuntu 16.04 mini. It was purely experimental, but one thing I noticed by using multi-user target was that it really wasn't like the machine booted to the command prompt and stopped there. To me this was more like booting into a GUI text mode, than it was booting to a command prompt. And during shutdown I also got the mate graphical splash as you wrote in your original post. This is probably part of the problem your having, as you have already indicated.

I also looked at the NoMachine web site. I may have to experiment with this when time permits. Anyway, if you had the minimal Mate desktop set according to plan, would you log in to it using something like this?


Not being satisfied with the Mate desktop mentioned above, I eventually started over and found a way, with a tip from @lah7, to install an extremely light version of Mate on top of Ubuntu mini. It might be of interest to you as there is no need to use multi-user target, and it boots to a true command prompt, using startx to run the GUI. Then back to the command prompt when exiting the GUI. Would be good for a lite version of Mate on a server if someone wanted to do so.


1 Like

I had considered this before. This issue with ubuntu mini is that that image is not UEFI/gpt bootable (only legacy bios/mpt bootable). I have wholly adopted uefi and refind for booting all my machines which support it dropping grub, etc. so I had no interest in going backwards on that progress. If unbuntu finally releases mini booting UEFI then what you suggest is definitely the best path to a minimal unbuntu booting to multi-user target mode.

BTW multi-user target is a “target” of systemd (not Xwindow) and would be so even if the system had no graphical target (gui) installed. Systemd will be the default init system on 16.04+

EDIT: Here https://onetransistor.blogspot.nl/2015/12/install-ubuntu-minimal-cd-uefi-enabled.html I found instructions for modifying the minimal iso for UEFI booting. So I guess I will attempt and then add mate and report back

1 Like

Yup this worked great.

Follow the directions for making EFI enabled minimal ubuntu https://onetransistor.blogspot.nl/2015/12/install-ubuntu-minimal-cd-uefi-enabled.html.

To make a bootable UEFI stick with minimal install image

  1. Take a usb stick. With gparted make it gpt, create a 100mb fat16 partition. Download refind flash zip and unzip it to this partition. https://sourceforge.net/projects/refind/files/0.10.8/

  2. Make at least a 1gb partition ext4. Copy the efi minimal folder you made above. You can delete the grub folder in boot/ and any other grub stuff.

Boot efi in a new machine (might have to enter machine setup and choose the stick from “boot override” or set it as the first to boot.

Now you can install minimal on your machine. Make your install drive gpt. If you choose the no bootable option it won’t install/ boot via grub and you can use refind instead. In that case you do pretty much the same thing as on the stick (make the 100mb uefi esp bootable partition but copy the contents of the bin zip file from refind). You’ll have to get efibootmgr going and add refind in that boot partition to the list. WHen you boot refind will come up and list your minimal install and then boot it automatically by default if it is the only one.

Nice thing about about that setup is you can easily make your machine multi boot by just adding other efi distros as their own partition. Refind will find and list all bootable OS partitions.

Once the minimal is running you can then do as you please. I installed the ssh server (during the install) and then followed what @steven did in his link above and that worked out great. Ran startx, then installed firefox from the beta ppa at launchpad. Downloaded nomachine from their website. Exited the gui, then used dpkg to install it from the command line and it works great. From the command line on the minimal box I can launch a nomachine remote session from another box and get a GUI on the minimal headless if I need/want it :slight_smile:

I’d recommend installing gparted and gnome-disk-utility packages for easier management of your machine’s drives. I’d also recommend using qt5-fsarchiver (dieter baum has a ppa for that)

So at this point I have 2.7GB install! on a 4gb partition. Sweet. No need to fall back to multi-user and thus my issue that prompted this post is gone and betteI have a minimal machine with just enough desktop support for gui remote session. I’m much happier!

That’s small enough to make create a partition image with gnome disk and xz it for moving to any machine or giving to a friend. Personally I use qt5-fsarchiver as it makes a smaller image especially if you have a large partition with very small install on it and can do that on a mounted root partition even. dd is not good in that regard.

If someone can offer up a “free” place to put such an image (and all the download bandwidth) I’d upload my image as it is now. That would help with everyone’s DRY.

Important Addition to my Solution:

I have set up nomachine to do remote sessions and this works well but if you need to start a x session directly on the machine you have two choices since as a regular user you can’t start an x session (on tty0) without root privileges in 16+ now.

  1. sudo startx # start a x session as root
  2. Install a display manager for doing a login from normal user

If doing choice 2 and you want to keep things as minimal as possible then try xdm
sudo apt install xdm

then to disable it starting at boot
sudo systemctl disable xdm

then from the command line just
sudo xdm

then in your session if you want to get back to the commandline open a terminal and kill the session
sudo killall xdm

you can install other dm’s like gdm3 but they install a ton of gnome and other dependencies thus ruining your minimal install. In my case I have not much reason to start an x session directly or doing it as root is fine.

But once again if you only want remote gui sessions or doing a mate session as root then you don’t need a display manager installed.