Serial Ports lost in IDE after a Linux reboot, again. SOLVED!

Arduino IDE: 1.8.19
Linux: Ubuntu 20.04 LTS

Occasionally I have to do a requisite reboot after a Ubuntu OS upgrade. I dread it.
Every time it involves losing my IDE ports.
If you look at my screenshot of the IDE at the bottom right of the screen it shows the
ACM0 port assignment as if everything was in working order.

I hope I have overlooked something one of you astute users can point out.

These are the terminal commands I have attempted to restore/link the serial ports:

sudo usermod -a -G dialout <username>    [logged off and back on]

sudo ~/.arduino15/packages/arduino/hardware/megaavr/1.8.7/scripts/create_dfu_udev_rule

sudo systemctl stop ModemManager

ed@ed-G41MT-S2PT:~$ ls -l /dev/ttyACM*
ls: cannot access '/dev/ttyACM*': No such file or directory

ed@ed-G41MT-S2PT:~$ ls -l /dev/ttyUSB*
ls: cannot access '/dev/ttyUSB*': No such file or directory
ed@ed-G41MT-S2PT:~$ 

ed@ed-G41MT-S2PT:~$ dmesg | grep tty
[    0.183024] printk: console [tty0] enabled
[    0.458852] 00:02: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
ed@ed-G41MT-S2PT:~$ 

ed@ed-G41MT-S2PT:~$ egrep dialout /etc/group
dialout:x:20:ed
ed@ed-G41MT-S2PT:~$ 


I don't know much about Arduino in combination with Linux. However, the right bottom only indicates the last used port, not the active port or the existence of the port.

brltty might be a suspect; uninstall it.
lsusb can tell you if the board is detected; not sure if it shows the VID and the PID, else they will be in dmesg
dmesg might give you additional information.

Instead of running usermod immediately, first check if you are still a member of dialout; you will never figure out if it's the cause of your problems or not in the way you do it.

good point... :+1:

I removed brltty. Closed the IDE and reopened but no effect regrettfully.
I do know before this OS update and reboot that whether I had an ESP32 or UNO WiFi Rev2
hooked to the ports my OS/IDE immediately "saw" whenever I unhooked a USB cable and
immediately show the port again upon reconnection.

If I can ever get my finger precisely on what happens to the IDE after these OS updates I will
be able to quit pulling out what little grey hair I have left. I really really do not want to do yet
another IDE install as a workaround. I need to know what is causing this so I can immediately address it going forward.

Can you share the part of the system log that shows what happens when the device is connected?

E.g.,

  • Run journalctl -f as root.
  • Plug in the device.

Here ya go:

d@ed-G41MT-S2PT:~$ sudo journalctl -f
-- Logs begin at Sat 2022-09-24 16:42:14 CDT. --
Nov 13 10:58:20 ed-G41MT-S2PT kernel: usb 4-2: device not accepting address 9, error -110
Nov 13 10:58:20 ed-G41MT-S2PT kernel: usb usb4-port2: unable to enumerate USB device
Nov 13 11:01:02 ed-G41MT-S2PT PackageKit[13648]: daemon quit
Nov 13 11:01:02 ed-G41MT-S2PT systemd[1]: packagekit.service: Succeeded.
Nov 13 11:02:18 ed-G41MT-S2PT kernel: i915 0000:00:02.0: [drm] *ERROR* Atomic update failure on pipe A (start=402157 end=402158) time 1309 us, min 894, max 899, scanline start 835, end 908
Nov 13 11:02:30 ed-G41MT-S2PT kernel: i915 0000:00:02.0: [drm] *ERROR* Atomic update failure on pipe A (start=402836 end=402837) time 1305 us, min 894, max 899, scanline start 840, end 840
Nov 13 11:02:31 ed-G41MT-S2PT kernel: i915 0000:00:02.0: [drm] *ERROR* Atomic update failure on pipe A (start=402922 end=402923) time 1306 us, min 894, max 899, scanline start 834, end 835
Nov 13 11:03:49 ed-G41MT-S2PT kernel: i915 0000:00:02.0: [drm] *ERROR* Atomic update failure on pipe A (start=407604 end=407605) time 1307 us, min 894, max 899, scanline start 871, end 871
Nov 13 11:09:15 ed-G41MT-S2PT sudo[14042]:       ed : TTY=pts/0 ; PWD=/home/ed ; USER=root ; COMMAND=/usr/bin/journalctl -f
Nov 13 11:09:15 ed-G41MT-S2PT sudo[14042]: pam_unix(sudo:session): session opened for user root by (uid=0)
Nov 13 11:11:43 ed-G41MT-S2PT kernel: usb 5-2: new full-speed USB device number 18 using uhci_hcd
Nov 13 11:11:59 ed-G41MT-S2PT kernel: usb 5-2: device descriptor read/64, error -110
Nov 13 11:12:15 ed-G41MT-S2PT kernel: usb 5-2: device descriptor read/64, error -110
Nov 13 11:12:15 ed-G41MT-S2PT kernel: usb 5-2: new full-speed USB device number 19 using uhci_hcd
Nov 13 11:12:30 ed-G41MT-S2PT kernel: usb 5-2: device descriptor read/64, error -110
Nov 13 11:12:46 ed-G41MT-S2PT kernel: usb 5-2: device descriptor read/64, error -110
Nov 13 11:12:46 ed-G41MT-S2PT kernel: usb usb5-port2: attempt power cycle
Nov 13 11:12:46 ed-G41MT-S2PT kernel: usb usb5-port2: failed to disable port power
Nov 13 11:12:46 ed-G41MT-S2PT kernel: usb 5-2: new full-speed USB device number 20 using uhci_hcd
Nov 13 11:12:57 ed-G41MT-S2PT kernel: usb 5-2: device not accepting address 20, error -110
Nov 13 11:12:57 ed-G41MT-S2PT kernel: usb 5-2: new full-speed USB device number 21 using uhci_hcd
Nov 13 11:13:07 ed-G41MT-S2PT kernel: usb 5-2: device not accepting address 21, error -110
Nov 13 11:13:07 ed-G41MT-S2PT kernel: usb usb5-port2: unable to enumerate USB device
^C
ed@ed-G41MT-S2PT:~$

I remember now when booting up this morning that I did get some USB 5-2 error messages after the POST and the system was generating the "journal" status, for lack of a better description. It is at 11:11 am that I plugged the USB cable to the UNO WiFi back in.

I found this:

The suggestion was to unload the uhci_hcd module (rmmod uhci_hcd) and try again.

[edit]

If that works, you can make it permanent by blacklisting the module, e.g.,

echo blacklist uhci_hcd > /etc/modprobe.d/uhci_hcd-blacklist.conf

Ubuntu did not like that command:

d@ed-G41MT-S2PT:~$ rmmod uhci_hcd
rmmod: ERROR: Module uhci_hcd is builtin.
ed@ed-G41MT-S2PT:~$ 


Hmm, you could try again as root, but if the error message is correct, then the module is part of the kernel.

Do you have a boot menu (e.g., grub) from which you can select the previous kernel perhaps?

Man oh man. I booted up the Grub Menu and then the arrow keys would not work. I had
to go digging around in my computer graveyards to find an old plug in style keyboard.
I did revert from kernel 5.15.0-52-generic to 5.15.0.48-generic.
NO CHANGE. :disappointed_relieved: :disappointed_relieved:

I need to figure out what is causing those boot error messages about usb 5-2.
"usb 5-2 device descriptor read/64, error -110 "
"usb 5-2 device not accepting address"

All of this happened after an OS update and reboot. ....sheeesh....

And the module can also not be unloaded when running 5.15.0.48?

"And the module can also not be unloaded when running 5.15.0.48?"

Probably. knowing my luck.
After reading this link, albeit dated, I am not sure about easily restraining that uhci_hcd module. I get over my head quick playing around with consequential files. May not have any choice but to reinstall IDE for the umpteenth time.

https://www.linuxquestions.org/questions/linux-newbie-8/unload-kernel-module-at-boot-time-debian-wheezy-7-2-3-2-0-4-686-pae-kernel-4175489749-print/

For anyone interested and might see something worth noting, from dmsg

300.577326] usb 4-2: new full-speed USB device number 2 using uhci_hcd
[  316.019449] usb 4-2: device descriptor read/64, error -110
[  331.643546] usb 4-2: device descriptor read/64, error -110
[  331.883253] usb 4-2: new full-speed USB device number 3 using uhci_hcd
[  347.261737] usb 4-2: device descriptor read/64, error -110
[  362.886433] usb 4-2: device descriptor read/64, error -110
[  362.994477] usb usb4-port2: attempt power cycle
[  362.994488] usb usb4-port2: failed to disable port power
[  363.122494] usb 4-2: new full-speed USB device number 4 using uhci_hcd
[  373.718020] usb 4-2: device not accepting address 4, error -110
[  373.845009] usb 4-2: new full-speed USB device number 5 using uhci_hcd
[  384.471051] usb 4-2: device not accepting address 5, error -110
[  384.471080] usb usb4-port2: unable to enumerate USB device
[  435.568453] usb 4-2: new full-speed USB device number 6 using uhci_hcd
[  450.965130] usb 4-2: device descriptor read/64, error -110
[  466.573514] usb 4-2: device descriptor read/64, error -110
[  466.809513] usb 4-2: new full-speed USB device number 7 using uhci_hcd
[  482.189669] usb 4-2: device descriptor read/64, error -110
[  497.809646] usb 4-2: device descriptor read/64, error -110
[  497.917671] usb usb4-port2: attempt power cycle
[  497.917685] usb usb4-port2: failed to disable port power
[  498.045657] usb 4-2: new full-speed USB device number 8 using uhci_hcd
[  508.637553] usb 4-2: device not accepting address 8, error -110
[  508.765551] usb 4-2: new full-speed USB device number 9 using uhci_hcd
[  519.389402] usb 4-2: device not accepting address 9, error -110
[  519.389433] usb usb4-port2: unable to enumerate USB device
[  526.945401] perf: interrupt took too long (2502 > 2500), lowering kernel.perf_event_max_sample_rate to 79750
[  891.311959] i915 0000:00:02.0: [drm] *ERROR* Atomic update failure on pipe A (start=56121 end=56122) time 1312 us, min 894, max 899, scanline start 869, end 9
[ 2109.011458] perf: interrupt took too long (3130 > 3127), lowering kernel.perf_event_max_sample_rate to 63750
[ 3073.720481] usb 1-7.3: new full-speed USB device number 6 using ehci-pci
[ 3078.952378] usb 1-7.3: device descriptor read/64, error -32
[ 3079.160367] usb 1-7.3: device descriptor read/64, error -32
[ 3079.348364] usb 1-7.3: new full-speed USB device number 7 using ehci-pci
[ 3079.456365] usb 1-7.3: device descriptor read/64, error -32
[ 3079.664360] usb 1-7.3: device descriptor read/64, error -32
[ 3079.772426] usb 1-7-port3: attempt power cycle
[ 3080.376346] usb 1-7.3: new full-speed USB device number 8 using ehci-pci
[ 3080.792339] usb 1-7.3: device not accepting address 8, error -32
[ 3080.872337] usb 1-7.3: new full-speed USB device number 9 using ehci-pci
[ 3081.288331] usb 1-7.3: device not accepting address 9, error -32
[ 3081.288428] usb 1-7-port3: unable to enumerate USB device
[ 3102.049197] i915 0000:00:02.0: [drm] *ERROR* Atomic update failure on pipe A (start=188392 end=188393) time 8493 us, min 894, max 899, scanline start 511, end 51
[ 3460.757265] i915 0000:00:02.0: [drm] *ERROR* Atomic update failure on pipe A (start=209854 end=209855) time 1291 us, min 894, max 899, scanline start 851, end 923
ed@ed-G41MT-S2PT:~$ 


Reinstalled IDE 1.8.19. NO CHANGE.
This output is currently what listing usb indicates:

ed@ed-G41MT-S2PT:~$ lsusb
Bus 001 Device 003: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 001 Device 002: ID 058f:6254 Alcor Micro Corp. USB Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

This output is what listing usb indicated prior to the problem:

ed@ed-G41MT-S2PT:~$ lsusb
Bus 001 Device 006: ID 046d:c315 Logitech, Inc. Classic Keyboard 200
Bus 001 Device 005: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 001 Device 003: ID 058f:6254 Alcor Micro Corp. USB Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 007: ID 10c4:ea60 Silicon Labs CP210x UART Bridge                        <  for ESP32
Bus 004 Device 013: ID 03eb:2145 Atmel Corp. ATMEGA328P-XMINI (CDC ACM)   < for UNO Wifi
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
ed@ed-G41MT-S2PT:~$ ls -l /dev/ttyACM0
crw-rw---- 1 root dialout 166, 0 Oct 23 21:31 /dev/ttyACM0           < for UNO Wifi Rev2
ed@ed-G41MT-S2PT:~$ ls -l /dev/ttyUSB*
crw-rw---- 1 root dialout 188, 0 Oct 23 20:47 /dev/ttyUSB0           < for ESP32

Sounds like you have a USB hardware problem. Try powering off your computer off and on versus restarting. Sometimes power off/on can reset internal hardware that cannot be done by restarting.

If the problem persists, try different USB ports on your computer. Perhaps one or more ports is flaky. If using a docking station, undock and plug directly into the computer USB ports. If using a USB hub try without the hub. If not using a USB hub, try with a powered USB. Some USB 3.x ports do not work with with old USB 1.1 devices such as used on Arduino boards. A USB 2.0 hub might
help.

Try different USB cables. If the cable wiggles around when plugged in, the USB connector may be damaged. If using USB Type C ports (very new computers have USB Type C ports), try different adapters.

In summary, methodically check/swap everything between the board and the computer USB port such as cables, adapters, hubs, docks, etc.

sudo chmod +x /dev/ttyUSB0 ?
sudo chmod 777 /dev/ttyUSB0 ?

the /dev address is your device. I couldn't scroll up to see it.

/dev/ttyACM0

or whatever your arduino IDE detected on plugin (in the tools|ports menu)

Cheers,

A

type ed@ed-G41MT-S2PT:~$ sudo chmod +x /dev/ttyUSB0 ?
sudo] password for ed: 
chmod: cannot access '/dev/ttyUSB0': No such file or directory
chmod: cannot access '?': No such file or directory

ed@ed-G41MT-S2PT:~$ sudo chmod 777 /dev/ttyUSB0 ?
chmod: cannot access '/dev/ttyUSB0': No such file or directory
chmod: cannot access '?': No such file or directory
ed@ed-G41MT-S2PT:~$ 


One thing I have noticed is that USB errors on power-on startup completely go away if the only thing I leave attached is the mini plug for the mouse. I have an old style keyboard PS2 plug
I am using right now instead of a usb corded keyboard.

the errors are similar to:
"usb 4-2 device descriptor read/64, error -110"

They used to be usb 5-1 but now are usb 4-2. ???

If it was hardware related, and it still might be, it is strange that the issue arose right after a Ubuntu OS update and restart. And this has happened before with these updates and I ended up just reloading EVERYTHING. ughhhhh...

I an loathe to continue doing updates if this crap is always the result. I like keeping my software updated but not at the expense of losing port functionality.

sudo chmod +x /dev/ttyUSB0 ?
sudo chmod 777 /dev/ttyUSB0 ?

the /dev address is your device. I couldn't scroll up to see it.

/dev/ttyACM0

or whatever your arduino IDE detected on plugin (in the tools|ports menu)

Cheers,

A

the system does not see them.

ed@ed-G41MT-S2PT:~$ sudo chmod +x /dev/ttyUSB0
[sudo] password for ed: 
chmod: cannot access '/dev/ttyUSB0': No such file or directory
ed@ed-G41MT-S2PT:~$ sudo chmod +x /dev/ttyACM0
chmod: cannot access '/dev/ttyACM0': No such file or directory

This is what it looked like when the ports were visible

ed@ed-G41MT-S2PT:~$ lsusb
Bus 001 Device 006: ID 046d:c315 Logitech, Inc. Classic Keyboard 200
Bus 001 Device 005: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 001 Device 003: ID 058f:6254 Alcor Micro Corp. USB Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 007: ID 10c4:ea60 Silicon Labs CP210x UART Bridge          < usb port for ESP32
Bus 004 Device 013: ID 03eb:2145 Atmel Corp. ATMEGA328P-XMINI (CDC ACM)   < usb port for UNO Wifi
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
ed@ed-G41MT-S2PT:~$ ls -l /dev/ttyACM0
crw-rw---- 1 root dialout 166, 0 Oct 23 21:31 /dev/ttyACM0           < for UNO Wifi Rev2
ed@ed-G41MT-S2PT:~$ ls -l /dev/ttyUSB*
crw-rw---- 1 root dialout 188, 0 Oct 23 20:47 /dev/ttyUSB0           < for ESP32