Quantcast

[solved] Serial Getty on ttyO2 sometimes hangs

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[solved] Serial Getty on ttyO2 sometimes hangs

Scott Ellis
This post was updated on .
Sometimes I get repeated Starting, Started, Stopped messages for
serial-getty@ttyO2.service on boot.

It looks like this.

Starting Serial Getty on ttyO2...                                              
Started Serial G                                          [  OK  ]
Stopping Serial Getty on ttyO2...                                    
Starting Serial Getty on ttyO2...                                
Started Serial G                                          [  OK  ]
Stopping Serial Getty on ttyO2...                                    
Starting Serial Getty on ttyO2...                                              
Started Serial G                                          [  OK  ]
Stopping Serial Getty on ttyO2...                                      
Starting Serial Getty on ttyO2...                                              
Started Serial G                                          [  OK  ]
Stopping Serial Getty on ttyO2...                                


There doesn't seem to be a pattern as far as booting. It can
happen after a cold start or a soft reboot. It's random. Most
boots are okay.

When it gets into this loop, sometimes the service will eventually
start and I'll get a login prompt. Sometimes it will repeat forever
or at least for a few minutes (I'm impatient.)

I've tried removing this Before arg from the service

# Before=getty.target

And I've added a rmnlogin.service to the After arg to the service

After=dev-%i.device systemd-user-sessions.service rmnologin.service

Those changes seem to make it a little better, but I could be fooling
myself.

I also tried disabling serial-getty.@service since I believe it's the
console= arg in the kernel thats really launching the service, but
that didn't seem to have an affect.

I removed everything from /etc/systemd/system/getty.target.wants/
but that also didn't seem to have any affect.

I think the fact that the 'Started Serial G' is truncated in the systemd
output might be a clue to the problem.

When the service starts successfully, the systemd output looks like this


Starting Serial Getty on ttyO2...                                              
Started Serial Getty on ttyO2  

Any clues to what the problem might be?

Solved: It was the systemd service start script for lighttpd. See later posts.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Serial Getty on ttyO2 sometimes hangs

Scott Ellis
One more thing.

Even though I don't have a console, if the system has a network
I can ssh in and the system is fine, even while the ttyO2 service
is still looping in a hung state.

Likewise, if I launch an application on a non-console terminal,
that application is fully usable.

It's just the console that's not accessible.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Serial Getty on ttyO2 sometimes hangs

Andy Walls
Just a wild guess:

There is errata for some FTDI serial-USB chips going into a sleep state when they detect a certain pattern on the USB bus. (Some Gumstix Janus boards are affected by this apparently.)

If you are connected through a USB hub, remove the hub and just use a direct cable to the USB console port.

I'm not sure what you meant by you have no console, so maybe this doesn't apply to your hardware. :)

Regards,
Andy
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Scott Ellis <[hidden email]> wrote:
One more thing.

Even though I don't have a console, if the system has a network
I can ssh in and the system is fine, even while the ttyO2 service
is still looping in a hung state.

Likewise, if I launch an application on a non-console terminal,
that application is fully usable.

It's just the console that's not accessible.




--
View this message in context: http://gumstix.8.x6.nabble.com/Serial-Getty-on-ttyO2-sometimes-hangs-tp4967147p4967148.html
Sent from the Gumstix mailing list archive at Nabble.com.



Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter


gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Serial Getty on ttyO2 sometimes hangs

Scott Ellis
No hub involved, just a usb cable.

When I said no console, I just meant the serial-getty service never succeeds
and thus no console prompt.

It's possible it's the board. It's a custom one from a customer.

I'm pretty sure I'd seen the problem on stock Gumstix boards as well, very
intermittently, so I never got around to tracking it down. But I just tried a
couple of dozen boots on a Chestnut and Tobi using the same COM and I
haven't seen a hang once.

Unfortunately, the 'bad system' is not hanging anymore either. Hard to
troubleshoot.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Serial Getty on ttyO2 sometimes hangs

Scott Ellis
It can't be that the FTDI chip went to sleep because I'm watching the
failed systemd serial getty service attempt failures on the console. ;-)

 I see the entire boot process. I just don't get a login prompt until/unless
the serial getty service succeeds which makes sense.

The question is why would the systemd serial getty service fail or think
its failing so that  it keeps stopping and trying to restart?

What is it checking for?

This is the exec line for the service

ExecStart=-/sbin/agetty -s %I 115200

where %I is resolved to ttyO2

Removing the '-' before /sbin/agetty didn't change anything.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Serial Getty on ttyO2 sometimes hangs

Chris G
In reply to this post by Scott Ellis
Scott Ellis wrote
Starting Serial Getty on ttyO2...                                              
Started Serial G                                          [  OK  ]
Stopping Serial Getty on ttyO2...                                      
Starting Serial Getty on ttyO2...                                              
Started Serial G                                          [  OK  ]
Stopping Serial Getty on ttyO2...                        
I don't have a good answer, but since any information can sometimes help, I had this problem (intermittently, like you) when I had a script in /etc/init.d calling a program that was trying (unsuccessfully) to connect to a server on our network inside a while(1) loop.

I'm still not sure what the exact correlation was or why it wasn't repeatable, but maybe give any custom init scripts a check?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Serial Getty on ttyO2 sometimes hangs

Andy Walls
In reply to this post by Scott Ellis


On Fri, 2013-04-12 at 14:37 -0700, Scott Ellis wrote:
> It can't be that the FTDI chip went to sleep because I'm watching the
> failed systemd serial getty service attempt failures on the console. ;-)

Well, then... :)

>  I see the entire boot process. I just don't get a login prompt until/unless
> the serial getty service succeeds which makes sense.
>
> The question is why would the systemd serial getty service fail or think
> its failing so that  it keeps stopping and trying to restart?
>
> What is it checking for?

Well, it checks for the Carrier Detect (CD) signal.

man agetty says to try the '-L' flag "For a directly connected terminal
without proper carriage detect wiring: (try this if your terminal just
sleeps instead of giving you a password: prompt.)"


> This is the exec line for the service
>
> ExecStart=-/sbin/agetty -s %I 115200
>
> where %I is resolved to ttyO2

Is '-s' even a valid commandline argument for agetty?  It isn't on my
RHEL system.

> Removing the '-' before /sbin/agetty didn't change anything.
>

Regards,
Andy


------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Serial Getty on ttyO2 sometimes hangs

Scott Ellis
From Ubuntu's agetty man page:
...
-s, --keep-baud
        Try to keep the existing baud rate. ...
...

I assume it's the same with the Yocto built Poky version.

There's nothing wrong with the baud rate though. When it's failing I can watch the repeated
failed systemd service messages on the console all day.

I put it in the -L suggestion, but I'm not getting any failures right now with or without that
change.  I'll keep testing tomorrow.

Thanks.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Serial Getty on ttyO2 sometimes hangs

Scott Ellis
In reply to this post by Chris G
Good suggestion.

There is lighttpd server getting started early in the userland startup process.
It always appears to succeed a few seconds before the console serial even
tries to start (the whole boot is about 10 seconds). I'm not exactly sure what
it tries to do on startup though.

I'll experiment with removing it tomorrow.

Thanks.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Serial Getty on ttyO2 sometimes hangs

Scott Ellis
I think that was it Chris.

The systemd service file for lighttpd was starting the server in foreground
mode with the -D switch.

This is the default lighttpd.service from the meta-openembedded layer

--- lighttpd.service ---
[Unit]
Description=Lightning Fast Webserver With Light System Requirements
After=syslog.target

[Service]
Type=oneshot
EnvironmentFile=-/etc/sysconfig/lighttpd
ExecStart=/usr/sbin/lighttpd -D -f /etc/lighttpd.conf
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
--- end lighttpd.service ---

In all cases, the lighttpd web server is running after boot.


Here is what systemctl thinks of the service using that default
service file:

root@overo:~# systemctl status lighttpd.service
lighttpd.service - Lightning Fast Webserver With Light System Requirements
          Loaded: loaded (/lib/systemd/system/lighttpd.service; enabled)
          Active: activating (start) since Sat, 01 Jan 2000 00:31:24 +0000; 40s ago
        Main PID: 530 (lighttpd)
          CGroup: name=systemd:/system/lighttpd.service
                  └ 530 /usr/sbin/lighttpd -D -f /etc/lighttpd.conf



If I remove the -D parameter from the ExecStart call, then systemctl
shows this:

root@overo:~# systemctl status lighttpd.service
lighttpd.service - Lightning Fast Webserver With Light System Requirements
          Loaded: loaded (/lib/systemd/system/lighttpd.service; enabled)
          Active: active (exited) since Sat, 01 Jan 2000 00:02:10 +0000; 21s ago
         Process: 534 ExecStart=/usr/sbin/lighttpd -f /etc/lighttpd.conf (code=exited, status=0/SUCCESS)
          CGroup: name=systemd:/system/lighttpd.service
                  └ 548 /usr/sbin/lighttpd -f /etc/lighttpd.conf


And if I add Type=forking instead of 'oneshot', I get this:

root@overo:~# systemctl status lighttpd.service
lighttpd.service - Lightning Fast Webserver With Light System Requirements
          Loaded: loaded (/lib/systemd/system/lighttpd.service; enabled)
          Active: active (running) since Sat, 01 Jan 2000 00:17:16 +0000; 1min 15s ago
         Process: 543 ExecStart=/usr/sbin/lighttpd -f /etc/lighttpd.conf (code=exited, status=0/SUCCESS)
        Main PID: 554 (lighttpd)
          CGroup: name=systemd:/system/lighttpd.service
                  └ 554 /usr/sbin/lighttpd -f /etc/lighttpd.conf


The last is what I'm going to use. So far no problems.

Thanks for the help.
Loading...