|Summary:||sys-apps/util-linux: make nofail be silent about ntfs if windows is hibernated|
|Product:||Gentoo Linux||Reporter:||nobody <noreply>|
|Component:||[OLD] Core system||Assignee:||Gentoo's Team for Core System packages <base-system>|
|Package list:||Runtime testing required:||---|
|Attachments:||as suggest per karelzak in openrc bug tracker|
Description nobody 2016-04-13 23:19:07 UTC
Adding nofail do nothing, when the fs with nofail fail to mount, openrc and depending services fail to start. Reproducible: Always Steps to Reproduce: 1.add a non working fs with nofail as option 2.start openrc 3.the non working fs prevent openrc to continue its work /dev/disk/by-label/WINDOWS /mnt/windows ntfs-3g user,uid=1000,gid=100,nofail 0 0 for the story why it couldn't mount it: mount /dev/disk/by-label/WINDOWS /mnt/windows -t ntfs-3g Windows is hibernated, refused to mount. Failed to mount '/dev/sda4': Opération non permise The NTFS partition is in an unsafe state. Please resume and shutdown Windows fully (no hibernation or fast restarting), or mount the volume read-only with the 'ro' mount option. Well, no big deal if openrc keep going even it couldn't mount this one, that's what i expect from the "nofail" option, but it doesn't not, and worst all services that depend on it are also unable to start (no network...)
Comment 1 nobody 2016-04-14 11:01:08 UTC
Comment 2 William Hubbs 2016-04-14 21:46:30 UTC
The nofail option works if the device the file system is on doesn't exist. For example, if you are unable to reach a network file system. If this is actually a bad file system, you have two options: You can add noauto instead of nofail so mount -a doesn't try to mount it, or you can set ignore_mount_errors="yes" in /etc/conf.d/localmount. I recommend the first method, because the second will ignore more things than just bad mounts.
Comment 3 nobody 2016-04-15 11:00:03 UTC
Thanks, i'll pickup the ignore_mount_error option. But trying to figure how "nofail" works, it raise other questions: 1/ the news didn't speak about nofail be a network only option, news says localmount and netmount change to fail now if fs cannot be mount but news then says "nofail" will allow the mount to fail. But the news didn't says it's only for network, nor it says it's only for some specifics conditions. 2/ looking at netmount, i see no "nofail" check in it. So i don't see any "nofail" support, i don't see any also in localmount, but it's ok as you said it's a netmount option only. I suppose you handle it elsewhere. 3/ netmount have a bug - line 38 : mount -at $fs - and on next line, it check if system is linux, and on linux only it try to "mount -a -O _netdev" That's not right, here's why some_server:/goodmount /mnt/good nfs4 rw,_netdev some_server:/badmount /mnt/will_fail nfs4 rw line38: rc=32 : /badmount is bad and cannot be mount, but /goodmount succeed line41: mount -O _netdev will only try to mount /goodmount only, as only that fs have the _netdev option set, and it is already mount, no other fs will be check. so at line42: $rc=0 and while line38 return error 32, line42 now return 0 and openrc will tell user everything is ok. line42 should be some kind of if ["$rc" -eq 0]; then $rc=$? 4/ it seems strange (for me) that openrc, return 0 unconditionally for non linux system. Do you know any non linux system where mount isn't reliably returning 0 on success and non 0 on errors? I don't think it's nice that linux system have difference like that if there's no real reason to have one, i would prefer openrc running with exceptions for the ones that aren't linux and have a problem with something, instead of checking if system is Linux and allow some options only on it. ignore_mount_options should be option for everyone, return code should be the same for everyone... It would be better to add a "weird_non_linux" option, so user could set it if his system is not a linux one, and if his system differ that much that we cannot use _netdev or getting a viable return result from mount -a on it. I think at least, the nofail should be better explain in the news, else many users will think like me that it could be use on any mount instead of network ones only.
Comment 4 William Hubbs 2016-04-15 16:04:22 UTC
(In reply to nobody from comment #3) > Thanks, i'll pickup the ignore_mount_error option. The reason I do not recommend this is it will ignore syntax errors in fstab as well. The safer choice is to mark non-critical filesystems as noauto in fstab. > But trying to figure how "nofail" works, it raise other questions: > > 1/ the news didn't speak about nofail be a network only option, news says > localmount and netmount change to fail now if fs cannot be mount but news > then says "nofail" will allow the mount to fail. But the news didn't says > it's only for network, nor it says it's only for some specifics conditions. The nofail option is a mount/fstab option; it isn't supported directly by OpenRC. Please see the fstab and mount man pages for more information about it. > 2/ looking at netmount, i see no "nofail" check in it. So i don't see any > "nofail" support, i don't see any also in localmount, but it's ok as you > said it's a netmount option only. I suppose you handle it elsewhere. As I said above, mount itself handles this, it isn't an OpenRC specific feature. > 3/ netmount have a bug > - line 38 : mount -at $fs > - and on next line, it check if system is linux, and on linux only it try to > "mount -a -O _netdev" > That's not right, here's why > some_server:/goodmount /mnt/good nfs4 rw,_netdev > some_server:/badmount /mnt/will_fail nfs4 rw > > line38: rc=32 : /badmount is bad and cannot be mount, but /goodmount succeed > line41: mount -O _netdev will only try to mount /goodmount only, as only > that fs have the _netdev option set, and it is already mount, no other fs > will be check. > so at line42: $rc=0 > and while line38 return error 32, line42 now return 0 and openrc will tell > user everything is ok. > line42 should be some kind of if ["$rc" -eq 0]; then $rc=$? I want to address a couple of things here. First, yes, this is a good catch and I'll fix it, in 0.21, and maybe 0.20.6. Second, the use of _netdev was confusing for me for a while too, but your example above is actually incorrect. You should remove the _netdev from the first line. The reason for this is that nfs is always a network file system. The _netdev mount option is only used for situations where it is not possible to tell from the file system type that you are working with a network file system. The example I can think of is ISCSI. > 4/ it seems strange (for me) that openrc, return 0 unconditionally for non > linux system. > Do you know any non linux system where mount isn't reliably returning 0 on > success and non 0 on errors? No, and that is why I tried to preserve the current behavior for them. > I don't think it's nice that linux system have difference like that if > there's no real reason to have one, i would prefer openrc running with > exceptions for the ones that aren't linux and have a problem with something, > instead of checking if system is Linux and allow some options only on it. > ignore_mount_options should be option for everyone, return code should be > the same for everyone... > It would be better to add a "weird_non_linux" option, so user could set it > if his system is not a linux one, and if his system differ that much that we > cannot use _netdev or getting a viable return result from mount -a on it. > > I think at least, the nofail should be better explain in the news, else many > users will think like me that it could be use on any mount instead of > network ones only. It isn't for network mounts only. You can use it on any mount. What it does is ignore the mount if the device the filesystem is on doesn't exist. Another good application of this is external hard drives. It could be argued in your ntfs example that since the windows computer is hibernated the device where the file system is located shouldn't exist.
Comment 5 William Hubbs 2016-04-15 16:43:14 UTC
https://github.com/openrc/openrc/1c3c2cf This fixes netmount so that it fails on Linux if the first mount fails rather than moving ahead and trying the mount -a -O _netdev.
Comment 6 William Hubbs 2016-04-15 18:42:32 UTC
There was a typo on the URL in the previous comment: https://github.com/openrc/openrc/commit/1c3c2cf
Comment 7 nobody 2016-04-15 23:11:32 UTC
Thanks for the explains. Alas, i'm a bit disappointed by the option and just prefer keep going with the ignore_mount_error. And you should think of turning that switch on per default and user can disable it to let his openrc goes into a "i'm a boot bugger" mode. ignore_mount_error = true - if user make a typo in fstab, his system will still boot properly, but of course because of typo, the mount point will not be mount. Sure if the typo is on a fs that is critical to boot, it will fail to boot, but not because openrc has stop him, because that's a nasty typo on a critcal fs. ignore_mount_error = false - if user make a typo in fstab, openrc will not boot properly and stop because of a typo, mount point in trouble will of course not be mount but worst legit mount point will also not (as soon as localmount is at fault, all deps are waiting for it to succeed: it mean it also prevent many services, just <grep "need localmount" /etc/init.d/*> and you'll see the huge impact.) i don't think it's a good idea to "trash" (until my english gets better to find a better word) anyone boot because openrc try to handle a typo in fstab. it's better to let the error appears because of the typo, but no let openrc stop its work and causing such trouble just for a typo. as you see like in my case, there will be many users that will get plague by that new behaviour of openrc, it should not stop booting for no real reason. I'm sorry but if you keep answering anyone that this should be "fixed" by adding noauto in fstab, you'll sure will not make friends. Of course as bugzilla is not a forum, i will stop speaking about it here, just please submit that question to QA team, as i don't think quality is limited to code but also include user experience. Because from user experience pov, your default setup make openrc 0.20 worst than 0.16 (my previous version). The second question to ask them is : as you have no real example of non linux system that act different than linux one, why such difference in handling them in openrc exist?
Comment 8 William Hubbs 2016-04-17 17:52:50 UTC
In the future, i want to remove the ignore_mount_errors option, because I think it is better to not boot into multiuser mode when a file system can't be mounted that a service needs than to continue booting and hope that things work. I understand your concern, but I feel that it is more appropriate to make the nofail option take this into account. I'm sending this to the util-linux maintainers to have them take a look at changing the behaviour of the nofail option. @vapier: See comment #0. Is this another situation where nofail could be silent about a file system similar to when the device or media does not exist?
Comment 9 SpanKY 2016-04-18 15:11:11 UTC
(In reply to William Hubbs from comment #8) based on the last upstream thread wrt nofail, i think the answer will be "no". they wanted to keep it as the docs implied -- missing devices only.
Comment 10 William Hubbs 2016-04-18 17:54:52 UTC
They added missing media in 2.28, so I hope they will be able to add this case as well, I guess we'll see.
Comment 11 SpanKY 2016-04-18 18:32:09 UTC
(In reply to William Hubbs from comment #10) yes, they merged my patch for missing media, but as a subset of "missing media is like a missing disk". the thread on the topic (referenced in the other bug) talked about a bunch of different nuances and they explicitly declined most of them.
Comment 12 William Hubbs 2016-04-18 22:43:18 UTC
If they decline this, is the best answer to use the noauto option in fstab?
Comment 13 SpanKY 2016-04-19 06:02:24 UTC
(In reply to William Hubbs from comment #12) probably, and most likely fits with the user's expected usage too. i wonder if ntfs-3g will be more forgiving if you try using the ro mount option w/hibernate state.
Comment 14 nobody 2016-04-19 13:14:02 UTC
(In reply to SpanKY from comment #13) > (In reply to William Hubbs from comment #12) > > probably, and most likely fits with the user's expected usage too. i wonder > if ntfs-3g will be more forgiving if you try using the ro mount option > w/hibernate state. Thank you guys, This is/was a great suggest! >mount /mnt/windows >Windows is hibernated, refused to mount. >Failed to mount '/dev/sda4': Opération non permise >The NTFS partition is in an unsafe state. Please resume and shutdown >Windows fully (no hibernation or fast restarting), or mount the volume >read-only with the 'ro' mount option. ># mount /mnt/windows -t ntfs-3g -o ro >echo $? >0 Because using it with noauto is really "dirty", while i could live with an automount ro, and remount rw if need.
Comment 15 nobody 2016-04-19 13:17:28 UTC
As i just see williamh open issue 316 about, it might help to know the return code mount /mnt/windows Windows is hibernated, refused to mount. Failed to mount '/dev/sda4': Opération non permise The NTFS partition is in an unsafe state. Please resume and shutdown Windows fully (no hibernation or fast restarting), or mount the volume read-only with the 'ro' mount option. echo $? 14