Skip to content

Setup guide Bookworm and X

helgeerbe edited this page Jun 1, 2024 · 4 revisions

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-get install --no-install-recommends   xserver-xorg   xserver-xorg-legacy   x11-xserver-utils xinit   python3-pip   libopenjp2-7   libgles-dev   libatlas3-base   libxrender-dev python3-venv
sudo reboot 

After reboot login via ssh to your raspberry and configure Xorg In order to run PictureFrame, configure the X server to execute as root.

ssh pi@raspberrypi
sudo sed -i 's/\(^allowed_users=\).*/\1anybody/' /etc/X11/Xwrapper.config
sudo bash -c 'echo "needs_root_rights=yes" >> /etc/X11/Xwrapper.config'

Run raspi-config for some initial settings:

sudo raspi-config

This should show config tool

image

  • 1 System Options -> S5 Boot -> B2 Console Autologin as 'pi' user
  • 2 Display Options -> D2 Screen Blanking -> Enable screen blanking
  • 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}

Set config to use glx

nano ~/picframe_data/config/configuration.yaml
display_power: 1 
use_glx: True

Create autostart script for X

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

Content of file is:

#!/bin/bash
xset -display :0 dpms 0 0 0 &
xset -display :0 s off &
source /home/pi/venv_picframe/bin/activate  # activate phyton virtual env
picframe   #start picframe

Autostart picframe

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 Pi3

[Service]
ExecStart=xinit /home/pi/start_picframe.sh
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