0

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.

1 Answer 1

0

I've been down this rabbit hole without success. I couldn't find a way to get access to tty1 for fbi from a systemd daemon.

I used crontab instead. First I disabled auto login via the gui by selecting “Preferences” > “Raspberry Pi Configuration”. In the “System” tab I set “Auto Login” to “Disabled”.

Then I added a cron entry (sudo crontab -e, so it runs as root):

@reboot fbi -a --noverbose -T 1 -d /dev/fb0 -l /home/ed/Documents/PictureFrame/images.txt --random --blend 120 -t 30

So the command runs when the pi comes up. This didn't work, though. I could see the slideshow start for a second, but then I lost it to the login screen. The slideshow started too early. That's OK, what I really wanted anyways is to download a fresh batch a pictures from SmugMug every time. So I created a shell script that downloads the pictures and then calls fbi. So in my cron job I wait for a network connection, then call the shell script that does that work:

@reboot /bin/bash -c 'until nc -z 8.8.8.8 53; do sleep 1; done; /home/ed/Documents/PictureFrame/FBISlideShow'

To get nc I ran sudo apt install netcat-traditional. Could just use sleep 10 or something, instead.

Now my slideshow starts up automatically after the Pi boots up, albeit after a short delay.

This is on a Raspberry Pi 4 with Debian Bookworm.

1
  • Very nice. I'll give that a shot!
    – Besi
    Commented Jan 3 at 19:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .