Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permission denied #2817

Open
eximo84 opened this issue Dec 13, 2021 · 20 comments
Open

Permission denied #2817

eximo84 opened this issue Dec 13, 2021 · 20 comments

Comments

@eximo84
Copy link

eximo84 commented Dec 13, 2021

The problem

updating my ESP devices, now get Permission Denied after compile.
Reading appears to be an issue with execute permissions on the file system? I mapped a new folder inside my SMB shared folder where the current configuration exists called "/cache" and gave all files and folders 777 permissions however still getting errors.

Which version of ESPHome has the issue?

2021.12.0

What type of installation are you using?

Docker

Which version of Home Assistant has the issue?

2021.11.4

What platform are you using?

ESP32

Board

nodemcu

Component causing the issue

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
Dependency Graph
|-- <AsyncTCP-esphome> 1.2.2
|-- <WiFi> 1.0
|-- <FS> 1.0
|-- <Update> 1.0
|-- <ESPAsyncWebServer-esphome> 2.1.0
|   |-- <AsyncTCP-esphome> 1.2.2
|-- <DNSServer> 1.1.0
|-- <Wire> 1.0.1
|-- <ESPmDNS> 1.0
Compiling .pioenvs/esp32_dev_03/src/esphome/components/api/api_connection.cpp.o
sh: 1: xtensa-esp32-elf-g++: Permission denied
Compiling .pioenvs/esp32_dev_03/src/esphome/components/api/api_frame_helper.cpp.o
Compiling .pioenvs/esp32_dev_03/src/esphome/components/api/api_pb2.cpp.o
sh: 1: xtensa-esp32-elf-g++: Permission denied
*** [.pioenvs/esp32_dev_03/src/esphome/components/api/api_connection.cpp.o] Error 126
*** [.pioenvs/esp32_dev_03/src/esphome/components/api/api_frame_helper.cpp.o] Error 126
sh: 1: xtensa-esp32-elf-g++: Permission denied
Compiling .pioenvs/esp32_dev_03/src/esphome/components/api/api_pb2_service.cpp.o
*** [.pioenvs/esp32_dev_03/src/esphome/components/api/api_pb2.cpp.o] Error 126
sh: 1: xtensa-esp32-elf-g++: Permission denied
*** [.pioenvs/esp32_dev_03/src/esphome/components/api/api_pb2_service.cpp.o] Error 126

Additional information

No response

@LarkeMikko
Copy link

I have had similar issue past 5 days (from december 17) and haven't found solution yet.. I have tried re installing, updating and upgrading pretty much everything related to esphome and platformio with no change.. I'm running esphome with debian if that information helps for finding solutions

@coax
Copy link

coax commented Dec 30, 2021

It's a cache folder issue, explained here: #2594 (comment)

@horodchukanton
Copy link

@coax Thanks! I've got my permissions problem fixed by adding the 'exec' option to the /etc/fstab entry for the drive that has the docker mount point on.

@u20p17
Copy link

u20p17 commented Mar 6, 2022

@coax Thanks! I've got my permissions problem fixed by adding the 'exec' option to the /etc/fstab entry for the drive that has the docker mount point on.

Hi,
I have the same problem and tried your suggestion. I opened the terminal on unraid, then cd /etc and after that nano fstab... Here I added the exec option to my hard drive and saved it.

 GNU nano 5.3                                                                                fstab                                                                                          
/dev/disk/by-label/UNRAID  /boot         vfat      auto,rw,flush,noatime,nodiratime,dmask=77,fmask=177,shortname=mixed,exec  0  1
/boot/bzmodules            /lib/modules  squashfs  ro,defaults  0  2
/boot/bzfirmware           /lib/firmware squashfs  ro,defaults  0  2
tmpfs                      /dev/shm      tmpfs     defaults     0  0
hugetlbfs                  /hugetlbfs    hugetlbfs defaults     0  0

But the problem stayed there. Did I something wrong? (Unraid 6.9.2, ESPHome, 2022.02.06 in a docker)

Thanks!

@ssieb
Copy link
Member

ssieb commented Aug 7, 2022

/boot is not the right filesystem. Also, your root filesystem, whatever it is, will already have execute permission or nothing would work at all. You need to find out where your container /config points to or add a mapping to the container for /cache that points to local storage.

@u20p17
Copy link

u20p17 commented Oct 4, 2022

@ssieb: My /config points to /mnt/user/appdata/ESPHome. What do I have to do in order to fix the problem?

Thanks!

@horodchukanton
Copy link

horodchukanton commented Oct 4, 2022

@u20p17 Your folder should have execution permission for the user which owns the ESPHome process (docker container in your case)

In my case the problem was in the mount attributes (I had noexec specified)

If that is not your case you should fix the specific folder permissions.
Use ls -ld /mnt/user/appdata/ESPHome to check the permissions on the folder.
Use ps aux | grep esphome to see the owner of the process.
Adjust either the permissions with chown, chmod, or the process owner by specifying the --user attribute for the docker command.

@u20p17
Copy link

u20p17 commented Oct 4, 2022

@horodchukanton : I did the first two steps you wrote and this is the result:
result

The user who should get permissions is called u20p17 - how would the command look like in this case? Thank you in advance!

@horodchukanton
Copy link

horodchukanton commented Oct 4, 2022

@u20p17 I'm sorry, but the commands were wrong )
The ls should have -ld to show permissions on the folder itself and the ps should have uax to show the owner of the process (already updated the commands in previous message).

To make u20p17 owner of the folder, simply call the
chown -R u20p17:root /mnt/user/appdata/ESPHome

Also, you probably have the execution bit missing according to the file permissions. You can add it with
chmod u+x /mnt/user/appdata/ESPHome

@u20p17
Copy link

u20p17 commented Oct 4, 2022

@horodchukanton : I now tried the updated commands, but to be honest I can not see who is the ower of the folder...
result

I didn't try to make u20p17 the owner, because I do not want to destroy anything :P

@horodchukanton
Copy link

@u20p17 Can you show the mount options?
mount | grep /mnt/user

@u20p17
Copy link

u20p17 commented Oct 4, 2022

@horodchukanton

image

@horodchukanton
Copy link

@u20p17 You should add the exec mount option

@u20p17
Copy link

u20p17 commented Oct 4, 2022

@horodchukanton : I put chmod u+x /mnt/user/appdata/ESPHome in the cmd and after that restartet unraid completely - same issue with esphome :(

@horodchukanton
Copy link

@u20p17 That's not what I meant. You're mounting the remote share without the exec option, and as the result the local OS does not allow you to execute files.
You should add the ,exec option to your /etc/fstab line

@u20p17
Copy link

u20p17 commented Oct 4, 2022

@horodchukanton: if I open the etc/fstab I see the following:

image

What would I need to add there? Thanks again!

@horodchukanton
Copy link

@u20p17 Please refer to the SSHFS documentation on how to specify the permanent mount

@u20p17
Copy link

u20p17 commented Oct 7, 2022

@horodchukanton: I now tried to add the mount to the/etc/fstab. I added the following:

UUID=301d42ac-f4eb-4e55-8792-9ad57d1ef60f /mnt/user/appdata/ESPHome xfs defaults,exec 0 0

After saving the fstab I worte mount --all in the cmd and after that I tried to compile again with ESPHome... But the permission error is still there - why?

@horodchukanton
Copy link

@u20p17 Im sorry, but I am not able to help you with mounts, as I know too little about your configuration. Please look for help in specific Linux community.

@u20p17
Copy link

u20p17 commented Oct 11, 2022

I think I fixed the issue now. It's a bit strange, but what I did is the following:
1.) ls -ld /mnt/user/appdata/ESPHome
Output: drwxrwxrwx 1 nobody users 90 Mar 3 2022 /mnt/user/appdata/ESPHome/
So it seemed that the every user/group should have read/write/execute rights on this folder. Nevertheless I did the following:

2.) chmod -R 777 /mnt/user/appdata/ESPHome
I recursive changed the rights for all users/groups to read/wrtie/execute and now it is working again... Strange - but maybe it helps other people...

/mnt/user/appdata/ESPHome points to the /config folder of ESPHome...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants