I have been tackling an issue where everytime the printer is powered off, or the USB cable is unplugged from the octoprint server; I have to login and run chmod 666 /dev/ttyACM every time.
So I began to look for a more permanent solution, and was met with several that didn't work for me. I decided to post what DID end up working, and share it with you all. Basically you need to add your octoprint user to the dialout, tty, uucp and plugdev groups to enable it to work. This did fix my issue on Ubuntu 19.04.
The actual error message:
Cannot open /dev/tty: Permission denied
The solution (from arduino IDE setup scripts) is:
- sudo nano setupscript.sh
- Copy/paste the script from below onto the file.
- Hit Ctrl+O to save, and Ctrl+X to leave.
- run id -Gn yourusername and you should see the groups: dialout, tty, uucp, and plugdev.
echo ""
echo "**** Add User to dialout,tty, uucp, plugdev groups ****"
echo ""
sudo usermod -a -G tty $1
sudo usermod -a -G dialout $1
sudo usermod -a -G uucp $1
sudo groupadd plugdev
sudo usermod -a -G plugdev $1
acmrules () {
echo ""
echo "# Setting serial port rules"
echo ""
cat <<EOF
"KERNEL="ttyUSB[0-9]*", TAG+="udev-acl", TAG+="uaccess", OWNER="$1"
"KERNEL="ttyACM[0-9]*", TAG+="udev-acl", TAG+="uaccess", OWNER="$1"
EOF
}
Business IT Solutions - https://bizhostnc.com
Plastic Process Engineering