The Linux ttyACM0 drama - more details after a lot of experimenting

I have looked and looked at this ttyACM0 thing with linux and tried just about every fix on the net :astonished:

I also have a Decimilia and Duemilanove running other projects, both of which work out of the box on the same system and default appropriately to /dev/ttyUSB0 - no issues.

This is what happens on my xubuntu 12.04 system and UNO compatible - Freetronics Eleven.

First - permissions set as recommended for groups and files.

Next - Uno is selected as the board, and when it appears (not grayed out), serial port /dev/ttyACM0.

From the beginning;

Connect board to USB

dmesg 
[ 1562.488131] usb 3-1: USB disconnect, device number 6
[ 1570.049707] usb 3-1: new full-speed USB device number 7 using xhci_hcd
[ 1570.121549] usb 3-1: ep 0x82 - rounding interval to 1024 microframes, ep desc says 2040 microframes
[ 1570.124259] cdc_acm 3-1:1.0: ttyACM0: USB ACM device

Open IDE (1.0 ubuntu installed or 1.0.1 in user folder)

Serial port /dev/ttyACM0 with a tick

But this is where the trouble starts;

Select File (or File > Sketchbook > 'your favorite sketch')

Serial port grayed out; and this

dmesg 
[ 1611.679418] xhci_hcd 0000:0c:00.0: ERROR no room on ep ring
[ 1611.679423] cdc_acm 3-1:1.1: acm_submit_read_urb - usb_submit_urb failed: -12
[ 1611.679426] tty_port_close_start: tty->count = 1 port count = 0.
[ 1615.390878] xhci_hcd 0000:0c:00.0: ERROR no room on ep ring
[ 1615.390893] cdc_acm 3-1:1.1: acm_submit_read_urb - usb_submit_urb failed: -12
[ 1615.390903] tty_port_close_start: tty->count = 1 port count = 0.

Now disconnect USB and reconnect;

Serial port /dev/ttyACM0 with a tick. Compile and upload OK, except for

avrdude: ser_open(): can't open device
"/dev/tty/ACM0" : Input/output error
ioctl("TIOCMET") : Invalid argument

Sometimes the error above doesn't show

Now try selecting the Serial Monitor (bunch of Java errors). Serial port '/dev/tty/ACM0' not found (of course). dmesg output same as previous failure.

This behaviour occurs when connecting and opening the IDE the first time. Second time around is unpredictable as to whether you even get to upload the script.

As I see it, any attempt to use the IDE causes ttyACM0 to become unavailable. I guess, if I understand dmesg output correctly, writing to the device fails, I think?

Reading further, Kernel 3.4 (version from memory) should fix this. Apparently, it's a bug in 3.2, however, some people have found a fix. Interestingly, there is not a lot of consistency to each one.

I have tried a lot of fixes on the net to no avail, except at one point I had it running smoothly. Then looked the other way and sneezed - and of course it broke. Reapplying the previous 'fix' did not fix it.

Hope there's enough here to help, but I guess it's old news anyhow.

I notice linux is using xhci - are you on a USB3 port? If your computer has any USB2-only ports try using those instead. A few of us have had trouble with USB3 ports on linux. I've upgraded to Kubuntu 12.10 and just checked my Uno on a USB3 port and it seems to be working again.

Please post the output of running "sudo lsusb -v"

I use Uno on 12.04, with ttyACM0, and it works ok. But my laptop as only USB2 ports.

I have 1 USB2 port and it works without a hitch. I guess I was looking to fix the USB3 thing. Will have to wait for the new kernel? Will have to find a new spot for the mouse :astonished:

 dmesg
[10998.175212] 3-1: USB disconnect, device number 18
[11013.463158] usb 2-1.2: new full-speed USB device number 10 using ehci_hcd
[11013.557924] cdc_acm 2-1.2:1.0: ttyACM0: USB ACM device

sudo lsusb -v attached as a .txt file. Too many characters.

lsusb-v.txt (48.9 KB)

The lsusb output looks fine (although being a clone board it uses different vid and pid numbers to a regular Arduino, so if you install any udev rules you might need to change the numbers)

It looks like the problem is the kernel USB3 driver. All you can do is wait for an updated kernel to be released, or there might be a PPA you can install a newer kernel from. It's probably better to ask on the xubuntu forums about that, they will probably know more.

Thanks. That's the conclusion I came to. I'll wait for 3.4 which is not too far away. Annoying more than any other issue. :~

Or get a USB 2.0 hub (preferably powered) and plug that into your single USB 2.0 port, and plug the other devices into the hub.

Did I see somewhere that this could be fixed with a USB 2 hub on the USB 3 port?

My own Uno (original R1) doesn't work through a hub in Linux. It has to be connected to a port on the computer. I don't know if this is fixed in later versions of the board.

The new Arduino Due works fine through a hub in Linux (on both ports).

USB 2 does the trick.

Yeah! Moving from USB3 to USB2 fixed the problem to me, too!
Thanks for pointing it out!

the hub did not fix the problem for me. but running avrdude as root worked. After that I realize that adding permissions to ttyACM0 for everybody also works. I just executed
sudo chmod 777 /dev/ttyACM0

and after that I could compile and upload the code to the arduino
The only issue with this is that I have to run that line everytime I connect the Arduino to the USB because ttyACM0 is recreated

The solution here is that you need to run the IDE as a superuser:
sudo ./arduino
to gain the necessary permissions to the serial interface.

cheers,
derick

If you must run the IDE as root, you probably do not have the correct group assigned to your user. The Ubuntu install does not (did not on my install) add dialout group to your user. If you add dialout group to your user, log out, then log in again, you should have access to the Arduino serial.

sudo usermod -a -G dialout yourUserName

Here is another thread on this:
http://forum.arduino.cc//index.php?topic=160106.0
That user needed to add tty group to the user also. On Ubuntu, I needed to add dialout only.

I know this post comes very late to the discussion, but I've spent days debugging problems with /dev/ttyACM0 under Linux (Ubuntu). I updated my BIOS, tried different kernels, and of course I'd double checked that my user account had read/write access to the device (because it was in the dialout group).

The issue for me was modemmanager. On my laptop, modemmanager was grabbing the /dev/ttyACM0 somehow and causing contention. I got "device or resource busy" messages; I got timeouts. I just got weird behavior in general, and almost always attempts to program failed.

Because it was so hard to find, I'm coming back here to update this thread, which was fairly prominent when I tried to hunt down the issue. For me the fix was:

$ sudo apt-get --purge remove modemmanager

After that, things work as they should.

On another laptop, modemmanager almost never caused a problem. Perhaps one in 25 times I had an issue. But on the laptop I use from day to day it was more like 99 out of 100 times it failed.

1 Like

Hi,

thank you so much for the tip with the modemmanager. I've tried with several differernt linux installations, but didn't succeeded. But after having purged the modemmanager, it worked like charm!

BR, Chris

I also started experiencing a similar problem with my linux setup (i.e., serial port being grayed out in the IDE, making it impossible to upload sketches), after a couple of days of being able to upload to my arduino uno just fine.

I was up until 4am trying various solutions and suggestions I read about in other threads and boards to no avail, until I noticed that steps for flashing the firmware involved shortening two pins on the board. Simply performing this step (basically just step 5 of this post, or part of the steps from this page ) worked for me:

  • with the USB cable plugged in, locate the two pins closest to the USB port on the board.
  • briefly touch the two pins with a piece of wire.
  • after the LED stopped blinking, unplug the USB cable from the PC, and plug it back in.

After this point, the Serial Port was detected again in the IDE, and I was able to start using it like before.

I'm still new to this whole thing, so I have to admit I'm not entirely sure if this makes a whole lot of sense (why it stopped working in the first place, and why the above step fixes the problem). Just thought I'd share my experience in case it helps someone out there having a similar problem...

donbindner:
I know this post comes very late to the discussion, but I've spent days debugging problems with /dev/ttyACM0 under Linux (Ubuntu). I updated my BIOS, tried different kernels, and of course I'd double checked that my user account had read/write access to the device (because it was in the dialout group).

The issue for me was modemmanager. On my laptop, modemmanager was grabbing the /dev/ttyACM0 somehow and causing contention. I got "device or resource busy" messages; I got timeouts. I just got weird behavior in general, and almost always attempts to program failed.

Because it was so hard to find, I'm coming back here to update this thread, which was fairly prominent when I tried to hunt down the issue. For me the fix was:

$ sudo apt-get --purge remove modemmanager

After that, things work as they should.

On another laptop, modemmanager almost never caused a problem. Perhaps one in 25 times I had an issue. But on the laptop I use from day to day it was more like 99 out of 100 times it failed.

Thanks a ton for this tip! I had exactly the same message as you.
I don't know what modemmanager does (I'm new to ubuntu but not new to arduino), but removing it was the way to go :slight_smile:
Thanks again!

Just getting started with Arduino and hit this issue with Debian 8.6 on an older PC and a Genuino 101. To confirm, removing modemmanager worked for me too. Thanks Don.

Just for future reference:

you can avoid removing the packet and simply stop the service with the following command:

systemctl stop ModemManager.service

if this works, you can then disable the service using the same syntax:

systemctl [stop|start|enable|disable] ModemManager.service