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:

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
@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
  • you say a "web browser" downloads the startup.sh file? ... web browsers don't automatically execute .sh files, so that's something to consider – Jaromanda X Feb 28 '18 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 – Iestyn Davies Mar 1 '18 at 12:40

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".


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.

  • shouldn't this be /bin/bash ...as which bash points to /bin/bash in raspberian – equivalent8 Nov 4 at 22:49
  • Thanks, I've corrected that. – fecavy Nov 5 at 8:00

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)

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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