log2ram: Log2ram failed to start on boot

Device: raspberry pi 4 2GB kernel: 5.10.63-v7l+

I noticed that my pi took a very long time to reboot. Then I checked that boot.log and found that log2ram failed to start. When I manually restart log2ram by

sudo systemctl restart log2ram

it worked totally fine.

Then I removed log2ram via the apt method, then installed it again. The problem was gone.

It might be due to an update that I have done 3 days ago as I haven’t rebooted since then.

Anyone who thinks that their raspberry pi failed to boot after reboot or just fails to boot should check if they have log2ram installed. If so, be patient and wait for about 5 minutes after power on to see if it boots up. If that is the case, try doing the following:

sudo apt update; sudo apt remove log2ram && sudo apt install log2ram

Then reboot. The first reboot may take longer, wait for at least 5 minutes before aborting. But the second one is fine.

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 1
  • Comments: 39 (8 by maintainers)

Most upvoted comments

Just my 2cp. As already said, if log2ram can be started without issues after the boot it means that there is a dependency that is slowing it down for some reasons. Therefore it’s all about finding what is causing the timeout.

In this view I’d suggest to check with systemd-analyze.

This command will generate a nice svg chart of the full systemd boot timings:

systemd-analyze plot >bootup.svg

And this will tell you the critical path to the final target (it does not include the full dependency tree, but only the dependencies that are actually delaying the path):

systemd-analyze critical-chain

Also you can specify a unit to the last command, thus if you run systemd-analyze critical-chain log2ram.service you should get something like

The time when unit became active or started is printed after the "@" character.
The time the unit took to start is printed after the "+" character.

log2ram.service +1.931s
└─var-log.mount @7.353s
  └─dev-zram0.device @7.030s

And finally this one will produce a dot format output of the dependencies of log2ram.service:

systemd-analyze dot 'log2ram.service'

I think the output is already readable, but if you want it is possible to generate an SVG chart of it running the output through dot:

systemd-analyze dot 'log2ram.service' | dot -Tsvg >log2ram.svg

Note: to be able to render the chart you need the graphviz package. That can be installed with apt install graphviz.

This should help in reducing the number of possible causes.