Setup guide Bookworm and Wayland - helgeerbe/picframe GitHub Wiki

Download Imager and OS

Download imager (to create sd card) and an image of the Raspberry Pi OS lite (64 bit).

[!NOTE] At the time of writing, this was the actual image.
Raspberry Pi OS Lite Release date: October 10th 2023 System: 64-bit Kernel version: 6.1 Debian version: 12 (bookworm) Size: 435MB

Preparing sd card

image

  1. The raspberry device (in my case a Pi 3)
  2. Own image and then select the downloaded image
  3. Your sd card

Click 'NEXT' and enter your settings (yellow frame).

image

image image

I will use those settings throughout this guide

Click 'SAVE' and confirm your settings (yellow frame).

image

Confirm that you want to delete the actual data on your sd card (yellow frame)

image

Done

image

Initial setup of your raspberry

Remove sd card and put it into your raspberry. Power on the device.

Raspberry should boot to desktop.

Login via ssh to your raspberry and do an OS update and install missing software packages:

ssh pi@raspberrypi
sudo apt-get update 
sudo apt-get full-upgrade
sudo apt install python3-venv git libsdl2-dev xwayland labwc wlr-randr

Login via ssh to your raspberry and run raspi-config for some initial settings:

ssh pi@raspberrypi
sudo raspi-config

This should show config tool

image

  • 1 System Options -> S5 Boot -> B2 Console Autologin as 'pi' user
  • 5 Localisation Options -> L1 Locale -> de_DE.UTF-8 UTF-8 (or whatever what your country is)
  • 6 Advanced Options -> A1 Expand Filesystem and reboot

When you are done, click 'Finish' and confirm that you want to reboot.

image

Install picframe

picframe will run under the user 'pi' with restricted rights. And we will setup a virtual python environment, so picframe dependencies will not interfere with other python applications that you might use as well.

Create python virtual environment and activate it

ssh pi@raspberrypi
mkdir venv_picframe
python -m venv /home/pi/venv_picframe
source venv_picframe/bin/activate

Install picframe

Install picframe

pip install picframe

At the end you should see something like this

Installing collected packages: paho-mqtt, IPTCInfo3, PyYAML, Pillow, numpy, defusedxml, pi3d, pi-heif, ninepatch, picframe
Successfully installed IPTCInfo3-2.1.4 Pillow-9.5.0 PyYAML-6.0.1 defusedxml-0.7.1 ninepatch-0.2.0 numpy-1.26.1 paho-mqtt-1.6.1 pi-heif-0.13.1 pi3d-2.49 picframe-2023.7.26.post1

Configure picframe

picframe -i /home/pi/ # accept defaults
mkdir {Pictures,DeletedPictures}

Create autostart script for labwc (compositor for wayland)

nano start_picframe.sh
#copy content from below in editor
chmod +x ./start_picframe.sh

Content of file is:

#!/bin/bash
source /home/pi/venv_picframe/bin/activate # activate phyton virtual env
picframe   #start pic frame

Autostart picframe

Programs that sould be autostarted by labwc have to be configured in ~/.config/labwc/autostart Boot to console with user 'pi' logged in and use a systemd service to start 'labwc'.

Create autostart config file:

mkdir -p ~/.config/labwc
nano ~/.config/labwc/autostart
#copy content from below

Content of autostart

/home/pi/start_picframe.sh

Create rc.xml config file:

nano ~/.config/labwc/rc.xml
#copy content from below

Content of rc.xml Without this, after screen blanking picframes appears with window decorations (like titelbar, ...)

<windowRules>
    <windowRule identifier="*" serverDecoration="no" />
</windowRules>

Create user systemd service to start picframe on boot

mkdir ~/.config/systemd/user/ -p
nano ~/.config/systemd/user/picframe.service
# copy text from below in editor
[Unit]
Description=PictureFrame on Pi

[Service]
ExecStart=/usr/bin/labwc
Restart=always

[Install]
WantedBy=default.target

Enable service and reboot

systemctl --user enable picframe.service
sudo reboot

Enjoy the show !!!!


Controlling the service

You have the following options:

  • Enable service systemctl --user enable picframe.service
  • Disable service systemctl --user disable picframe.servcie
  • Start service systemctl --user start picframe.service (does not work over ssh)
  • Stop service systemctl --user stop picframe.service
  • Stop restart systemctl --user restart picframe.service (does not work over ssh)
  • Check logfiles journalctl --user-unit picframe.service

Additional tweaks

Disable bluetooth

To disable bluetooth

sudo nano /boot/config.txt

Look for

# Additional overlays and parameters are documented
# /boot/firmware/overlays/README

and add below:

For pi prior 5

# Disable Bluetooth
dtoverlay=disable-bt

For pi 5

# Disable Bluetooth
dtoverlay=disable-bt-pi5

Silent boot

To minimize the output on screen while the raspi boot up

sudo nano /boot/cmdline.txt

Append to the line

quiet logo.nologo loglevel=3 vt.global_cursor_default=0