Re: initramfs: kernel update adds unwanted driver?

2018-04-16 Thread Grant Edwards
On 2018-04-14, francis.montag...@inria.fr  wrote:

> Thus, for the running kernel:
>
>   /bin/kernel-install add $(uname -r) /lib/$(uname -r)/vmlinuz
>
> It will regenerate the initramfs and eventually other things like the
> grub.cfg.
>
> I tested to add a /etc/dracut.conf.d/test.conf to omit a driver. It
> works: the driver is no more in the initramfs.

That mostly works: it omits the kernel module itself (which we'll call
"foo").  Howevr, it still includes in the initramfs the files
etc/modprobe.d/foo.conf and /etc/modules-load.d/foo.conf.

That doesn't seem to cause any real harm other than an annoying error
message in the syslog:

  Apr 16 05:00:19 beta systemd-modules-load[192]: Failed to find module 'foo'

I've been re-reading the dracut docs, and can't figure out how to tell
it to omit those files (I suspect the latter of the two is the
critical one).  I suppose I could remove those files, regenerate the
initramfs, then re-install them.

That's annoying. :/

-- 
Grant Edwards   grant.b.edwardsYow! Look!  A ladder!
  at   Maybe it leads to heaven,
  gmail.comor a sandwich!
___
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org


Re: initramfs: kernel update adds unwanted driver?

2018-04-14 Thread Roger Heflin
You can also use lsinitrd to show the current files in any initramfs
and/or cat out the contents of single files you see in the initramfs.

On Sat, Apr 14, 2018 at 10:43 AM,   wrote:
>
> On Sat, 14 Apr 2018 15:07:28 - Grant Edwards wrote:
>> On 2018-04-14, francis.montag...@inria.fr  wrote:
>>> Thus, for the running kernel:
>>> /bin/kernel-install add $(uname -r) /lib/$(uname -r)/vmlinuz
>
>> Thanks!  That looks like a good option.  I may prompt the user for
>> confirmation before doing that step in my driver install script -- how
>> likely is it that the admin has done something manually which that
>> script will undo?
>
> IMO it is really unlikely since there is many ways to hook the
> postrans action of the kernel-core RPM, ex:
>
>   /usr/lib/kernel/install.d/
>   /etc/kernel/install.d/
>   /etc/kernel/postinst.d/
>
> I use for example postinst.d for regenerating the grub.cfg with
> grub2-mkconfig.
>
> --
> francis
> ___
> users mailing list -- users@lists.fedoraproject.org
> To unsubscribe send an email to users-le...@lists.fedoraproject.org
___
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org


Re: initramfs: kernel update adds unwanted driver?

2018-04-14 Thread Francis . Montagnac

On Sat, 14 Apr 2018 15:07:28 - Grant Edwards wrote:
> On 2018-04-14, francis.montag...@inria.fr  wrote:
>> Thus, for the running kernel:
>> /bin/kernel-install add $(uname -r) /lib/$(uname -r)/vmlinuz

> Thanks!  That looks like a good option.  I may prompt the user for
> confirmation before doing that step in my driver install script -- how
> likely is it that the admin has done something manually which that
> script will undo?

IMO it is really unlikely since there is many ways to hook the
postrans action of the kernel-core RPM, ex:

  /usr/lib/kernel/install.d/
  /etc/kernel/install.d/
  /etc/kernel/postinst.d/

I use for example postinst.d for regenerating the grub.cfg with
grub2-mkconfig.

-- 
francis
___
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org


Re: initramfs: kernel update adds unwanted driver?

2018-04-14 Thread Grant Edwards
On 2018-04-14, francis.montag...@inria.fr  wrote:
> On Fri, 13 Apr 2018 21:03:34 - Grant Edwards wrote:
>
>> First create a file named /etc/dracut.conf.d/foo containing the line
>> omit_drivers+="foo".  Then either
>
> Bexware, this file should have .conf as suffix.

Ah yes, thanks for pointing that out.

>> 1. Rebuild the initramfs with the 'dracut' command.  I haven't tested
>>this yet. It seems a bit risky [...]

> You can simply execute the postrans of the kernel-core RPM
>
> rpm -q --scripts kernel-core-$(uname -r)
> ...
> posttrans scriptlet (using /bin/sh):
> /bin/kernel-install add 4.15.4-300.fc27.x86_64 
> /lib/modules/4.15.4-300.fc27.x86_64/vmlinuz || exit $?
>
> Thus, for the running kernel:
>
> /bin/kernel-install add $(uname -r) /lib/$(uname -r)/vmlinuz
>
> It will regenerate the initramfs and eventually other things like the
> grub.cfg.
>
> I tested to add a /etc/dracut.conf.d/test.conf to omit a driver. It
> works: the driver is no more in the initramfs.

Thanks!  That looks like a good option.  I may prompt the user for
confirmation before doing that step in my driver install script -- how
likely is it that the admin has done something manually which that
script will undo? [It's been a long time since I ran RedHat much. I
think RedHat 8.0 was the last version I used regularly.]

-- 
Grant




___
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org


Re: initramfs: kernel update adds unwanted driver?

2018-04-14 Thread Francis . Montagnac

Hi.

On Fri, 13 Apr 2018 21:03:34 - Grant Edwards wrote:

> First create a file named /etc/dracut.conf.d/foo containing the line
> omit_drivers+="foo".  Then either

Beware, this file should have .conf as suffix.

> 1. Rebuild the initramfs with the 'dracut' command.  I haven't tested
>this yet. It seems a bit risky, since (AFAICT) I don't have any way
>of knowing what command-line options were used to generate the
>current, working initramfs, and I might end up making unintentional
>changes when I regenerate it.

You can simply execute the postrans of the kernel-core RPM

rpm -q --scripts kernel-core-$(uname -r)
...
posttrans scriptlet (using /bin/sh):
/bin/kernel-install add 4.15.4-300.fc27.x86_64 
/lib/modules/4.15.4-300.fc27.x86_64/vmlinuz || exit $?

Thus, for the running kernel:

/bin/kernel-install add $(uname -r) /lib/$(uname -r)/vmlinuz

It will regenerate the initramfs and eventually other things like the
grub.cfg.

I tested to add a /etc/dracut.conf.d/test.conf to omit a driver. It
works: the driver is no more in the initramfs.

-- 
francis
___
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org


Re: initramfs: kernel update adds unwanted driver?

2018-04-13 Thread Grant Edwards
On 2018-04-13, Rick Stevens  wrote:
> On 04/13/2018 09:34 AM, Grant Edwards wrote:

>> What's the best way to remove the old, broken driver from the
>> initramfs so that the driver in the root filesystem is used on boot?
>> 
>> Is there a way to prevent the kernel update process from adding the
>> driver back to the initramfs the next time a kernel is updated?
[...]

> Uhm, probably do a "rmmod foo;modprobe foo", THEN rebuild the
> initramfs image. Also check both the /etc/dracut.conf file and
> /etc/dracut.conf.d directory to see if they're specifying some
> ancient version of your module. At worst, add a
> --add-modules=" to the command.

Except the goal is to _not_ have the driver in the initramfs.  There
is absolutely no reason it needs to be there, and eliminating it from
the initramfs avoids a source of confusion.

I've identified a couple options:

First create a file named /etc/dracut.conf.d/foo containing the line
omit_drivers+="foo".  Then either

1. Rebuild the initramfs with the 'dracut' command.  I haven't tested
   this yet. It seems a bit risky, since (AFAICT) I don't have any way
   of knowing what command-line options were used to generate the
   current, working initramfs, and I might end up making unintentional
   changes when I regenerate it.  One presumes that a well-behaved
   admin would edit the dracut config files rather than use
   command-line options, but I one should not assume customers are all
   well-behaved.

or

2. Unpack the current initramfs-*.img file, delete the foo.ko.xz file
   and re-pack the initramfs-*.img file. I've written a bash shell
   script to do that, and its seems to work fine.  This feels a little
   less risky than regenerating the initramfs from scratch.

In either case, the omit_drivers setting should prevent re-breaking
the system with future runs of dracut (either manually by the admin or
as part of a kernel upgrade).

-- 
Grant Edwards   grant.b.edwardsYow! ... or were you
  at   driving the PONTIAC that
  gmail.comHONKED at me in MIAMI last
   Tuesday?
___
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org


Re: initramfs: kernel update adds unwanted driver?

2018-04-13 Thread Rick Stevens
On 04/13/2018 09:34 AM, Grant Edwards wrote:
> On Fedora 27 with kernel recently updated to 4.15.15-300.fc27.i686, I
> ran into a problem when I installed a new version of a driver (we'll
> call "foo") in /lib/modules/$(uname -r)/kernel/drivers/[...].
> 
> Doing a "rmmod foo; modprobe foo" loads the new driver and everything
> works great.  However, rebooting loads a 15-year old version of the
> driver (which doesn't work great).
> 
> lsinitrd shows that the 15-year old driver is present in the
> initramfs.  On a clean install of Fedora 27 (running an identical
> kernel version) the initramfs does not contain the "foo" driver at
> all.
> 
> Did the kernel upgrade process muck up the initramfs by adding the old
> version of the "foo" driver?  The "old" version is the one that's
> shipped with the kernel package, but I've never seen it included in
> the initramfs before.
> 
> What's the best way to remove the old, broken driver from the
> initramfs so that the driver in the root filesystem is used on boot?
> 
> Is there a way to prevent the kernel update process from adding the
> driver back to the initramfs the next time a kernel is updated?
> 
> Alternatively, I suppose I could add a "service" that runs at boot
> time and does a "rmmod foo; modrobe foo", but that seems like the
> wrong way to fix this...

Uhm, probably do a "rmmod foo;modprobe foo", THEN rebuild the initramfs
image. Also check both the /etc/dracut.conf file and /etc/dracut.conf.d
directory to see if they're specifying some ancient version of your
module. At worst, add a --add-modules=" to the command.
--
- Rick Stevens, Systems Engineer, AllDigitalri...@alldigital.com -
- AIM/Skype: therps2ICQ: 22643734Yahoo: origrps2 -
--
-  Death is nature's way of dropping carrier -
--
___
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org


initramfs: kernel update adds unwanted driver?

2018-04-13 Thread Grant Edwards
On Fedora 27 with kernel recently updated to 4.15.15-300.fc27.i686, I
ran into a problem when I installed a new version of a driver (we'll
call "foo") in /lib/modules/$(uname -r)/kernel/drivers/[...].

Doing a "rmmod foo; modprobe foo" loads the new driver and everything
works great.  However, rebooting loads a 15-year old version of the
driver (which doesn't work great).

lsinitrd shows that the 15-year old driver is present in the
initramfs.  On a clean install of Fedora 27 (running an identical
kernel version) the initramfs does not contain the "foo" driver at
all.

Did the kernel upgrade process muck up the initramfs by adding the old
version of the "foo" driver?  The "old" version is the one that's
shipped with the kernel package, but I've never seen it included in
the initramfs before.

What's the best way to remove the old, broken driver from the
initramfs so that the driver in the root filesystem is used on boot?

Is there a way to prevent the kernel update process from adding the
driver back to the initramfs the next time a kernel is updated?

Alternatively, I suppose I could add a "service" that runs at boot
time and does a "rmmod foo; modrobe foo", but that seems like the
wrong way to fix this...

-- 
Grant
___
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org