All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v3 0/2] Fix fsck issues regarding merged /sbin and /usr/sbin
@ 2017-04-02 17:28 Carlos Santos
  2017-04-02 17:28 ` [Buildroot] [PATCH v3 1/2] e2fsprogs: keep util-linux's fsck if chosen Carlos Santos
  2017-04-02 17:28 ` [Buildroot] [PATCH v3 2/2] systemd: select util-linux/fsck and e2fsprogs/e2fsck Carlos Santos
  0 siblings, 2 replies; 6+ messages in thread
From: Carlos Santos @ 2017-04-02 17:28 UTC (permalink / raw)
  To: buildroot

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:

- Fix e2fsprogs to prevent removing/overriding the fsck from util-linux.
- Make systemd select util-linux/fsck and e2fsprogs/e2fsck to prevent
  ending up with the fsck from busybox, which is not compatible with
  systemd.

Carlos Santos (2):
  e2fsprogs: keep util-linux's fsck if chosen
  systemd: select util-linux/fsck and e2fsprogs/e2fsck

 package/e2fsprogs/Config.in    |  4 ++++
 package/e2fsprogs/e2fsprogs.mk | 17 ++++++++++++-----
 package/systemd/Config.in      |  3 +++
 3 files changed, 19 insertions(+), 5 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH v3 1/2] e2fsprogs: keep util-linux's fsck if chosen
  2017-04-02 17:28 [Buildroot] [PATCH v3 0/2] Fix fsck issues regarding merged /sbin and /usr/sbin Carlos Santos
@ 2017-04-02 17:28 ` Carlos Santos
  2017-04-03 13:17   ` Arnout Vandecappelle
  2017-04-02 17:28 ` [Buildroot] [PATCH v3 2/2] systemd: select util-linux/fsck and e2fsprogs/e2fsck Carlos Santos
  1 sibling, 1 reply; 6+ messages in thread
From: Carlos Santos @ 2017-04-02 17:28 UTC (permalink / raw)
  To: buildroot

Since e2fsprogs depends on util-linux, it's built after it. So you can't
have e2fsck from e2fsprogs along with the fsck wrapper from util-linux
(which is better maintained and compatible with systemd) because we end
up deleting the fsck from util-linux.

Fix this issue by disabling e2fsprogs' fsck if the one from util-linux
is selected.

Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
---
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.
In the long run the e2fsprogs recipe deserves an extreme overhauling
like we did for util-linux but right now these changes are enough to
fix the specific problem of fsck.
---
 package/e2fsprogs/Config.in    |  4 ++++
 package/e2fsprogs/e2fsprogs.mk | 17 ++++++++++++-----
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/package/e2fsprogs/Config.in b/package/e2fsprogs/Config.in
index d1914a9..418f877 100644
--- a/package/e2fsprogs/Config.in
+++ b/package/e2fsprogs/Config.in
@@ -59,8 +59,12 @@ config BR2_PACKAGE_E2FSPROGS_FILEFRAG
 
 config BR2_PACKAGE_E2FSPROGS_FSCK
 	bool "fsck"
+	depends on !BR2_PACKAGE_UTIL_LINUX_FSCK
 	default y
 
+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
diff --git a/package/e2fsprogs/e2fsprogs.mk b/package/e2fsprogs/e2fsprogs.mk
index 3f235c5..ac7e4f3 100644
--- a/package/e2fsprogs/e2fsprogs.mk
+++ b/package/e2fsprogs/e2fsprogs.mk
@@ -11,7 +11,7 @@ E2FSPROGS_LICENSE = GPL-2.0, BSD-3-Clause (libuuid), MIT-like with advertising c
 E2FSPROGS_LICENSE_FILES = NOTICE lib/uuid/COPYING lib/ss/mit-sipb-copyright.h lib/et/internal.h
 E2FSPROGS_INSTALL_STAGING = YES
 E2FSPROGS_DEPENDENCIES = host-pkgconf util-linux
-# we don't have a host-util-linux
+# We don't need host-util-linux, since we disable libblkid, libuuid.
 HOST_E2FSPROGS_DEPENDENCIES = host-pkgconf
 
 # e4defrag doesn't build on older systems like RHEL5.x, and we don't
@@ -24,11 +24,11 @@ E2FSPROGS_CONF_OPTS = \
 	$(if $(BR2_PACKAGE_E2FSPROGS_DEBUGFS),,--disable-debugfs) \
 	$(if $(BR2_PACKAGE_E2FSPROGS_E2IMAGE),,--disable-imager) \
 	$(if $(BR2_PACKAGE_E2FSPROGS_E4DEFRAG),,--disable-defrag) \
+	$(if $(BR2_PACKAGE_E2FSPROGS_FSCK),--enable-fsck,--disable-fsck) \
 	$(if $(BR2_PACKAGE_E2FSPROGS_RESIZE2FS),,--disable-resizer) \
 	--disable-uuidd \
 	--disable-libblkid \
 	--disable-libuuid \
-	--enable-fsck \
 	--disable-e2initrd-helper \
 	--disable-testio-debug \
 	--disable-rpath
@@ -76,7 +76,9 @@ define HOST_E2FSPROGS_INSTALL_CMDS
 	$(HOST_MAKE_ENV) $(MAKE) -C $(@D) install install-libs
 endef
 
-# binaries to keep or remove
+# Binaries to keep or remove. For fsck, there is no conflict with the
+# one from util-linux (because they are mutually exclusive) and fsck
+# from busybox is handled below.
 E2FSPROGS_BINTARGETS_$(BR2_PACKAGE_E2FSPROGS_BADBLOCKS) += usr/sbin/badblocks
 E2FSPROGS_BINTARGETS_$(BR2_PACKAGE_E2FSPROGS_CHATTR) += usr/bin/chattr
 E2FSPROGS_BINTARGETS_$(BR2_PACKAGE_E2FSPROGS_DUMPE2FS) += usr/sbin/dumpe2fs
@@ -86,7 +88,6 @@ E2FSPROGS_BINTARGETS_$(BR2_PACKAGE_E2FSPROGS_E2LABEL) += usr/sbin/e2label
 E2FSPROGS_BINTARGETS_$(BR2_PACKAGE_E2FSPROGS_E2UNDO) += usr/sbin/e2undo
 E2FSPROGS_BINTARGETS_$(BR2_PACKAGE_E2FSPROGS_E4DEFRAG) += usr/sbin/e4defrag
 E2FSPROGS_BINTARGETS_$(BR2_PACKAGE_E2FSPROGS_FILEFRAG) += usr/sbin/filefrag
-E2FSPROGS_BINTARGETS_$(BR2_PACKAGE_E2FSPROGS_FSCK) += usr/sbin/fsck
 E2FSPROGS_BINTARGETS_$(BR2_PACKAGE_E2FSPROGS_LOGSAVE) += usr/sbin/logsave
 E2FSPROGS_BINTARGETS_$(BR2_PACKAGE_E2FSPROGS_LSATTR) += usr/bin/lsattr
 E2FSPROGS_BINTARGETS_$(BR2_PACKAGE_E2FSPROGS_MKE2FS) += usr/sbin/mke2fs
@@ -146,10 +147,16 @@ E2FSPROGS_DEPENDENCIES += busybox
 define E2FSPROGS_REMOVE_BUSYBOX_APPLETS
 	$(RM) -f $(TARGET_DIR)/bin/chattr
 	$(RM) -f $(TARGET_DIR)/bin/lsattr
-	$(RM) -f $(TARGET_DIR)/sbin/fsck
 	$(RM) -f $(TARGET_DIR)/sbin/tune2fs
 	$(RM) -f $(TARGET_DIR)/sbin/e2label
 endef
+
+# We only build fsck if it's not selected in util-linux, on which e2fsprogs
+# depends, so at this point /sbin/fsck must have come from busybox.
+ifeq ($(BR2_PACKAGE_E2FSPROGS_FSCK),y)
+E2FSPROGS_REMOVE_BUSYBOX_APPLETS += $(RM) -f $(TARGET_DIR)/sbin/fsck
+endif
+
 E2FSPROGS_PRE_INSTALL_TARGET_HOOKS += E2FSPROGS_REMOVE_BUSYBOX_APPLETS
 endif
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH v3 2/2] systemd: select util-linux/fsck and e2fsprogs/e2fsck
  2017-04-02 17:28 [Buildroot] [PATCH v3 0/2] Fix fsck issues regarding merged /sbin and /usr/sbin Carlos Santos
  2017-04-02 17:28 ` [Buildroot] [PATCH v3 1/2] e2fsprogs: keep util-linux's fsck if chosen Carlos Santos
@ 2017-04-02 17:28 ` Carlos Santos
  2017-04-03 13:26   ` Arnout Vandecappelle
  1 sibling, 1 reply; 6+ messages in thread
From: Carlos Santos @ 2017-04-02 17:28 UTC (permalink / raw)
  To: buildroot

e2fsprogs does not override/remove the fsck from util-linux anymore when
/sbin and /usr/sbin are merged. So we can select the fsck tools required
by systemd provided by those packages. This also prevents ending up with
the fsck from busybox, which is incompatible with systemd.

Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
---
 package/systemd/Config.in | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/package/systemd/Config.in b/package/systemd/Config.in
index 0f54686..f5eb9d0 100644
--- a/package/systemd/Config.in
+++ b/package/systemd/Config.in
@@ -22,6 +22,9 @@ 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_E2FSPROGS
+	select BR2_PACKAGE_E2FSPROGS_E2FSCK
 	select BR2_PACKAGE_KMOD
 	select BR2_PACKAGE_BUSYBOX_SHOW_OTHERS # kmod-tools
 	select BR2_PACKAGE_KMOD_TOOLS
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH v3 1/2] e2fsprogs: keep util-linux's fsck if chosen
  2017-04-02 17:28 ` [Buildroot] [PATCH v3 1/2] e2fsprogs: keep util-linux's fsck if chosen Carlos Santos
@ 2017-04-03 13:17   ` Arnout Vandecappelle
  0 siblings, 0 replies; 6+ messages in thread
From: Arnout Vandecappelle @ 2017-04-03 13:17 UTC (permalink / raw)
  To: buildroot



On 02-04-17 19:28, Carlos Santos wrote:
> Since e2fsprogs depends on util-linux, it's built after it. So you can't
> have e2fsck from e2fsprogs along with the fsck wrapper from util-linux
> (which is better maintained and compatible with systemd) because we end
> up deleting the fsck from util-linux.
> 
> Fix this issue by disabling e2fsprogs' fsck if the one from util-linux
> is selected.
> 
> Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
> Signed-off-by: Carlos Santos <casantos@datacom.ind.br>

 Darn, I replied to v2 before seeing this.

Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>


 Regards,
 Arnout

> ---
> 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.
> In the long run the e2fsprogs recipe deserves an extreme overhauling
> like we did for util-linux but right now these changes are enough to
> fix the specific problem of fsck.


[snip]
> @@ -24,11 +24,11 @@ E2FSPROGS_CONF_OPTS = \
>  	$(if $(BR2_PACKAGE_E2FSPROGS_DEBUGFS),,--disable-debugfs) \
>  	$(if $(BR2_PACKAGE_E2FSPROGS_E2IMAGE),,--disable-imager) \
>  	$(if $(BR2_PACKAGE_E2FSPROGS_E4DEFRAG),,--disable-defrag) \
> +	$(if $(BR2_PACKAGE_E2FSPROGS_FSCK),--enable-fsck,--disable-fsck) \

 That's indeed what I meant :-)

 Regards,
 Arnout

>  	$(if $(BR2_PACKAGE_E2FSPROGS_RESIZE2FS),,--disable-resizer) \
>  	--disable-uuidd \
>  	--disable-libblkid \
>  	--disable-libuuid \
> -	--enable-fsck \
>  	--disable-e2initrd-helper \
>  	--disable-testio-debug \
>  	--disable-rpath

[snip]

-- 
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH v3 2/2] systemd: select util-linux/fsck and e2fsprogs/e2fsck
  2017-04-02 17:28 ` [Buildroot] [PATCH v3 2/2] systemd: select util-linux/fsck and e2fsprogs/e2fsck Carlos Santos
@ 2017-04-03 13:26   ` Arnout Vandecappelle
  2017-04-03 13:41     ` Carlos Santos
  0 siblings, 1 reply; 6+ messages in thread
From: Arnout Vandecappelle @ 2017-04-03 13:26 UTC (permalink / raw)
  To: buildroot



On 02-04-17 19:28, Carlos Santos wrote:
> e2fsprogs does not override/remove the fsck from util-linux anymore when
> /sbin and /usr/sbin are merged. So we can select the fsck tools required
> by systemd provided by those packages. This also prevents ending up with
> the fsck from busybox, which is incompatible with systemd.
> 
> Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
> ---
>  package/systemd/Config.in | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/package/systemd/Config.in b/package/systemd/Config.in
> index 0f54686..f5eb9d0 100644
> --- a/package/systemd/Config.in
> +++ b/package/systemd/Config.in
> @@ -22,6 +22,9 @@ 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

 I agree with this bit. If I understand correctly, as soon as you have *some*
filesystem configured (or hotplugged), systemd will call fsck with an option not
known to busybox/e2fsprogs fsck and will barf.

> +	select BR2_PACKAGE_E2FSPROGS
> +	select BR2_PACKAGE_E2FSPROGS_E2FSCK

 I don't agree with this bit: it should only be necessary when there is an ext2
filesystem somewhere. And even so, with a 'nofail' in fstab, it's not an error
if the fsck.ext2 is missing. Therefore, it's up to the user to select it IMO. At
most, add something to the help text about it.

 Note that e2fsprogs is AFAIK the only provider of e2fsck (busybox has an fsck
wrapper but not an fsck.ext2).


 Regards,
 Arnout

>  	select BR2_PACKAGE_KMOD
>  	select BR2_PACKAGE_BUSYBOX_SHOW_OTHERS # kmod-tools
>  	select BR2_PACKAGE_KMOD_TOOLS
> 

-- 
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH v3 2/2] systemd: select util-linux/fsck and e2fsprogs/e2fsck
  2017-04-03 13:26   ` Arnout Vandecappelle
@ 2017-04-03 13:41     ` Carlos Santos
  0 siblings, 0 replies; 6+ messages in thread
From: Carlos Santos @ 2017-04-03 13:41 UTC (permalink / raw)
  To: buildroot

> From: "Arnout Vandecappelle" <arnout@mind.be>
> To: "Carlos Santos" <casantos@datacom.ind.br>, buildroot at buildroot.org
> Cc: "Yann E . MORIN" <yann.morin.1998@free.fr>, "Maxime Hadjinlian" <maxime.hadjinlian@gmail.com>
> Sent: Monday, April 3, 2017 10:26:26 AM
> Subject: Re: [Buildroot] [PATCH v3 2/2] systemd: select util-linux/fsck and e2fsprogs/e2fsck

> On 02-04-17 19:28, Carlos Santos wrote:
>> e2fsprogs does not override/remove the fsck from util-linux anymore when
>> /sbin and /usr/sbin are merged. So we can select the fsck tools required
>> by systemd provided by those packages. This also prevents ending up with
>> the fsck from busybox, which is incompatible with systemd.
>> 
>> Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
>> ---
>>  package/systemd/Config.in | 3 +++
>>  1 file changed, 3 insertions(+)
>> 
>> diff --git a/package/systemd/Config.in b/package/systemd/Config.in
>> index 0f54686..f5eb9d0 100644
>> --- a/package/systemd/Config.in
>> +++ b/package/systemd/Config.in
>> @@ -22,6 +22,9 @@ 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
> 
> I agree with this bit. If I understand correctly, as soon as you have *some*
> filesystem configured (or hotplugged), systemd will call fsck with an option not
> known to busybox/e2fsprogs fsck and will barf.
> 
>> +	select BR2_PACKAGE_E2FSPROGS
>> +	select BR2_PACKAGE_E2FSPROGS_E2FSCK
> 
> I don't agree with this bit: it should only be necessary when there is an ext2
> filesystem somewhere. And even so, with a 'nofail' in fstab, it's not an error
> if the fsck.ext2 is missing. Therefore, it's up to the user to select it IMO. At
> most, add something to the help text about it.

Good point. I will submit a new patch set removing the selection of
e2fsprogs.

-- 
Carlos Santos (Casantos) - DATACOM, P&D
?The greatest triumph that modern PR can offer is the transcendent 
success of having your words and actions judged by your reputation, 
rather than the other way about.? ? Christopher Hitchens

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-04-03 13:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-02 17:28 [Buildroot] [PATCH v3 0/2] Fix fsck issues regarding merged /sbin and /usr/sbin Carlos Santos
2017-04-02 17:28 ` [Buildroot] [PATCH v3 1/2] e2fsprogs: keep util-linux's fsck if chosen Carlos Santos
2017-04-03 13:17   ` Arnout Vandecappelle
2017-04-02 17:28 ` [Buildroot] [PATCH v3 2/2] systemd: select util-linux/fsck and e2fsprogs/e2fsck Carlos Santos
2017-04-03 13:26   ` Arnout Vandecappelle
2017-04-03 13:41     ` Carlos Santos

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.