public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] example-raw: fix postinst script dependency on adduser
@ 2022-11-14  9:01 Uladzimir Bely
  2022-11-14 10:07 ` Henning Schild
  0 siblings, 1 reply; 4+ messages in thread
From: Uladzimir Bely @ 2022-11-14  9:01 UTC (permalink / raw)
  To: isar-users

Starting from Nov 2022, package `adduser` is not preinstalled
when the distro debootstrapped.

This caused example-raw `postinst: 6: addgroup: not found` error
when installing `container-amd64-bookworm` image.

The problem was not reproduced on `qemuamd64-bookworm` while `adduser`
exist in the image as a dependency of some other package.

Fix the problem by adding explicit dependency to `adduser` package.

Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
 meta-isar/recipes-app/example-raw/example-raw_0.3.bb | 2 +-
 meta-isar/recipes-app/example-raw/files/postinst     | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/meta-isar/recipes-app/example-raw/example-raw_0.3.bb b/meta-isar/recipes-app/example-raw/example-raw_0.3.bb
index 21664642..7f90d43b 100644
--- a/meta-isar/recipes-app/example-raw/example-raw_0.3.bb
+++ b/meta-isar/recipes-app/example-raw/example-raw_0.3.bb
@@ -5,7 +5,7 @@
 
 DESCRIPTION = "Sample application for ISAR"
 MAINTAINER = "Your name here <you@domain.com>"
-DEBIAN_DEPENDS = "apt (>= 0.4.2), passwd"
+DEBIAN_DEPENDS = "adduser, apt (>= 0.4.2), passwd"
 
 SRC_URI = "file://README \
 	   file://postinst \
diff --git a/meta-isar/recipes-app/example-raw/files/postinst b/meta-isar/recipes-app/example-raw/files/postinst
index d25c251d..a461600a 100644
--- a/meta-isar/recipes-app/example-raw/files/postinst
+++ b/meta-isar/recipes-app/example-raw/files/postinst
@@ -3,6 +3,8 @@
 set -e
 
 if ! getent group isar >/dev/null; then
+	# We use `addgroup` instead of `groupadd` here in order
+	# to prove `adduser` Debian dependency in the recipe
 	addgroup --quiet --system isar
 fi
 
-- 
2.20.1


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

* Re: [PATCH] example-raw: fix postinst script dependency on adduser
  2022-11-14  9:01 [PATCH] example-raw: fix postinst script dependency on adduser Uladzimir Bely
@ 2022-11-14 10:07 ` Henning Schild
  2022-11-15  9:11   ` Uladzimir Bely
  0 siblings, 1 reply; 4+ messages in thread
From: Henning Schild @ 2022-11-14 10:07 UTC (permalink / raw)
  To: Uladzimir Bely; +Cc: isar-users

Am Mon, 14 Nov 2022 10:01:20 +0100
schrieb Uladzimir Bely <ubely@ilbers.de>:

> Starting from Nov 2022, package `adduser` is not preinstalled
> when the distro debootstrapped.
> 
> This caused example-raw `postinst: 6: addgroup: not found` error
> when installing `container-amd64-bookworm` image.
> 
> The problem was not reproduced on `qemuamd64-bookworm` while `adduser`
> exist in the image as a dependency of some other package.
> 
> Fix the problem by adding explicit dependency to `adduser` package.
> 
> Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
> ---
>  meta-isar/recipes-app/example-raw/example-raw_0.3.bb | 2 +-
>  meta-isar/recipes-app/example-raw/files/postinst     | 2 ++
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/meta-isar/recipes-app/example-raw/example-raw_0.3.bb
> b/meta-isar/recipes-app/example-raw/example-raw_0.3.bb index
> 21664642..7f90d43b 100644 ---
> a/meta-isar/recipes-app/example-raw/example-raw_0.3.bb +++
> b/meta-isar/recipes-app/example-raw/example-raw_0.3.bb @@ -5,7 +5,7 @@

I would suggest to bump to 0.3.1 with that.

>  DESCRIPTION = "Sample application for ISAR"
>  MAINTAINER = "Your name here <you@domain.com>"
> -DEBIAN_DEPENDS = "apt (>= 0.4.2), passwd"
> +DEBIAN_DEPENDS = "adduser, apt (>= 0.4.2), passwd"

Nice catch. But you can remove passwd now since adduser depends on
passwd in all distros.

Henning

>  SRC_URI = "file://README \
>  	   file://postinst \
> diff --git a/meta-isar/recipes-app/example-raw/files/postinst
> b/meta-isar/recipes-app/example-raw/files/postinst index
> d25c251d..a461600a 100644 ---
> a/meta-isar/recipes-app/example-raw/files/postinst +++
> b/meta-isar/recipes-app/example-raw/files/postinst @@ -3,6 +3,8 @@
>  set -e
>  
>  if ! getent group isar >/dev/null; then
> +	# We use `addgroup` instead of `groupadd` here in order
> +	# to prove `adduser` Debian dependency in the recipe

I think this mainly serves as an example on how people should create a
group with a package. So we should skip that comment. If we find that
groupadd should rather be used to create a group with a package, we
should switch to be a good example.

I do not remember where i got that pattern from. Likely some postinst
from some service package like apache or nginx.

Henning

>  	addgroup --quiet --system isar
>  fi
>  


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

* Re: [PATCH] example-raw: fix postinst script dependency on adduser
  2022-11-14 10:07 ` Henning Schild
@ 2022-11-15  9:11   ` Uladzimir Bely
  2022-11-15 16:40     ` Henning Schild
  0 siblings, 1 reply; 4+ messages in thread
From: Uladzimir Bely @ 2022-11-15  9:11 UTC (permalink / raw)
  To: Henning Schild; +Cc: isar-users

In mail from понедельник, 14 ноября 2022 г. 13:07:58 +03 You wrote:
> Am Mon, 14 Nov 2022 10:01:20 +0100
> 
> schrieb Uladzimir Bely <ubely@ilbers.de>:
> > Starting from Nov 2022, package `adduser` is not preinstalled
> > when the distro debootstrapped.
> > 
> > This caused example-raw `postinst: 6: addgroup: not found` error
> > when installing `container-amd64-bookworm` image.
> > 
> > The problem was not reproduced on `qemuamd64-bookworm` while `adduser`
> > exist in the image as a dependency of some other package.
> > 
> > Fix the problem by adding explicit dependency to `adduser` package.
> > 
> > Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
> > ---
> > 
> >  meta-isar/recipes-app/example-raw/example-raw_0.3.bb | 2 +-
> >  meta-isar/recipes-app/example-raw/files/postinst     | 2 ++
> >  2 files changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/meta-isar/recipes-app/example-raw/example-raw_0.3.bb
> > b/meta-isar/recipes-app/example-raw/example-raw_0.3.bb index
> > 21664642..7f90d43b 100644 ---
> > a/meta-isar/recipes-app/example-raw/example-raw_0.3.bb +++
> > b/meta-isar/recipes-app/example-raw/example-raw_0.3.bb @@ -5,7 +5,7 @@
> 
> I would suggest to bump to 0.3.1 with that.
> 
> >  DESCRIPTION = "Sample application for ISAR"
> >  MAINTAINER = "Your name here <you@domain.com>"
> > 
> > -DEBIAN_DEPENDS = "apt (>= 0.4.2), passwd"
> > +DEBIAN_DEPENDS = "adduser, apt (>= 0.4.2), passwd"
> 
> Nice catch. But you can remove passwd now since adduser depends on
> passwd in all distros.
> 
> Henning
> 
> >  SRC_URI = "file://README \
> >  
> >  	   file://postinst \
> > 
> > diff --git a/meta-isar/recipes-app/example-raw/files/postinst
> > b/meta-isar/recipes-app/example-raw/files/postinst index
> > d25c251d..a461600a 100644 ---
> > a/meta-isar/recipes-app/example-raw/files/postinst +++
> > b/meta-isar/recipes-app/example-raw/files/postinst @@ -3,6 +3,8 @@
> > 
> >  set -e
> >  
> >  if ! getent group isar >/dev/null; then
> > 
> > +	# We use `addgroup` instead of `groupadd` here in order
> > +	# to prove `adduser` Debian dependency in the recipe
> 
> I think this mainly serves as an example on how people should create a
> group with a package. So we should skip that comment. If we find that
> groupadd should rather be used to create a group with a package, we
> should switch to be a good example.
> 

Actually, `groupadd` also works, so we technically don't need `adduser` 
package at all. From my experiment, the difference is that `groupadd` creates 
the group with GID=999, while addgroup creates it with GID=N+1, where N is the 
last GID in /etc/group.

> I do not remember where i got that pattern from. Likely some postinst
> from some service package like apache or nginx.
> 
> Henning
> 
> >  	addgroup --quiet --system isar
> >  
> >  fi




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

* Re: [PATCH] example-raw: fix postinst script dependency on adduser
  2022-11-15  9:11   ` Uladzimir Bely
@ 2022-11-15 16:40     ` Henning Schild
  0 siblings, 0 replies; 4+ messages in thread
From: Henning Schild @ 2022-11-15 16:40 UTC (permalink / raw)
  To: Uladzimir Bely; +Cc: isar-users

Am Tue, 15 Nov 2022 12:11:25 +0300
schrieb Uladzimir Bely <ubely@ilbers.de>:

> In mail from понедельник, 14 ноября 2022 г. 13:07:58 +03 You wrote:
> > Am Mon, 14 Nov 2022 10:01:20 +0100
> > 
> > schrieb Uladzimir Bely <ubely@ilbers.de>:  
> > > Starting from Nov 2022, package `adduser` is not preinstalled
> > > when the distro debootstrapped.
> > > 
> > > This caused example-raw `postinst: 6: addgroup: not found` error
> > > when installing `container-amd64-bookworm` image.
> > > 
> > > The problem was not reproduced on `qemuamd64-bookworm` while
> > > `adduser` exist in the image as a dependency of some other
> > > package.
> > > 
> > > Fix the problem by adding explicit dependency to `adduser`
> > > package.
> > > 
> > > Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
> > > ---
> > > 
> > >  meta-isar/recipes-app/example-raw/example-raw_0.3.bb | 2 +-
> > >  meta-isar/recipes-app/example-raw/files/postinst     | 2 ++
> > >  2 files changed, 3 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/meta-isar/recipes-app/example-raw/example-raw_0.3.bb
> > > b/meta-isar/recipes-app/example-raw/example-raw_0.3.bb index
> > > 21664642..7f90d43b 100644 ---
> > > a/meta-isar/recipes-app/example-raw/example-raw_0.3.bb +++
> > > b/meta-isar/recipes-app/example-raw/example-raw_0.3.bb @@ -5,7
> > > +5,7 @@  
> > 
> > I would suggest to bump to 0.3.1 with that.
> >   
> > >  DESCRIPTION = "Sample application for ISAR"
> > >  MAINTAINER = "Your name here <you@domain.com>"
> > > 
> > > -DEBIAN_DEPENDS = "apt (>= 0.4.2), passwd"
> > > +DEBIAN_DEPENDS = "adduser, apt (>= 0.4.2), passwd"  
> > 
> > Nice catch. But you can remove passwd now since adduser depends on
> > passwd in all distros.
> > 
> > Henning
> >   
> > >  SRC_URI = "file://README \
> > >  
> > >  	   file://postinst \
> > > 
> > > diff --git a/meta-isar/recipes-app/example-raw/files/postinst
> > > b/meta-isar/recipes-app/example-raw/files/postinst index
> > > d25c251d..a461600a 100644 ---
> > > a/meta-isar/recipes-app/example-raw/files/postinst +++
> > > b/meta-isar/recipes-app/example-raw/files/postinst @@ -3,6 +3,8 @@
> > > 
> > >  set -e
> > >  
> > >  if ! getent group isar >/dev/null; then
> > > 
> > > +	# We use `addgroup` instead of `groupadd` here in order
> > > +	# to prove `adduser` Debian dependency in the recipe  
> > 
> > I think this mainly serves as an example on how people should
> > create a group with a package. So we should skip that comment. If
> > we find that groupadd should rather be used to create a group with
> > a package, we should switch to be a good example.
> >   
> 
> Actually, `groupadd` also works, so we technically don't need
> `adduser` package at all. From my experiment, the difference is that
> `groupadd` creates the group with GID=999, while addgroup creates it
> with GID=N+1, where N is the last GID in /etc/group.

I think we should look at other debian packages to see what is used
there and only switch the tool if other debian packages also use that
other tool.

Henning

> 
> > I do not remember where i got that pattern from. Likely some
> > postinst from some service package like apache or nginx.
> > 
> > Henning
> >   
> > >  	addgroup --quiet --system isar
> > >  
> > >  fi  
> 
> 
> 


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

end of thread, other threads:[~2022-11-15 16:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-14  9:01 [PATCH] example-raw: fix postinst script dependency on adduser Uladzimir Bely
2022-11-14 10:07 ` Henning Schild
2022-11-15  9:11   ` Uladzimir Bely
2022-11-15 16:40     ` Henning Schild

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox