How to speed up the shutdown and/or reboot time in R4R/GoPiGo O/S

Greetings!

Another simple system enhancement:

I have noticed that during shutdown there can be an extensive delay - 90 seconds - for the GPIO daemon to shut down. The shutdown timer eventually times out and the kernel kills the process anyway.

During this time the robot appears to “hang” with (sometimes) the power light flashing purple.

@cleoqc
Would you please publish a list of color codes and signals for the power LED?

Since the activity LED on the GoPiGo board goes dark for an extended period of time, I have mistakenly assumed that the system had completely powered down, but (somehow or other), the GoPiGo board didn’t get the message.  As a consequence, I have unplugged power long before the actual shutdown process was complete - as much critical stuff remains to be done.

This is not good.  In fact, this might be responsible for some weird and unexpected SD card corruption, trashing my system several times for no obvious reason.  (That is, unless you have a monitor plugged in, and have the splash-screen disabled.)

I don’t know why this module doesn’t stop normally - maybe it’s being held open by parts of the R4R software and GoPiGo controller firmware?

The solution is to edit /etc/systemd/system.conf as root, with your favorite editor.

You will find a long list of parameters, all commented out.  These represent the compile-time defaults for various kernel options and parameters.  If you un-comment a line and change its value, the new value for that option/parameter will be used after the next reboot.

What I did was to find the line that says #DefaultTimeoputStopSec=90s and:

  1. Either un-comment it or, (as I did), make a copy of that line and uncomment the copy.
  2. Change the value to something more reasonable - like 10 or 15 seconds.
    (I chose 10 seconds since the process never stops by itself anyway - better to kill it quickly and get on with the rest of the shutdown process.

Then save the file.

That part of my file now looks like:

#DefaultTimeoutStartSec=90s
#DefaultTimeoutStopSec=90s
DefaultTimeoutStopSec=10s  <== This is the line I changed
#DefaultRestartSec=100ms
#DefaultStartLimitIntervalSec=10s

Save and reboot and any shutdown delays will be gone.

I have tried this extensively and there appears to be no change to the way the Raspberry Pi or the GoPiGo behaves during shutdown.

1 Like

Very interesting. Often when I shutdown, the green disk access light on the Pi board will flash like once a second for 20 times with a final long pulse, but every once in a while perhaps when the OS image is pure and untouched the light only flashes a couple times before the long pulse. Related?

1 Like

There’s no way of telling if you don’t have a monitor connected so you can see the shutdown process.

It might be in the system logs, but I haven’t had much success reading them.

1 Like

One of the things I plan on doing with Charlie soon, (when I get the connectors!), is to create a HDMI extension cable that will plug into the micro-HDMI connector on the Pi and bring it out via a short cable to someplace accessible.

The reason it needs to be custom made is because the strain-relief on a normal cable is too big and won’t fit behind the wheel. If I make my own, I can make the strain-relief as long or short as I wish, even right-angled if that fits better.

It’s a pity I’m not in the States - I’d be glad to make two, (or four, extras are always good!), and send you a set for Carl. Unfortunately, shipping from Russia is problematic at best.

I just thought of something:

The difference between a “virgin” operating system and one that is fully fleshed out is the number of processes you have running to do the various things that Carl requires.

All the extra processes that need to cleanly shut down is a process that doesn’t happen instantly - it can take non-trivial amounts of time, especially if the process is logging and has queued data to spool to disk.

Maybe true, maybe not.  You’d need to monitor the shutdown process to know for sure.

1 Like