Bug 265289 - Error building sysutils/fusefs-ext2 with read-only system root directory
Summary: Error building sysutils/fusefs-ext2 with read-only system root directory
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Emanuel Haupt
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-18 08:20 UTC by Andrey Zakharchenko
Modified: 2023-03-02 08:08 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (ehaupt)


Attachments
Using sysutils/e2fsprogs@nobootfsck as a dependency for sysutils/fusefs-ext2 (479 bytes, patch)
2022-07-18 08:20 UTC, Andrey Zakharchenko
no flags Details | Diff
add flavor, pacify portclippy/portfmt (1.28 KB, patch)
2022-07-19 09:54 UTC, Emanuel Haupt
no flags Details | Diff
add flavor, pacify portclippy/portfmt (revised) (1.46 KB, patch)
2022-07-20 19:22 UTC, Emanuel Haupt
no flags Details | Diff
Patch to fix dependency v1 (727 bytes, patch)
2022-12-24 12:41 UTC, Guido Falsi
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Zakharchenko 2022-07-18 08:20:57 UTC
Created attachment 235326 [details]
Using sysutils/e2fsprogs@nobootfsck as a dependency for sysutils/fusefs-ext2

-------------------------------------------------
#synth just-build sysutils/fusefs-ext2
===>   fusefs-ext2-0.0.10_3 depends on executable: mke2fs - not found
===>   Installing existing package /packages/All/e2fsprogs-1.46.5_1.pkg
Installing e2fsprogs-1.46.5_1...
`-- Installing e2fsprogs-libblkid-1.46.5...
|   `-- Installing e2fsprogs-libuuid-1.46.5...
|   `-- Extracting e2fsprogs-libuuid-1.46.5: .......... done
`-- Extracting e2fsprogs-libblkid-1.46.5: .......... done
`-- Installing gettext-runtime-0.21...
|   `-- Installing indexinfo-0.3.1...
|   `-- Extracting indexinfo-0.3.1: .... done
`-- Extracting gettext-runtime-0.21: .......... done
Extracting e2fsprogs-1.46.5_1: 
pkg-static: Fail to create temporary file: /sbin/.pkgtemp.e2fsck.ihJYgaA5Q8MD:Read-only file system
Extracting e2fsprogs-1.46.5_1... done

Failed to install the following 1 package(s): /packages/All/e2fsprogs-1.46.5_1.pkg
*** Error code 1

Stop.
-------------------------------------------------

sysutils/e2fsprogs tries to install e2fsck(8) to /sbin; it is a read-only directory in synth(1) build environment. There is a flavor sysutils/e2fsprogs@nobootfsck that doesn't put anything outside $LOCALBASE, but sysutils/fusefs-ext2 tries to use sysutils/e2fsprogs@default and fails.

I don't think fusefs ext2 support (used mainly for mounting external drives) needs boottime fsck in its default configuration. Why don't we use sysutils/e2fsprogs@nobootfsck as default dependency to allow read-only system root? And if you need boottime e2fsck, you know how to use sysutils/e2fsprogs@default or sysutils/e2fsprogs@roothardlinks.

The attached patch was tested on my system, synth(1) building of sysutils/fusefs-ext2 is OK; mke2fs, mounting, writing, unmounting, e2fsck, remounting and reading external drive work correctly.
Comment 1 Emanuel Haupt freebsd_committer freebsd_triage 2022-07-19 09:54:37 UTC
Created attachment 235351 [details]
add flavor, pacify portclippy/portfmt

Your patch works but would render the port useless for people using the default flavor of e2fsprogs. It might be better to add the same flavor to support both situations.

Could you please try this patch?
Comment 2 Andrey Zakharchenko 2022-07-19 12:26:59 UTC
Your patch doesn't work because new Makefile still tries to pull sysutils/e2fsprogs [@default] regardless of its own flavor, and that can't be installed into read-only system root directory.

Moreover, if you change the patch to pull sysutils/e2fsprogs@nobootfsck for sysutils/fusefs-ext2@nobootfsck and sysutils/e2fsprogs@default for sysutils/fusefs-ext2@default, you won't correct our error but propagate it to the next level. sysutils/dsbmd pulls sysutils/fusefs-ext2 as a dependency, and it doesn't use @nobootfsck flavor, so it'll try to install @default version and will trigger the same problem of read-only /sbin. And if you provide sysutils/dsbmd with @nobootfsck flavor, sysutils/dsbmc and sysutils/dsbmc-cli will pull flavorless dependencies…
Comment 3 Emanuel Haupt freebsd_committer freebsd_triage 2022-07-20 19:22:05 UTC
Created attachment 235394 [details]
add flavor, pacify portclippy/portfmt (revised)

I meant to add the @${FLAVOR} to the dependencies and not the LDFLAGS.

With the revised patch I tried:

poudriere bulk -C -j 130amd64 -v -t sysutils/fusefs-ext2@nobootfsck

Then I spun up a vanilla 13.0 jail:

[added my poudriere repository]
find /sbin/ > /tmp/before
pkg install -r mypoudriererepo sysutils/fusefs-ext2@nobootfsck
find /sbin/ > /tmp/after
diff -uN /tmp/before /tmp/after
[nothing new in /sbin]
pkg info | grep -i -e e2fsprog -e fusefs-ext2
e2fsprogs-libblkid-1.46.5      Blkid library from e2fsprogs package
e2fsprogs-libuuid-1.46.5       UUID library from e2fsprogs package
e2fsprogs-nobootfsck-1.46.5_1  Utilities & library to manipulate ext2/3/4 filesystems
fusefs-ext2-nobootfsck-0.0.10_4 FUSE module to mount ext2, ext3 and ext4 with read write support

I don't use synth but it looks to me as if the revised patch achieves the goal.

Can you please check again?
Comment 4 Emanuel Haupt freebsd_committer freebsd_triage 2022-07-20 20:12:29 UTC
counter-evidence to my above example using @default:

diff -uN /tmp/before /tmp/after
--- /tmp/before 2022-07-20 22:05:26.735588000 +0200
+++ /tmp/after  2022-07-20 22:05:27.038480000 +0200
@@ -28,6 +28,7 @@
 /sbin/gbde
 /sbin/pfilctl
 /sbin/zfsbootcfg
+/sbin/fsck_ext2fs
 /sbin/kldunload
 /sbin/tunefs
 /sbin/mount_fusefs
@@ -97,6 +98,7 @@
 /sbin/sha512
 /sbin/shutdown
 /sbin/setkey
+/sbin/e2fsck
 /sbin/mount_cd9660
 /sbin/ipmon
 /sbin/mount_nullfs

You wrote about sysutils/dsbmc and sysutils/dsbmc-cli: these ports would have to be adapted as well to support the nobootfsck flavour in the same fashion as this port.
Comment 5 Andrey Zakharchenko 2022-07-21 11:10:28 UTC
The corrected patch works for sysutils/fusefs-ext2

But it doesn't work for:
sysutils/dsbmd
sysutils/dsbmc
sysutils/dsbmc-cli
sysutils/automount
- they all pull flavorless sysutils/e2fsprogs as a dependency.

And if yet another port depending on e2fsprogs appears, it will require two flavors support.

IMHO it is more convenient to drop the proliferating flavors and organize three-position config option for e2fsprogs:
* Install e2fsck copy to /sbin [default]
* Hardlink e2fsck to /sbin
* Don't touch /sbin

What do you think?
Comment 6 Emanuel Haupt freebsd_committer freebsd_triage 2022-07-21 12:32:24 UTC
Being the maintainer sysutils/fusefs-ext2 I can offer you a solution that works for this port. Other ports depending on e2fsprogs will have to implement those flavors as well if you like to have them supported but you will have to check with their maintainers.

Alternatively you could try to convince the maintainer of e2fsprogs to change defaults.
Comment 7 Guido Falsi freebsd_committer freebsd_triage 2022-12-24 12:41:01 UTC
Created attachment 238999 [details]
Patch to fix dependency v1

Hi,

After commit 14e733a6bb4b to sysutils/e2fsprogs I have noticed poudriere always rebuilding sysutils/fusefs-ext2

Turns out that that issue, and the issue reported here should be fixed by adjusting the dependency to sysutils/e2fsprogs-core which contains the actual files needed.

BTW the other ports showing similar issues are most probably fixed with the same change.

Attaching patch to address this for the maintainer to evaluate.

Thanks in advance!
Comment 8 commit-hook freebsd_committer freebsd_triage 2022-12-24 15:03:31 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3912e8caff71c080cd709d1bca6967c6cb0d8b6c

commit 3912e8caff71c080cd709d1bca6967c6cb0d8b6c
Author:     Guido Falsi <madpilot@FreeBSD.org>
AuthorDate: 2022-12-24 15:01:54 +0000
Commit:     Emanuel Haupt <ehaupt@FreeBSD.org>
CommitDate: 2022-12-24 15:02:51 +0000

    sysutils/fusefs-ext2: Adjust dependencies after 14e733a6bb4b

    After commit 14e733a6bb4b to sysutils/e2fsprogs, poudriere always
    rebuilds sysutils/fusefs-ext2.

    Adjust dependency to sysutils/e2fsprogs-core which contains the actual
    files needed.

    PR:             265289

 sysutils/fusefs-ext2/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Comment 9 Emanuel Haupt freebsd_committer freebsd_triage 2022-12-24 22:24:31 UTC
(In reply to Guido Falsi from comment #7)
Thank you Guido, committed, thanks!
Comment 10 Emanuel Haupt freebsd_committer freebsd_triage 2023-03-02 08:08:13 UTC
Closing this PR.