How to install a minimal Mate desktop on your Raspberry Pi

The purpose of this tutorial is to show you how to install a minimal Mate desktop based on Raspbian Stretch Lite for the Raspberry Pi.

It should be noted that the Ubuntu Mate team already provides a full Mate desktop environment for the Raspberry Pi based on Ubuntu 16.04. You can find more information about that at

  • Project: Install a minimal Mate desktop on top of Raspbian Stretch Lite
  • Operating System: 2017-11-29-raspbian-stretch-lite
  • Hardware: Raspberry Pi 3 (RPi3) Model B

This tutorial assumes that:

  1. You either have a spare Micro SD card, or you don’t mind overwriting your existing Micro SD card. You will loose all data on your existing Micro SD card if you choose to overwrite it. I highly recommend purchasing a new Class 10 Micro SD Card for the purposes of the project if you choose to duplicate it.

  2. You have enough skills to install applications, update the system, and edit configuration files from the command line.

Part 1: Getting started

First you will need to download the Raspbian Stretch Lite image from

Then write the image to your Micro SD Card by following the directions using the gnome disk utility from the following link.

Part 2: Changes to Raspbian Stretch Lite

After you have Raspbian Stretch Lite up and running on your Raspberry Pi, there are some necessary changes that you will need to make.

  1. Before changing any passwords, or editing any files, run sudo raspi-config, and select Localisation Options > Change keyboard Layout. Then select the correct keyboard layout to match your requirements. For me this was Generic 105-Key PC.

  2. Then while still in Localisation Options select Change Locale, and change the language to match your requirements. For me this was en_US.UTF-8 UTF-8.

  3. Before leaving Localisation Options, you should set the Time Zone and Wi-fi Country as well.

  4. The importance of setting the Localisation Options for me was that the special characters where not typing correctly, and thus when I changed the password from a SSH session, it could not be reproduced with the keyboard connected to the Raspberry Pi, or from the SSH session. I was essentially locked out of the system until I found a workaround.

Part 3: Setup WiFi

If you need to setup WiFi run the following command:

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Add the following to the end of the file


Changing “networkname” to your WiFi network name, and “networkpassword” to your WiFi network password.

Then save (Ctrl+O) and exit the file (Ctrl+X)

Reboot the system by entering sudo reboot, and if all the information was entered correctly, a WiFi connection should now be established.

You can test the WiFi connection by pinging google


If you get a output, press Ctrl+C on you keyboard to stop the ping command.

Now that WiFi is working, it’s time to hide the plain text password in wpa_supplicant.conf

First run the following command

wpa_passphrase "networkname" "networkpassword"

Changing “networkname” to your WiFi network name, and “networkpassword” to your WiFi network password.

This will yeld something like the following:


Replace this new information in wpa_supplicant.conf and reboot the system.

If WiFi is still working after rebooting, edit wpa_supplicant.conf once more and remove the line #psk="networkpassword". Then save and exit the file.

Now that WiFi is completely setup, it would be a good time to update your system by running the following command:

sudo apt update && sudo apt upgrade

Part 4: Enable SSH logins

You may wish to enable SSH logins on your Raspberry Pi. I do this so I can log into my Raspberry Pi from the terminal of my Ubuntu Mate system, which allows me to copy & paste commands from my setup notes. Very handy if you ever need to re-install, or just want to make some changes with out physically being in front of your Raspberry Pi.

To setup SSH logins, run the sudo raspi-config command, and select Interfacing Options > SSH to enable SSH.

Part 5: Change the default user

Raspbian comes pre-loaded with a user account named pi. The password for the pi account is raspberry. Since this information is widely known on the Internet it presents a huge security risk, especially if your going to login into your Raspberry Pi from a location outside of your local network. To correct this situation, you should first create a new user account, followed by removing the default pi account.

To create a new user, run the following command:

sudo useradd -m username -G sudo

Followed by:

sudo passwd username

Replacing username with the name of your new user account in each command.

Log out and log into the new user account. Check to see if the sudo command works by running the sudo visudo command, which can only be run by an account with sudo privileges.

Remove the pi account:

Now that you are logged into your new user account, and the sudo command is working correctly, it’s time to remove the default pi account. You can do so by running the following command:

sudo deluser -remove-home pi

Remove /etc/sudoers.d/010_pi-nopasswd:

The file /etc/sudoers.d/010_pi-nopasswd allows the default pi account to use the sudo command without entering a password. Since the pi account has been removed, I first made a backup of the file:

sudo cp /etc/sudoers.d/010_pi-nopasswd /etc/sudoers.d/010_pi-nopasswd~

Then I removed it:

sudo rm /etc/sudoers.d/010_pi-nopasswd

Change default shell:

When previously logging in as the default user pi the command prompt appeared normally as [email protected]:~ $, and pressing the UP key displays previously typed commands.

But when logging in as the newly created user, the prompt only shows “$”, and the UP key displays the characters ^[[A

If you experience the same situation, it can be corrected by running the following command:

echo $SHELL

If this does not return /bin/bash it means that the bash shell is not being used by the created user.

This can be changed by running the following command:

sudo usermod -s /bin/bash username

Replacing username with the name of your new user account.

It’s likely the cause of all this is because the system has a different default shell than bash.

Part 6: Installing additional applications (optional)

The following command will install some useful command line utility applications:

sudo apt install htop iftop traceroute finger nmap glances

You may wish to google these apps before installing them if you do not know what they do.


You can check your Raspberry Pi’s temperature by running the following command:

sudo /opt/vc/bin/vcgencmd measure_temp

Part 7: Installing a minimal Mate desktop

Run the following command to install a minimal Mate desktop:

sudo apt install mate-desktop --no-install-recommends mate-desktop-environment-core mate-themes mate-session-manager xinit mate-terminal mate-applets pluma software-properties-gtk xserver-xorg

Next create a file named .xinitrc in your home directory

nano .xinitrc

Then add the following content to the file

exec mate-session

Then save (Ctrl+O) and exit the file (Ctrl+X)

Reboot your system sudo reboot, then log in and start a Mate desktop session by entering the startx command.

If everything went well, your new minimal Mate desktop should be running. :relaxed:

Part 8: Fixing a few things

The monitor I have connected to my Raspberry Pi is a Dell U2211H, and currently there is a border around each edge of the monitor screen. In Monitor Preferences display resolution is fixed at 1824 x 984. However, the following command reveals a discrepancy.

$ sudo /opt/vc/bin/tvservice -s
[sudo] password for steven: 
state 0x12000a [HDMI CEA (16) RGB lim 16:9], 1920x1080 @ 60.00Hz, progressive

As you can see, the monitor should be set to 1920 x 1080.

The solution to all this was to edit /boot/config.txt and uncomment disable_overscan=1

After rebooting, the screen is now filled and the resolution is set to 1920x1080 in Monitor Preferences.

Part 9: More software additions (optional)

The following is a list of applications that I find to make the Mate desktop more robust and allows me to work as I normally would. You may wish to google these apps before installing them if you do not know what they do. You can also open a terminal and use apt to find more information about each application. For example:

apt search gufw

Mate desktop related and useful utilities

system-config-printer (If you have a printer)
simple-scan (If you have a scanner)

Web browser, office suite, audio & video playback


Part 10: Making it your own

This turned out to be a longer tutorial than I imagined it would be. If you have followed it to the end, you should now have a minimal Mate desktop installed on your Raspberry Pi. From this point forward you can tweak everything to your liking, and install your own personal list of must have applications. Please feel free to reply to this post with any changes you made along the way. I look forward to seeing how you use this information.

As for me, I’m going to shut down my Raspberry Pi, remove the Micro SD card, plug it into my laptop, and use the Gnome Disk Utility to make a disk image of it that can be restored at a later date if needed.

Part 11: Playing sound through external speakers

If you wish to play sound through external speakers that are connected to your Raspberry Pi’s 3.5mm audio jack, you will need to run the following command:

sudo raspi-config

Then navigate to Advanced Options > Audio and select Force 3.5mm ('headphone') jack. Then select <OK> and <Finish>.

Part 12: GParted and Administrator Authentication

After installing GParted on this system I soon found out that it could not be authenticated by supplying the sudo password.

I had previously ran gksu-properties to change authentication from su to sudo in order for gksu to accept the sudo password, but this does not affect GParted authentication.

So here’s how to make it work:

Create a file in /etc/polkit-1/localauthority.conf.d/ and name it 60-desktop-policy.conf

I just opened a terminal and ran the following command:

sudo nano /etc/polkit-1/localauthority.conf.d/60-desktop-policy.conf

Then enter the following information into the file:


Then save (Ctrl+O) and exit the file (Ctrl+X)

Now GParted can be authenticated with the sudo password.

See the pklocalauthority man page for a more detailed explanation.


Hi! In case anyone has any trouble with graphics drivers, for some reason my raspbian didn’t see fit to pull in fbdev (maybe had something to do with me downloading from the kali linux raspbian repos, IDK). These two threads were a huge help to me!:

Hi, will the same steps that are described will work with Raspberry Pi OS lite too?
I followed the steps and encountered wit the below errors while upgrading:

/usr/lib/xorg/Xorg.wrap: Only console users are allowed to run the X server
xinit: giving up
xinit: unable to connect to X server: Connection refused
xinit: server error
Couldn't get a file descriptor referring to the console