Mailing List Archive

[PATCH 2/2] kernel-install.eclass: Warn about linux-firmware in pkg_pretend()
Signed-off-by: Micha? Górny <mgorny@gentoo.org>
---
eclass/kernel-install.eclass | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass
index b3ef186a74eb..8065a8f5638e 100644
--- a/eclass/kernel-install.eclass
+++ b/eclass/kernel-install.eclass
@@ -260,6 +260,29 @@ kernel-install_test() {
EOF
}

+# @FUNCTION: kernel-install_pkg_pretend
+# @DESCRIPTION:
+# Check for missing optional dependencies and output warnings.
+kernel-install_pkg_pretend() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ if ! has_version -d sys-kernel/linux-firmware; then
+ ewarn "sys-kernel/linux-firmware not found installed on your system."
+ ewarn "This package provides various firmware files that may be needed"
+ ewarn "for your hardware to work. If in doubt, it is recommended"
+ ewarn "to pause or abort the build process and install it before"
+ ewarn "resuming."
+
+ if use initramfs; then
+ elog
+ elog "If you decide to install linux-firmware later, you can rebuild"
+ elog "the initramfs via issuing a command equivalent to:"
+ elog
+ elog " emerge --config ${CATEGORY}/${PN}"
+ fi
+ fi
+}
+
# @FUNCTION: kernel-install_src_test
# @DESCRIPTION:
# Boilerplate function to remind people to call the tests.
@@ -356,4 +379,4 @@ _KERNEL_INSTALL_ECLASS=1
fi

EXPORT_FUNCTIONS src_test pkg_preinst pkg_postinst pkg_prerm pkg_postrm
-EXPORT_FUNCTIONS pkg_config
+EXPORT_FUNCTIONS pkg_config pkg_pretend
--
2.27.0
Re: [PATCH 2/2] kernel-install.eclass: Warn about linux-firmware in pkg_pretend() [ In reply to ]
>>>>> On Wed, 17 Jun 2020, Micha? Górny wrote:

> +# @FUNCTION: kernel-install_pkg_pretend
> +# @DESCRIPTION:
> +# Check for missing optional dependencies and output warnings.
> +kernel-install_pkg_pretend() {
> + debug-print-function ${FUNCNAME} "${@}"
> +
> + if ! has_version -d sys-kernel/linux-firmware; then
> + ewarn "sys-kernel/linux-firmware not found installed on your system."
> + ewarn "This package provides various firmware files that may be needed"
> + ewarn "for your hardware to work. If in doubt, it is recommended"
> + ewarn "to pause or abort the build process and install it before"
> + ewarn "resuming."
> +
> + if use initramfs; then
> + elog
> + elog "If you decide to install linux-firmware later, you can rebuild"
> + elog "the initramfs via issuing a command equivalent to:"
> + elog
> + elog " emerge --config ${CATEGORY}/${PN}"
> + fi
> + fi
> +}

Should we really warn about a package that (in its default
configuration) can only be installed if the user accepts non-free
licenses?

I would think that even without such a warning, users will be well aware
if some devices of their system will need additional firmware. Also,
some people prefer the separate packages from sys-firmware which tend to
be more lightweight (though I am aware that some of them may be
considered legacy packages).

Ulrich
Re: [PATCH 2/2] kernel-install.eclass: Warn about linux-firmware in pkg_pretend() [ In reply to ]
On Wed, 2020-06-17 at 12:57 +0200, Ulrich Mueller wrote:
> > > > > > On Wed, 17 Jun 2020, Micha? Górny wrote:
>
> > +# @FUNCTION: kernel-install_pkg_pretend
> > +# @DESCRIPTION:
> > +# Check for missing optional dependencies and output warnings.
> > +kernel-install_pkg_pretend() {
> > + debug-print-function ${FUNCNAME} "${@}"
> > +
> > + if ! has_version -d sys-kernel/linux-firmware; then
> > + ewarn "sys-kernel/linux-firmware not found installed on your system."
> > + ewarn "This package provides various firmware files that may be needed"
> > + ewarn "for your hardware to work. If in doubt, it is recommended"
> > + ewarn "to pause or abort the build process and install it before"
> > + ewarn "resuming."
> > +
> > + if use initramfs; then
> > + elog
> > + elog "If you decide to install linux-firmware later, you can rebuild"
> > + elog "the initramfs via issuing a command equivalent to:"
> > + elog
> > + elog " emerge --config ${CATEGORY}/${PN}"
> > + fi
> > + fi
> > +}
>
> Should we really warn about a package that (in its default
> configuration) can only be installed if the user accepts non-free
> licenses?

That's one of the reasons it's only a warning and not a USE flag.

> I would think that even without such a warning, users will be well aware
> if some devices of their system will need additional firmware. Also,
> some people prefer the separate packages from sys-firmware which tend to
> be more lightweight (though I am aware that some of them may be
> considered legacy packages).
>

This has been requested by users, some of whom apparently forget that
they need to manually install one more package for their system to even
boot. If it saves a few people from having to go through recovery, it's
worth it.

--
Best regards,
Micha? Górny
Re: [PATCH 2/2] kernel-install.eclass: Warn about linux-firmware in pkg_pretend() [ In reply to ]
>>>>> On Wed, 17 Jun 2020, Micha? Górny wrote:

>> Should we really warn about a package that (in its default
>> configuration) can only be installed if the user accepts non-free
>> licenses?

> That's one of the reasons it's only a warning and not a USE flag.

Still, "Gentoo will never depend upon a piece of software or metadata
unless it conforms to [a free license]" (Social Contract).

If you really think that you must have that message, can you at least
downgrade it to einfo or elog? That would still be very visible, given
that it's in the pretend phase where there tends to be little output.

Ulrich
Re: [PATCH 2/2] kernel-install.eclass: Warn about linux-firmware in pkg_pretend() [ In reply to ]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On Wed, 17 Jun 2020 13:08:56 +0200
Micha? Górny <mgorny@gentoo.org> wrote:

> On Wed, 2020-06-17 at 12:57 +0200, Ulrich Mueller wrote:
> > > > > > > On Wed, 17 Jun 2020, Micha? Górny wrote:
> >
> > > +# @FUNCTION: kernel-install_pkg_pretend
> > > +# @DESCRIPTION:
> > > +# Check for missing optional dependencies and output warnings.
> > > +kernel-install_pkg_pretend() {
> > > + debug-print-function ${FUNCNAME} "${@}"
> > > +
> > > + if ! has_version -d sys-kernel/linux-firmware; then
> > > + ewarn "sys-kernel/linux-firmware not found
> > > installed on your system."
> > > + ewarn "This package provides various firmware
> > > files that may be needed"
> > > + ewarn "for your hardware to work. If in doubt,
> > > it is recommended"
> > > + ewarn "to pause or abort the build process and
> > > install it before"
> > > + ewarn "resuming."
> > > +
> > > + if use initramfs; then
> > > + elog
> > > + elog "If you decide to install
> > > linux-firmware later, you can rebuild"
> > > + elog "the initramfs via issuing a
> > > command equivalent to:"
> > > + elog
> > > + elog " emerge --config
> > > ${CATEGORY}/${PN}"
> > > + fi
> > > + fi
> > > +}
> >
> > Should we really warn about a package that (in its default
> > configuration) can only be installed if the user accepts non-free
> > licenses?
>
> That's one of the reasons it's only a warning and not a USE flag.
>
> > I would think that even without such a warning, users will be well
> > aware if some devices of their system will need additional
> > firmware. Also, some people prefer the separate packages from
> > sys-firmware which tend to be more lightweight (though I am aware
> > that some of them may be considered legacy packages).
> >
>
> This has been requested by users, some of whom apparently forget that
> they need to manually install one more package for their system to
> even boot. If it saves a few people from having to go through
> recovery, it's worth it.
>

You're probably better with a proper check like what debian's scripts
do:
https://salsa.debian.org/kernel-team/initramfs-tools/-/blob/master/hook-functions#L101

so that there is only a warning when the real file is missing; this
would also handle cases with non-linux-firmware firmwares or
USE=savedconfig there
-----BEGIN PGP SIGNATURE-----

iHUEAREIAB0WIQSpOxaxaZikKNVNlsYOJUi7xgflrgUCXun+HwAKCRAOJUi7xgfl
rlAIAP97XGdJwGvbWcDwMfZ5lptj/TRdhS77mzCAl2OY2CZ12gD+P8Csx0bnQnk0
4NvZwkoBl+fFiaGWvUFkva08A8MKOoo=
=ayj9
-----END PGP SIGNATURE-----
Re: [PATCH 2/2] kernel-install.eclass: Warn about linux-firmware in pkg_pretend() [ In reply to ]
On Wed, 2020-06-17 at 13:22 +0200, Ulrich Mueller wrote:
> > > > > > On Wed, 17 Jun 2020, Micha? Górny wrote:
> > > Should we really warn about a package that (in its default
> > > configuration) can only be installed if the user accepts non-free
> > > licenses?
> > That's one of the reasons it's only a warning and not a USE flag.
>
> Still, "Gentoo will never depend upon a piece of software or metadata
> unless it conforms to [a free license]" (Social Contract).
>
> If you really think that you must have that message, can you at least
> downgrade it to einfo or elog? That would still be very visible, given
> that it's in the pretend phase where there tends to be little output.
>

Can we please put users above silly politics? Gentoo 'does not depend'
on any non-free package to print the warning. If people have hardware
that requires non-free firmware, the least we can do is point out where
to get this firmware from.

--
Best regards,
Micha? Górny
Re: [PATCH 2/2] kernel-install.eclass: Warn about linux-firmware in pkg_pretend() [ In reply to ]
>>>>> On Wed, 17 Jun 2020, Micha? Górny wrote:

> Can we please put users above silly politics? Gentoo 'does not depend'
> on any non-free package to print the warning. If people have hardware
> that requires non-free firmware, the least we can do is point out where
> to get this firmware from.

s/If/If and only if/ and I'll be fine with it. :)
Re: [PATCH 2/2] kernel-install.eclass: Warn about linux-firmware in pkg_pretend() [ In reply to ]
On 17/06/2020 12:57, Ulrich Mueller wrote:
>>>>>> On Wed, 17 Jun 2020, Micha? Górny wrote:
>
>> +# @FUNCTION: kernel-install_pkg_pretend
>> +# @DESCRIPTION:
>> +# Check for missing optional dependencies and output warnings.
>> +kernel-install_pkg_pretend() {
>> + debug-print-function ${FUNCNAME} "${@}"
>> +
>> + if ! has_version -d sys-kernel/linux-firmware; then
>> + ewarn "sys-kernel/linux-firmware not found installed on your system."
>> + ewarn "This package provides various firmware files that may be needed"
>> + ewarn "for your hardware to work. If in doubt, it is recommended"
>> + ewarn "to pause or abort the build process and install it before"
>> + ewarn "resuming."
>> +
>> + if use initramfs; then
>> + elog
>> + elog "If you decide to install linux-firmware later, you can rebuild"
>> + elog "the initramfs via issuing a command equivalent to:"
>> + elog
>> + elog " emerge --config ${CATEGORY}/${PN}"
>> + fi
>> + fi
>> +}
>
> Should we really warn about a package that (in its default
> configuration) can only be installed if the user accepts non-free
> licenses?

Yes, since those binary blobs are needed to have functioning hardware.

lu
Re: [PATCH 2/2] kernel-install.eclass: Warn about linux-firmware in pkg_pretend() [ In reply to ]
On Wed, Jun 17, 2020 at 7:42 AM Ulrich Mueller <ulm@gentoo.org> wrote:
>
> >>>>> On Wed, 17 Jun 2020, Micha? Górny wrote:
>
> > Can we please put users above silly politics? Gentoo 'does not depend'
> > on any non-free package to print the warning. If people have hardware
> > that requires non-free firmware, the least we can do is point out where
> > to get this firmware from.
>
> s/If/If and only if/ and I'll be fine with it. :)

Are you proposing that the ebuild inspect the user's hardware and/or
kernel config before printing a warning? That sounds like a terrible
idea to me. Who is going to maintain the problematic hardware list?

I do think it would be nice to give people a way to opt-out of seeing
this warning message every time they install a kernel though.
Re: [PATCH 2/2] kernel-install.eclass: Warn about linux-firmware in pkg_pretend() [ In reply to ]
On Wed, 17 Jun 2020 10:58:03 -0400
Mike Gilbert <floppym@gentoo.org> wrote:

> On Wed, Jun 17, 2020 at 7:42 AM Ulrich Mueller <ulm@gentoo.org> wrote:
> >
> > >>>>> On Wed, 17 Jun 2020, Micha? Górny wrote:
> >
> > > Can we please put users above silly politics? Gentoo 'does not
> > > depend' on any non-free package to print the warning. If people
> > > have hardware that requires non-free firmware, the least we can
> > > do is point out where to get this firmware from.
> >
> > s/If/If and only if/ and I'll be fine with it. :)
>
> Are you proposing that the ebuild inspect the user's hardware and/or
> kernel config before printing a warning? That sounds like a terrible
> idea to me. Who is going to maintain the problematic hardware list?

The kernel. Try 'modinfo -F firmware iwlwifi'.
e.g. something like that could work:
modinfo -F firmware $(lsmod | sed '1d' | awk '{print $1}')


or if there is a need to be extra protective, iterate over all
installed modules.
Re: [PATCH 2/2] kernel-install.eclass: Warn about linux-firmware in pkg_pretend() [ In reply to ]
>>>>> On Wed, 17 Jun 2020, Mike Gilbert wrote:

>> s/If/If and only if/ and I'll be fine with it. :)

> Are you proposing that the ebuild inspect the user's hardware and/or
> kernel config before printing a warning?

Of course not.

> That sounds like a terrible idea to me. Who is going to maintain the
> problematic hardware list?

> I do think it would be nice to give people a way to opt-out of seeing
> this warning message every time they install a kernel though.

IMHO this type of message just adds noise to emerge output, which
elsewhere we have fought to reduce (using readme.gentoo-r1.eclass,
for example).

So yes, you need to install a kernel, a bootloader, and maybe some
specific system tools and firmware. All of this is documented in the
handbook [1], and for the others we don't display messages all the time
if we divine that something could be possibly missing.

Anyway, this is just about verboseness of output. I think I've made my
point, so I'll shut up now. :)

Ulrich

[1] https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Kernel#Optional:_Installing_firmware