4

I just upgraded to Ubuntu Vivid (15.04) today, and after the restart I experienced a very long boot process. My laptop usually boots in 5 seconds or less, and now it hadn't finished even after a few minutes.

Pressing Esc showed the following screen:

enter image description here

The last line says "A start job is running for /etc/rc.local Compatibility (7 min 24s / no limit)". Despite the "no limit" part, it gave up (or completed ?) after exactly 10 minutes, and the boot process finished.

This happens on every boot.

Could it be related to the transition to systemd? How can I fix this? (Right now, I think twice before shutting down my laptop). Should I report a bug? And if so, where?

My /etc/rc.local file:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
fstrim -v /
fstrim -v /home
exit 0

The file is executable:

$ ls -l /etc/rc.local
-rwxr-xr-x 1 root root 333 aug 14  2013 /etc/rc.local

I added the 2 fstrim lines almost 2 years ago, when I installed a SSD, following the instructions from Easy Linux tips project.

Apparently these are the cause of my problem (I removed them and rebooted - the problem was gone), but I still think the system shouldn't hang like that for 10 minutes. Also, how can I run fstrim at boot now?

6

If you put long-running commands in rc.local, your startup will be delayed. You should send these to the background:

( fstrim -v /; fstrim -v /home ) &

That said, you probably don't have to do this yourself. Ubuntu 14.10 added a weekly job for fstrim.

2

Strange that this is suddenly a problem in Ubuntu 15.04, whereas it has always worked well for you in Ubuntu 14.04....

You might also add a sleep parameter before the trim, so that the two trim commands will be executed after a set number of seconds. This should allow the boot process to complete, causing the trim commands to be run in the background.

Like this (40 seconds delay):

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
sleep 40
fstrim /
fstrim /home
exit 0

The -v (verbose) parameter for trim has in this case no use, by the way, because it's being run in the background. I've changed that in my Easylinuxtips how-to as well.

Note: I've only tested such a sleep parameter in rc.local in Ubuntu 14.04 and Linux Mint 17.x (for another purpose than trim), so I'm not sure whether this will work similarly in Ubuntu 15.04.

1

I had the same issue, basically this happens when something in rc.local does not terminate normally such as a daemon of some sort. To find which command in rc.local is the culprit simply to a killall -9 command/from/etc.local and it will reboot once all commands from rc.local are terminated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.