Installing RaspberryPi Desktop

1. Introduction

Raspberry Pi Desktop is actually a Raspberry Pi OS installed on a PC. It is based on Debian, it looks nice, and it is lightweight. It can give a new life to an old computer that is no longer powerful enough to run a modern commercial operating system. Actually, RaspiOS is so nice, that I would prefer it over other alternatives even on a new or powerful computer.

The only problem is that it is a bit outdated. For the time being, only the 32-bit version is available, that was released over two years ago, and is based on Debian 11 (bullseye). However, the good news is that it is not too difficult to install RaspiOS on top of the latest Debian stable realese (which is Debian 12, or bookworm). In this article I am going to show how I did it.

2. Install Debian 12 LXDE

We will start by installing Debian 12 with LXDE (the desktop of RaspiOS is based on LXDE).

  1. Download debian-live-12.8.0-amd64-lxde.iso from ISO images:

    wget https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/debian-live-12.8.0-amd64-lxde.iso
  2. Write it to an USB flash drive:

    lsblk
    sudo cp debian-live-12.8.0-amd64-lxde.iso /dev/sdX
    sync
  3. Boot the live Debian system from the flash drive.
    Then start the installation from the icon "Install Debian":

    debian12 start installation
    Figure 1. Start installing Debian

    At the end, reboot and remove the flash drive.

3. Install RaspiOS

On top of Debian we can install the RaspberryPi packages.

  1. Let’s make sure that we have the right package sources:

    # debian package sources
    cat <<EOF > /etc/apt/sources.list
    deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
    deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
    deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
    EOF
    
    # raspberry package sources
    cat <<EOF > /etc/apt/sources.list.d/raspi.list
    deb http://archive.raspberrypi.org/debian/ bookworm main
    EOF
  2. Get the key of the raspberrypi packages (82B129927FA3303E):

    # get the key of the raspberry source
    apt install --yes gpg
    
    apt-key adv \
        --keyserver hkps://keyserver.ubuntu.com \
        --recv-keys 82B129927FA3303E
    cp /etc/apt/trusted.gpg /etc/apt/trusted.gpg.d/
    Another way
    apt install --yes gpg
    mkdir -p ~/.gnupg
    chmod 700 ~/.gnupg
    gpg --no-default-keyring --keyring raspi.gpg \
        --keyserver hkps://keyserver.ubuntu.com \
        --recv-keys 82B129927FA3303E
    gpg --no-default-keyring --keyring raspi.gpg \
        --export --armor 82B129927FA3303E \
        > /etc/apt/trusted.gpg.d/raspi.asc
    rm raspi.gpg
  3. Update and upgrade:

    apt update
    apt upgrade --yes
  4. Install package raspberrypi-ui-mods (RaspiOS modifications of the LXDE desktop):

    apt install --yes raspberrypi-ui-mods
  5. Install additional packages:

    Install packages
    apt install --yes
        alacarte \
        apt-listchanges \
        apt-utils \
        bash-completion \
        build-essential \
        cifs-utils \
        console-setup \
        curl \
        debconf-i18n \
        debconf-utils \
        debian-reference-en \
        dillo \
        dosfstools \
        dphys-swapfile \
        ed \
        eom \
        ethtool \
        evince \
        fake-hwclock \
        fbset \
        ffmpeg \
        firefox-esr \
        fonts-liberation2 \
        gdb \
        geany \
        git \
        gnome-keyring \
        gpiod \
        gvfs-backends \
        gvfs-fuse \
        htop \
        hunspell-en-gb \
        hyphen-en-gb \
        init \
        iputils-ping \
        isc-dhcp-client \
        isc-dhcp-common \
        less \
        libcamera-tools \
        libmtp-runtime \
        libtext-wrapi18n-perl \
        luajit \
        manpages-dev \
        menu-xdg \
        meson \
        mkvtoolnix \
        nano \
        ncdu \
        network-manager \
        nfs-common \
        ntfs-3g \
        openocd \
        p7zip-full \
        pi-package \
        piclone \
        pigpio \
        piwiz \
        pprompt \
        python-is-python3 \
        python3-flask \
        python3-gpiozero \
        python3-pgzero \
        python3-picamera2 \
        python3-pigpio \
        python3-pip \
        python3-pygame \
        python3-rpi-lgpio \
        python3-serial \
        python3-smbus2 \
        python3-spidev \
        python3-twython \
        python3-venv \
        raspberrypi-net-mods \
        raspi-firmware \
        rp-prefapps \
        rpi-imager \
        rpi-update \
        sense-hat \
        squeekboard \
        ssh \
        strace \
        tasksel-data \
        tasksel \
        thonny \
        tree \
        udisks2 \
        unzip \
        usb-modeswitch \
        v4l-utils \
        vim-tiny \
        vlc \
        vulkan-tools \
        wamerican \
        wbritish \
        wireless-tools \
        wpasupplicant \
        xcompmgr \
        xserver-xorg-video-fbdev \
        zip
  6. Optionally, install some other packages that might be useful:

    Install packages
    apt install --yes \
        claws-mail \
        code-the-classics \
        kicad \
        libreoffice-help-en-gb \
        libreoffice-l10n-en-gb \
        libreoffice-pi \
        mu-editor \
        scratch \
        gimp \
        arduino \
        calibre \
        fritzing \
        xfce4-terminal

The result may look something like this:

raspi desktop

4. Customizing

4.1. Disable the switch-to-labwc prompt

Usually RaspiOS displays a popup window that asks wheather to keep X11 or to switch to Wayland/labwc. Let’s disable this prompt and keep X11 for the time being:

rm -f /etc/xdg/autostart/labwc-prompt.desktop

If later we want to switch to Wayland, we can do it from the command line with:

sudo raspi-config

4.2. Use multiple desktops / workspaces

By default RaspiOS has a single desktop. We can increase the number of desktops using the tool obconf (openbox configurator).

apt install --yes obconf

obconf

Alternatively, edit the configuration file ~/.config/openbox/lxde-pi-rc.xml and make sure that it contains a section like this:

  <desktops>
    <number>3</number>
    <firstdesk>1</firstdesk>
    <names>
      <name>Desk1</name>
      <name>Desk2</name>
      <name>Desk3</name>
    </names>
    <popupTime>0</popupTime>
  </desktops>

Then run:

openbox --reconfigure
Remove the file ~/.config/openbox/lxde-rc.xml, if there is such a file.

In order to show what is the current desktop, add the applet "Desktop Number / Workspace Name":

  1. Right-click on the panel and select "Add / Remove Panel Items".

  2. Click on "Add" and select "Desktop Number / Workspace Name", then "Add" button at the bottom.

The plugin "Desktop Pager" could have been useful too, but unfortunately it breaks the style/layout of the panel, when added.

4.3. Set up Hotkeys to switch between multiple desktops

Because multiple desktops are disabled by default, RaspiOS Desktop does not define hotkeys for switching between multiple desktops. This is easy to fix:

  1. Edit the configuration file ~/.config/openbox/lxde-pi-rc.xml and make sure that it contains definitions like this:

    <keyboard>
        ...
        <keybind key="C-S-Left">
          <action name="DesktopLeft">
            <dialog>no</dialog>
            <wrap>yes</wrap>
          </action>
        </keybind>
        <keybind key="C-S-Right">
          <action name="DesktopRight">
            <dialog>no</dialog>
            <wrap>yes</wrap>
          </action>
        </keybind>
        ...
      </keyboard>
  2. Reconfigure openbox:

    openbox --reconfigure

The hotkeys that we have chosen are Ctrl-Shift-Left and Ctrl-Shift-Right (Ctrl-Alt-Left and Ctrl-Alt-Right are already defined for other things).

For more details see this page.

4.4. Install font Monaco

I like this font and sometimes I use it as the default font for the terminal. It can be installed like this:

mkdir -p /usr/share/fonts/truetype/Monaco
cd /usr/share/fonts/truetype/Monaco
wget https://github.com/mikesmullin/gvim/raw/master/.fonts/Monaco_Linux.ttf
fc-cache -f .