obcd
Posts: 917
Joined: Sun Jul 29, 2012 9:06 pm

pi serial console

Mon Oct 16, 2017 1:55 pm

I enabled the serial console on a pi3 by adding to /boot/config.txt

enable_uart=1
dtoverlay=pi3-disable-bt

further, in /boot/cmdline.txt I modified
console=serial0,115200 to console=ttyAMA0,115200

This gives me a serial console on pin6 = GND pin8 = TXD pin10 = RXD

The login prompt only appears when rc.local has finished.

The purpose of the setup is to debug a read only system. Occasionally such a pi can not be accessed using a ssh client. After a power cycle, things start to work normally.

I had hoped to use the serial console on such a system to log in and check the logfiles. The system uses busybox syslogd so it's logging is using a ram buffer. Upon a reboot or power cycle, the loggings are gone.

There are approx 20 systems running like that, and one not starting up is happening randomly. So, changing the setup to a "logging 2 usb" is an option I would prefer 2 avoid.

So, the question. How can I get a serial console login prompt as early as possible in the boot process?
Some custom programs are started in rc.local. If they cause rc.local to hang, I won't be able to login serially to find out what goes wrong.

ericcooper
Posts: 125
Joined: Sat Apr 08, 2017 6:23 pm

Re: pi serial console

Mon Oct 16, 2017 2:51 pm

Not tested, but try enabling getty on that tty via systemd:

# systemctl enable getty@ttyAMA0.service
# systemctl start getty@ttyAMA0.service # only needed for the current session, to see if it works

obcd
Posts: 917
Joined: Sun Jul 29, 2012 9:06 pm

Re: pi serial console

Mon Oct 16, 2017 3:31 pm

I had tried it, but it's the same. The login prompt only appears when rc.local has finished it's script.

I have logo.nologo consoleblank=0 loglevel=1 quiet in /boot/cmdline.txt to show a splash screen at bootup.
I tested without those as well and don't think it makes a difference. (Will test again to be sure)

Tested again. No difference.

beta-tester
Posts: 1237
Joined: Fri Jan 04, 2013 1:57 pm
Location: de_DE

Re: pi serial console

Mon Oct 16, 2017 8:44 pm

maybe with option "earlycon= Output early console device and options." see: Kernel Parameters
{ I only give negative feedback }
RPi Model B (rev1, 256MB) & B (rev2, 512MB) & B+, RPi2B, RPi3B, RPi3B+, RPiZeroW, ...

Return to “Advanced users”