redrumloa
Posts: 4
Joined: Fri Mar 17, 2017 9:49 pm

No login promt for serial console

Fri Mar 17, 2017 11:32 pm

I installed the most recent Raspbian Jessie Lite and am trying to use a serial console with a USB Serial port adapter. I'm not getting a login prompt on the other end. I can use the echo command see see it on the other end.

I do echo testest > /dev/ttyUSB0 and I see testest on the other end.

I do ls -l /dev/ttyUSB0 and I see dialout listed.

I do id and see dialout listed.

I know the default baud rate is 9600 and have it set on the other end, obviously working since I can echo.

I've used serial consoles with Linux in the past and never had this much of a headache. Trying to find help with Google is infuriating as every result talks about inittab which apparently no longer exists.

The connection is there, but no prompt! What gives?

Once this is running, how would I permanently change baud rate?

Thanks in advance.

redrumloa
Posts: 4
Joined: Fri Mar 17, 2017 9:49 pm

Re: No login promt for serial console

Sat Mar 18, 2017 1:22 am

OK, I may have found a solution but could use a tweak? From the shell I tried the following.

/sbin/agetty -8 ttyUSB0 9600 vt102

Bingo! I get a login prompt on the other end. The only problem is I lose my rpi prompt until I exit on the other end. Is there an argument to use agetty and not lose the main rpi console? I'll keep digging but some replies could save me a great bit of time.

TIA

redrumloa
Posts: 4
Joined: Fri Mar 17, 2017 9:49 pm

Re: No login promt for serial console

Sat Mar 18, 2017 2:20 am

*RESOLVED*

After I got a lead, digging deeper into the bowels of Google I found EXACTLY what I was looking for. It lead me back to a thread here.

viewtopic.php?f=29&t=177076&p=1129209&h ... y#p1129209

copied a default config file fron /lib/systemd/system/serial-getty@.service and moved/renamed to /etc/systemd/system/serial-getty@ttyUSB0.service .

Tweaked the default baud rate.

Set it to be permanent.

# systemctl enable serial-getty@ttyUSB0.service
# systemctl start serial-getty@ttyUSB0.service

That's it, all working. Very frustrating having to navigate the changes that makes it different than other Linux distros and even earlier Raspbian builds, but happy I only have to do it once. Not so hard when you know what to do. If I have to again, I'll remember.

Hopefully this will help someone else.

redrumloa
Posts: 4
Joined: Fri Mar 17, 2017 9:49 pm

Re: No login promt for serial console

Sat Mar 18, 2017 11:04 pm

Well I still do have one problem after all. I thought the above instructions would set the serial speed, but it doesn't 9600 seems to be the only speed that works. No matter what I do the serial speed stays at 9600.

Now to change the serial speed for ttyUSB0?

Paul Hutch
Posts: 550
Joined: Fri Aug 25, 2017 2:58 pm
Location: Blackstone River Valley, MA, USA
Contact: Website

Re: No login promt for serial console

Wed May 09, 2018 9:05 pm

Sorry to necro an old thread but I found a solution that worked for me.

In /etc/systemd/system/serial-getty@ttyUSB0.service I changed the ExecStart line from:

Code: Select all

ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM
to:

Code: Select all

ExecStart=-/sbin/agetty 115200 %I $TERM
Now I have a 115200 bps serial login console via a USB to Serial adapter.

User avatar
HawaiianPi
Posts: 5840
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: No login promt for serial console

Fri May 11, 2018 6:19 pm

I use the screen command to open a serial terminal, and just specify the baud rate in the command.

Code: Select all

sudo screen /dev/ttyS3 115200
Works for me in WSL (Windows Subsystem for Linux). Also works in Linux/Raspbian (/dev/ttyUSBx).
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

Paul Hutch
Posts: 550
Joined: Fri Aug 25, 2017 2:58 pm
Location: Blackstone River Valley, MA, USA
Contact: Website

Re: No login promt for serial console

Fri May 11, 2018 8:29 pm

The problem was not with a user started serial session but with a systemd started serial-getty. I wanted a serial login via a USB to serial adapter because the built-in serial is being used for something else.

Return to “Raspberry Pi OS”