Raspberry pi permission denied

7,761 views
Skip to first unread message

Sebastian

unread,
Aug 9, 2013, 6:58:18 AM8/9/13
to ope...@googlegroups.com
Hello everybody,

after tinkering with my raspberry pi for three days now, I finally managed to install javafx on wheezy hard float.
But unforunately when I try to run the start.sh I get the response: Permission denied.

I read about this on the german knx forum and it looks as though there has to be an x somewhere to grant me permission, but the solution in the knx forum didn't work for me.

Do you have any idea?

Thanks
Sebastian



milymat

unread,
Aug 9, 2013, 7:21:27 AM8/9/13
to ope...@googlegroups.com
cd to/the/openhab/folder
chmod 777 start.sh

this should work fine

Sebastian

unread,
Aug 9, 2013, 8:45:10 AM8/9/13
to ope...@googlegroups.com
Thank you milymat,

I have never used a linux based operating system, so bear with me.

Your command looks good.

Launching the openHAB runtime...

But then I get:

java: command not found

But there is a folder jdk1.8.0 in the /opt
Do I have to do anything to make it run, or does java have to be in a different folder, or what?
I tried "java -version" but I don't  get an answer, looks like there was no java installed?

thanks
Sebastian

gba...@gmail.com

unread,
Aug 9, 2013, 9:13:01 AM8/9/13
to ope...@googlegroups.com
Hi Sebastian,
You should have a look at my posts in : Problems with RFXCOM Binding on Raspbian.

You have to install a jdk, and do some simple command. The tutorial doesn't seems so hard to follow, but just let me know if you need help.
You will find everything to run OH on a Rpi, and I can assure you it runs well for me :-)

Gilles

Sebastian

unread,
Aug 9, 2013, 10:39:18 AM8/9/13
to ope...@googlegroups.com, gba...@gmail.com
Thank you Gilles,

I made it work.
But do I have to run these every time:

7. add to .bashrc following lines:
export JAVA_HOME="/opt/jdk1.8.0"
export PATH=$PATH:$JAVA_HOME/bin


I probably have to add them to something? What is .bashrc ?

thanks
Sebastian

gba...@gmail.com

unread,
Aug 9, 2013, 11:14:17 AM8/9/13
to ope...@googlegroups.com, gba...@gmail.com
Great! Seems you're not so bad using a linux ;-)
I add these 2 lines to this file /etc/profile.d/jdk1.8.sh
You can do it with these 2 commands at the linux shell prompt. You can just copy/paste:
echo "export JAVA_HOME="/opt/jdk1.8.0"" >/etc/profile.d/jdk1.8.sh
echo "export PATH=$PATH:$JAVA_HOME/bin" >>/etc/profile.d/jdk1.8.sh

This way, this script will be launch each time you restart your Pi.
Just to let you know, .bashrc is located in user home directory, so if you add "export" lines to .bashrc, the setup only exists when you open a session for this user.
You can also add it to /etc/profile, but this file can be overwritten during a system update/upgrade. That's why /etc/profile.d directory exists.

Have fun with OH on pi
Gilles

Sebastian

unread,
Aug 9, 2013, 12:02:02 PM8/9/13
to ope...@googlegroups.com, gba...@gmail.com
unfortunately: Permission denied

gba...@gmail.com

unread,
Aug 9, 2013, 12:20:51 PM8/9/13
to ope...@googlegroups.com
Yes, right.
You must be root for that.
So you can try with "sudo echo..." with your own user account, it will be easier.

Sebastian

unread,
Aug 11, 2013, 12:05:42 AM8/11/13
to ope...@googlegroups.com, gba...@gmail.com
I'm afraid I can't make it work,

even with sudo or root
right now I always copy and paste the commands to make it start.

Sebastian

gba...@gmail.com

unread,
Aug 11, 2013, 3:02:11 AM8/11/13
to ope...@googlegroups.com, gba...@gmail.com
Ok, I go back deeper in Rpi own config and I think we gonna make it works:

1- You must login as pi user (the default account, when you install raspbian. Default password is "raspberry")
You can open a new session with "pi" user (easier)
Or, you can use your own account then do a "su pi". When you've finished, "exit" command get you back to you own session.

2- Do both commands ("pi" user is allowed to do so, but your own account isn't):
sudo echo "export JAVA_HOME="/opt/jdk1.8.0"" >/etc/profile.d/jdk1.8.sh
sudo echo "export PATH=$PATH:$JAVA_HOME/bin" >>/etc/profile.d/jdk1.8.sh

3- That's all. You can logout "pi" or reboot and try to launch OH to check that it's ok... or not.

To go ahead... if you got some time.
Some useful information about Linux on Rpi: http://elinux.org/RPi_Beginners
Next, if you don't want to log as "pi" user each time you need to do a "root" command, you can update the /etc/sudoers file. You must do that with your "pi" user session. Simply duplicate the last line: To avoid using the "beautifull and powerfull" vi or nano editors, you can just do:

sudo cp /etc/sudoers /etc/sudoers.BAK (Keep a copy of the original file, just in case...)

sudo cat /etc/sudoers (Display file content. The last line will be something like : "pi ALL=(ALL) NOPASSWD: ALL")

Add a new line at the end of the file, replace "pi" with your own user account. In my case I'll do
sudo echo "gilles ALL=(ALL) NOPASSWD: ALL" >>/etc/sudoers

You can now leave "pi" session and open a new one with your own account and check that you can do a "sudo". To check, you can do a "sudo su" (be carefull, you're now the root user), and if there is no error message, see that the last character of your prompt isn't "$" anymore, but "#", which means you're login as root user. Do "exit" command to go back to your session, note the last "$" at the prompt.

Let me know if it's ok now
Gilles

Sebastian

unread,
Aug 11, 2013, 7:05:21 PM8/11/13
to ope...@googlegroups.com, gba...@gmail.com
Thanks for your reply,

but it doesn't work, I tried everything, created my own account with root access.
It either doesn't work or the access gets denied.
I have to enter the following four commands everytime to start openHAB:


export JAVA_HOME="/opt/jdk1.8.0"
export PATH=%PATH:$JAVA_HOME/bin
chmod u+x /home/pi/openhab-runtime-1.2.0/start.sh
/home/pi/openhab-runtime-1.2.0/start.sh

since I have to do it every time I copy and paste obviously, but it is still very tedious.
I would like to reach a state in which openHAB boots on startup.

gba...@gmail.com

unread,
Aug 12, 2013, 1:06:24 AM8/12/13
to ope...@googlegroups.com, gba...@gmail.com
It's very weird... but as far you won't be able to do anything as root, you won't be able to install an init script to auto-start OH.

Please log in using the "pi" account.

First can you send copy of the results for the following commands:
sudo ls -l /etc/profile.d/
sudo cat /etc/profile.d/jdk1.8.sh
sudo ls -l /opt/jdk1.8.0/
sudo ls -l /home/pi/openhab-runtime-1.2.0/start.sh
sudo cat /etc/sudoers


Next, can you provide a log (screen copy) of what you type in what you get in reply ? I mean log with "pi" account then run both sudo commands
sudo echo "export JAVA_HOME="/opt/jdk1.8.0"" >/etc/profile.d/jdk1.8.sh
sudo echo "export PATH=$PATH:$JAVA_HOME/bin" >>/etc/profile.d/jdk1.8.sh


If you want to auto-start OH, you should have a look at this post: Good daemon script for openhab on raspberry?

Let me know
Good luck

Gilles
Reply all
Reply to author
Forward
Message has been deleted
0 new messages