Ubuntu – USB to Serial in Chrubuntu – /dev/ttyUSB0 missing

driversUbuntuusb

The usbserial stuff has been working so well for me in Ubuntu for a number of years that I have almost forgotten how to troubleshoot it. I just installed Chrubuntu, however, and now my usbserial is not just magically working.

Here's the info I think you will need:

uname -a

Linux ChrUbuntu 3.4.0 #1 SMP Sun Aug 26 19:17:55 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux

I would normally expect to see the cp210x driver. (As I will show below, modprobe doesn't seem to load it.)

root@ChrUbuntu:/lib/modules/3.4.0/kernel/drivers/usb/serial# ls
option.ko  pl2303.ko  qcserial.ko  sierra.ko  usb_wwan.ko

lsusb

Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 04ca:3006 Lite-On Technology Corp. 
Bus 001 Device 004: ID 064e:d251 Suyin Corp. 
Bus 002 Device 003: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x Composite Device

dmesg

[  649.111665] usb 2-1.3: new full-speed USB device number 3 using ehci_hcd
[  649.199149] usb 2-1.3: New USB device found, idVendor=10c4, idProduct=ea60
[  649.199161] usb 2-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  649.199169] usb 2-1.3: Product: CP2103 USB to UART Bridge Controller
[  649.199175] usb 2-1.3: Manufacturer: Silicon Labs
[  649.199179] usb 2-1.3: SerialNumber: 0001

after disconnecting the device, one new line is logged in dmesg:

[ 2858.730137] usb 2-1.3: USB disconnect, device number 3

lsmod

Module                  Size  Used by
fuse                   59885  2 
rfcomm                 25259  0 
snd_hda_codec_hdmi     29062  1 
snd_hda_codec_realtek    49177  1 
memconsole             12352  0 
snd_hda_intel          24601  3 
snd_hda_codec          71435  3 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel
snd_hwdep              12351  1 snd_hda_codec
ath9k                 118119  0 
uvcvideo               59368  0 
videodev               81368  1 uvcvideo
snd_pcm                61468  3 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec
videobuf2_core         25280  1 uvcvideo
videobuf2_vmalloc      12313  1 uvcvideo
videobuf2_memops       12475  1 videobuf2_vmalloc
mac80211              318094  1 ath9k
ath9k_common           12689  1 ath9k
ath9k_hw              351731  2 ath9k,ath9k_common
sdhci_pci              16409  0 
sdhci                  25037  1 sdhci_pci
ath                    21105  3 ath9k,ath9k_common,ath9k_hw
mmc_core               71579  2 sdhci_pci,sdhci
btusb                  16409  0 
joydev                 16409  0 
nm10_gpio              12313  0 
tg3                   118809  0 
snd_timer              21055  1 snd_pcm
snd_page_alloc         12757  2 snd_hda_intel,snd_pcm
bluetooth             143138  13 rfcomm,btusb
cfg80211              141223  3 ath9k,mac80211,ath
rtc_cmos               16409  0 

Assuming the module I need for the CP210x driver is usbserial, I tried this:

root@ChrUbuntu:/# modprobe usbserial
root@ChrUbuntu:/# 

root@ChrUbuntu:/# lsmod | grep usbserial
root@ChrUbuntu:/# 

The expected /dev/ttyUSB0 is missing (both before and after trying modprobe usbserial):

root@ChrUbuntu:/dev# ls

agpgart           ecryptfs  loop4               port    sda2    tpm0   tty19  tty30  tty42  tty54  tty9     vcs6
block             fb0       loop5               ppp     sda3    tty    tty2   tty31  tty43  tty55  uinput   vcs7
bsg               fd        loop6               ptmx    sda4    tty0   tty20  tty32  tty44  tty56  urandom  vcsa
bus               full      loop7               pts     sda5    tty1   tty21  tty33  tty45  tty57  usbmon0  vcsa1
char              fuse      loop-control        random  sda6    tty10  tty22  tty34  tty46  tty58  usbmon1  vcsa2
chromeos-low-mem  hpet      mapper              rfkill  sda7    tty11  tty23  tty35  tty47  tty59  usbmon2  vcsa3
console           input     mcelog              rtc     sda8    tty12  tty24  tty36  tty48  tty6   v4l      vcsa4
core              kmsg      mem                 rtc0    sda9    tty13  tty25  tty37  tty49  tty60  vcs      vcsa5
cpu               log       net                 sda     shm     tty14  tty26  tty38  tty5   tty61  vcs1     vcsa6
cpu_dma_latency   loop0     network_latency     sda1    snd     tty15  tty27  tty39  tty50  tty62  vcs2     vcsa7
disk              loop1     network_throughput  sda10   stderr  tty16  tty28  tty4   tty51  tty63  vcs3     video0
dm-0              loop2     null                sda11   stdin   tty17  tty29  tty40  tty52  tty7   vcs4     zero
dri               loop3     nvram               sda12   stdout  tty18  tty3   tty41  tty53  tty8   vcs5

I would normally use udev rules like this and I would use ttyUSB0 as my port for the device of interest now. Obviously, these won't work if ttyUSB* is missing, as it is now.

KERNEL=="ttyUSB[0-9]*", DRIVERS=="cp210x", ATTRS{interface}=="CP2103 USB to UART Bridge Controller", MODE="0666", NAME:="ttyUSB0"
KERNEL=="ttyUSB[0-9]*", DRIVERS=="pl2303", SUBSYSTEMS=="usb-serial", MODE="0666", NAME:="ttyUSB1"

The solution apparently is to build kernel modules usbserial.ko and cp210x.ko. However, ChrUbuntu is based on Ubuntu 12.04 but with kernel 3.4. I can't seem to figure out all the variables required to build the modules in ChrUbuntu.

Best Answer

The lack of the cp210x.ko and usbserial.ko kernel modules in the directory:

/lib/modules/`uname -r`/kernel/drivers/usb/serial/

would seem to indicate that the kernels provided with the ChrUbuntu releases were built not having these features enabled at compile time.

Comparing the output that's provided in the question by the OP against Ubuntu 12.10 would seem to back this up:

ChrUbuntu

root@ChrUbuntu:/lib/modules/3.4.0/kernel/drivers/usb/serial# ls
option.ko  pl2303.ko  qcserial.ko  sierra.ko  usb_wwan.ko

Ubuntu 12.10

$ ls /lib/modules/`uname -r`/kernel/drivers/usb/serial/
aircable.ko         empeg.ko        ipaq.ko         mct_u232.ko    option.ko       sierra.ko            visor.ko
ark3116.ko          f81232.ko       ipw.ko          metro-usb.ko   oti6858.ko      spcp8x5.ko           vivopay-serial.ko
belkin_sa.ko        ftdi_sio.ko     ir-usb.ko       mos7720.ko     pl2303.ko       ssu100.ko            whiteheat.ko
ch341.ko            funsoft.ko      iuu_phoenix.ko  mos7840.ko     qcaux.ko        symbolserial.ko      zio.ko
cp210x.ko           garmin_gps.ko   keyspan.ko      moto_modem.ko  qcserial.ko     ti_usb_3410_5052.ko
cyberjack.ko        hp4x.ko         keyspan_pda.ko  navman.ko      quatech2.ko     usb_debug.ko
cypress_m8.ko       io_edgeport.ko  kl5kusb105.ko   omninet.ko     safe_serial.ko  usbserial.ko
digi_acceleport.ko  io_ti.ko        kobil_sct.ko    opticon.ko     siemens_mpi.ko  usb_wwan.ko

Given this you'll need to build the cp210x.ko kernel module from source and then install it manually.

See this Unix & Linux Q&A titled: Ubuntu make fails with No such file or directory /lib/modules/3.4.0/build, for details on how to accomplish this task.

Related Question