Can only upload sketches as 'root'?

:stuck_out_tongue: I just got a mega2560.

if I log in as root, I can upload, because ttyACM0 is selected under
Tools>Serial Port in the IDE

BUT if I log in as someone else...(non-root)
then I can't upload, because the IDE is looking for
COM1 and the Tools>Serial Port menu item is greyed out.

Ubuntu 11.04, IDE 0022

Please advise...thanks

Did you put yourself into the correct user group to have write access to serial ports?

ls -l /dev/ttyACM*

dexternew@esposa-segunda:~$ ls -l /dev/ttyACM*
crw-rw---- 1 root dialout 166, 0 2011-06-11 19:55 /dev/ttyACM0

I created the group dialout, and placed dexternew in it.

Every time I think I understand what's supposed to be happening,
I find out I really don't.

More help needed.

Arrghh1

NOW it's working.

I changed nothing.

Only difference is a reboot performed earlier today.

Yes, you need to do a logoff/logon cycle to make those changes become active. Now next time you'll remember this ]:smiley:

Thank you. :blush:

Hey i did the same thing earlier and it showed me ttyACM0. But later on i input this:

user@userPC:~$ ls -l /dev/ttyACM*

and this is the output:

ls: cannot access /dev/ttyACM*: No such file or directory

Meaning there aren't any ttyACM* files in the directory, so the question is: how do i create one? Is a plain text file enough, so that linux will later populate the file when i connect my board?

If you run a modern linux distribution (using udev), these files will be created automatically when they are needed. That is once you plug the arduino into your machine, it will show up. If you need to know more about this process, google for "udev rules" (can get quite confusing at first).

That also means that if you unplug the board, this file vanishes.

Make sure you are in the same user group as the file to have write access.

ok so now i know the file vanishes when the board is unplugged. So now i run the arduino software as root. It DOES let me choose the (correct) port and there is connection&power to the arduino but when uploading i still get same problem: serial port /dev/ttyACM0 not found. ... what am i doing wrong? btw TX light is constantly on, does that indicate anything?

There seems to be a problem with java not looking for devices named "ttyACM*".

Try adding a custom udev rule to automatically create a symlink. Locate your udev 'rules.d' folder (presumably somewhere in /etc/, maybe even /etc/udev/rules.d) and create a custom rule file, e.g. named '99-arduino.rules' - the ending should be the same as all the other files.

The file's content:

KERNEL=="ttyACM[0-9]", SYMLINK+="ttyUSB%n"

Now restart udev manually or restart your machine. This should now create a symlink for every "ttyACM*" named "ttyUSB*".

And please don't run the IDE as root. This is not windows. Fix your group membership as shown above and it will work.

unbelieveable. I done exactly as you said and i finally managed to upload the 'blink' example. So it finally worked. Then i uploaded the 'DigitalReadSerial' sketch and it uploaded successfully. Then when i wanted to see the output, i pressed on the serial monitor icon and...AGAIN! Same shit - i cannot upload sketches AGAIN, the analogue example doesn't work AGAIN! It is definitely something with the software. By the way thank you for the previous solution.

hmmm looks like i need that group membership fixed... how do i do that again? I changed the permissions for the file itself but i still can only run it as root :frowning:

  • usermod won't work :frowning:

sure there is a gui to do this, but I been using unix a long time...

first check which group /dev/ttyACM* belongs to. With the arduino usb plugged in:
execute: ls -l /dev/ttyACM0

mine like like this:
crw-rw---- 1 root dialout 166, 0 2011-06-13 11:19 /dev/ttyACM0

dialout is the group

execute sudo usermod -G dialout userid
(you will need the root password)

if usermod does not work:

using a your text editor
execute: sudo gedit /etc/group
(you will need the root password)

search for dialout
once again mine looks this:

dialout:x:20:don,mark
mark is my userid

if your userid is not in the dialout group, add it.

save the file.

then:
log out and log back in

ok so my ttyACM0 was also in the dialout group. i added my user to the group (but i think you got the group and user wrong way round so i just changed that) and then, just in case, checked the file. My username is 'user' and it was there so i restarted. When it booted i loaded arduino software again and tried to upload something but i still get the same error.

try executing the "id" command: The ouput on my machine looks like:
uid=1000(mark) gid=1000(mark) groups=1000(mark),4(adm),20(dialout),24(cdrom),46(plugdev),112(lpadmin),120(admin),122(sambashare)

Here's output from my computer:

uid=1000(user) gid=1000(user) groups=1000(user),20(dialout)

and yes, my username is user :stuck_out_tongue:

That one look good. Post an ls -l /etc/ttyACM*. I'm looking at the permissions of the device. Looks like:
crw-rw---- 1 root dialout 188, 0 2011-06-15 11:26 ttyUSB0

Your should be different: My uno is at the other house

sorry i don't know if you made a mistake or not but my tty files are in the dev directory not etc. Here's the output:

crw-rw---- 1 root dialout 166, 0 2011-06-15 22:56 /dev/ttyACM0

And for ttyUSB* there was this too:

lrwxrwxrwx 1 root root 7 2011-06-15 22:56 /dev/ttyUSB0 -> ttyACM0

Thanks

Janek566

my bad, should be /dev/ttyACM*

can you check what kernel verion you have. the command is uname -r

yep, it's:

2.6.38-8-generic-pae

I think the newest one for Natty is 2.6.38-10-generic so i think i'm pretty close xD

Thanks
Janek566