We want to use Raspbian Lite with the LXDE graphical user interface on a Raspberry Pi Zero. We need the reduced memory usage compared to a full install of Raspbian.
(This article describes an earlier version of Raspbian Lite, Raspbian Jessie Lite. The current version is Raspbian Buster Lite.)
Raspbian Lite uses the same Debian Linux base as Raspbian. The Lite version has no graphical user interface and none of the application junk. Raspbian Lite uses only 1.4 gigabytes on disk instead of the 4 gigabytes swallowed by the full version.
You load Raspbian Lite onto a microSD card. An 8 gigabyte card is enough. 16 is recommended for expansion. Buy a fast card because the card is the system disk.
Image on microSD
The Raspbian Lite image file expands out to two partitions on the microSD card. Partition 1 is a 63 MB FAT boot partition named boot. Partition 2 is a 1.3 GB Ext4 partition named Filesystem
.
Install
Insert the microSD card in the Raspberry Pi then start the device. Raspbian will start, run through some Linux command line stuff, then display the following.
Raspbian GNU/Linux 8 raspberrypi tty1 raspberrypi login:
Enter the user id, pi, then the password raspberry.
Enter the following command to open the Raspberry Pi Software Configuration Tool.
sudo raspi-config
Select Expand Filesystem
to expand Raspbian across the whole microSD card. You will see some command line stuff rush past then a message about the resize happening on the next reboot.
Select Boot Options
to change the login at boot time. Select Console Autologin to automatically log you in as pi, saving you a couple of seconds.
Select Internationalisation Options
to fix up the country and keyboard settings. Change the locale, timezone, keyboard layout, and Wifi country. You have to select the Internationalisation four times to set the four options.
Select Finish then Yes to reboot.
Connect the Wifi
There is more detail about this step in www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md.
Enter the following command to find your local Wifi networks.
sudo iwlist wlan0 scan
Look at the lines starting with ESSID
. You need that plus the password for the network.
Enter the following command to edit one of the Wifi configuration files.
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
The file should contain lines similar to the following. If the file is empty, you may have typed a name wrong in the previous command.
country=AU ctrl_interface=DIR=/var/run/wpa_supplicant update_config=1
In the Nano editor, add the following lines to the end of the current entries.
network={ ssid="Optus-something-somethingelse" psk="300g0jar" }
Ctrl-o starts the file write then press Enter to complete the write. Ctrl-x closes the Nano editor.
Back at the command line, enter sudo reboot
to restart the network and test the wireless configuration will work when you boot up the machine.
Update the current software
Enter the following command to update the operating system's list of available packages. The update downloads about 9 megabytes.
sudo apt-get update
You will see errors if the Wifi has not connected.
Enter the following command to install updates. My machine downloaded 23.3 megabytes. The increase in disk space is only 0.295 megabytes.
sudo apt-get upgrade
Enter the following command to install more updates. There was nothing downloaded by this step.
sudo apt-get dist-upgrade
You can also enter the following command to remove obsolete items. You normally do this only after a major upgrade when packages are replaced by something different.
sudo apt-get clean
Install LXDE
LXDE is the light weight graphical user interface installed in the full version of Raspbian. We will install it here without all the extras, the games and other junk.
LXDE is built on Xorg. Enter the following command to install Xorg. The download is 26.1 megabytes and it uses 72 megabytes on disk.
sudo apt-get install xserver-xorg
The install takes a couple of minutes, long enough to put the kettle on for a cup of tea or coffee.
Enter the following command to install an Xorg command line start option. You may never need this but the download is only 2.6 megabytes and it uses only 6.4 megabytes on disk.
sudo apt-get install xinit
Enter the following command to install LXDE. This is the big bit. The download is 71 megabytes and it uses 242 megabytes on disk.
sudo apt-get install lxde-core lxterminal lxappearance
You now have time to use the boiled water to make and drink that coffee.
Enter the following command to install the LightDM login manager. The download is 25 megabytes and it uses 35.1 megabytes on disk.
sudo apt-get install lightdm
A large chunk of the LightDM download is gnome theme junk. LightDM could be trimmed for LXDE.
You can now start raspi-cinfig again, sudo raspi-config
, select Boot Options, then select Desktop Autologin
.
Reboot.
You now have the Debian Raspbian LXDE desktop.
Cleanup
Change the desktop background to something bland, a plain light colour.
You can remove the annoying screensaver with the following command.
sudo apt-get purge xscreensaver
Preferences
Select the menu icon then Preferences.
Under Preferences, there is a "Customise Look and Feel" application. I did not find anything worth changing. You might prefer a different theme on your screen.
"Default Applications for LXSession" might be worth changing if you install new applications to replace current applications.
Package Management
There is no package manager installed. Unfortunately the recommended package manager, Synaptic Package Manager, is currently broken. We are stuck with the command line for a few more months or years.
You could enter the following command to install the Synaptic Package Manager. The Synaptic Package Manager might be fixed by the time you read this. The download would be 4.5 megabytes and it would use 18 megabytes on disk.
sudo apt-get install synaptic
Network management
Enter the following commands to install the Network Manager. The downloads total 5.9 megabytes and use 22.2 megabytes on disk.
sudo apt-get install network-manager
sudo apt-get install network-manager-gnome
Select the menu icon, Preferences, then Network Connections.
Resource usage
The highest memory usage on my Raspberry Pi 3 B was 110 megabytes and the highest CPU usage was 24%. 24% is one core out of 4 and may be the limit for applications that cannot use multiple cores.
Software installed
Select the menu icon. You have three menu options, System Tools, Preferences, and Run.
Run is just a cut down terminal. Use a terminal window for commands so you can see all the messages and run extra commands to verify the results.
System Tools
File Manager PCManFM
PCManFM 1.2.3 is the file manager installed with LXDE. PCManM has everything you expect from using the Nemo file manager and equivalents.
The search is slightly more complicated and gives you more control of the search. Look in the menu bar, Tools, Find Files. Adding a simple search would help make PCManFM better than Nemo.
LXTerminal
The LXDE terminal window appears to be the same as every terminal window in every version of Linux and Unix.
Root Terminal
This is a broken option. The application asks for the "root" password but there is no password disclosed for root. There is nothing you could do in Root Terminal that you cannot do in the regular Terminal window by using the "sudo" option.
Task Manager
The LXDE task manager is LXTask 0.1.6. LXTask lists the tasks and their resource usage plus a total CPU usage and a total memory usage. There are no fancy charts and no network usage. Network usage is the one other resource item you might want to know.
UXTerm
UXTerm is another terminal window and not as pretty.
XTerm
Xterm appears to be the same as UXTerm. Neither is as useful as LXTerminal.
Preferences
Step through the Preferences options looking at what you can change.
Customise Look and Feel
Open the Customise Look and Feel item in the Preferences menu. Select each tab across the top and browse the options. You might want to change something.
The "Other" tab has the sound effects options. If you switch off the sound effects, your Raspberry Pi should use less electricity. This could make a difference when running on batteries.
Default applications for LXSession
Select the Default applications for LXSession item in Preferences. Select each of the menu items in the left part of the LXSession configuration window and browse the options. You might want to change what is started automatically.
Desktop Preferences
Desktop Preferences lets you change the desktop background colour and other settings. Open the application. Browse each tab. You can reach the same Desktop Preferences by right clicking the desktop.
Desktop Session Settings
Select the menu option. Look at the "Automatically Started Applications" tab then the "Advanced Options" tab. Do you want the network software automatically started? You can change that type of setting in the Desktop Session Settings.
Network Connections
The network icon in the bottom righ corner gives you some options when you select the icon then some more options when you right click the icon. One of the right click options is Edit connections. You can select the same option through Preferences, Network Connections. This is the place where you can create bridges and other fancy options.
Select Add then the drop down arrow in Choose a Connection Type. Read the options. This is the place to create those options. Select Cancel then close the Network Connections window.
Openbox Configuration Manager
Openbox lets you control the theme fo open windows. The default theme is Onyx and is ok on my screen. You might choose something else for a different screen. Note all the other options you can change. You might want to change the docking options or number of desktops.
Copied from the full Raspbian
The editor in Raspbian is Leafpad. You can install Leafpad with the command sudo apt-get install leafpad.
I would like to use the Synaptic Package Manager but it is broken. Synaptic works in the full Raspbian but fails when installed in Raspbian Lite. There is some slight difference in configuration that makes Synaptic useless.
Resource usage
Raspbian Lite with LXDE uses 82 MB of memory with the Task Manager loaded. A simple action, resizing a window, uses 25% of the CPU instead of the 50% used by the MATE graphical user interface.
The installation had 112057 files using 1.4 gigabytes of disk space.
Conclusion
The extra work to set up Raspbian Lite with LXDE is worth the effort when your project is headed toward a Raspberry Pi Zero. For the Raspberry Pi 3, use the standard Raspbian and forget the bloat. A Raspberry Pi 2 is close to a 3 but might benefit from the Lite version of Raspbian, depending on the code you want to run on top of Raspbian. The Raspberry 1+ is close to a Zero and would benefit from customising the Lite version.
- Log in to post comments