Port permissions access denied in arduino.(solved).

Questions about applications and software
Forum rules
Before you post please read how to get help
Post Reply
Wompoo
Level 5
Level 5
Posts: 973
Joined: Sat Dec 28, 2013 2:42 am

Port permissions access denied in arduino.(solved).

Post by Wompoo »

I am using Linux Mint 19.3 on an Asus desktop computer running Arduino 1.8.10
Under tools in the Arduino IDE, the port can be selected from (usually) two options. When either one is selected, it results in a failed upload due to "permission denied".
The ports are:
1. /dev/ttySo
2. /dev/ttyUSBO..................(not showing as an available option this morning).

Is this just another dreaded Linux permissions problem?
If so, can it be remedied?

Assistance will be most appreciated.

Jim.
Last edited by Wompoo on Wed Feb 19, 2020 4:26 pm, edited 1 time in total.
Desktop PC #2
Linux Mint 19.3 MATE desktop (64-bit), Asus
CPU E7500, 8 Gb RAM


Desktop #1
Dell Vostro 220 64 bit.
Linux Mint 19.3 MATE

Dell Inspiron 6000 laptop
rene
Level 16
Level 16
Posts: 6681
Joined: Sun Mar 27, 2016 6:58 pm

Re: Port permissions access denied in arduino.

Post by rene »

Likely (but also note that that "o" and "O" are not o's but zeroes); /dev/ttyS? refers to regular PC serial ports, /dev/ttyUSB? to USB serial adapters. You will of course need to know what you are in fact using but permissions are easily determined:

Code: Select all

$ ls -l /dev/ttyS0
crw-rw---- 1 root dialout 4, 64 feb 18 10:34 /dev/ttyS0
We are shown a so-called character device (c) owned by user "root", with both read (r) and write (w) permissions granted to said owner and members of UNIX-group "dialout", no permissions granted whatsoever to anyone else. You are supposedly not running Arduino as "root" but as your user, as you should be, so it remains to check said user's membership of "dialout":

Code: Select all

$ id
uid=1000(wompoo) gid=1000(wompoo) groups=1000(wompoo),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),112(lpadmin),129(sambashare),133(wireshark)
No "dialout" by default for the first, standard Mint user that is. Doing

Code: Select all

sudo usermod -aG dialout $(whoami)
will add you to "dialout". You need to log out and back in after that.

I don't have a USB serial adapter at hand, but check its permissions similarly; I assume it'll be the same as for regular serial ports.
Wompoo
Level 5
Level 5
Posts: 973
Joined: Sat Dec 28, 2013 2:42 am

Command Not Found.

Post by Wompoo »

Thanks for the reply rene.
However, the first command you list in your post is not found when I entered it into terminal.
Desktop PC #2
Linux Mint 19.3 MATE desktop (64-bit), Asus
CPU E7500, 8 Gb RAM


Desktop #1
Dell Vostro 220 64 bit.
Linux Mint 19.3 MATE

Dell Inspiron 6000 laptop
rene
Level 16
Level 16
Posts: 6681
Joined: Sun Mar 27, 2016 6:58 pm

Re: Port permissions access denied in arduino.

Post by rene »

As in "Command not found" or "No such file or directory"? If former; please note that the starting "$" is not part of the command; was shown only as a prompt; ls -l /dev/ttyS0

If latter; sure you spelled it right, i.e., not with an "o" again? Because since as far as I'm aware /dev/ttyS0 exists even on systems without actual legacy serial ports; certainly does on this one. Anyways... just ls -l /dev/tty{S,USB}* will also do (with the USB serial adapter attached, if that's what we are talking about).
Wompoo
Level 5
Level 5
Posts: 973
Joined: Sat Dec 28, 2013 2:42 am

Re: Port permissions access denied in arduino.

Post by Wompoo »

rene wrote:
Tue Feb 18, 2020 4:49 pm
As in "Command not found" ............[/command not found]

If latter; sure you spelled it right, i.e., not with an "o" again? Because since as far as I'm aware /dev/ttyS0 exists even on systems without actual legacy serial ports; certainly does on this one. ................
I am not in the habit of manually typing out any recommended terminal commands. The explanation for the error was that I simply clicked on "Select All" from your post, copied the contents, and then pasted them into terminal. I failed to delete the added dollar sign. But then, you already guessed that might have been the problem

One command entered successfully.
On to the second one and it's problem:
Anyways... just ls -l /dev/tty{S,USB}* will also do (with the USB serial adapter attached, if that's what we are talking about).
Just to repeat, I am unable to find any available port that will work in this Linux Mint 19.3, but can find one in my older Linux Mint 19.1 (Both up to date). I cannot provide a screenshot in Arduino, as the tools menu disappears when I try to do so.
I am afraid I don't know what "USB serial adapter attached". What does this mean? Some external hardware? Or software I should install?

Should I remove the brackets from the second entry command that you list above? I am receiving a syntax error near unexpected token notification regarding "(".

Two very ignorant questions meanwhile:

1. I still don't know how to "log out". I have searched for an explanation, but the answers appeared to be very convoluted and confusing.
Can you explain please?
If I simply reboot, does this do the same thing?

2. What defines "Run as Root" please?

My apologies for loading up this reply with such trivial questions that I should already know.

Thanks for staying with me on this rene.

Jim.
Desktop PC #2
Linux Mint 19.3 MATE desktop (64-bit), Asus
CPU E7500, 8 Gb RAM


Desktop #1
Dell Vostro 220 64 bit.
Linux Mint 19.3 MATE

Dell Inspiron 6000 laptop
rene
Level 16
Level 16
Posts: 6681
Joined: Sun Mar 27, 2016 6:58 pm

Re: Port permissions access denied in arduino.

Post by rene »

Let's start fresh. You are running the Arduino IDE and aim to upload from it to a board. This is to say said board is connected to your computer somehow; through a legacy PC serial port on your computer, the one with the clunky DB-9 or DB-25 connectors, or more likely through USB. Former ports are in Linux referred to as /dev/ttyS0 and so on numerically, latter /dev/ttyUSB0 and so on.

Returning to my initial reply, If you run ls -l /dev/ttyS0, or ls -l /dev/ttyUSB0 or (both those in one go) ls -l /dev/tty{S,USB}0 you are going to see user and group information (in the USB case if the board/adapter is in fact connected since otherwise the /dev/ttyUSB0 node generally won't even exist). Follow that initial reply's advise from there.

"Running as root" is something that happens when you e.g. launch an application through sudo, which you again should not do with Arduino, and which you aren't. All fine. Logging out you do by, well, picking the logout option from your desktop environments menu's. Slightly different between Cinnamon, Xfce and MATE but should be findable. Yes, reboot is fine as well, just does a lot more and takes unnecessarily long.

Once re-logged in, again run id from a terminal to be certain that you are now a member of whichever group, supposedly "dialout", you saw on the /dev device node, and retry to see whether or not Arduino then feels you worthy.
Wompoo
Level 5
Level 5
Posts: 973
Joined: Sat Dec 28, 2013 2:42 am

Re: Port permissions access denied in arduino.

Post by Wompoo »

rene wrote:
Wed Feb 19, 2020 7:35 am
................, If you run ls -l /dev/ttyS0, or ls -l /dev/ttyUSB0 or (both those in one go) ls -l /dev/tty{S,USB}0 you are going to see user and group information (in the USB case if the board/adapter is in fact connected since otherwise the /dev/ttyUSB0 node generally won't even exist)............
Those commands ran ok.

jim@jim-LinuxMint-ASUS:~$ ls -l /dev/tty{S,USB}0
crw-rw---- 1 root dialout 4, 64 Feb 19 10:33 /dev/ttyS0
crw-rw---- 1 root dialout 188, 0 Feb 19 22:55 /dev/ttyUSB0
jim@jim-LinuxMint-ASUS:~$

However, I am not sure how to interpret the result.
Follow that initial reply's advise from there..........
This is the point that I not sure of. Do I retain the brackets in the command? Or do I edit them out?
I keep getting a syntax error notification relating to a bracket.

jim@jim-LinuxMint-ASUS:~$ uid=1000(Jim) gid=1000(Jim) groups=1000(Jim),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),112(lpadmin),129(sambashare),133(wireshark)
bash: syntax error near unexpected token `('
jim@jim-LinuxMint-ASUS:~$

Please advise further.
Thanks,
Jim.
Desktop PC #2
Linux Mint 19.3 MATE desktop (64-bit), Asus
CPU E7500, 8 Gb RAM


Desktop #1
Dell Vostro 220 64 bit.
Linux Mint 19.3 MATE

Dell Inspiron 6000 laptop
rene
Level 16
Level 16
Posts: 6681
Joined: Sun Mar 27, 2016 6:58 pm

Re: Port permissions access denied in arduino.

Post by rene »

At this point run

Code: Select all

sudo usermod -aG dialout $(whoami)
precisely as quoted (will ask you for your sudo password), log out and back in or reboot, run id again to verify that "dialout" is then one of your mentioned groups, and retry Arduino.

And note that I was initially only as verbose as I was due to wanting you to understand what was going on. Me and my good intentions...
Wompoo
Level 5
Level 5
Posts: 973
Joined: Sat Dec 28, 2013 2:42 am

Re: Port permissions access denied in arduino.

Post by Wompoo »

That fixed it Rene, thanks very much for sticking with me on this.
Linux permission problems have haunted me since I first started out with Linux.
One of the few things I hate about it.

Jim.
Desktop PC #2
Linux Mint 19.3 MATE desktop (64-bit), Asus
CPU E7500, 8 Gb RAM


Desktop #1
Dell Vostro 220 64 bit.
Linux Mint 19.3 MATE

Dell Inspiron 6000 laptop
rene
Level 16
Level 16
Posts: 6681
Joined: Sun Mar 27, 2016 6:58 pm

Re: Port permissions access denied in arduino.(solved).

Post by rene »

Noticed as much from your post so arranged to demystify this for you. Not sure I managed....
Wompoo
Level 5
Level 5
Posts: 973
Joined: Sat Dec 28, 2013 2:42 am

Re: Port permissions access denied in arduino.(solved).

Post by Wompoo »

rene wrote:
Wed Feb 19, 2020 4:38 pm
Noticed as much from your post so arranged to demystify this for you. Not sure I managed....
rene,

I read your text above a couple of times. I am not at all sure what you mean though.............sorry!
And I thought my comprehension was good.
Not so it appears.

If I have inadvertently given you the impression I am ungrateful, please be assured that is not the case.
I am very grateful...........like I have been for previous assistance you provided for me.

In 2014, when I first loaded Linux Mint 16, I knew almost nothing about computers. My adoption of Linux, and the generous assistance I have received here on these forums, and from a private online contact, has turned this around dramatically. And at my ripe old age of 75 years!

So, thanks offered sincerely,

Jim.
Desktop PC #2
Linux Mint 19.3 MATE desktop (64-bit), Asus
CPU E7500, 8 Gb RAM


Desktop #1
Dell Vostro 220 64 bit.
Linux Mint 19.3 MATE

Dell Inspiron 6000 laptop
rene
Level 16
Level 16
Posts: 6681
Joined: Sun Mar 27, 2016 6:58 pm

Re: Port permissions access denied in arduino.(solved).

Post by rene »

No, no, nothing of the sort, all well. You expressed unease with UNIX-permission mechanisms in your original post, so I set up through my initial reply to demystify at least the historical such mechanism for you; i.e., looking at the user:group assignment and corresponding permissions of the device node (here, "root:dialout" resp. read and write permissions for both "root" and members of "dialout" and no permissions for others; rw-|rw-|---), then see whether or not your user, "jim", was in fact a member of group "dialout"; when not, to make your user a member. As we have done now.

We however got semi-stuck at the somewhat earlier level of pasting commands into the terminal, so not completely sure I managed that specific goal of demystification yet. That's all I said :)
Wompoo
Level 5
Level 5
Posts: 973
Joined: Sat Dec 28, 2013 2:42 am

Re: Port permissions access denied in arduino.(solved).

Post by Wompoo »

Ok, all good then.
Thanks for answering.
Desktop PC #2
Linux Mint 19.3 MATE desktop (64-bit), Asus
CPU E7500, 8 Gb RAM


Desktop #1
Dell Vostro 220 64 bit.
Linux Mint 19.3 MATE

Dell Inspiron 6000 laptop
ThatGodotGuy
Level 1
Level 1
Posts: 5
Joined: Sat Sep 14, 2019 1:39 am

Re: Port permissions access denied in arduino.(solved).

Post by ThatGodotGuy »

Hey rene, your explanation helped me solve this same problem, and it took me about 10 minutes, including the time it took to get another drink.
So thank you. :D
Post Reply

Return to “Software & Applications”