The Computer Oracle

Linux tells me a serial port is in use, but it isn't

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 3

--

Chapters
00:00 Linux Tells Me A Serial Port Is In Use, But It Isn'T
01:05 Accepted Answer Score 14
01:34 Answer 2 Score 3
01:48 Answer 3 Score 5
02:03 Answer 4 Score 0
02:27 Thank you

--

Full question
https://superuser.com/questions/794309/l...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#linux #serialport

#avk47



ACCEPTED ANSWER

Score 14


There is probably no real usage of the line, but a permission issue. quick and dirty way to test for me was to execute:

ls -la /dev/ttyUSB0
sudo chmod 666 /dev/ttyUSB0

and retry cu. If it starts working, you need to take care of the respective udev file and the user permissions/groups. For my device it looked like this (being member in plugdev group):

> cat /etc/udev/rules.d/42-CP210x.rules 
ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", SUBSYSTEMS=="usb",
ACTION=="add", MODE="0666", GROUP="plugdev"



ANSWER 2

Score 5


Serial devices privileges are granted to members of the dialout group. To get connected to /dev/ttyS0 I added the current user to the group using:

sudo adduser <username> dialout




ANSWER 3

Score 3


It seems that this is a bug in cu. I solved this by changing owner group of /dev/ttyUSB0 using following command:

chown root:root /dev/ttyUSB0



ANSWER 4

Score 0


Add your user to the dialout group. Depending on the system, it may also be necessary to add your user to the uucp group.

Check the group for membership:

getent group dialout

Or check your user:

groups `whoami`

Add your user if necessary:

usermod -aG dialout `whoami`

verify with getent as mentioned above.