-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
zfs-mount causes error in mount #3509
Comments
That function have been subject to quite some controversy… It's old, and I don't know exactly where it came from. We ended up keeping it, mostly because we weren't exactly sure what it did or under what circumstances it was needed. "Thanx" for triggering this :). Now, looking at the function and it's call again, it's supposed to be called ONLY if /etc/mtab != /proc/mounts. Looking at it again and actually LOOKING at the code, I can see the error. The comment talks about it only being called if /etc/mtab isn't a link to /proc/mounts (don't know why that is needed), but the actual code reads /proc/mounts anyway. That might be the first error.. Could you please give me the output of:
If you can trigger this at every boot, could you edit the function to read |
Since you seem to be ok with using GIT, may I ask you to checkout https://github.com/FransUrbo/zfs/tree/fixes.initscripts3 and install the init scripts from that branch? Just run Hopefully those should do it. If they do, let me know and I'll create a pull request for @behlendorf to look at. |
This reverts commit 036391c. Because openzfs#3509 came just after this commit was accepted and is related to the original problem the commit was supposed to fix, we need to solve the problem in another way.
* Fix problems (!?) in the mounts file. It will record 'rpool 1' as 'rpool\0401' instead of 'rpool\00401' which seems to be the correct (at least as far as 'printf' is concerned). Use this using the external 'echo' command (and not the one built in to the shell) because the internal one would interpret the backslash code (incorrectly), giving us a � instead. Signed-off-by: Turbo Fredriksson [email protected] Closes openzfs#3488 Closes openzfs#3509
Fix problems (!?) in the mounts file. It will record 'rpool 1' as 'rpool\0401' instead of 'rpool\00401' which seems to be the correct (at least as far as 'printf' is concerned). Use this using the external 'echo' command (and not the one built in to the shell) because the internal one would interpret the backslash code (incorrectly), giving us a � instead. Signed-off-by: Turbo Fredriksson [email protected] Closes openzfs#3488 Closes openzfs#3509
Fix problems (!?) in the mounts file. It will record 'rpool 1' as 'rpool\0401' instead of 'rpool\00401' which seems to be the correct (at least as far as 'printf' is concerned). Use this using the external 'echo' command (and not the one built in to the shell) because the internal one would interpret the backslash code (incorrectly), giving us a � instead. Signed-off-by: Turbo Fredriksson [email protected] Closes openzfs#3488 Closes openzfs#3509
* In read_mtab(), fix problems (!?) in the mounts file. It will record 'rpool 1' as 'rpool\0401' instead of 'rpool\00401' which seems to be the correct (at least as far as 'printf' is concerned). Use this using the external 'echo' command (and not the one built in to the shell) because the internal one would interpret the backslash code (incorrectly), giving us a � instead. * In reregister_mounts(), the mount command options differ depending on if we're remounting is a legacy or native Z filesystem. Signed-off-by: Turbo Fredriksson [email protected] Closes openzfs#3488 Closes openzfs#3509
* In read_mtab(), fix problems (!?) in the mounts file. It will record 'rpool 1' as 'rpool\0401' instead of 'rpool\00401' which seems to be the correct (at least as far as 'printf' is concerned). Use this using the external 'echo' command (and not the one built in to the shell) because the internal one would interpret the backslash code (incorrectly), giving us a � instead. * In reregister_mounts(), the mount command options differ depending on if we're remounting is a legacy or native Z filesystem. Signed-off-by: Turbo Fredriksson [email protected] Closes openzfs#3488 Closes openzfs#3509
It seems like this function is usable if/when mounts exists in If this is happening in the original issue I'm not sure, but it seems likely. |
* In read_mtab(), fix problems (!?) in the mounts file. It will record 'rpool 1' as 'rpool\0401' instead of 'rpool\00401' which seems to be the correct (at least as far as 'printf' is concerned). Use this using the external 'echo' command (and not the one built in to the shell) because the internal one would interpret the backslash code (incorrectly), giving us a � instead. * In reregister_mounts(), the mount command options differ depending on if we're remounting is a legacy or native Z filesystem. Signed-off-by: Turbo Fredriksson [email protected] Closes openzfs#3488 Closes openzfs#3509
Ok, I'm think I'm happy with this last commit. @janlam7 if you could test it and make sure it works for you to, I'd appreciate it. |
@FransUrbo commit b7bdebd does NOT work for me. I think the mount message is caused by the combination of -f and -t zfs parameters. If I take -t zfs out, it seems to work. During the boot process I do get a warning that support for /etc/mtab is deprecated, I'll have a look at that too. It suggests running: ln -snf /proc/self/mounts /etc/mtabToo answer the previous questions: ls -l /etc/mtab /proc/mounts-rw-r--r-- 1 root root 1338 Jun 20 06:26 /etc/mtab cat /etc/mtabrootfs / rootfs rw 0 0 cat /proc/mountsrootfs / rootfs rw 0 0 zfs get all pool2/ROOT/gentooNAME PROPERTY VALUE SOURCE |
The code does not get triggered anymore after executing ln -snf /proc/self/mounts /etc/mtab |
The thing is, the options ARE (supposed to be) correct. They depend on if the filesystem/dataset is a native Z filesystem or a legacy one.
I notice that Gentoo (latest) also does this. Have no idea why. /proc/mounts (which is a link to /proc/self/mounts) is authoritative. Meaning, that's the kernel updating that and it is ALWAYS right. /etc/mtab on the other hand is updated by any command you run (such as mount/umount etc) and can (and apparently do) get out of sync with the kernels opinion on what's mounted and not. Which is why the link came to be years ago in the first place. No idea why some dists still insist on having it as a plain file...
That's what reregister_mounts() is supposed to fix.
The correct (!!) command to mount a native Z fs is one of:
and to mount a legacy fs:
The -t option needs to be there, it is correct. Why it doesn't work for you, I don't know. Work just fine on every machine here… How did you ./configure and install the new version? Did you have a previous one, from a package or did you install the new one in another place than the first? Could it be that the mount.zfs helper command got "lost" somewhere? You should have only ONE and the correct and only place for it is in /sbin. If that's an older one, that MIGHT (although I kind'a doubt it, it really haven't changed in years) explain it… Or if it (the actual "mount" command) can't find the helper as "/sbin/mount.zfs" (and only that, anything else is a failure), that's an ever bigger clue. |
A command similiar to mount -f -t zfs -o zfsutil rpool/tests/test09 /rpool/tests/test09 works fine on my machine. In the initscript it is also called with the --move option. That does not work on my machine. |
Works for me... |
Ok, I'll get around it by turning /etc/mtab into a symlink on my machines. |
If you have the time, I'd appreciate if you could try to figure out why the command doesn't work for you. Since I can't reproduce it here on any of my machines, there must (?) be something special about your setup... |
For what it's worth, I am seeing the same problems as @janlam7 using git HEAD on my Funtoo system. I haven't posted because I haven't had any other details to share, but I can at least say it's not just his setup, though there may be something about Gentoo/Funtoo at play. I've been using ZFS on Funtoo for two years without issue using the old Applying b7bdebd does not stop the error:
(I think it's weird that However, the system does come up with all of the datasets mounted. I don't really understand the point of |
* In read_mtab(), fix problems (!?) in the mounts file. It will record 'rpool 1' as 'rpool\0401' instead of 'rpool\00401' which seems to be the correct (at least as far as 'printf' is concerned). Use this using the external 'echo' command (and not the one built in to the shell) because the internal one would interpret the backslash code (incorrectly), giving us a � instead. * In reregister_mounts(), the mount command options differ depending on if we're remounting is a legacy or native Z filesystem. * Remove '-t zfs' from 'mount --move' commands. Don't work on mount v2.25.0 (Jessie and Gentoo). Thanx to @janlam7 and @MrStaticVoid for help in tracking this done. Signed-off-by: Turbo Fredriksson [email protected] Closes openzfs#3488 Closes openzfs#3509
@ryao, do you have any idea?
Verify this by running "zpool import" to see what it finds. It should print out all pools that isn't already imported that it can find labels for on the disks/devices (including zvols etc).
Trying to compare "mount" between Wheezy, Jessie and Gentoo I see:
This is how I test:
Now that we have a clue about Gentoo, I notice that this only works on Wheezy, which is my primary test platform… ! It seems, like @janlam7 have said several times, that the only way to resolve this is to remove the "-t zfs" option. It seems to be working on all three systems. I'm just worried that that might introduce something else… I've removed this option and pushed another version (commit 4215fda) which according to information in this issue should solve the problem. If you could just triple check that, I'd appreciate it. |
Nope:
I'll look into it some more and open a new issue if I find anything. For this issue, 4215fda appears to solve the problem. Your test case doesn't make sense, because it includes the
According to
|
@FransUrbo the version from 4215fda seems to work for me and does not print the mount manual anymore. |
|
Thanks, @FransUrbo. The phantom pool showed up when I ran Also, thanks for 4215fda. It seems to be working reliably. I even tested a legacy mountpoint dataset in /etc/fstab and it booted/mounted fine. |
You don't have to update to that if you don't want to, since your version now works and your system boots. But just remember that the init script and the function script will be updated as soon as Brian accepts this PR. |
This reverts commit 036391c. Because openzfs#3509 came just after this commit was accepted and is related to the original problem the commit was supposed to fix, we need to solve the problem in another way.
* In read_mtab(), fix problems (!?) in the mounts file. It will record 'rpool 1' as 'rpool\0401' instead of 'rpool\00401' which seems to be the correct (at least as far as 'printf' is concerned). Use this using the external 'echo' command (and not the one built in to the shell) because the internal one would interpret the backslash code (incorrectly), giving us a � instead. * Remove reregister_mounts() - no longer needed. Signed-off-by: Turbo Fredriksson [email protected] Closes openzfs#3488 Closes openzfs#3509
* In read_mtab(), fix problems (!?) in the mounts file. It will record 'rpool 1' as 'rpool\0401' instead of 'rpool\00401' which seems to be the correct (at least as far as 'printf' is concerned). Use this using the external 'echo' command (and not the one built in to the shell) because the internal one would interpret the backslash code (incorrectly), giving us a � instead. * Remove reregister_mounts() - no longer needed. * For Gentoo, the zfs_log_failure_msg() should use eend(), not eerror() (which requires an error message, which we don't have). Signed-off-by: Turbo Fredriksson [email protected] Closes openzfs#3488 Closes openzfs#3509 Closes openzfs#3514
This reverts commit 036391c. Because openzfs#3509 came just after this commit was accepted and is related to the original problem the commit was supposed to fix, we need to solve the problem in another way. Signed-off-by: Turbo Fredriksson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]>
I know I'm a bit late to this party, but gentoo initscripts have a |
Hi,
on one of my machines I updated to 0.6.4-109_g57ae840 and the zfs-mount initscript seems to work OK, but halfway through the mount help page is shown.
I tracked it down to the method reregister_mounts. It tries to go through all the entries in /proc/mounts and the following line in /proc/mounts causes the problem. On this machine I have the root on zfs.
pool2/ROOT/gentoo / zfs rw,relatime,noxattr,noacl 0
The script ends up trying this:
mount -f -o zfsutil -t zfs --move / /removethismountpointhoweverpossible
Without the '-t zfs' it seems to work.
Jan
The text was updated successfully, but these errors were encountered: