Skip to main content
2 of 2
fix random taps of shift (also see https://www.freedesktop.org/wiki/Software/systemd/)
ilkkachu
  • 143.6k
  • 16
  • 255
  • 426

Display images using fbi on startup using systemd

I can successfully display images using the following command:

sudo fbi -T 1 /home/pi/photo-screen/photos/*.jpg -t 4

I now want to start a slide show of those pictures as soon as the Raspberry PI boots up.

So I added a systemd file like so:

[Unit]
Wants=graphical.target
After=graphical.target

[Service]
Type=simple
User=pi
Group=pi
WorkingDirectory=/home/pi/photo-screen
ExecStart=sudo bash -c "fbi -T 1 -d /dev/fb0 photos/*"
Restart=always
RestartSec=20

[Install]
WantedBy=multi-user.target
● photo-screen.service
     Loaded: loaded (/etc/systemd/system/photo-screen.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2023-12-11 15:12:07 CET; 61ms ago
   Main PID: 1080 (sudo)
      Tasks: 2 (limit: 472)
        CPU: 23ms
     CGroup: /system.slice/photo-screen.service
             ├─1080 sudo bash -c fbi -T 1 -d /dev/fb0 photos/*
             └─1082 fbi -T 1 -d /dev/fb0 photos/0058966c-7ee5-4fc0-80ec-55885809567b.jpg photos/04669eb7-bf5e-4cbf-ab8f-fc7b3566186d.jpg photos/0cc1ad40-1b05-4f1c-beae-0c285d6b62>

Dec 11 15:12:07 foto systemd[1]: Started photo-screen.service.
Dec 11 15:12:07 foto sudo[1080]:       pi : PWD=/home/pi/photo-screen ; USER=root ; COMMAND=/usr/bin/bash -c fbi -T 1 -d /dev/fb0 photos/*
Dec 11 15:12:07 foto sudo[1080]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1000)

Please note that I am signed in via SSH so assigning the right tty does work fine with the -T 1 parameter.

I tried:

  • Including chvt 1; in my script
  • Running it as root
  • Adding the option -d /dev/fb0 to my script
  • Using fim but there I have the exact same problem
  • Using non-relative paths

I have a screen attached and the login prompt does at some point get black but I don't see any images.

I did get OOPS Terminated at some point on the screen above the login prompt.

Also when I fill the screen with random stuff then it will be overwritten after some time with a black bar that fills around 80% of the screen:

cat /dev/random > /dev/fb0

enter image description here

I tried replacing my fbi-script with cat /dev/random > /dev/fb0 but that did not fill the screen either.

I thought that giving an elevated bash terminal might fix the problem:

sudo bash -c "chvt 1; fbi -T 1 -d /dev/fb0 images/*"

That again works via my ssh terminal but not using systemd.

Besi
  • 113
  • 5