Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Tutorial: How to enable the serial port in Pidora

Wed Jun 12, 2013 2:02 pm

Since Pidora doesn't have /etc/inittab - and no other method seems to work, I figured out a way to enable logins on the serial port.

Create the following script and put it somewhere (I usually just stick it in /root):

Code: Select all

#!/bin/bash
[ $# = 0 ] && exec echo "Usage: $0 -run"
[ $1 = -run ] && exec setsid $0 -go
while :;do
    agetty -8 -L ttyAMA0 115200
    sleep 1
done
Then run it (with -run) and away you go. Serial port logins work again!
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

User avatar
jojopi
Posts: 3000
Joined: Tue Oct 11, 2011 8:38 pm

Re: Tutorial: How to enable the serial port in Pidora

Thu Jun 13, 2013 6:07 am

I believe the modern Fedora way to do this is:

Code: Select all

sudo systemctl start serial-getty@ttyAMA0.service
And to make it permanent the even less plausible:

Code: Select all

sudo ln -snf /usr/lib/systemd/system/serial-getty@.service \
  /etc/systemd/system/getty.target.wants/serial-getty@ttyAMA0.service
The baud rate is "automatic" and cycled by sending breaks, but you could also copy and edit the service file.

macemoneta
Posts: 59
Joined: Sun Oct 23, 2011 12:47 pm
Contact: Website

Re: Tutorial: How to enable the serial port in Pidora

Thu Jun 13, 2013 9:41 am

The second command should be the effect of:

Code: Select all

systemctl enable serial-getty@ttyAMA0.service

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Tutorial: How to enable the serial port in Pidora

Thu Jun 13, 2013 10:54 am

Geez - what a mess!

I like my way better.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

User avatar
jojopi
Posts: 3000
Joined: Tue Oct 11, 2011 8:38 pm

Re: Tutorial: How to enable the serial port in Pidora

Thu Jun 13, 2013 11:09 am

macemoneta wrote:The second command should be the effect of:
Perhaps it should, since the blog post referred to in the unit as documentation even says so. But actually the unit is static and cannot be enabled that way.

Maybe that is because, also according to the documentation, systemd-getty-generator is supposed to instantiate a serial-getty automatically on any port named as a kernel console that is not a VT. That does not work either.

pkm343
Posts: 1
Joined: Sat Nov 16, 2013 6:23 pm

Re: Tutorial: How to enable the serial port in Pidora

Sat Nov 16, 2013 6:55 pm

If you're reading this you've no doubt noticed that getting your serial console working is a boot-strap issue. If you lack a monitor, keyboard, and mouse to use for your first boot what do you do? You must have been able to mount your boot media somehow so you could install the image. So long as that system can mount the ext4 filesystem containing the / (root) partition there is a way to solve the boot-strap problem. Because Pidora's /boot/cmdline.txt tells the RPi about the console the only other step needed is to start the getty service. I was able to get Pidora 18 rc2 to bootup with a serial console as follows:

Code: Select all

# mount /dev/[name-of-root-partition-device] /mnt
# cd /mnt/etc
# echo "systemctl start getty@ttyAMA0" >> vconsole.conf
My vconsole.conf now contains:
KEYMAP=us
systemctl start getty@ttyAMA0

Remember to unmount:

Code: Select all

# umount /mnt
I booted from the new media and I was able to connect to my Pi with screen. Thanks to all who posted previously.

Return to “Pidora / Fedora”

Who is online

Users browsing this forum: No registered users and 6 guests