Linux dev ttyusb0 permission denied

Arch Linux

Hello all,
I use an Arduino, an open-source microcontroller platform, which sits on /dev/ttyUSB0 and spits out data over the serial port. It would be very useful to me to be able to access the arduino without having to be root or to sudo. As it is, here’s what happens:

[user@computer ~]$ minicom -D /dev/ttyUSB0 -b 57600
minicom: cannot open /dev/ttyUSB0: Permission denied
[user@computer ~]$ sudo minicom -D /dev/ttyUSB0 -b 57600

OPTIONS: I18n
Compiled on Feb 2 2011, 18:45:31.
Port /dev/ttyUSB0

Press CTRL-A Z for help on special keys

GO,1023,353,352,255,0,1,,377,0,505,ST
GO,1023,297,295,255,0,1,,204,0,505,ST
GO,1023,387,386,255,0,1,,417,0,506,ST
. and so on.

Last edited by tirezo (2011-07-07 19:43:59)

#2 2011-07-06 19:31:25

Re: Accessing USB device (Arduino) while not root

By the way, here’s ls -l for the device:

[user@computer ~]$ ls -l /dev/ | grep ttyUSB
crw-rw—- 1 root uucp 188, 0 Jul 6 15:22 ttyUSB0

I tried adding myself to the uucp group and it still didn’t work:

[user@computer ~]$ groups user
lp wheel uucp games video audio optical storage scanner power users

#3 2011-07-06 19:40:45

Re: Accessing USB device (Arduino) while not root

okay, this worked:
sudo chmod 666 /dev/ttyUSB0

But how can I have arch do this automatically for all USB devices?

Last edited by tirezo (2011-07-06 19:40:59)

#4 2011-07-07 01:42:57

ewaller Administrator From: Pasadena, CA Registered: 2009-07-13 Posts: 19,346

Re: Accessing USB device (Arduino) while not root

I think you want to create a udev rule.

Nothing is too wonderful to be true, if it be consistent with the laws of nature — Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. — Alan Turing

How to Ask Questions the Smart Way

#5 2011-07-07 18:04:57

Re: Accessing USB device (Arduino) while not root

Thanks ewaller! I had no idea what udev rules were.
For anyone having trouble with arduino permissions on arch, add the following 2 lines to this file:
/etc/udev/rules.d/50-embedded_devices.rules

Читайте также:  Running office on linux

SUBSYSTEMS=»usb», ATTRS== «Arduino Uno», GROUP=»users», MODE=»0666″
SUBSYSTEMS=»usb», ATTRS== «FT232R USB UART», GROUP=»users», MODE=»0666″

This will let you use the arduino uno and duemilanove without having to worry about permissions (I haven’t tested any other versions)

Last edited by tirezo (2011-07-07 19:45:04)

#6 2015-05-15 19:06:08

Re: Accessing USB device (Arduino) while not root

I had the same problem and after much mucking around in udevadm, found out why this wasn’t working; it should be SUBSYSTEMS==»usb», not single =. Udev considered this file unparseable.

SUBSYSTEMS==»usb», ATTRS== «Arduino Uno», GROUP=»users», MODE=»0666″
SUBSYSTEMS==»usb», ATTRS== «FT232R USB UART», GROUP=»users», MODE=»0666″

I found you can also avoid needing a reboot/replug by running:
$sudo udevadm trigger

#7 2015-05-15 19:08:23

Re: Accessing USB device (Arduino) while not root

Not sure if you need it for the Arduino, just the USB UART serial adapter.

I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces.
Look ma, no mouse.

#8 2015-05-15 20:37:28

Re: Accessing USB device (Arduino) while not root

Easier than the udev rule would just be to add your user to the uucp group as the device files already have group r/w access.

«UNIX is simple and coherent. » — Dennis Ritchie, «GNU’s Not UNIX» — Richard Stallman

#9 2015-11-07 02:07:45

Re: Accessing USB device (Arduino) while not root

# usermod -a -G uucp yourregusername

#10 2015-11-07 02:21:45

Re: Accessing USB device (Arduino) while not root

As to why adding oneself to uucp group failed to solve permission issue for OP is probably because he forgot to relog his user.

Wiki also suggest that if adding a user to uucp is still causing problems, try adding the user to lock group also.

#11 2016-01-10 04:51:36

Re: Accessing USB device (Arduino) while not root

None of this works for me. I added myself to

a long time ago and have been quite happy using my arduino with Arch. All of the sudden (there was a system upgrade) it stopped working.

Now I get the error message:

avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission denied Problem uploading to board. 

Whenever I try to upload. I added myself to

and re-logged in. Still doesn’t work. When running the Arduino IDE as root, however, there is no issue. It works fine.

Other strange fact. I changed the permission mode of

to 666, but after trying to upload to the board the permission mode reverts to 660, i.e.

Any suggestions? I didn’t make a udev rule yet, but I don’t think it should be necessary.

#12 2016-01-10 05:03:58

ewaller Administrator From: Pasadena, CA Registered: 2009-07-13 Posts: 19,346

Re: Accessing USB device (Arduino) while not root

What type of Arduino is it? Some flavors do a USB disconnect when the Arduino’s processor is reset — Leonardo and others that use the Atmel’s intrinsic USB interface do this. Edit: When it reconnects, the permissions reset (end edit)
Which version of AVRDUDE are you using? A recent version had issues with Arduino and needed downgradng.
What is the output of groups

Last edited by ewaller (2016-01-10 05:04:40)

Nothing is too wonderful to be true, if it be consistent with the laws of nature — Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. — Alan Turing

How to Ask Questions the Smart Way

Читайте также:  Linux создать рут пользователя

#13 2016-01-10 06:57:58

Re: Accessing USB device (Arduino) while not root

@ tirezo, can you try changing permission of minicom, so that when it is run by normal user it runs with root previlages,

sudo chmod u+s /usr/bin/minicom

assuming minicom is in /usr/bin, this works with wvdial when I use it for my usb modem.

#14 2016-01-10 14:39:12

Re: Accessing USB device (Arduino) while not root

Thanks for the quick reply, ewaller!

What type of Arduino is it?

Some flavors do a USB disconnect when the Arduino’s processor is reset — Leonardo and others that use the Atmel’s intrinsic USB interface do this. Edit: When it reconnects, the permissions reset (end edit)

Right, the Esplora is based on Leonardo, I believe.

Which version of AVRDUDE are you using? A recent version had issues with Arduino and needed downgradng.
What is the output of groups

My avrdude version is 1:6.1-1 (Edit: This version was installed on December 9 2015, and uploading worked fine then. I downgraded to avrdude 6.1-1 but there was no imporvement.)

Groups output: tty wheel uucp lock audio vboxusers nick (n.b. my username is nick)

I’m using the latest version (as of January 9th 2016) of the Arduino IDE and also I can upload to my board when running the IDE as root.

Last edited by NickTouik (2016-01-10 14:50:09)

#15 2016-01-10 16:42:56

Re: Accessing USB device (Arduino) while not root

#16 2016-01-10 16:51:03

ewaller Administrator From: Pasadena, CA Registered: 2009-07-13 Posts: 19,346

Re: Accessing USB device (Arduino) while not root

It works here.

ewaller@turing ~ 1096 %pacman -Qi arduino Name : arduino Version : 1:1.6.7-1 Description : Arduino prototyping platform SDK Architecture : x86_64 URL : http://arduino.cc/en/Main/Software Licenses : GPL LGPL Groups : None Provides : None Depends On : gtk2 libusb-compat java-runtime desktop-file-utils giflib avrdude Optional Deps : None Required By : None Optional For : None Conflicts With : None Replaces : None Installed Size : 402.84 MiB Packager : Unknown Packager Build Date : Sat 02 Jan 2016 09:58:16 AM PST Install Date : Sat 02 Jan 2016 10:00:43 AM PST Install Reason : Explicitly installed Install Script : Yes Validated By : None ewaller@turing ~ 1097 %pacman -Qi avrdude Name : avrdude Version : 1:6.1-1 Description : Download/upload/manipulate the ROM and EEPROM contents of AVR microcontrollers Architecture : x86_64 URL : http://www.nongnu.org/avrdude/ Licenses : GPL Groups : None Provides : None Depends On : readline libftdi libusb-compat elfutils Optional Deps : None Required By : arduino Optional For : None Conflicts With : None Replaces : None Installed Size : 950.00 KiB Packager : Anatol Pomozov Build Date : Wed 09 Dec 2015 01:04:02 PM PST Install Date : Thu 10 Dec 2015 08:03:58 AM PST Install Reason : Installed as a dependency for another package Install Script : No Validated By : Signature ewaller@turing ~ 1098 %ll /dev/ttyACM? crw-rw---- 1 root uucp 166, 1 Jan 10 08:33 /dev/ttyACM1 ewaller@turing ~ 1099 %

As a sanity check, is the group of the device node uucp?

Читайте также:  Linux как установить обои

Edit: I just saw bstaletic’s post — I think we are on the same track.

Last edited by ewaller (2016-01-10 16:52:03)

Nothing is too wonderful to be true, if it be consistent with the laws of nature — Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. — Alan Turing

How to Ask Questions the Smart Way

#17 2016-01-11 01:41:10

Re: Accessing USB device (Arduino) while not root

Everything looks like it checks out:

ls -l ttyACM0 crw-rw---- 1 root uucp 166, 0 Jan 10 20:32 ttyACM0
[nick@TaMereVIII dev]$ pacman -Qi arduino Name : arduino Version : 1:1.6.7-1 Description : Arduino prototyping platform SDK Architecture : x86_64 URL : http://arduino.cc/en/Main/Software Licenses : GPL LGPL Groups : None Provides : None Depends On : gtk2 libusb-compat java-runtime desktop-file-utils giflib avrdude Optional Deps : None Required By : None Optional For : None Conflicts With : None Replaces : None Installed Size : 402.84 MiB Packager : Unknown Packager Build Date : Sat 09 Jan 2016 11:02:35 PM EST Install Date : Sat 09 Jan 2016 11:19:22 PM EST Install Reason : Explicitly installed Install Script : Yes Validated By : None [nick@TaMereVIII dev]$ pacman -Qi avrdude Name : avrdude Version : 1:6.1-1 Description : Download/upload/manipulate the ROM and EEPROM contents of AVR microcontrollers Architecture : x86_64 URL : http://www.nongnu.org/avrdude/ Licenses : GPL Groups : None Provides : None Depends On : readline libftdi libusb-compat elfutils Optional Deps : None Required By : arduino Optional For : None Conflicts With : None Replaces : None Installed Size : 950.00 KiB Packager : Anatol Pomozov Build Date : Wed 09 Dec 2015 04:04:02 PM EST Install Date : Sun 10 Jan 2016 09:50:40 AM EST Install Reason : Installed as a dependency for another package Install Script : No Validated By : None

This is really frustrating. Works fine as root, and I think the permission problem is subtle because when I upload, I get the permission error but my Arduino also resets, so something is going through.

Edit: I also rebooted, deleted the ~/Arduino and ~/.arduino15 directories, to remove any options. Still no luck. I also tried chowning ttyACM0 to myself, but it resets to belonging to root.

Last edited by NickTouik (2016-01-11 01:49:12)

Источник

Arduino в Debian. Ошибка can’t open device «/dev/ttyUSB0»: Permission denied

Arduino в Debian. Ошибка can’t open device «/dev/ttyUSB0»: Permission denied

Запустив рабочую среду Arduino IDE (версия 1.8.9) при попытке залить скетч или открыть монитор порта получил ошибку can’t open device «/dev/ttyUSB0»: Permission denied.

Данная ошибка явно говорит об отсутствии прав для записи в порт.

Для решения проблемы, необходимо добавить пользователя, из под которого производится работа, в группу которой позволено работать с данным портом. Выяснить название группы можно следующим образом. В консоли вводим:

user@pc:~$ ls -l /dev/ttyUSB0 crw-rw---- 1 root dialout 188, 0 фев 17 16:36 /dev/ttyUSB0

Группа называется «dialout». Добавим себя в группу командой:
sudo usermod -a -G dialout user

Далее рекомендуют перезагрузиться или выйти и зайти в сеанс, для того чтобы изменения учетной записи применились.

Но можно поступить другим способом. Выполняем команду:

sudo chmod a+rw /dev/ttyUSB0

И порт становится доступен для работы c Arduino.

TwitterFacebookВконтактеОдноклассникиGoogle+

В этом разделе

Источник

Оцените статью
Adblock
detector