Bug#1012601: wireless-regdb: alternative broken on debian-installer install

2022-06-29 Thread Dominique Martinet
Ben Hutchings wrote on Thu, Jun 30, 2022 at 02:08:24AM +0200:
> > Sorry this wasn't clear. I didn't mean obsolete as no longer useful,
> > just that it is old: wireless-regdb-udeb hasn't been updated in two
> > years, while the main wireless-regdb package keeps getting updates
> > regularly.
> 
> You are comparing wireless-regdb-udeb in stable with wireless-regdb in
> unstable.
> 
> Both the regular and udeb packages are outdated in stable, but this
> should be fixed in the next point release.

Ah, sorry I didn't realize they had the same source package.

> > Yeah, it probably makes more sense to just remove whatever was there in
> > the post-install script.
> > I'll leave the resolution to you unless you want/need help with
> > something.
> 
> That is what I've now implemented.

I've had a look at the postinst script[1] after the automated
notification and it looks good to me, thank you.

[1] 
https://salsa.debian.org/kernel-team/wireless-regdb/-/blob/master/debian/wireless-regdb.postinst

-- 
Dominique



Bug#1012601: wireless-regdb: alternative broken on debian-installer install

2022-06-29 Thread Ben Hutchings
On Tue, 2022-06-14 at 08:27 +0900, Dominique Martinet wrote:
> Ben Hutchings wrote on Mon, Jun 13, 2022 at 04:39:23PM +0200:
> > On Fri, 2022-06-10 at 09:39 +0900, Dominique Martinet wrote:
> > > the udeb regdb is also slightly obsolete, I'm not sure why it was needed
> > > in the first place but it might be possible to use the normal package
> > > instead?
> > 
> > Why do you think it's obsolete?  It is useful to have this file present
> > in the installer.
> 
> Sorry this wasn't clear. I didn't mean obsolete as no longer useful,
> just that it is old: wireless-regdb-udeb hasn't been updated in two
> years, while the main wireless-regdb package keeps getting updates
> regularly.

You are comparing wireless-regdb-udeb in stable with wireless-regdb in
unstable.

Both the regular and udeb packages are outdated in stable, but this
should be fixed in the next point release.

[...]
> Note that for clients (installer usecase), it _also_ doesn't matter: if
> an AP uses regulated bands, the client will (should?) rightfully use
> these.

Yes, I think this is generally what happens.  But the kernel wants to
load regulatory.db regardless of what mode is being used, so it seemed
like a good idea to include it in the installer.

This bug shows that that didn't have an entirely positive effect, but
it will be fixed.

[...]
> Yeah, it probably makes more sense to just remove whatever was there in
> the post-install script.
> I'll leave the resolution to you unless you want/need help with
> something.

That is what I've now implemented.

Ben.

-- 
Ben Hutchings
Nothing is ever a complete failure;
it can always serve as a bad example.


signature.asc
Description: This is a digitally signed message part


Bug#1012601: wireless-regdb: alternative broken on debian-installer install

2022-06-13 Thread Dominique Martinet
Ben Hutchings wrote on Mon, Jun 13, 2022 at 04:39:23PM +0200:
> On Fri, 2022-06-10 at 09:39 +0900, Dominique Martinet wrote:
> > the udeb regdb is also slightly obsolete, I'm not sure why it was needed
> > in the first place but it might be possible to use the normal package
> > instead?
> 
> Why do you think it's obsolete?  It is useful to have this file present
> in the installer.

Sorry this wasn't clear. I didn't mean obsolete as no longer useful,
just that it is old: wireless-regdb-udeb hasn't been updated in two
years, while the main wireless-regdb package keeps getting updates
regularly.

That means it's possible a firmware that requires the updated version
to work for new band regulations will not have access to these bands
for IR.

Note that for clients (installer usecase), it _also_ doesn't matter: if
an AP uses regulated bands, the client will (should?) rightfully use
these. Regulations mean a wireless emetter cannot start broadcasting on
regulated bands unless they know it's safe, but if an access point or
other clients use the band they can tell it's OK and will allow it.
The regdb will thus only matter for people setting up hotspots or AP on
their system, or perhaps if the remote AP is also missing its regdb but
I'm not sure how the ssid would come up then.
(At least, the marvell/NXP chip I've tested this with does that
properly; there can be other aspects to regdb I'm not aware of or didn't
understand)

In that sense, removing the firmware from installer also should not make
a difference to most users, but I'm not suggesting to remove it in this
bug as I'm sure there was a reason for it to be added in the first place.

I'd just like post-install systems which install the package to get the
new version :)

> > That won't fix existing systems though.
> > If wireless-regdb had been owning the files in dpkg it would be fair
> > game to just overwrite the files (dpkg overwrites any untracked file
> > when installing a package that provides the path).
> > 
> > Would it make sense to include regulatory.db -> regulatory.db-debian
> > (+same for p7s) links in the package itself, so package installation
> > overwrites these and the post update-alternative step fixes it?
> > It seems to fix "broken" links without force in this case.
> > (or push real links to /etc/alternatives/regulatory.db would work too)
> 
> I don't think it's right to include symlinks in the package that are
> supposed to be managed by update-alternatives.  I would rather fix this
> up in the postinst script.

Yeah, it probably makes more sense to just remove whatever was there in
the post-install script.
I'll leave the resolution to you unless you want/need help with
something.

-- 
Dominique



Bug#1012601: wireless-regdb: alternative broken on debian-installer install

2022-06-13 Thread Ben Hutchings
On Fri, 2022-06-10 at 09:39 +0900, Dominique Martinet wrote:
[...]
> The original cause for this is that deian-installer copies the files
> because of the combinaison of these two:
> https://salsa.debian.org/installer-team/debian-installer/-/blob/master/build/pkg-lists/base#L34
>  - wireless-regdb-udeb contains the firmwares as regular files
> https://salsa.debian.org/installer-team/hw-detect/-/blob/master/hw-detect.post-base-installer.d/50install-firmware#L14
>  - it copies /lib/firmware content in base post-install step

I didn't realise the installer was copying firmware files over.  It
should be installing the relevant packages instead where possible.

> the udeb regdb is also slightly obsolete, I'm not sure why it was needed
> in the first place but it might be possible to use the normal package
> instead?

Why do you think it's obsolete?  It is useful to have this file present
in the installer.

> That won't fix existing systems though.
> If wireless-regdb had been owning the files in dpkg it would be fair
> game to just overwrite the files (dpkg overwrites any untracked file
> when installing a package that provides the path).
> 
> Would it make sense to include regulatory.db -> regulatory.db-debian
> (+same for p7s) links in the package itself, so package installation
> overwrites these and the post update-alternative step fixes it?
> It seems to fix "broken" links without force in this case.
> (or push real links to /etc/alternatives/regulatory.db would work too)

I don't think it's right to include symlinks in the package that are
supposed to be managed by update-alternatives.  I would rather fix this
up in the postinst script.

Ben.

-- 
Ben Hutchings
It's easier to fight for one's principles than to live up to them.


signature.asc
Description: This is a digitally signed message part


Bug#1012601: wireless-regdb: alternative broken on debian-installer install

2022-06-09 Thread Dominique Martinet
Package: wireless-regdb
Version: 2021.08.28-1
Severity: important
Tags: d-i
X-Debbugs-Cc: debian-b...@lists.debian.org

Dear Maintainer,

I've noticed after installing wireless-regdb on a fresh install the
package-provided file is not actually used (older version from
wireless-regdb-udeb is used), and update-alternative to select the
upstream version of the regdb also fails


(debian-boot@l.d.o: sorry for the explicit cc, I'm not really sure what
the d-i tag implies)


The problem is that the installer copies /lib/firmware/regulatory.db and
/lib/firmware/regulatory.db.p7s from the installer, and wireless-regdb
postinstall script does not overwrite these if they exist.

This can be reproduced in a minimal container:
root@00e7025e1eeb:/# mkdir /lib/firmware
root@00e7025e1eeb:/# touch /lib/firmware/regulatory.db
root@00e7025e1eeb:/# apt install -y wireless-regdb
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Suggested packages:
  crda
The following NEW packages will be installed:
  wireless-regdb
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 13.9 kB of archives.
After this operation, 42.0 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bullseye/main amd64 wireless-regdb all 
2020.04.29-2 [13.9 kB]
Fetched 13.9 kB in 0s (222 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package wireless-regdb.
(Reading database ... 6662 files and directories currently installed.)
Preparing to unpack .../wireless-regdb_2020.04.29-2_all.deb ...
Unpacking wireless-regdb (2020.04.29-2) ...
Setting up wireless-regdb (2020.04.29-2) ...
update-alternatives: using /lib/firmware/regulatory.db-debian to provide 
/lib/firmware/regulatory.db (regulatory.db) in auto mode
update-alternatives: warning: not replacing /lib/firmware/regulatory.db with a 
link
update-alternatives: warning: forcing reinstallation of alternative 
/lib/firmware/regulatory.db-debian because link group regulatory.db is broken
update-alternatives: warning: not replacing /lib/firmware/regulatory.db with a 
link
root@00e7025e1eeb:/# ls -l /lib/firmware/regulatory.db*
-rw-r--r-- 1 root root0 Jun 10 00:21 /lib/firmware/regulatory.db
-rw-r--r-- 1 root root 3764 Jun 30  2020 /lib/firmware/regulatory.db-debian
-rw-r--r-- 1 root root 3764 Jun 30  2020 /lib/firmware/regulatory.db-upstream
lrwxrwxrwx 1 root root   35 Jun 10 00:21 /lib/firmware/regulatory.db.p7s -> 
/etc/alternatives/regulatory.db.p7s
-rw-r--r-- 1 root root 1249 Jun 30  2020 /lib/firmware/regulatory.db.p7s-debian
-rw-r--r-- 1 root root 1182 Jun 30  2020 
/lib/firmware/regulatory.db.p7s-upstream
root@00e7025e1eeb:/# update-alternatives --config regulatory.db
There are 2 choices for the alternative regulatory.db (providing 
/lib/firmware/regulatory.db).

  SelectionPath  Priority   Status

  0/lib/firmware/regulatory.db-debian 100   auto mode
* 1/lib/firmware/regulatory.db-debian 100   manual mode
  2/lib/firmware/regulatory.db-upstream   50manual mode

Press  to keep the current choice[*], or type selection number:
update-alternatives: warning: forcing reinstallation of alternative 
/lib/firmware/regulatory.db-debian because link group regulatory.db is broken
update-alternatives: warning: not replacing /lib/firmware/regulatory.db with a 
link
root@00e7025e1eeb:/# ls -l /lib/firmware/regulatory.db
-rw-r--r-- 1 root root0 Jun 10 00:21 /lib/firmware/regulatory.db


Running with --force removes the original file with a warning and works:
root@00e7025e1eeb:/# update-alternatives --force --config regulatory.db
There are 2 choices for the alternative regulatory.db (providing 
/lib/firmware/regulatory.db).

  SelectionPath  Priority   Status

  0/lib/firmware/regulatory.db-debian 100   auto mode
* 1/lib/firmware/regulatory.db-debian 100   manual mode
  2/lib/firmware/regulatory.db-upstream   50manual mode

Press  to keep the current choice[*], or type selection number:
update-alternatives: warning: forcing reinstallation of alternative 
/lib/firmware/regulatory.db-debian because link group regulatory.db is broken
root@00e7025e1eeb:/# ls -l /lib/firmware/regulatory.db
lrwxrwxrwx 1 root root 31 Jun 10 00:23 /lib/firmware/regulatory.db -> 
/etc/alternatives/regulatory.db




The original cause for this is that deian-installer copies the files
because of the combinaison of these two:
https://salsa.debian.org/installer-team/debian-installer/-/blob/master/build/pkg-lists/base#L34
 - wireless-regdb-udeb contains the firmwares as regular files