Page 1 of 1
Can't flash from ubuntu terminal - serial port permissions denied
Posted: Sun Nov 05, 2017 7:18 pm
by rwel59
I have just switched over from windows to linux for esp32 development. I can communicate with esp32 (verified with putty and make menuconfig) but when I try to flash a program I get an error message: could not open port xxx, permission denied.
I can get around that with sudo chmod 777 xxport but that only lasts as long as my session. I assume that I need to give python permission to the serial port but I cannot figure out how.
I will be moving on to eclipse environment and out of console - guessing that this issue would follow.
Re: Can't flash from ubuntu terminal - serial port permissions denied
Posted: Mon Nov 06, 2017 5:52 am
by ESP_Sprite
Try 'sudo adduser [your username] dialout', then logging out and logging in again.
Re: Can't flash from ubuntu terminal - serial port permissions denied
Posted: Mon Nov 06, 2017 9:08 am
by loboris
You can also add the
udev rule for USBtoUART device used on ESP32 board.
Simple, add new rule file to the
/etc/udev/rules.d directory, for example
98-esp32.rules with the content like this:
Code: Select all
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6015", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
idVendor&
idProduct can be obtained with
lsusb.
After changing the rules, you need to run:
Code: Select all
sudo udevadm control --reload-rules
Re: Can't flash from ubuntu terminal - serial port permissions denied
Posted: Mon Nov 06, 2017 1:35 pm
by rwel59
Solution (for me)
I failed to mention that I am working with Virtual Box on Windows 10 machine. These are the steps I used...
- close ubuntu session
- in Virtual Box, select settings->usb and add Silcon Labs uart to device filers. Save
- Open Ubuntu session. Tried to find the name of the esp32 device port but didn't have any luck. Lots of /dev/tty devices but no named usb. So I made the assumption that mine was /dev/ttyUSB0 as defined in default menuconfig
- Added myself to dialout group. Logged out and shutdown ubuntu session - most ideas I found googling said to log out and log back in but this did not work for me.
- Once I opened up a new session, I was able to flash
Re: Can't flash from ubuntu terminal - serial port permissions denied
Posted: Mon Nov 06, 2017 2:08 pm
by Gfast2
Hi,
Surely I got the same issue, you can try my solution either:
Code: Select all
sudo chown <yourname> /dev/ttyUSB0
I'm running my ubuntu in Virtualbox which is hosted by windows10, too. As default, when a usb device is set to connect to VM, it's owner is root but not you. So you have to "Fix" it.
Re: Can't flash from ubuntu terminal - serial port permissions denied
Posted: Thu Nov 16, 2017 1:56 am
by rwel59
Just to clarify what worked for me. I added my to dialout group but it did not take effect logging out and back in to ubuntu. I had to shut ubuntu down. After starting a new ubuntu session, I was now added to the dialout group with access to the usb
Re: Can't flash from ubuntu terminal - serial port permissions denied
Posted: Sat Oct 15, 2022 7:08 am
by marcusob
To get over the permission denied - I am running Windows 10 Host, with VMWare Ubuntu 20.04.1 guest
File "/home/marcus/.espressif/python_env/idf3.3_py2.7_env/lib/python2.7/site-packages/serial/serialposix.py", line 325, in open
raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 13] could not open port /dev/ttyUSB0: [Errno 13] Permission denied: '/dev/ttyUSB0'
make: *** [/home/marcus/esp-idf/components/esptool_py/Makefile.projbuild:71: flash] Error 1
I had to do both of these
sudo adduser <yourname> dialout
sudo chown <yourname> /dev/ttyUSB0
I did have to log out and back in after the adduser for it to take effect, but didnt have to log out and back in for the chown to take affect.