In message <20250614063551.c8c40...@slippy.cwsent.com>, Cy Schubert writes: > In message <20250614062906.169ea...@slippy.cwsent.com>, Cy Schubert writes: > > In message <202506131548.55dfmqnu004...@gitrepo.freebsd.org>, Warner Losh > > write > > s: > > > The branch main has been updated by imp: > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=900bc0206348a439b3a0625a7239 > cb > > 87 > > > a2dc27c5 > > > > > > commit 900bc0206348a439b3a0625a7239cb87a2dc27c5 > > > Author: Siva Mahadevan <m...@svmhdvn.name> > > > AuthorDate: 2025-03-14 15:52:12 +0000 > > > Commit: Warner Losh <i...@freebsd.org> > > > CommitDate: 2025-06-13 15:47:25 +0000 > > > > > > rc.d/zpool: change mountcritlocal dep from BEFORE to REQUIRE > > > > > > In cases where the `/boot` directory is mounted from a different disk > , > > > `/boot/zfs/zpool.cache` will not be found during a `rc.d/zpool` > > > run. This is because `/etc/fstab` mounts are mounted in > > > `rc.d/mountcritlocal`, which currently runs AFTER (i.e. `REQUIRE:`) > > > `rc.d/zpool`. > > > > > > This change swaps the `rcorder` of `rc.d/zpool`'s dependency on > > > `mountcritlocal` from `BEFORE:` to `REQUIRE:`. This will ensure that > > > `/boot` (or even `/etc/` in some configurations) to be visible while > > > searching for `zpool.cache`. > > > > > > Reviewed by: imp > > > Pull Request: https://github.com/freebsd/freebsd-src/pull/1614 > > > Closes: https://github.com/freebsd/freebsd-src/pull/1614 > > > --- > > > libexec/rc/rc.d/zpool | 3 +-- > > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > > > diff --git a/libexec/rc/rc.d/zpool b/libexec/rc/rc.d/zpool > > > index 94e107bd9ae0..63f040ad122b 100755 > > > --- a/libexec/rc/rc.d/zpool > > > +++ b/libexec/rc/rc.d/zpool > > > @@ -3,8 +3,7 @@ > > > # > > > > > > # PROVIDE: zpool > > > -# REQUIRE: hostid disks > > > -# BEFORE: mountcritlocal > > > +# REQUIRE: hostid disks mountcritlocal > > > # KEYWORD: nojail > > > > > > . /etc/rc.subr > > > > > > > This causes systems which boot off UFS with ZFS to fail boot. The machine > > drops into single user until one can /etc/rc.d/zpool start and hit > > control-d to continue the boot. > > > > The reason this fails is /etc/fstab with legacy ZFS will no longer boot > > into multiuser. > > > > slippy$ grep zfs /etc/fstab | head > > # tank/usr/lib/debug/amd64 /usr/lib/debug zfs rw,noatime > > > 0 0 > > tank/sfw/modules /boot/modules zfs rw,noatime 0 0 > > tank/sfw/local /usr/local zfs rw,noatime 0 0 > > tank/sfw/compat /usr/compat zfs rw,noatime 0 0 > > tank/sfw/var/lib /var/lib zfs rw,noatime 0 0 > > tank/sfw/var/db/pkg /var/db/pkg zfs rw,noatime 0 0 > > tank/sfw/var/db/ports /var/db/ports zfs rw,noatime 0 0 > > tank/var/db/mysql /var/db/mysql zfs rw,noatime 0 0 > > tank/db/pgsql /var/db/postgres zfs rw,noatime 0 0 > > tank/var/db/local /var/db/local zfs rw,noatime 0 0 > > slippy$ > > > > Please revert this. > > I left this comment in the pull request and reopened it. > > This causes systems with ZFS legacy filesystems, those specified in > /etc/fstab to fail to enter multi-user because mountcritlocal cannot find > fstyp zfs. > > BTW, this is the reason I specified BEFORE: mountcritlocal when I created > this rc script.
An alternative would be this: diff --git a/libexec/rc/rc.d/mountcritlocal b/libexec/rc/rc.d/mountcritlocal index f91eaf44457c..db6436f63eb8 100755 --- a/libexec/rc/rc.d/mountcritlocal +++ b/libexec/rc/rc.d/mountcritlocal @@ -27,6 +27,15 @@ mountcritlocal_start() ;; esac + while read a b fstype rest; do + if [ "$fstype" = "zfs" ]; then + # zpool is needed for legacy ZFS + echo 'Importing zpools for legacy ZFS' + /etc/rc.d/zpool start + break + fi + done < /etc/fstab + # Mount everything except nfs filesystems. startmsg -n 'Mounting local filesystems:' mount_excludes='no' -- Cheers, Cy Schubert <cy.schub...@cschubert.com> FreeBSD UNIX: <c...@freebsd.org> Web: https://FreeBSD.org NTP: <c...@nwtime.org> Web: https://nwtime.org e**(i*pi)+1=0