5

I have a fresh install of Debian 9.0.0. It has a separate 1 GB partition for /var formatted at ext4. When I shutdown from the terminal, using shutdown -h now, there is a bright-red error message stating "failed unmounting /var".

What is the fix for this error?

  • Seems like a common bug. Is it still shutting down successfully afterwards? – Jesse_b Jul 15 '17 at 15:30
  • It does appear to shutdown after the error is displayed. – Village Jul 15 '17 at 16:44
  • When I googled it I found a few Ubuntu and Kali users experiencing the same issue and many people were chiming in that they saw the same thing but it didn't seem to affect anything. – Jesse_b Jul 15 '17 at 21:59
5

The problem is journald

Or rather how it is still logging to /var while systemd is trying to unmount it.

Solutions

According to this thread, there are two ways to go about it:

  1. Make journald log to a volatile location in /run so it doesn't lock /var, but the tradeoff is that you lose logs at shutdown.

    Edit /etc/systemd/journald.conf to change the Storage= line to

    Storage=volatile

    This is what I did, and I it worked for me.

  2. Or set up a shutdown hook to unmount /var later. This won't remove the failed message as systemd will still try to unmount /var but will indeed unmount /var properly at the end of the shutdown sequence. You just won't see it. (I haven't tested that solution though)

    Add a shutdown hook to mkinitcpio's HOOKS= array, e.g. :

    HOOKS="base udev autodetect block keymap encrypt lvm2 filesystems usbinput fsck var shutdown"

  • 1
    I have two laptops with Ubuntu (one with a single HDD and one with HDD+SSD) and I got that annoying error message only on the second. In the second laptop, /var is in a different partition from / (/ is in the SSD and /var is in the HDD) and, in the first laptop, /var is within /. This might play a role in the problem. – Marcelo Ventura May 25 '18 at 3:11
  • A variant of topic (1) is to leave Storage=auto in journald.conf and just remove /var/log/journal. This worked for me, too, and journald logs are done to /run/log/journal/, instead. See man journald.conf. – René Nov 29 '18 at 10:41

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.