13

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?

3
  • 1
    Seems like a common bug. Is it still shutting down successfully afterwards?
    – jesse_b
    Jul 15, 2017 at 15:30
  • It does appear to shutdown after the error is displayed.
    – Village
    Jul 15, 2017 at 16:44
  • 1
    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, 2017 at 21:59

1 Answer 1

12

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.

  1. (EDIT: this is ArchLinux-specific) 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"

5
  • 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. May 25, 2018 at 3:11
  • 1
    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, 2018 at 10:41
  • mkinitcpio is specific to Arch, so your option 2) needs to be implemented in some other way in Debian.
    – telcoM
    Dec 26, 2020 at 22:48
  • @telcoM Okay thanks. I don't use Arch anymore, but I've updated the answer. Dec 30, 2020 at 21:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .