Error: Failed to autodetect serial port on Ubuntu 15.04

Hey there,
Just got a mini, and installed the cuar software on a small laptop running Ubuntu 15.10. It failed to autodetect the serial port but after fiddling about with the machine settings and serial port managed to get it to work. I also ran
sudo usermod -a -G tty $USER
sudo usermod -a -G dialout $USER
sudo usermod -a -G serial $USER (got an error on this one)

The second print went wrong. I’m guessing it was a problem with cura as I found the software in a hung state, so I decided to install on my main Ubuntu 15.04 pc. Got everything set up but I keep getting the Error: Failed to autodetect serial port.
Did all the same things but still no luck.

After checking on the internet a bit, I ran cura as root and then it connected. Has anyone come across this? What am I missing to get it to connect without running it as root.?

Some more info:
ls -ld /dev/ttyACM0
crw-rw---- 1 root dialout 166, 0 Feb 13 10:12 /dev/ttyACM0

Log:
_Changing monitoring state from ‘Offline’ to ‘Opening serial port’
Connecting to: /dev/serial/by-id/usb-UltiMachine__ultimachine.com__RAMBo_74034313938351C0D041-if00 with baudrate: 115200 (configured)
Unexpected error while connecting to serial port: /dev/serial/by-id/usb-UltiMachine__ultimachine.com__RAMBo_74034313938351C0D041-if00 SerialException: ‘could not open port /dev/serial/by-id/usb-UltiMachine__ultimachine.com__RAMBo_74034313938351C0D041-if00: [Errno 13] Permission denied: ‘/dev/serial/by-id/usb-UltiMachine__ultimachine.com__RAMBo_74034313938351C0D041-if00’’ @ machineCom.py:monitor:346
Found no ports to try for auto detection
Changing monitoring state from ‘Opening serial port’ to ‘Error: Failed to autodetect serial port.’

Ok fixed with the following commands, from terminal.

cd /dev/serial/by-id
sudo chown usb*
sudo chgrp usb*

Thought I’d leave the post just in case anyone else had the same problem.

Cheers

Had the same problem the other day on Ubuntu 14.04, it was something to do with cura being run as a normal user and not having root usb privilages. I just ran cura as root. “Sudo cura”. There is probably another work around, but for now this works and i dont have to go fiddling.

Thank you for this! I was close to calling tech support but I figured I’d Google it first. Glad I did. I figured it was similar to having to run a program as Administrator in Windows. Perhaps the people at Aleph Objects could include an insert for the quick start guide about this issue.

No problem! i’m pretty sure the same issue happens when trying to run the arduino software on Linux as well. Anything on a serial port just seems to need root privileges. Again, i believe there are some commands one can add to the shortcut / launcher to somehow use root privileges without having to type “sudo cura” in a terminal every time, but i haven’t ventured to look for one yet. I seem to remember doing that for my Arduino software once though, so i’m fairly sure it can be done for other programs like cura.

This should work on most versions of Ubuntu… Replace the obvious bit with your username. :slight_smile:

sudo gpasswd --add ${USERNAME_HERE} dialout

ie... sudo gpasswd --add ttabbal dialout

Here is the solution that worked for me to make a desktop shortcut open Cura as root:

Open a terminal window and type the following:

sudo apt-get install gksu

Once that is installed, find the shortcut file on your system, it is named “cura.desktop”. I had created a shortcut on my desktop so mine was in ~/Desktop. Otherwise look in one of these two places:

/usr/share/applications/APPNAME.desktop
~/.local/share/applications/APPNAME.desktop

If it is not in any of those places, take the brute force approach:

locate .desktop|grep APPAME

Once you know where it is, type the following (I’ll use my desktop shortcut as an example):

gksudo gedit ~/Desktop/cura.desktop

Find the line that begins with “Exec=” and add this to the beginning of it:

gksudo -k -u root

On my computer, the end result looked like this:

Exec=gksudo -k -u root /usr/bin/python /usr/share/cura/cura.py

Once all this is done, save the file, close gedit, close the terminal window, and double click your modified shortcut. You will be prompted for your password, type it in and Cura will run normally.

This was adapted from this site: http://askubuntu.com/questions/118822/how-to-launch-application-as-root-from-unity-launcher

You know how sometimes you do something to fix an error and years go by before you see something similar? I completely forgot about this possibility but when I stumbled across your answer it “hit me” that his was the issue!

I know it has been a while since 15.04 but it looks like the same issue is still there with Pop! OS, which is based on Ubuntu 17.10 and the mini with Cuza 21.03.

I haven’t tried it but instead of using

sudo chown {username}:{username} /dev/serial/by-id/usb*

I wonder if you can just change permissions

sudo chmod 777 /dev/serial/by-id/usb*