4

I am having some problems with getting feh to load at startup. I'm new to Linux but have been in IT for years.. any help is much appreciated. I am running Raspbian Stretch. It's a Pi 3.

I have a NAS and I have created the mounts in FStab so I mount a folder called pictures to /media. This works. I then created a shell script and modified its permissions so it runs chmod 775 /startup.sh. The location of the startup.sh file is: /home/pi My startup.sh script looks like this:

#!/bin/bash
sleep 30
bash feh -Y -x -q -D 5 -B black -F -Z -z -r /media/

I then added an entry to the autostart file located at /home/pi/.config/lxsession/LXDE-pi.

The autostart now looks like:

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
@point-rpi
@epiphany /home/pi/startup.sh

I then rebooted the Pi... here's the weird thing! When I reboot my Pi, it opens a web browser and downloads the startup.sh file but it doesn't seem to execute it. I tried changing (within the autostartfile) @epiphany /home/pi/startup.sh to @terminal /home/pi/startup.sh.

Nothing happens. Does that mean @epiphany is the program (webbrowser) it uses to open the script with? What else could I: 1. Install to use to execute the script or 2. Is there something like terminal I could use (I tried @bash) but it didn't work either.

Here is the output of ls -al /home/pi/startup.sh:

$ ls -al /home/pi/startup.sh
-rwxr-xr-x 1 root root 78 Feb 28 19:27 /home/pi/startup.sh
2
  • you say a "web browser" downloads the startup.sh file? ... web browsers don't automatically execute .sh files, so that's something to consider Feb 28, 2018 at 22:02
  • Sorry I missed these alerts i assumed it would email me to say people had commented. Ok so output of ls -al /home/pi/startup.sh pi@raspberrypi:~ $ ls -al /home/pi/startup.sh -rwxr-xr-x 1 root root 78 Feb 28 19:27 /home/pi/startup.sh Mar 1, 2018 at 12:40

4 Answers 4

1
+50

Replace the call to @epiphany to a call to @lxterminal. Epiphany is a browser and obviously the wrong program to execute bash scripts.

LXTerminal is the Terminal program of LXDE, the Lightweight X Desktop Environment. LXDE has been heavily customised but is still the foundation of the "Raspberry Pi Desktop".

1

Have you tried @/bin/bash /home/pi/startup.sh? This should do the trick.

Another option would be to use /etc/rc.local. Just add /home/pi/startup.sh to the end of the file.

1
  • shouldn't this be /bin/bash ...as which bash points to /bin/bash in raspberian Nov 4, 2019 at 22:49
0

Try a different startup location. try enabling autologin then adding

sleep 10 &
sudo feh -Y -x -q -D 5 -B black -F -Z -z -r /media/ &

to the end of /etc/profile . (make sure you keep the & symbols)

2
  • probably won't work because it might execute before x starts. it might work with the sleep 10 &, though Mar 5, 2018 at 17:00
  • I've also heard /etc/profile isn't the correct place to put startup scripts... but it's worked for me... Mar 6, 2018 at 15:10
0

This is the most elegant solution to auto-launch FEH in Rasbian. I have performed this on both a Raspberry Pi3B and a Zero. While both where the latest updated version (Dec 2019) they did have a difference! In Rasbian it does boot to the full GUI for myself, nothing custom.

This is a two step process. You can launch FEH automatically when you open the Command Window: In /home/pi using sudo nano .bash_aliases add in the FEH command. CTL O then CTL X (save and exit). To show it works, simply launch the command window, IF FEH does not launch there is a problem. You can read more on this here: https://www.raspberrypi.org/documentation/linux/usage/bashrc.md

To then auto-launch the command window on a reboot, this is where there were some differences. In both cases you are adding in the autostart file the line: @lxterminal

In the Pi Zero add the entry to the autostart file located at /home/pi/.config/lxsession/LXDE-pi. For the Pi3B I had to go /etc/xdg/lxsession/LXDE-pi Permissions were an issue so don't forget to use: sudo nano /etc/xdg/lxsession/LXDE-pi/autostart You can read about that: https://www.raspberrypi.org/forums/viewtopic.php?t=227191

As an FYI, here is my FEH command that I put in the .bash_aliases file feh -Y -x -q -D 12 -B black --auto-rotate -F -Z -r /home/pi/Pictures/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.