Skip to content

Setup a Simple X11 Desktop Environment on the Lite Image

sakaki edited this page Oct 5, 2019 · 1 revision

Quickly setup a simple X11 desktop environment on the 'lite' variant image!

Introduction

Even if you have chosen to work with the more minimal gentoo-on-rpi-64bit 'lite' image, which as shipped boots only to a CLI, you can still easily (and quickly) put together a simple X11 graphical desktop. In fact, since the 'lite' image uses the same custom profile (and hence USE flags etc.) as the 'full' version does, you'll find that the packages you need to install are mostly already available (in compiled form) on the project's binhost. You should also find that RPi-specific features (such as VC4/V3D acceleration) 'just work', without further configuration.

In this brief tutorial, we'll run through how to set up a very basic instance of the openbox window manager, over X11.

This is just an example of what can be done, and you can obviously adapt as required to your own use case.

Prerequisites

You'll need a RPi4 B (or RPi3 B/B+) running the most recent 'lite' copy of the image. I'm going to assume you have performed a first boot, been able to log in as root (initial password raspberrypi64), and that you have network connectivity (ping etc. works).

Hint: you can use the bundled tool nmtui to easily establish persistent WiFi connections from the command line.

Ensuring your Image is Up-to-Date

Although optional, it is wise to ensure your image is fully up-to-date before proceeding further.

To do so, (as root) issue:

pi64 ~ # genup

Let this process run to completion - it may take a few hours if a lot has changed. Once you see the message:

* All done - your system is now up to date!

you can safely continue.

Installing the Necessary Packages

Next, let's install our X11 server, openbox window manager, and a couple of simple X11 applications.

Issue:

pi64 ~ # emerge -v x11-base/xorg-server x11-terms/xterm \
  x11-apps/xsetroot x11-apps/xclock x11-wm/openbox 

At the time of writing, only x11-wm/openbox was unavailable on the binhost (and so required local compilation). As such, on an RPi4, the above command should take less than 15 minutes or so to complete (hence the claim that installing a simple graphical desktop on the 'lite' image is by no means an onerous process).

Setting Up a Trivial .xinitrc

Once the above completes, you can set up an simple .xinitrc file for demouser:

pi64 ~ # sudo su - demouser
demouser@pi64 ~ $ nano -w ~/.xinitrc

You can of course set up your own 'regular' user as described here. For simplicity, in this guide we'll stick to demouser.

Place the following (sample) content in that file:

openbox &
xsetroot -solid CornflowerBlue &
xclock -geometry 100x100-1+1 &
xterm -geometry 80x50+494+51 &
xterm -geometry 80x20+494-0 &
exec xterm -geometry 80x66+0+0 -name login 

Save, and exit nano.

For more information on what the above means, please see here.

Starting X11

That's it: the setup is done, and you can now try starting up X11/openbox! Issue:

demouser@pi64 ~ $ startx

and with luck you should see something like the following desktop appear on your RPi's display (minus the commands shown in the leftmost terminal of course!):

Screenshot of RPi4 running basic openbox desktop on X11

If you right-click on the (light blue) background area on the desktop, an openbox context menu will appear (as shown above). Be aware that the menu displayed is simply the shipped default (you can modify it by creating ~/.config/openbox/menu.xml if you like), and so many of the applications shown won't be installed on your system, and will fail to start if selected. Nevertheless, you should be able to run xterm (a simple terminal emulator), as we installed it earlier.

You should also find, if you examine /var/log/Xorg.0.log, that accelerated (glamor) rendering via the vc4/v3d driver is in use.

Enter "exit" in the leftmost terminal to quit X11, and return to the command line.

Of course, you can use any lightweight window manager you like, setup a proper login manager etc. Up to you!

Clone this wiki locally