Why do I get the error "failed unmounting /var" during shutdown?
20,101
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:
- 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.
- (EDIT: this is ArchLinux-specific) Or set up a shutdown hook to unmount
/var
later. This won't remove thefailed
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"
Related videos on Youtube
Author by
Village
Updated on September 18, 2022Comments
-
Village over 1 year
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?
-
Marcelo Ventura almost 6 yearsI 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 almost 6 years
-
JanPropelforwards over 5 yearsA 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. Seeman journald.conf
. -
telcoM over 3 years
mkinitcpio
is specific to Arch, so your option 2) needs to be implemented in some other way in Debian. -
Thibault Lemaire over 3 years@telcoM Okay thanks. I don't use Arch anymore, but I've updated the answer.