How do I connect to a terminal to a serial-to-USB device on Ubuntu 10.10 (Maverick Meerkat)?
Asked Answered
F

11

81

I am trying to connect minicom to a serial device that is connected via a USB-to-serial adapter. This is a PL2303 and from everything I've read no additional drivers are required. The device is recognised as a PL2303.

I'm a beginner at minicom. Is this the correct command to execute? Or do I need to configure something?

$ sudo minicom --device /dev/ttyUSB0
minicom: cannot open /dev/ttyUSB0: No such file or directory

$ sudo lsusb -v

Bus 002 Device 006: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Device Descriptor:
  bLength                18
  bDescriptorType         1

$ tail /var/log/syslog  #then removed and attached the device.
Mar 13 23:31:49 ubuntu kernel: [807996.786805] usb 2-1: pl2303 converter now attached to ttyUSB0
Mar 13 23:34:44 ubuntu kernel: [808172.155129] usb 2-1: USB disconnect, address 7
Mar 13 23:34:44 ubuntu kernel: [808172.156321] pl2303 ttyUSB0: pl2303 converter now disconnected from ttyUSB0
Mar 13 23:34:44 ubuntu kernel: [808172.156374] pl2303 2-1:1.0: device disconnected
Mar 13 23:34:52 ubuntu kernel: [808179.497856] usb 2-1: new full speed USB device using uhci_hcd and address 8
Mar 13 23:34:52 ubuntu kernel: [808179.785845] pl2303 2-1:1.0: pl2303 converter detected
Mar 13 23:34:52 ubuntu kernel: [808179.872309] usb 2-1: pl2303 converter now attached to ttyUSB0
Fraxinella answered 18/3, 2011 at 4:8 Comment(5)
The output of lsusb is essentially useless here. Post the output in the system log when you plug the device in.Jackhammer
It might also be useful to see the output of ls -al /dev/ttyUSB* as it may not be coming up as 0. Also see linux.org/docs/ldp/howto/Serial-HOWTO-11.htmlHals
Modified to attach logfile output confirms /dev/ttyUSB0 as the device. So why would minicom not be able to connect to /dev/ttyUSB0?Fraxinella
There are lots of possible problems (is udev running, devfs mounted, appropriate hotplug script installed) and none of them are even slightly programming-related. Your question will be moved to SuperUser.com eventually.Nosepiece
Are you sure your minicom supports specifying the serial device on the command line? Mine doesn't (though as a result I get an error message to that effect, not the one you got). Nor do the ubuntu docs indicate that capability has been added, but perhaps they are out of date. You might try the setup instructions in them anyway: help.ubuntu.com/community/Minicom Also post an ls -al /dev/tty/USB* as dj_segfault suggested, maybe you have a hierarchical /dev and they are in a sub-directory?Krutz
C
97

First check with dmesg | grep tty if system recognize your adapter. Then try to run minicom with sudo minicom -s, go to "Serial port setup" and change the first line to /dev/ttyUSB0.

Don't forget to save config as default with "Save setup as dfl". It works for me on Ubuntu 11.04 on VirtualBox.

Cetinje answered 16/7, 2011 at 18:34 Comment(4)
Also, add user to the dialout group, as you need write access to the device.Courcy
Should probably mean /dev/ttyACM0 instead of /dev/ttyUSB0.Palaeo
@MatthiasDieterWallnöfer it depends.Reyna
The group name is not universal. On Manjaro, for example, one has to add the user to the group uucp.Ber
A
19

You will need to set the permissions every time you plug the converter in. I use PuTTY to connect. In order to do so, I have created a little Bash script to sort out the permissions and launch PuTTY:

#!/bin/bash
sudo chmod 666 /dev/ttyUSB0

putty

P.S. I would never recommend that permissions are set to 777.

Aluino answered 16/11, 2012 at 11:46 Comment(2)
I think that is worth trying to add your user to the dialout and/or uucp group before changing permissions, as you might not need to do that anymore!Courcy
I can add an update: @Courcy answer is true still today (even on Ubuntu 20). If you had ls -l /dev/ttyUSB0 and looked at the device's "group" owner, that would be a clue what group your user needs to be added to. Lastly, the 3rd column is "nobody" permission meaning if you're going to hack permission changes, that's the column you especially do not want to change (it won't help your user, and it may grant permission to insecure processes such as a webserver you run). See: usermod -a -G dialout $USER instead..Fidge
P
11

Long time reader, first time helper ;)

I'm going through the same hellish experience here with a Prolific USB <> Serial adapter and so far Linux is the easiest to get it to work.

On CentOS, I didn't need to install any drivers etc.. That said,

  • dmesg | grep -i tty or dmesg | grep -i usb showed me /dev/ttyUSB0.
  • screen ttyUSB0 9600 didn't do the trick for me like it did in OSX
  • minicom is new to me but it was complaining about lack of /dev/modem

However, this helped: https://www.centos.org/forums/viewtopic.php?t=21271

So install minicom (yum install minicom) then enter its settings (minicom -s).

Then select Serial Port Setup and change the Serial Device (Option A) to /dev/ttyUSB0, or whatever your device file is as it slightly differs per distro.

Then change the Bps (Option E) to 9600 and the rest should be default (8N1 Y N)

Save as default, then simply minicom and Bob's your uncle.

HTH.

Patron answered 8/11, 2018 at 22:11 Comment(2)
Excellent SO writing style :)Review
I'm able to use screen -U /dev/ttyUSB0 115200 to connect to a PL2303Bonin
P
8

The serial port communication programs moserial or gtkterm provide an easy way to check connectivity and modify /dev/ttyUSB0 (or /dev/ttyUSB1!) settings. Even though there maybe only a single USB to RS232 adapter, the n designation /dev/ttyUSBn can and does change periodically! Both moserial and gtkterm will show what port designation is relevant in their respective pull down menus when selecting an appropriate port to use.

Check out help.ubuntu.com/community/Minicom for details on minicom.

Pas answered 28/6, 2011 at 18:21 Comment(1)
Cutecom is an intuitive serial-port monitor. Be sure to mind the devices permissions: best to open them up: chmod 777 /dev/ttyUSB0Mulcahy
M
4

I had fix this with adduser *username* dialout. I never had this error again, even though previously the only way to get it to work was to reboot the PC or unplug and replug the usb to serial adapter.

Magazine answered 11/6, 2015 at 9:35 Comment(1)
Could you please add a little more description about the explanation you provide?Dyche
E
1

I get get the same minicom error, "cannot open /dev/ttyUSB0: No such file or directory"

Three notes:

  1. I get the error when the device attached to the serial port end of my Prolific Technology PL2303 USB/Serial adapter is turned off. After turning on the device (an embedded controller running Linux) minicom connected fine.

  2. I have to run as super user (i.e. sudo minicom)

  3. Sometimes I have to unplug and plug back in the USB-to-serial adapter to get minicom to connect to it.

I am running Ubuntu 10.04 LTS (Lucid Lynx) under VMware (running on Windows 7). In this situation, make sure the device is attached to VM operating system by right clicking on the USB/Serial USB icon in the lower right of the VMware window and select Connect (Disconnect from Host).

Remember to press Ctrl + A to get minicom's prompt, and type X to exit the program. Just exiting the terminal session running minicom will leave the process running.

Erleena answered 15/3, 2012 at 14:3 Comment(1)
Unplugging and plugging back in worked for me, thanks!Euphorbia
S
1

I had the exact same problem, and it was fixed by doing a chmod 777 /dev/ttyUSB0. I never had this error again, even though previously the only way to get it to work was to reboot the VM or unplug and replug the USB-to-serial adapter. I am running Ubuntu 10.04 (Lucid Lynx) VM on OS X.

Striped answered 11/5, 2012 at 3:30 Comment(2)
Yes, if you run as a regular user permissions could be an issue. Note however that in this question, minicom is being run as root using sudo. Generally the preferred solution on access permissions is to assign users who need access to a group which owns the serial port device files and has the needed permission to them - on Ubuntu that is typically 'dialout'Krutz
For more details on the dialout group, see a related question on askubuntu.com.Teary
S
1

In some cases the brltty service may be running. There seem to be cases when an update results in the service being installed and automatically started.

If brltty is your problem then when you plug in the USB TTY, it will take over the port. You can check if this is happening with the command dmesg | grep tty. If you see logs something like the following then brltty is your problem. See reddit - BRLTTY Fighting with My /dev/ttyUSB0 for MCU Programming.

orangepi@orangepi5plus:~$ dmesg | grep tty
[ 1104.336365] usb 4-1: ch341-uart converter now attached to ttyUSB0
[ 1104.985780] usb 4-1: usbfs: interface 0 claimed by ch341 while 'brltty' sets config #1
[ 1104.988450] ch341-uart ttyUSB0: ch341-uart converter now disconnected from ttyUSB0
[ 1298.811838] usb 4-1: ch341-uart converter now attached to ttyUSB0
[ 1299.440590] usb 4-1: usbfs: interface 0 claimed by ch341 while 'brltty' sets config #1
[ 1299.442800] ch341-uart ttyUSB0: ch341-uart converter now disconnected from ttyUSB0

You can also check to see if the brltty service is running with the following:

orangepi@orangepi5plus:~$ ps -ef | grep "brltty"
root       14934       1  1 09:45 ?        00:00:00 /sbin/brltty -n -p /var/run/brltty.pid
orangepi   14972    3167  0 09:45 pts/0    00:00:00 grep --color=auto brltty

To disable the brltty service, you must enter two commands, one after the other:

orangepi@orangepi5plus:~$ sudo systemctl disable --now brltty brltty-udev
orangepi@orangepi5plus:~$ sudo systemctl mask brltty brltty-udev
Created symlink /etc/systemd/system/brltty.service → /dev/null.
Created symlink /etc/systemd/system/brltty-udev.service → /dev/null.
orangepi@orangepi5plus:~$ ps -ef | grep "brltty"
orangepi   15026    3167  0 09:46 pts/0    00:00:00 grep --color=auto brltty

After stopping the brltty service, unplug and then plug back in the device. Check using dmesg | grep tty that brltty is no longer running.

orangepi@orangepi5plus:~$ dmesg | grep tty
[ 1298.811838] usb 4-1: ch341-uart converter now attached to ttyUSB0
[ 1299.440590] usb 4-1: usbfs: interface 0 claimed by ch341 while 'brltty' sets config #1
[ 1299.442800] ch341-uart ttyUSB0: ch341-uart converter now disconnected from ttyUSB0
[ 1790.219667] usb 4-1: ch341-uart converter now attached to ttyUSB0
[ 1790.826036] usb 4-1: usbfs: interface 0 claimed by ch341 while 'brltty' sets config #1
[ 1790.828359] ch341-uart ttyUSB0: ch341-uart converter now disconnected from ttyUSB0
[ 1859.583622] usb 4-1: ch341-uart converter now attached to ttyUSB0

You will then be able to select /dev/ttyUSB0 or other ttyUSB device with a terminal emulator such as minicom or gtkterm.

Note that you may need to still do the following as indicated above:

  • add your user to the dialout group
  • change the permissions on the /dev/ttyUSB0 device

To check if the user is in the dialout group:

orangepi@orangepi5plus:~$ groups
orangepi tty disk dialout sudo audio video plugdev games users systemd-journal input netdev bluetooth docker

To check device permissions:

orangepi@orangepi5plus:~$ ls -l /dev/ttyUSB*
crw-rw---- 1 root dialout 188, 0 Feb 20 10:00 /dev/ttyUSB0

If you want to just eliminate brltty this will do the job

sudo apt remove brltty 
Serving answered 28/11, 2023 at 1:45 Comment(0)
E
0

I just got my GUC232A cable with a molded-in PL2302 converter chip.

In addition to adding myself and br to group dialout, I found this helpful tip in the README.Debian file in /usr/share/doc/bottlerocket:

This package uses debconf to configure the /dev/firecracker symlink, should you need to change the symlink in the future run this command:

dpkg-reconfigure -pmedium bottlerocket

That will then prompt you for your new serial port and modify the symlink. This is required for proper use of bottlerocket.

I did that and voila! bottlerocket is able to communicate with my X-10 devices.

Ephraim answered 15/6, 2015 at 16:59 Comment(0)
M
0

I suggest that newbies connect a PL2303 to Ubuntu, chmod 777 /dev/ttyUSB0 (file-permissions) and connect to a CuteCom serial terminal. The CuteCom UI is simple \ intuitive. If the PL2303 is continuously broadcasting data, then Cutecom will display data in hex format

Mulcahy answered 8/6, 2016 at 5:28 Comment(0)
I
0

Putty on ubuntu There is no need to install the driver for PL2303 So only type the command to enable the putty Sudo chmod 666 /dev/ttyUSB0 Done Open the putty.

Inroad answered 19/7, 2018 at 9:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.