I wrote a pygame program that acts like a mp3 player on Raspberry Pi, and I want it to run from startup, which I accomplished by adding python Music.pyw to the bottom of .bashrc

This works fine, that is, if I have already booted desktop mode (startx) But when it is a fresh boot, it tells me permission is denied to my flash drive with all of the songs!

What can I do, to.. grant myself permission?

Sidenotes: -I am very new to linux/raspberry pi -I am running Raspbian.

2 Answers 2


It sounds like your "external disk" (or "flash drive") isn't being mounted. When you run your desktop (I guess LXDE?) then it looks for drives and mounts them for you.

To confirm this, look at the path which your python program is trying to use, and from the console do an ls command on this path. The error message will tell you whether it's a permissions problem or a "doesn't exist" problem.

What you probably need to do is edit your fstab file so that your drive is automatically mounted at boot time.


You can use the device manager UDEV to execute your script when, and only when your external usb disk is detected and mounted. You just have to add a rule the udev rule directory /etc/udev/rules.d/. To do that you can put your rule in a custom file that you can name 30-my-custom.rules

Follow more detailed instructions here.

Your Answer

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

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