Skip to contentSkip to conversation

e2fsprogs: fix issues regarding merged /sbin and /usr/sbin

PATCH New Carlos Santos 3 participants 5 messages Apr 12, 2017

lore
Share & tools
lore
#0 lore raw

v7 cover e2fsprogs: fix issues regarding merged /sbin and /usr/sbin

Since e2fsprogs depends on util-linux, it's build after it. It means that if you want the fsck wrapper from util-linux (which is better maintained and you are sure that it's compatible with systemd) and you want e2fsck, it won't work. Because of the merge of /usr/bin and /bin, we end up deleting the fsck from util-linux.

In order to solve the problem we need to make two changes:

- Refactor the e2fsprogs recipe to, among other things, prevent it from removing/overriding the fsck from util-linux.

- Make systemd select util-linux/fsck to prevent ending up with the fsck from busybox, which is not compatible with systemd.

Carlos Santos (2):
e2fsprogs: refactor to fix conflicts with busybox and util-linux
systemd: select fsck wrapper from util-linux

 package/e2fsprogs/Config.in      |  87 ++++++++---------------
 package/e2fsprogs/Config.in.host |   1 +
 package/e2fsprogs/e2fsprogs.mk   | 147 ++++++++++++---------------------------
 package/systemd/Config.in        |   6 ++
 4 files changed, 80 insertions(+), 161 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH v7 1/2 e2fsprogs: refactor to fix conflicts with busybox and util-linux

So far we attempted to solve the conflicts between busybox and e2fsprogs by removing busybox programs from /bin and /sbin, leaving the e2fsprogs ones at /usr/bin and /usr/sbin. This fails with BR2_ROOTFS_MERGED_USR=y, leading to situations like the one described in bug 9436.

We could provide a better solution by means of a fine-grained selection of programs, like util-linux does, but this would require big changes in e2fsprogs. So instead of resorting to dirty tricks we switch to a more pragmatic approach:

- Use libblkid and libuuid from util-linux for host and target packages. This prevents overriding them with e2fsprogs' ones, which may cause problems for other packages.

- Drop all configs to select/deselect utilities without corresponding enable/disable options to the configure script. In other words, we always install the basic set of utilities.

- Do not build UUID utilities, which are disabled along with libuuid. The util-linux ones must be used instead.

- Install e2fsprogs utilities at /bin and /sbin, overriding the ones eventually installed by busybox.

- Do not create symlinks from mke2fs to mkfs.ext[234], since e2fsprogs' installation already creates them (fsck.ext4dev and mkfs.ext4dev were dropped in version 1.43.4).

Notice that these changes do exactly the opposite of what is requested in bug 9436. On the other hand the policy for e2fsprogs becomes coherent with the one for util-linux: busybox never wins.

Since e2fsprogs depends on util-linux, it's built later. So in order to have e2fsck from e2fsprogs and the fsck wrapper from util-linux (which is better maintained and compatible with systemd) we disable e2fsprogs' fsck if the one from util-linux is selected.

Fixes:
https://bugs.busybox.net/show_bug.cgi?id=9436 (no fix, in fact)

CC Maxime Hadjinlian <[email protected]>

---
Changes v1->v2
- Add depenndece on !BR2_PACKAGE_UTIL_LINUX_FSCK to BR2_PACKAGE_E2FSPROGS_FSCK
- Add comment telling that the fsck from util-linux has preference.
- Pass "--enable-fsck" conditionally to configure
- Remove the guard around the removal of /usr/sbin/fsck, since the fsck from busybox and util-linux are installed at /sbin
- Improve comments and commit message
Changes v2->v3
- Pass "--disable-fsck" conditionaly to configure too, since enable is the default.
- Do not attempt to remove $(TARGET_DIR)/usr/sbin/fsck, just the

    $(TARGET_DIR)/sbin/fsck from busybox.

Changes v3->v4
- Improve commit message
Changes v4->v5
- Extreme overhauling, deeply simplifying the recipe and following the suggestion from Arnout Vandecappelle to install e2fsprogs utilities on /bin and /sbin.
Changes v5->v6
- Fix typos and make small changes in commit message
Changes v6->v7
- Improve/clean comments in Config.in and add a missing depend on

     !BR2_nios2
   - Add explanation in .mk about the dependence on host-util-linux
   - Restore forced link to libintl if BR2_NEEDS_GETTEXT_IF_LOCALE=y
     and BR2_STATIC_LIBS=y.
   - Improve commit message
---
 package/e2fsprogs/Config.in      |  87 ++++++++---------------
 package/e2fsprogs/Config.in.host |   1 +
 package/e2fsprogs/e2fsprogs.mk   | 147 ++++++++++++---------------------------
 3 files changed, 74 insertions(+), 161 deletions(-)
package/e2fsprogs/Config.in +29 -58
index d1914a9..03a17c9 100644
@@ -1,101 +1,72 @@
-config BR2_PACKAGE_E2FSPROGS
+menuconfig BR2_PACKAGE_E2FSPROGS
 	bool "e2fsprogs"
 	depends on BR2_USE_MMU # util-linux/libblkid
 	select BR2_PACKAGE_UTIL_LINUX
 	select BR2_PACKAGE_UTIL_LINUX_LIBBLKID
-	select BR2_PACKAGE_UTIL_LINUX_LIBUUID
 	help
 	  The EXT2 file system utilities.
 
-	  http://e2fsprogs.sf.net
+	  The following programs are always built and installed:
+	  badblocks chattr debugfs dumpe2fs e2freefrag e2fsck e2image
+	  e2undo e4crypt e4defrag filefrag fsck fuse2fs logsave lsattr
+	  mke2fs mklost+found resize2fs tune2fs
 
-if BR2_PACKAGE_E2FSPROGS
+	  The uuid utilities (uuidd, uuidgen) are not built. Use the
+	  ones from util-linux, instead.
 
-config BR2_PACKAGE_E2FSPROGS_BADBLOCKS
-	bool "badblocks"
-	default y
+	  Other programs can be selected individually.
 
-config BR2_PACKAGE_E2FSPROGS_CHATTR
-	bool "chattr"
-	default y
+	  http://e2fsprogs.sourceforge.net/
+
+if BR2_PACKAGE_E2FSPROGS
 
 config BR2_PACKAGE_E2FSPROGS_DEBUGFS
 	bool "debugfs"
-
-config BR2_PACKAGE_E2FSPROGS_DUMPE2FS
-	bool "dumpe2fs"
-	default y
-
-config BR2_PACKAGE_E2FSPROGS_E2FREEFRAG
-	bool "e2freefrag"
-	default y
-
-config BR2_PACKAGE_E2FSPROGS_E2FSCK
-	bool "e2fsck"
-	default y
+	help
+	  ext2/ext3/ext4 file system debugger
 
 config BR2_PACKAGE_E2FSPROGS_E2IMAGE
 	bool "e2image"
-
-config BR2_PACKAGE_E2FSPROGS_E2LABEL
-	bool "e2label"
-	default y
-
-config BR2_PACKAGE_E2FSPROGS_E2UNDO
-	bool "e2undo"
-	default y
+	help
+	  Save critical ext2/ext3/ext4 filesystem metadata to a file
 
 config BR2_PACKAGE_E2FSPROGS_E4DEFRAG
 	bool "e4defrag"
 	depends on !BR2_nios2 # fallocate not implemented
 	depends on !BR2_TOOLCHAIN_USES_UCLIBC # sync_file_range not impl
+	help
+	  Online defragmenter for ext4 filesystem
 
 comment "e4defrag needs a glibc or musl toolchain"
+	depends on !BR2_nios2
 	depends on BR2_TOOLCHAIN_USES_UCLIBC
 
-config BR2_PACKAGE_E2FSPROGS_FILEFRAG
-	bool "filefrag"
-	default y
-
 config BR2_PACKAGE_E2FSPROGS_FSCK
 	bool "fsck"
+	depends on !BR2_PACKAGE_UTIL_LINUX_FSCK
 	default y
+	help
+	  Check and repair a Linux file system. This is a wrapper around
+	  the filesystem-specific fsck tools.
+
+comment "the fsck from util-linux has preference over this one"
+	depends on BR2_PACKAGE_UTIL_LINUX_FSCK
 
 config BR2_PACKAGE_E2FSPROGS_FUSE2FS
 	bool "fuse2fs"
 	depends on !BR2_STATIC_LIBS # libfuse
 	depends on BR2_TOOLCHAIN_HAS_THREADS # libfuse
 	select BR2_PACKAGE_LIBFUSE
+	help
+	  FUSE file system client for ext2/ext3/ext4 file systems
 
 comment "fuse2fs needs a toolchain w/ threads, dynamic library"
 	depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS
 
-config BR2_PACKAGE_E2FSPROGS_LOGSAVE
-	bool "logsave"
-	default y
-
-config BR2_PACKAGE_E2FSPROGS_LSATTR
-	bool "lsattr"
-	default y
-
-config BR2_PACKAGE_E2FSPROGS_MKE2FS
-	bool "mke2fs"
-	default y
-
-config BR2_PACKAGE_E2FSPROGS_MKLOSTFOUND
-	bool "mklost+found"
-	default y
-
 config BR2_PACKAGE_E2FSPROGS_RESIZE2FS
 	bool "resize2fs"
-
-config BR2_PACKAGE_E2FSPROGS_TUNE2FS
-	bool "tune2fs"
-	default y
-	select BR2_PACKAGE_E2FSPROGS_E2LABEL
-
-config BR2_PACKAGE_E2FSPROGS_UUIDGEN
-	bool "uuidgen"
 	default y
+	help
+	  ext2/ext3/ext4 file system resizer
 
 endif
package/e2fsprogs/Config.in.host +1 -0
index de9148e..7591bbc 100644
@@ -1,5 +1,6 @@
 config BR2_PACKAGE_HOST_E2FSPROGS
 	bool "host e2fsprogs"
+	select BR2_PACKAGE_HOST_UTIL_LINUX
 	help
 	  The EXT2/3/4 file system utilities.
 
package/e2fsprogs/e2fsprogs.mk +44 -103

187 lines not on this page · raw message

Signature · 1 line
2.7.4
#2 lore raw

PATCH v7 2/2 systemd: select fsck wrapper from util-linux

In reply to Carlos Santos

Select the fsck required by systemd provided by util-linux. This prevents ending up with fsck from busybox, which is incompatible with systemd.

---
[there were no v1, v2]
Changes v3
- Select e2fsprogs + e2fsck
Changes v3->v4
- Remove selection of e2fsprogs + e2fsck
- Clean-up commit message
Changes v4->v5
- Screwed-up everything, reverting the chances made in v4
Changes v5->v6
- Restored changes made in v4.
- Restore the patch changelog.
Changes v6->v7
- Removed spurious Change-Id from commit message.

---
 package/systemd/Config.in | 6 ++++++
 1 file changed, 6 insertions(+)
package/systemd/Config.in +6 -0
index 0f54686..478cc10 100644
@@ -22,6 +22,7 @@ menuconfig BR2_PACKAGE_SYSTEMD
 	select BR2_PACKAGE_UTIL_LINUX_BINARIES
 	select BR2_PACKAGE_UTIL_LINUX_MOUNT
 	select BR2_PACKAGE_UTIL_LINUX_NOLOGIN
+	select BR2_PACKAGE_UTIL_LINUX_FSCK
 	select BR2_PACKAGE_KMOD
 	select BR2_PACKAGE_BUSYBOX_SHOW_OTHERS # kmod-tools
 	select BR2_PACKAGE_KMOD_TOOLS
@@ -61,6 +62,11 @@ menuconfig BR2_PACKAGE_SYSTEMD
 	  - libgcrypt package will add support for journal sealing and
 	    DNSSEC verification in resolved.
 
+	  Notice that systemd selects the fsck wrapper from util-linux
+	  but no particular fsck.<fstype> is selected. You must choose
+	  the apropriate ones (e.g. e2fsck, from the e2fsprogs package)
+	  according to the system configuration.
+
 	  http://freedesktop.org/wiki/Software/systemd
 
 if BR2_PACKAGE_SYSTEMD
Signature · 1 line
2.7.4
#3 lore raw

PATCH v7 2/2 systemd: select fsck wrapper from util-linux

Quoted 5 lines · Carlos Santos

Select the fsck required by systemd provided by util-linux. This prevents ending up with fsck from busybox, which is incompatible with systemd.

Note that this can be applied independently of patch 1.

Regards,
Arnout

Quoted 43 lines

---
[there were no v1, v2]
Changes v3
- Select e2fsprogs + e2fsck
Changes v3->v4
- Remove selection of e2fsprogs + e2fsck
- Clean-up commit message
Changes v4->v5
- Screwed-up everything, reverting the chances made in v4
Changes v5->v6
- Restored changes made in v4.
- Restore the patch changelog.
Changes v6->v7
- Removed spurious Change-Id from commit message.

---
 package/systemd/Config.in | 6 ++++++
 1 file changed, 6 insertions(+)
package/systemd/Config.in +6 -0
index 0f54686..478cc10 100644
@@ -22,6 +22,7 @@ menuconfig BR2_PACKAGE_SYSTEMD
 	select BR2_PACKAGE_UTIL_LINUX_BINARIES
 	select BR2_PACKAGE_UTIL_LINUX_MOUNT
 	select BR2_PACKAGE_UTIL_LINUX_NOLOGIN
+	select BR2_PACKAGE_UTIL_LINUX_FSCK
 	select BR2_PACKAGE_KMOD
 	select BR2_PACKAGE_BUSYBOX_SHOW_OTHERS # kmod-tools
 	select BR2_PACKAGE_KMOD_TOOLS
@@ -61,6 +62,11 @@ menuconfig BR2_PACKAGE_SYSTEMD
 	  - libgcrypt package will add support for journal sealing and
 	    DNSSEC verification in resolved.
 
+	  Notice that systemd selects the fsck wrapper from util-linux
+	  but no particular fsck.<fstype> is selected. You must choose
+	  the apropriate ones (e.g. e2fsck, from the e2fsprogs package)
+	  according to the system configuration.
+
 	  http://freedesktop.org/wiki/Software/systemd
 
 if BR2_PACKAGE_SYSTEMD
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#4 lore raw

PATCH v7 2/2 systemd: select fsck wrapper from util-linux

In reply to Carlos Santos

Hello,

Quoted 19 lines · Carlos Santos

Select the fsck required by systemd provided by util-linux. This prevents ending up with fsck from busybox, which is incompatible with systemd.

---
[there were no v1, v2]
Changes v3
- Select e2fsprogs + e2fsck
Changes v3->v4
- Remove selection of e2fsprogs + e2fsck
- Clean-up commit message
Changes v4->v5
- Screwed-up everything, reverting the chances made in v4
Changes v5->v6
- Restored changes made in v4.
- Restore the patch changelog.
Changes v6->v7
- Removed spurious Change-Id from commit message.

Quoted 3 lines
---
 package/systemd/Config.in | 6 ++++++
 1 file changed, 6 insertions(+)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com