Package: sane-utils
Version: 1.2.1-2
Severity: important

sane-utils postinst script adds a user in the scanner group:

https://sources.debian.org/src/sane-backends/1.3.1-1/debian/sane-utils.postinst/#L54

But the scanner group is created by libsane1 postinst:

https://sources.debian.org/src/sane-backends/1.3.1-1/debian/libsane1.postinst/#L26

It is not guaranteed that the two postinsts will be ordered, and indeed
in some cases apt reorders them so that it fails:

Setting up sane-utils:armhf (1.2.1-2) ...
Adding saned group and user...
adduser: The group `scanner' does not exist.
dpkg: error processing package sane-utils:armhf (--configure):
 installed sane-utils:armhf package post-installation script subprocess 
returned error exit status 1
…
Setting up libsane1:armhf (1.2.1-2) ...
Adding scanner group...
Processing triggers for libc-bin:armhf (2.36-9+deb12u9) ...
Errors were encountered while processing:
 sane-utils:armhf
E: Sub-process /usr/bin/dpkg returned an error code (1)
‣ "apt-get -o APT::Architecture=armhf -o APT::Architectures=armhf -o 
APT::Install-Recommends=false -o APT::Immediate-Configure=off -o 
APT::Get::Assume-Yes=true -o APT::Get::AutomaticRemove=true -o 
APT::Get::Allow-Change-Held-Packages=true -o 
APT::Get::Allow-Remove-Essential=true -o APT::Sandbox::User=root -o 
Acquire::AllowReleaseInfoChange=true -o Dir::Cache=/var/cache/apt -o 
Dir::State=/var/lib/apt -o Dir::Log=/var/log/apt -o 
Dir::State::Status=/buildroot/var/lib/dpkg/status -o 
Dir::Bin::DPkg=/usr/bin/dpkg -o Debug::NoLocking=true -o 
DPkg::Options::=--root=/buildroot -o DPkg::Options::=--force-unsafe-io -o 
DPkg::Options::=--force-architecture -o DPkg::Options::=--force-depends -o 
DPkg::Options::=--no-debsig -o DPkg::Use-Pty=false -o 
DPkg::Install::Recursive::Minimum=1000 -o pkgCacheGen::ForceEssential=, 
'--option=DPkg::Options::=--path-exclude=/usr/share/doc/*' 
'--option=DPkg::Options::=--path-exclude=/usr/share/man/*' 
'--option=DPkg::Options::=--path-exclude=/usr/share/groff/*' 
'--option=DPkg::Options::=--path-exclude=/usr/share/gtk-doc/*' 
'--option=DPkg::Options::=--path-exclude=/usr/share/info/*' 
'--option=DPkg::Options::=--path-include=/usr/share/doc/*/copyright' install 
sane-utils" returned non-zero exit code 100.

https://github.com/systemd/mkosi/issues/3310

There are at least two possible solutions: sane-utils pre-depends on
libsane1, or libsane1 adds the user in its preinst script instead of
postinst.

Reply via email to