Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#28341 - [initscripts] 'nofail' devices won't get unmounted on shutdown

Attached to Project: Arch Linux
Opened by Artem Sheremet (dot) - Friday, 10 February 2012, 03:38 GMT
Last edited by Tom Gundersen (tomegun) - Saturday, 25 February 2012, 11:30 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Dave Reisner (falconindy)
Tom Gundersen (tomegun)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
an external (USB) HDD filesystem has the 'nofail' option in fstab for the case it is disconnected or out of service.

findmnt returns _netdev in OPTIONS for this device, which causes unmount_all in /etc/rc.d/functions ignore this mount. This ends up in unmounted/corrupt filesystem and always forces fsck of the whole partition.

Any reason to avoid _netdevs? If so, can there be a workaround to unmount _netdev if it's ext2?

Additional info:
* package version(s)
initscripts 2012.01.3-1

* config and/or log files etc.
fstab entry (of interest):
/dev/sdb1 /media/hdd ext2 defaults,noatime,nofail 0 2
'mount' output (the line of interest):
/dev/sdb1 on /media/hdd type ext2 (rw,noatime,errors=continue,_netdev)
'findmnt' output (the line of interest):
/media/hdd ext2 rw,noatime,errors=continue,_netdev

Steps to reproduce:
mount a media with 'nofail' option, reboot the system, observe that the FS has not been unmounted and fsck has been forced on it.
This task depends upon

Closed by  Tom Gundersen (tomegun)
Saturday, 25 February 2012, 11:30 GMT
Reason for closing:  Fixed
Additional comments about closing:  by util-linux-2.21
Comment by Dave Reisner (falconindy) - Saturday, 11 February 2012, 18:15 GMT
_netdev cannot possibly apply to an ext2 drive.

From mount(8):

_netdev
The filesystem resides on a device that requires network access (used to prevent the system from
attempting to mount these filesystems until the network has been enabled on the system).

I don't really understand what's going on here. Adding 'nofail' to a mount doesn't cause _netdev to be appended as a mount option.
Comment by Artem Sheremet (dot) - Tuesday, 14 February 2012, 07:14 GMT
just tried it again — it really didn't. But I could swear I tried it a couple of times, wondering myself how it could happen.

Frankly I faced it on every reboot — each time my /dev/sdb1 gets fsck'd. Not saying we reboot too often, usually only after major kernel update. That time trying to find out the reason, I have seen '_netdev' in the 'findmnt' output and after trying various mount options figured out that 'nofail' in fstab turns into '_netdev' in findmnt. Cannot reproduce it right now though — weird!

Comment by Artem Sheremet (dot) - Tuesday, 21 February 2012, 21:27 GMT
just updated to Linux 3.2.6-2-ARCH, rebooted and sdb1 got fsck'd again. When it finished the boot process, tried 'findmnt -mrunRo TARGET,FSTYPE,OPTIONS /' (just as it is in umount_all function) and it shows
/media/hdd ext2 rw,noatime,errors=continue,_netdev

After stopping the services and issuing

umount /media/hdd
mount /media/hdd

findmnt still shows _netdev. Options in fstab are unchanged: defaults,noatime,nofail. Could it be a mount bug to be reported upstream or would you like to see/try it in action (ssh?) ?
Comment by Dave Reisner (falconindy) - Tuesday, 21 February 2012, 21:31 GMT
ssh would be lovely.
Comment by Dave Reisner (falconindy) - Wednesday, 22 February 2012, 02:55 GMT
Followup for anyone else finding this FS -- it's a legit but in util-linux's mount when linked against libmount that causes _netdev to be appended when nofail is used as a mount option. I recommended to Artem that in place of nofail, he add 'noauto' to his /etc/fstab and check for the block device being present in rc.local along the lines of...

blkid -lt UUID=..... &>/dev/null && mount <device>

I went back as far as util-linux 2.19 and this bug still exists, so it's nothing new, this is just the first we're hearing about it. Additionally, I've nailed down exactly where the fault is, but the code is a goddamn mess. We're likely moving away from this particular mount implementation in favor of one more closely linked to libmount, so this bug may fix itself by way of deprecation...
Comment by Tom Gundersen (tomegun) - Saturday, 25 February 2012, 10:43 GMT
This should have been fixed in util-linux in testing. Could anyone confirm?
Comment by Artem Sheremet (dot) - Saturday, 25 February 2012, 11:19 GMT
Confirmed. After installing util-linux-2.21-2 from testing 'findmnt -mrunRo TARGET,FSTYPE,OPTIONS /' no longer shows _netdev against nofail-mounted ext2:

/media/hdd ext2 rw,noatime,errors=continue
Comment by Tom Gundersen (tomegun) - Saturday, 25 February 2012, 11:30 GMT
thanks!

Loading...