View previous topic :: View next topic |
Author |
Message |
RayDude Advocate


Joined: 29 May 2004 Posts: 2103 Location: San Jose, CA
|
Posted: Sun Feb 23, 2025 7:18 pm Post subject: kernel messages on /dev/ttyUSB0 |
|
|
Just to confirm, it doesn't look like there is a way to earlyprintk to a USB device, is that right?
I'm trying to debug a reboot problem I have. It has been reproduced twice, so I figure if I try to backup using borg again, it will reboot again and I'd like to capture dmesg and console output on /dev/ttyUSB0.
I have my server connected to my laptop through USB serial ports. It works. I get some logging.
But I can't login to the console, which is weird. and I'm not getting kernel messages, which is the purpose of this experiment.
There is a lot out there about /dev/ttyS0, but not so much about /dev/ttyUSB0.
I'm going to dig around in kernel config again to see if there's something else to enable. I guess I could turn on kdbg, but that feels like I'd be in over my head...
Any suggestions? _________________ Some day there will only be free software. |
|
Back to top |
|
 |
NeddySeagoon Administrator


Joined: 05 Jul 2003 Posts: 54916 Location: 56N 3W
|
Posted: Sun Feb 23, 2025 7:28 pm Post subject: |
|
|
RayDude,
You need to add Code: | console=ttyUSB0,115200,n,1 | to your kernel command line to gen console output on /dev/ttyUSB0.
The ,115200,n,1 sets 115200 baud, no parity and one stop bit. The other end needs to use the same settings. Use whatever works for you.
You need to add a line to /etc/inittab if you want to be able to log in there.
The will be no output until the /dev/ttyUSB0. drivers are loaded.
Nothing beats a real serial port for debugging, well maybe two real serial ports :)
There is also the net console, which I have never used. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
 |
RayDude Advocate


Joined: 29 May 2004 Posts: 2103 Location: San Jose, CA
|
Posted: Sun Feb 23, 2025 7:57 pm Post subject: |
|
|
NeddySeagoon wrote: | RayDude,
You need to add Code: | console=ttyUSB0,115200,n,1 | to your kernel command line to gen console output on /dev/ttyUSB0.
The ,115200,n,1 sets 115200 baud, no parity and one stop bit. The other end needs to use the same settings. Use whatever works for you.
You need to add a line to /etc/inittab if you want to be able to log in there.
The will be no output until the /dev/ttyUSB0. drivers are loaded.
Nothing beats a real serial port for debugging, well maybe two real serial ports
There is also the net console, which I have never used. |
Thanks Neddy. I have the console comand on the kernel command line and I get output to the serial console from the laptop, but only info from RC, nothing from the kernel directly.
I also can't login.
This mobo might actually have a real serial interface, but I'm not opening it up to install a cable because I don't like to mess with it.
I have used netconsole in an embedded environment and it's cranky at best. _________________ Some day there will only be free software. |
|
Back to top |
|
 |
NeddySeagoon Administrator


Joined: 05 Jul 2003 Posts: 54916 Location: 56N 3W
|
Posted: Sun Feb 23, 2025 8:22 pm Post subject: |
|
|
RayDude,
Have you got all the kernel bits loaded for your /dev//ttyUSB0?
Are they modules or built into the kernel?
Built in will start faster that modules but USB is not started until after root is mounted, so you will miss a lot of kernel messages.
The entire USB stack needs to be built in for earliest start.
At the end of /etc/inittab/ you will find
Code: | # SERIAL CONSOLES
#s0:12345:respawn:/sbin/agetty -L 115200 ttyS0 vt100
#s1:12345:respawn:/sbin/agetty -L 115200 ttyS1 vt100 |
Uncomment one of those and change the device. Then you will get agetty on your /dev//ttyUSB0
That's required to be able to log in. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
 |
pingtoo Veteran


Joined: 10 Sep 2021 Posts: 1508 Location: Richmond Hill, Canada
|
Posted: Sun Feb 23, 2025 8:23 pm Post subject: |
|
|
RayDude,
Can you clarify Quote: | I have my server connected to my laptop through USB serial ports. |
Which end is USB device and which end is serial device?
It sound like the server end is USB device then you will not get anything prior to server kernel probe USB. |
|
Back to top |
|
 |
RayDude Advocate


Joined: 29 May 2004 Posts: 2103 Location: San Jose, CA
|
Posted: Sun Feb 23, 2025 8:59 pm Post subject: |
|
|
NeddySeagoon wrote: | RayDude,
Have you got all the kernel bits loaded for your /dev//ttyUSB0?
|
Yes.
NeddySeagoon wrote: | RayDude,
Are they modules or built into the kernel?
Built in will start faster that modules but USB is not started until after root is mounted, so you will miss a lot of kernel messages.
The entire USB stack needs to be built in for earliest start.
|
I have all USB drivers built in, ehci ohci xhci, etc
NeddySeagoon wrote: | RayDude,
At the end of /etc/inittab/ you will find
Code: | # SERIAL CONSOLES
#s0:12345:respawn:/sbin/agetty -L 115200 ttyS0 vt100
#s1:12345:respawn:/sbin/agetty -L 115200 ttyS1 vt100 |
Uncomment one of those and change the device. Then you will get agetty on your /dev//ttyUSB0
That's required to be able to log in. |
I forgot about that! I'll fix that right away.
I still can't get printk messages to come out on the console, but maybe this will help... _________________ Some day there will only be free software. |
|
Back to top |
|
 |
RayDude Advocate


Joined: 29 May 2004 Posts: 2103 Location: San Jose, CA
|
Posted: Sun Feb 23, 2025 9:03 pm Post subject: |
|
|
pingtoo wrote: | RayDude,
Can you clarify Quote: | I have my server connected to my laptop through USB serial ports. |
Which end is USB device and which end is serial device?
It sound like the server end is USB device then you will not get anything prior to server kernel probe USB. |
Both are connected via USB Serial.
I'm not overly concerned about getting dmesg data before USB initialization as I'm trying to catch the cause of a spontaneous reboot that occurs when I'm using Borg to backup to an external USB drive. I think the drive is SMR and I think because it's almost full it is slowing down to a really slow crawl and I think that's causing the kernel to panic or something.
I figure since it's reproducible (or at least seems to be) that if I can catch it, I might be able to help fix a kernel issue. But I have to catch it in the act first. _________________ Some day there will only be free software. |
|
Back to top |
|
 |
RayDude Advocate


Joined: 29 May 2004 Posts: 2103 Location: San Jose, CA
|
Posted: Sun Feb 23, 2025 9:06 pm Post subject: |
|
|
The console has moved to /dev/ttyUSB0, thanks Neddy!
But I'm still not getting dmesg output on it... _________________ Some day there will only be free software. |
|
Back to top |
|
 |
NeddySeagoon Administrator


Joined: 05 Jul 2003 Posts: 54916 Location: 56N 3W
|
Posted: Sun Feb 23, 2025 9:10 pm Post subject: |
|
|
RayDude,
I have a feeling that USB output is buffered. The message your want to see, if its there at all, may die with the buffer, so you never see it.
It may be worth investing a few shillings is a real serial port for the transmitting end of the serial link, then listening with a USB to serial dongle.
Share your dmesg output so e can see what the kernel does when it starts. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
 |
RayDude Advocate


Joined: 29 May 2004 Posts: 2103 Location: San Jose, CA
|
Posted: Sun Feb 23, 2025 9:45 pm Post subject: |
|
|
Code: | dmesg | grep -i tty
[ 0.000000] Command line: BOOT_IMAGE=/vmlinuz-6.13.4-gentoo root=PARTUUID=8e713e72-02a1-9b49-9b4c-c295620f36e0 ro console=ttyUSB0,115200 initcall_blacklist=acpi_cpufreq_init amd_pstate=passive amd_iommu=on sysrq_always_enabled=1 bdl_pos_adj=8,8
[ 0.069244] Kernel command line: BOOT_IMAGE=/vmlinuz-6.13.4-gentoo root=PARTUUID=8e713e72-02a1-9b49-9b4c-c295620f36e0 ro console=ttyUSB0,115200 initcall_blacklist=acpi_cpufreq_init amd_pstate=passive amd_iommu=on sysrq_always_enabled=1 bdl_pos_adj=8,8
[ 1.019302] Bluetooth: RFCOMM TTY layer initialized
[ 2.258663] usb 1-2.2: FTDI USB Serial Device converter now attached to ttyUSB0
[ 2.258987] printk: legacy console [ttyUSB0] enabled
|
It looks like it ought to be working. But no printk messages...
I just got another idea, maybe I should set the default log levels in the kernel instead of by echoing to /proc/sys/kernel/printk...
I'm using two USB to 3.3V com port cables connected to each other with RX and TX swapped.
I don't have a usb to db9 serial cable or another machine with a real serial port, so even if there is one on this mobo, I can't really use it. _________________ Some day there will only be free software. |
|
Back to top |
|
 |
RayDude Advocate


Joined: 29 May 2004 Posts: 2103 Location: San Jose, CA
|
Posted: Sun Feb 23, 2025 10:35 pm Post subject: |
|
|
I think the issue was console log level which defaults to 1. I changed that trying to get the kwin spam to go away. It didn't work.
I set it by hand to 15 and printk is showing in the console on the laptop.
I'm trying the borgbackup now... _________________ Some day there will only be free software. |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|