What is really going on with Linux and my Uno?

I started off programming my Uno (2) on my Ubuntu 11.04 with no problems whatsoever. I was able to upload at will. Then one day something happened... I dunno what! My Uno wondermachine fell into the trap that I have now been reading about for a lot of hours. I can't open the port to upload my sketch. Lots of folks have had this problem. Some have solved it. I can't get it to work with any of the solutions I have read about: flash your firmware... been there, done that. No help. udev... tried that restarts, reinstalling, symbolic links... glimmer of hope, but then back to the drawing board. and others.

Anyway, what I DID manage to do was to get it running again on my Vista computer. I was asked to install the drivers when I plugged the card in. I found the drivers, but Vista couldn't see them when it searched for them. then I found a post in the forum that said to back up one level in the file heirarchy. It worked. Now I can program the Uno using Vista.

My point? It ain't the Uno at fault here. I don't think one needs to short anything out, flash anything or whatever. It seems to me the problem is in the way Linux is handling the COM port connections. And symbolic link does NOT work for me. Remember, my Uno USED to work (the same day, in fact) perfectly on the same computer, only to suddenly develop this bug. So what changed? Any Linux experts that can figure this out for the many users who are stuck? I don't know enough about Linux to understand what goes on, but I think that my reasoning is sound. I love my Linux computer, and hate to use the other one... It's not often one hits a tough spot like this with Linux, at least in my experience.

I’m running Linux, Ubuntu 11.10, and I don’t have a problem. I was told the same thing about my Mega2560. Gotta replace this, jump this. I didn’t. Same thing as you. Windows worked, Linux didn’t. Until now. :slight_smile:

What are the symptoms? Is it the “Serial port” selection in the IDE “Tools” drop-down menu greyed out? Or nothing in the list? Or are they greyed out?

Symptoms: If I plug in the USB cable and have a sketch to upload, there will be a port (ttsACM0, for ex) in that menu. Or others! Last night there were three after I set up another symbolic link in the (open) terminal. I hit the compile button, so that I had not skipped over a step here, and then the upload button. I get a message about failing to open the port, and a bunch of java messages. I can't decipher all that! My java is installed and working correctly.

After that failed upload attempt one of the port icons had disappeared, so I chose another one and then the same thing happened, two down, one to go! Then the third failed and the menu went grey, as you described. All the while, no other USB devices were in use. Over and over and over again...

Did yours just start working again or what?

It did not correct itself here. I had to make some adjustments.

It sounds like you may have a permission problem. From a command prompt:

cd /dev
ls -l ttyACM0

Find the groups the ttyACM0 requires. Mine has dialout. Here is mine:

crw-rw---- 1 root dialout 166, 0 2011-12-06 03:26 ttyACM0

Then use this to determine what group permissions your username has.

groups

My install required uucp and dialout added as secondary groups.

sudo usermod -aG uucp username
sudo usermod -aG dialout username

Replace username with you username of course.

I did not need any symbolic links. All else worked fine once the permissions thing was covered.

Yippeeee!!! The Arduino forum server stayed up long enough this time to post this!!

Isn't it a bit unfair to blame 'Linux' for this issue, and your only data point is Ubuntu?

madworm: Isn't it a bit unfair to blame 'Linux' for this issue, and your only data point is Ubuntu?

Considering past history, it is not unfair at all. I tried PCLinuxOS and openSUSE. Both had problems then. When I got here in July, this part of the forum was loaded with Linux problems. Now, most seem to get corrected quickly.

Add: Now that I think about it, it is unfair to blame Linux. The blame falls on Arduino. It is their code that malfunctions. And don't start with "we didn't know". You did know. It has been reported and nothing has been done. These are just my reports: http://code.google.com/p/arduino/issues/detail?id=604&start=200 http://code.google.com/p/arduino/issues/detail?id=605&start=200

I feel your pain - and you're not alone.

I myself once provided a truly trivial patch when V0022 was the current version and nothing has been done about it. It was not accepted, nor was it rejected. It was ignored.

This project may be open source, but it is certainly not very open with respect to user contributed 'stuff' to the IDE/core libraries. And I'm not talking about massive 'brain surgery', but just little things too.

I think the problem is that there are simply not enough people around that are allowed to contribute to the code base. I guess it's basically David Mellis who's in charge - and everything must get past him. Of course he can't deal with it 24/7, but he is a 'single point of failure' in this chain. The linux-kernel way of dealing with this is much more preferred. Many different maintainers who can make decisions of their own as far as 'their' part of the code is concerned - at least in the development branch.

These facts are a big loss of potential for the project.

Hi madworm. I am not blaming David Mellis. I was just venting. Sometimes I get frustrated when I have to help users correct the same bugs over and over. I'm sure you know about that.

I did manage to get most of the Linux repositories up-to-date with the avr-gcc.1.7.1 fix. Debian, Ubuntu, and Mint have all upgraded, which has made this debugging stuff much easier for me. No more patched up v1.6.x problems.

I would volunteer to help him, but I am not sure how. I must admit, I'm a bit new to this open source hardware still. I feel it is like the Linux crowd when I got here. Many complained, few helped. What can I do? Would David like some assistance? How do I volunteer?

Hmm. What more can one do than to file bugs and ideally supply patches.

If they're not taken into consideration, the only thing to do is fork the project and draw away all people willing to make the software better. But it is somewhat mean. Probably it can't be called 'Arduino IDE' anymore. And most of the beginners might shy away from it like a vampire from holy water.

They need to open up and accept the community influence some more.

The '#define round...' issue is partially back in 1.0. I've posted regarding that in the '25% code size' post.

madworm:
Hmm. What more can one do than to file bugs and ideally supply patches.

Help him out. I considered offering help in August, but I did not feel experienced enough yet to help. That has changed.

If they’re not taken into consideration, the only thing to do is fork the project and draw away all people willing to make the software better. But it is somewhat mean. Probably it can’t be called ‘Arduino IDE’ anymore. And most of the beginners might shy away from it like a vampire from holy water.

No. I don’t want to start anything new. This is ok. He didn’t say “NO! I’m not doing that!”.

They need to open up and accept the community influence some more.

Yes.

The ‘#define round…’ issue is partially back in 1.0. I’ve posted regarding that in the ‘25% code size’ post.

Damn!! Debian lists that as a bug.

Bug-Debian: http://bugs.debian.org/633659
— arduino-0022+dfsg.orig/hardware/arduino/cores/arduino/wiring.h
+++ arduino-0022+dfsg/hardware/arduino/cores/arduino/wiring.h
@@ -76,7 +76,7 @@ extern “C”{
#define max(a,b) ((a)>(b)?(a):(b))
#define abs(x) ((x)>0?(x):-(x))
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
-#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
+//#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
#define radians(deg) ((deg)*DEG_TO_RAD)
#define degrees(rad) ((rad)RAD_TO_DEG)
#define sq(x) ((x)
(x))

BTW, there is an alternative to just commenting out that macro. That was also offered with the patch. It uses that macro if the avr-gcc version is lower than 1.7.1, and does not use it otherwise. That gets everything covered.

I know...

Checking for avr-libc version works here.

Thanks guys, for taking the time to help me out. I will try the fix and report back. In the meantime, I didn't mean to "blame" Linux, but the fixes I have been reading about for the last 48 straight hours just wouldn't work, and I know that there is enough expertise in this forum to fix it. I also had a problem even finding information about it on the forum, due to a lack of a standard way of phrasing the question. I just wish I have a little uns of your knowledge on the subject. Thanks again!

No thing. This is a recent challenge that has emerged since the release of a new runtime library in the repository.

In this case, it is a bit of a Linux problem. For some reason, the Ubuntu repository install is not adding the correct user groups to the user, and that blocks access to the Arduino usb port. Let me know if it works for you.

I ran your suggestions through, and got this.

jim@jim-laptop:/dev$ ls -l ttyACM0 ls: cannot access ttyACM0: No such file or directory

so I ran this: jim@jim-laptop:/dev$ groups

and got this: jim adm lp dialout cdrom plugdev lpadmin admin sambashare

I added the changes anyway: jim@jim-laptop:/dev$ sudo usermod -aG dialout jim jim@jim-laptop:/dev$ sudo usermod -aG uucp jim

then I ran this: jim@jim-laptop:/dev$ groups

and got this: jim adm lp dialout cdrom plugdev lpadmin admin sambashare

Next? thanks ahead of time. Santa is going to be good to you!

Have you tried looking in the /dev/ directory when you plug in the Arduino and see if anything changes?
Use just

cd /dev
ls -l

Then remove or insert the Arduino and see if there is a change.

BTW, I did not see the change take effect when you tried to add the uucp group. Here is mine:

tim@tim-desktop:/dev$ groups
tim adm uucp dialout lpadmin admin

The only reason I added uucp to the groups was a message displayed during the install of the Arduino IDE from the repository. There was a warning message that said “unable to add group uucp to user”. I am using Ubuntu 11.10.

Add: I tried a test adding a group to a user. I added group “cdrom” to tim

sudo usermod -aG cdrom tim

The change did not show until I rebooted the computer.

You do not need to reboot! This is not winblows after all.

If you're running the graphical user interface, it is enough to quit your session and log in again.

If you're using text-mode only, just log off and log in again (or switch to the next console).

madworm: You do not need to reboot! This is not winblows after all.

Thank my lucky stars for that!!

Thanks madworm. I did not try that. Actually, I thought it hadn't worked. I shut down my computer for something else, and when I booted back up, there it was. So close and open the user session should do it. :)

I got the changes to show up, after logging out :wink: and then in again. When I connected the arduino I could see two serial connections:
ACM0 and tty7. Both failed to load the sketch, and one disappeared after each try. Then I had nothing in the serial line.

VERY shortly thereafter the system crashed! and I checked the log to see this:
Dec 10 16:48:14 jim-laptop kernel: [15528.100153] usb 6-1: new full speed USB device using uhci_hcd and address 5
Dec 10 16:48:15 jim-laptop kernel: [15528.301190] cdc_acm 6-1:1.0: ttyACM0: USB ACM device
Dec 10 16:51:40 jim-laptop wpa_supplicant[1182]: WPA: Group rekeying completed with 1c:7e:e5:43:25:81 [GTK=CCMP]
Dec 10 16:51:40 jim-laptop NetworkManager[1013]: (wlan0): supplicant connection state: completed → group handshake
Dec 10 16:51:40 jim-laptop NetworkManager[1013]: (wlan0): supplicant connection state: group handshake → completed
Dec 10 16:55:52 jim-laptop kernel: [15986.000120] usb 6-1: USB disconnect, address 5
Dec 10 16:57:23 jim-laptop kernel: [16076.276045] usb 6-1: new full speed USB device using uhci_hcd and address 6
Dec 10 16:57:23 jim-laptop kernel: [16076.477908] cdc_acm 6-1:1.0: ttyACM1: USB ACM device
Dec 10 16:57:23 jim-laptop modem-manager[1110]: (ttyACM1) opening serial port…
Dec 10 16:57:32 jim-laptop kernel: [16085.696061] usb 6-1: USB disconnect, address 6
Dec 10 16:57:32 jim-laptop modem-manager[1110]: (ttyACM1) closing serial port…
Dec 10 16:57:32 jim-laptop kernel: [16085.708785] BUG: unable to handle kernel NULL pointer dereference at 00000002
Dec 10 16:57:32 jim-laptop kernel: [16085.708850] IP: [] acm_ctrl_msg.clone.13+0x36/0x70 [cdc_acm]
Dec 10 16:57:32 jim-laptop kernel: [16085.708905] *pde = 7c962067
Dec 10 16:57:32 jim-laptop kernel: [16085.708931] Oops: 0000 [#1] SMP
Dec 10 16:57:32 jim-laptop kernel: [16085.708963] last sysfs file: /sys/devices/pci0000:00/0000:00:1d.1/usb6/idProduct

As I understand, the USB port is working fine, but what is the BUG: unable to handle…?

Whatever distribution you have, please file a bug report there. Kernel bugs surely cannot be solved by ‘us’.