🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.debian.bugs.dist
1 messages
1 total messages Started by Johannes Schauer Marin Rodrigues Wed, 07 Oct 2026 09:30
Bug#1139592: mmdebstrap: improve error message for unreadable files such as --keyring
#23
Author: Johannes Schauer Marin Rodrigues
Date: Wed, 07 Oct 2026 09:30
93 lines
5450 bytes
--===============5429652727986582826==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable

Hi,

Quoting Helmut Grohne (2026-06-09 13:59:27)
> If you mmdebstrap --keyring=3D/path/to/somekeyring ...  and that keyring
> happens to not be readable by your subuid range (e.g.  when it is not
> world readable) the error message is not very helpful.  The permission
> problem is not displayed at all. Instead, a missing key is reported:

I can reproduce the problem. There is some code which attempted to warn but
uses the wrong logic:

if (-e $options->{apttrusted} && !-r $options->{apttrusted}) {
    warning "cannot read $options->{apttrusted}";
}

The above assumes that the unshared user is able to see whether the file ex=
ists
but that can fail if there are insufficient permissions along the path. The=
 new
code now also considers whether the unprivileged _apt user is able to read =
the
keyring:

    foreach my $path ($options->{apttrusted}, $options->{apttrustedparts}) {
        if (!-e $path) {
            warning("keyring does not exist (or insufficient permissions): "
                  . $path);
            next;
        }
        if (!-r $path) {
            warning("keyring cannot be read: " . $path);
            next;
        }
        my @testcmd =3D (
            '/usr/lib/apt/apt-helper', 'drop-privs', '--', 'test', '-r', $p=
ath
        );
        my $pid =3D fork() // error "fork() failed: $!";
        if ($pid =3D=3D 0) {
            open(STDOUT, '>', '/dev/null')
              or error "cannot open /dev/null for writing: $!";
            open(STDERR, '>', '/dev/null')
              or error "cannot open /dev/null for writing: $!";
            exec { $testcmd[0] } @testcmd
              or error("cannot exec " . (join " ", @testcmd) . ": $!");
        }
        waitpid $pid, 0;
        if ($? !=3D 0) {
            warning "apt is unable to read $path after dropping privileges";
        }
    }

But, please be careful when using the --keyring argument. apt developers
deprecated the Dir::Etc::Trusted option:

W: http://archive.ubuntu.com/ubuntu/dists/resolute/InRelease: Loading /home=
/josch/mmdebstrap/target/usr/share/keyrings/ubuntu-archive-keyring.gpg from=
 deprecated option Dir::Etc::Trusted

Instead, you should be using the keyring option in your sources.list.

Thanks!

cheers, josch
--===============5429652727986582826==
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Description: signature
Content-Type: application/pgp-signature; name="signature.asc"; charset="us-ascii"

-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEElFhU6KL81LF4wVq58sulx4+9g+EFAmrGDpkACgkQ8sulx4+9
g+Ec1Q/9HmMU64c7oIPLZNB/nb12PFfvNx0jJ0VL6EKAQxrvXjCG+pZ7v6+p2d9w
lqNJY3ie/XEL9/8JcqXyktxiEen1G9pEq8hDbcpUNr4NhL8nlHsg6RWUE+tPt+8W
E9J+TVCj8iXoBV5Y0VtOqNXTvCO18umkmNHm2S5xaDxz3HNWLHAfe5lc13iMTQYG
4NxW8UvcQIWzA6sa3WhVJtHJIY7Zt+47Z/PcXKJYCH0axZEivEf/UqKT9lWUq1y/
B6UnMsa7uhdvRu9Pq8RXxIo0i+bTrwe9ITu8ieyeksL/0Yc9l3q7tOSUoSr4O7Pp
tH5ygdk1yldrB9orSo5wi+v+0sBV1iZEdka5Iu9RyXc6Cv69LHo6vJ4LU1zPzmzn
8M7G/asV5pKjecdu3EgWryPTpo9nolTVuQJOSKlzBd25CGUxUDNddhRbxspY4/qC
1X+KYuew8BXOoVI0Tf5Gkwe2VlQZNRAR+AKnBBXwlCDv2/QaSdjFy189d+EX6O5Z
GaqvM0yq+YeAcwZdukwurXGiVXhCA0uSiWrXZqa2cV9ohbMLd76xXMJvbyxab9wh
LEcj3bb/76ve34w26ym41XjRcx9p/BNTB2cpofEiQOhEvPIMeGK04GLHeABC5d3b
yTfmM3O4uuCq3ifJMe16IoZfhRmmydj57VphqBZEqDUrwnmZzzI=
=Yzb/
-----END PGP SIGNATURE-----

--===============5429652727986582826==--
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads