Bosse_B
Posts: 1009
Joined: Thu Jan 30, 2014 9:53 am

New Pi-OS install on RPi3B, USB serial ports missing!

Tue Aug 04, 2020 7:40 am

Contrary to how Raspbian has worked for me on numerous RPi installations over many years I have run into a problem concerning USB-Serial converters which I use a lot to communicate with multiple RS232 devices from my RPi units.
This is an RPi3B on which I have done a test using a new blank SDcard and downloading the Pi-OS image with GUI but without the extra applications (bare-bones GUI version). The RPi3B has its original SDcard still available and on that the problem does not exist.

So:
- I have made a first Pi-OS installation and done the sudo update/upgrade steps to get it current.
- Next I have attached two USB/RS232 converters to the top USB ports on the RPI.
Then:

Code: Select all

$ lsusb
Bus 001 Device 005: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 001 Device 006: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
This shows my two serial devices as device 005 and 006. So far so good.
But then when I want to find which tty device they have been associated with:

Code: Select all

$ ll /dev/ttyUSB*
ls: cannot access '/dev/ttyUSB*': No such file or directory
If I move these devices to my RPi4 development machine still running Raspbian Buster (fully updated) I get this instead:

Code: Select all

$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 006: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC
Bus 001 Device 007: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

$ ll /dev/ttyUSB*
crw-rw---- 1 root dialout 188, 0 Aug  4 09:23 /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 1 Aug  4 09:23 /dev/ttyUSB1
Here the two devices show up as they should as ttyUSB devices!
Why has this been removed from Pi-OS and how can I now access these serial devices?????
Bo Berglund
Sweden

hippy
Posts: 7911
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: New Pi-OS install on RPi3B, USB serial ports missing!

Tue Aug 04, 2020 11:40 am

Bosse_B wrote:
Tue Aug 04, 2020 7:40 am
Why has this been removed from Pi-OS
It hasn't. It works for me on my Pi 3B, Raspberry Pi OS, Buster, 32-bit 5.4 kernel, fourth and fifth lines of 'lsusb' ...

Code: Select all

pi@Pi3B:~ $ uname -a
Linux Pi3B 5.4.51-v7+ #1327 SMP Thu Jul 23 10:58:46 BST 2020 armv7l GNU/Linux

Code: Select all

pi@Pi3B:~ $ lsusb
Bus 001 Device 006: ID 04d9:1203 Holtek Semiconductor, Inc. Keyboard
Bus 001 Device 005: ID 04f3:0213 Elan Microelectronics Corp. 
Bus 001 Device 004: ID 0a05:7211 Unknown Manufacturer hub
Bus 001 Device 010: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 001 Device 011: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Code: Select all

pi@Pi3B:~ $ ls -l /dev/ttyUSB*
crw-rw---- 1 root dialout 188, 0 Aug  4 12:31 /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 1 Aug  4 12:31 /dev/ttyUSB1

Code: Select all

pi@Pi3B:~/apps/usbttylist $ python usbttylist.py 
ttyUSB0 Bottom Left 067b:2303 Prolific Technology Inc. USB-Serial Controller D 1.10
ttyUSB1 Top Left 0403:6001 FTDI USB to Serial Cable 1.10
So the question is; why isn't it working for you ?

Taking a look at 'dmesg' may indicate why the /dev/ttyUSB* devices aren't being created, what is happening when the two USB cables are detected.

Bosse_B
Posts: 1009
Joined: Thu Jan 30, 2014 9:53 am

Re: New Pi-OS install on RPi3B, USB serial ports missing!

Tue Aug 04, 2020 12:38 pm

I found the reason which I believe was not there in previous operating system images:
The use of the serial ports (even USB connected) needs to be enabled in raspi-config!
So I made these notes in my project setup instructions (Readme.md):

Code: Select all

First of all the use of the serial port needs to be enabled in raspi-config.
This is done by starting raspi-config:  
```
$ sudo raspi-config
```
Then go to:
- 5. Interfacing options
- P6 Serial
- Reply No to the first question about login via serial
- Reply yes to enable the serial port hardware
After this and a reboot the serial ports started to appear.
I can't remember ever having to do this before...
Bo Berglund
Sweden

trejan
Posts: 2240
Joined: Tue Jul 02, 2019 2:28 pm

Re: New Pi-OS install on RPi3B, USB serial ports missing!

Tue Aug 04, 2020 12:49 pm

Bosse_B wrote:
Tue Aug 04, 2020 12:38 pm
I found the reason which I believe was not there in previous operating system images:
The use of the serial ports (even USB connected) needs to be enabled in raspi-config!
No. Nothing has changed there. The raspi-config option is only for the serial port on the GPIO header. It has nothing to do with USB serial ports.

My guess is that you updated your kernel but hadn't rebooted yet. This meant that the kernel modules on the card/disk no longer matches the kernel so when you plugged in your USB device, it couldn't load the module for it.

hippy
Posts: 7911
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: New Pi-OS install on RPi3B, USB serial ports missing!

Tue Aug 04, 2020 1:46 pm

trejan wrote:
Tue Aug 04, 2020 12:49 pm
My guess is that you updated your kernel but hadn't rebooted yet. This meant that the kernel modules on the card/disk no longer matches the kernel so when you plugged in your USB device, it couldn't load the module for it.
That makes a lot of sense.

As would having some sort of pop-up or warning that the Pi needs to be re-booted. Some sort of notification that things may be in an indeterminate state with mismatches between modules and kernel.

I have fallen into that trap myself. One can waste a whole lot of time, money and effort in not realising an update/upgrade has silently 'damaged a system', needs a reboot to fix things.

I can confirm that disabling on-board serial doesn't affect anything so I would say your analysis is correct.

Bosse_B
Posts: 1009
Joined: Thu Jan 30, 2014 9:53 am

Re: New Pi-OS install on RPi3B, USB serial ports missing!

Tue Aug 04, 2020 2:23 pm

hippy wrote:
Tue Aug 04, 2020 1:46 pm
As would having some sort of pop-up or warning that the Pi needs to be re-booted. Some sort of notification that things may be in an indeterminate state with mismatches between modules and kernel.
That would be really good!
On my Ubuntu servers that is what happens ever so often since I am doing apt update/upgrade at least once a week or more on these and I get a message on login via PuTTY that the system needs a reboot sometimes (a few times a month possibly).
That is really useful.

Is it possible to configure something like that for Pi-OS as well?
Bo Berglund
Sweden

Bosse_B
Posts: 1009
Joined: Thu Jan 30, 2014 9:53 am

Re: New Pi-OS install on RPi3B, USB serial ports missing!

Tue Aug 04, 2020 2:24 pm

hippy wrote:
Tue Aug 04, 2020 1:46 pm
I can confirm that disabling on-board serial doesn't affect anything so I would say your analysis is correct.
Does this affect weather the serial port on the GPIO connector is available or not?
Bo Berglund
Sweden

trejan
Posts: 2240
Joined: Tue Jul 02, 2019 2:28 pm

Re: New Pi-OS install on RPi3B, USB serial ports missing!

Tue Aug 04, 2020 2:58 pm

needrestart is kind of what you want but the kernel upgrade detection doesn't work with the Pi kernel configuration. needrestart expects a new /boot/kernel-1.2.3.img to appear and assumes the numbers are the kernel version with a higher number = newer version. This fails on a Pi because the Pi kernels have a fixed filename and the suffix is the architecture of the kernel e.g. 7 = ARMv7, 7l = ARMv7 + LPAE and 8 = ARMv8. needrestart continually complains about a restart being needed if you're not using the 64-bit ARMv8 kernel. The developer approved fix for needrestart is to add a configuration option that filters for the specific kernel you're using.

We could do it manually by writing a small post install script for /etc/kernel/postinst.d to set a flag somewhere to do the notification. A startup service would need to clear the flag. rpi-update would need to be altered to call the postinst.d script as well.
Bosse_B wrote:
Tue Aug 04, 2020 2:24 pm
Does this affect weather the serial port on the GPIO connector is available or not?
Yes. The raspi-config option is only for the serial port on the GPIO connector. You can enable/disable it using raspi-config or do it manually by editing /boot/configtxt.
Last edited by trejan on Tue Aug 04, 2020 3:42 pm, edited 1 time in total.

hippy
Posts: 7911
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: New Pi-OS install on RPi3B, USB serial ports missing!

Tue Aug 04, 2020 3:42 pm

trejan wrote:
Tue Aug 04, 2020 2:58 pm
We could do it manually by writing a small post install script for /etc/kernel/postinst.d to set a flag somewhere to do the notification.
Something which indicated "Reboot required" on every login until it had been done, for console and GUI, would be great, but during the update is essential.

That is done for ui-mods but would be better reported at the end rather than in the midst of an update as I have missed those when they have scrolled off the screen when upgrading over SSH/Telnet.

I would prefer it if it simply asked at the end of an upgrade whether I wanted to reboot now or not, but can appreciate that might not suit some people's use cases.

But anything has got to be better than nothing. I started a separate thread - viewtopic.php?f=63&t=281930

hippy
Posts: 7911
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: New Pi-OS install on RPi3B, USB serial ports missing!

Tue Aug 04, 2020 3:46 pm

Bosse_B wrote:
Tue Aug 04, 2020 2:24 pm
hippy wrote:
Tue Aug 04, 2020 1:46 pm
I can confirm that disabling on-board serial doesn't affect anything so I would say your analysis is correct.
Does this affect weather the serial port on the GPIO connector is available or not?
Sorry I wasn't clear.

The raspi-config setting, on or off, doesn't affect the ability of the OS to recognise and present /dev/ttyUSB* devices.

It does still affect whether the serial port is enabled for user use, as a console login service, or is disabled.

Return to “General discussion”