Can't flash from ubuntu terminal - serial port permissions denied

rwel59
Posts: 27
Joined: Thu Oct 12, 2017 3:32 pm

Can't flash from ubuntu terminal - serial port permissions denied

Postby rwel59 » Sun Nov 05, 2017 7:18 pm

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.

ESP_Sprite
Posts: 1218
Joined: Thu Nov 26, 2015 4:08 am

Re: Can't flash from ubuntu terminal - serial port permissions denied

Postby ESP_Sprite » Mon Nov 06, 2017 5:52 am

Try 'sudo adduser [your username] dialout', then logging out and logging in again.

User avatar
loboris
Posts: 271
Joined: Wed Dec 21, 2016 7:40 pm

Re: Can't flash from ubuntu terminal - serial port permissions denied

Postby loboris » Mon Nov 06, 2017 9:08 am

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

rwel59
Posts: 27
Joined: Thu Oct 12, 2017 3:32 pm

Re: Can't flash from ubuntu terminal - serial port permissions denied

Postby rwel59 » Mon Nov 06, 2017 1:35 pm

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

User avatar
Gfast2
Posts: 107
Joined: Fri Aug 11, 2017 1:52 am

Re: Can't flash from ubuntu terminal - serial port permissions denied

Postby Gfast2 » Mon Nov 06, 2017 2:08 pm

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. :lol:

rwel59
Posts: 27
Joined: Thu Oct 12, 2017 3:32 pm

Re: Can't flash from ubuntu terminal - serial port permissions denied

Postby rwel59 » Thu Nov 16, 2017 1:56 am

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

Who is online

Users browsing this forum: Bing [Bot], dparkinson and 11 guests