dkms icon indicating copy to clipboard operation
dkms copied to clipboard

Reduce output when installing/uninstalling

Open scaronni opened this issue 1 year ago • 3 comments

The output when installing and uninstalling modules is unbelievably long, and in most cases it prints useless information.

Make some changes to print additional information only when relevant to the context and shorten output in general. List of commits, in order:

  • Drop useless duplicate line when building.
  • When a task is set into background, dots are used to show progress. Add a "done." at the end of the dots when the task it's finished.
  • Reduce output when installing and uninstalling. Contexts like "Uninstallation" and "Original module" are no longer printed and instead lines with the detail about the topic are printed only if they are relevant. So if everything is simple (one module, not present, etc.) not much is printed. One-line outpus ("Installation aborted" etc. are separated by one line.

scaronni avatar Jun 25 '24 09:06 scaronni

Sample for commit 1 & 2. ll examples below taken with the xone DKMS modules as it contains a few modules which are a good representation of the output.

Before:

# dkms build -m xone/0.3
Sign command: /lib/modules/6.9.4-200.fc40.x86_64/build/scripts/sign-file
Signing key: /var/lib/dkms/mok.key
Public certificate (MOK): /var/lib/dkms/mok.pub

Building module:
Cleaning build area...
Building module(s)...
Signing module /var/lib/dkms/xone/0.3/build/xone-wired.ko
Signing module /var/lib/dkms/xone/0.3/build/xone-dongle.ko
Signing module /var/lib/dkms/xone/0.3/build/xone-gip.ko
Signing module /var/lib/dkms/xone/0.3/build/xone-gip-gamepad.ko
Signing module /var/lib/dkms/xone/0.3/build/xone-gip-headset.ko
Signing module /var/lib/dkms/xone/0.3/build/xone-gip-chatpad.ko
Signing module /var/lib/dkms/xone/0.3/build/xone-gip-madcatz-strat.ko
Signing module /var/lib/dkms/xone/0.3/build/xone-gip-madcatz-glam.ko
Signing module /var/lib/dkms/xone/0.3/build/xone-gip-pdp-jaguar.ko
Cleaning build area...

After:

# dkms build -m xone/0.3
Sign command: /lib/modules/6.9.4-200.fc40.x86_64/build/scripts/sign-file
Signing key: /var/lib/dkms/mok.key
Public certificate (MOK): /var/lib/dkms/mok.pub
Creating symlink /var/lib/dkms/xone/0.4/source -> /usr/src/xone-0.4

Cleaning build area... done.
Building module(s)... done.
Signing module /var/lib/dkms/xone/0.4/build/xone-wired.ko
Signing module /var/lib/dkms/xone/0.4/build/xone-dongle.ko
Signing module /var/lib/dkms/xone/0.4/build/xone-gip.ko
Signing module /var/lib/dkms/xone/0.4/build/xone-gip-gamepad.ko
Signing module /var/lib/dkms/xone/0.4/build/xone-gip-headset.ko
Signing module /var/lib/dkms/xone/0.4/build/xone-gip-chatpad.ko
Signing module /var/lib/dkms/xone/0.4/build/xone-gip-madcatz-strat.ko
Signing module /var/lib/dkms/xone/0.4/build/xone-gip-madcatz-glam.ko
Signing module /var/lib/dkms/xone/0.4/build/xone-gip-pdp-jaguar.ko
Cleaning build area... done.

scaronni avatar Jun 25 '24 09:06 scaronni

Sample for commit 3, again examples below are taken with the xone DKMS modules.

Before, with a simple situation:

# dkms install -m xone/0.3 --force

xone-wired.ko.xz:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/6.9.4-200.fc40.x86_64/extra/

xone-dongle.ko.xz:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/6.9.4-200.fc40.x86_64/extra/

xone-gip.ko.xz:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/6.9.4-200.fc40.x86_64/extra/

xone-gip-gamepad.ko.xz:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/6.9.4-200.fc40.x86_64/extra/

xone-gip-headset.ko.xz:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/6.9.4-200.fc40.x86_64/extra/

xone-gip-chatpad.ko.xz:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/6.9.4-200.fc40.x86_64/extra/

xone-gip-madcatz-strat.ko.xz:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/6.9.4-200.fc40.x86_64/extra/

xone-gip-madcatz-glam.ko.xz:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/6.9.4-200.fc40.x86_64/extra/

xone-gip-pdp-jaguar.ko.xz:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/6.9.4-200.fc40.x86_64/extra/
depmod....

Module xone-0.3 for kernel 6.9.4-200.fc40.x86_64 (x86_64).
Before uninstall, this module version was ACTIVE on this kernel.

xone-wired.ko.xz:
 - Uninstallation
   - Deleting from: /lib/modules/6.9.4-200.fc40.x86_64/extra/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

xone-dongle.ko.xz:
 - Uninstallation
   - Deleting from: /lib/modules/6.9.4-200.fc40.x86_64/extra/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

xone-gip.ko.xz:
 - Uninstallation
   - Deleting from: /lib/modules/6.9.4-200.fc40.x86_64/extra/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

xone-gip-gamepad.ko.xz:
 - Uninstallation
   - Deleting from: /lib/modules/6.9.4-200.fc40.x86_64/extra/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

xone-gip-headset.ko.xz:
 - Uninstallation
   - Deleting from: /lib/modules/6.9.4-200.fc40.x86_64/extra/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

xone-gip-chatpad.ko.xz:
 - Uninstallation
   - Deleting from: /lib/modules/6.9.4-200.fc40.x86_64/extra/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

xone-gip-madcatz-strat.ko.xz:
 - Uninstallation
   - Deleting from: /lib/modules/6.9.4-200.fc40.x86_64/extra/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

xone-gip-madcatz-glam.ko.xz:
 - Uninstallation
   - Deleting from: /lib/modules/6.9.4-200.fc40.x86_64/extra/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

xone-gip-pdp-jaguar.ko.xz:
 - Uninstallation
   - Deleting from: /lib/modules/6.9.4-200.fc40.x86_64/extra/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.
depmod....

Before, with a more complicated case where modules are already there:

# dkms install -m xone/0.3

xone-wired.ko.xz:
Running module version sanity check.
Module version 0.3 for xone-wired.ko.xz
exactly matches what is already found in kernel 6.9.4-200.fc40.x86_64.
DKMS will not replace this module.
You may override by specifying --force.

xone-dongle.ko.xz:
Running module version sanity check.
Module version 0.3 for xone-dongle.ko.xz
exactly matches what is already found in kernel 6.9.4-200.fc40.x86_64.
DKMS will not replace this module.
You may override by specifying --force.

xone-gip.ko.xz:
Running module version sanity check.
Module version 0.3 for xone-gip.ko.xz
exactly matches what is already found in kernel 6.9.4-200.fc40.x86_64.
DKMS will not replace this module.
You may override by specifying --force.

xone-gip-gamepad.ko.xz:
Running module version sanity check.
Module version 0.3 for xone-gip-gamepad.ko.xz
exactly matches what is already found in kernel 6.9.4-200.fc40.x86_64.
DKMS will not replace this module.
You may override by specifying --force.

xone-gip-headset.ko.xz:
Running module version sanity check.
Module version 0.3 for xone-gip-headset.ko.xz
exactly matches what is already found in kernel 6.9.4-200.fc40.x86_64.
DKMS will not replace this module.
You may override by specifying --force.

xone-gip-chatpad.ko.xz:
Running module version sanity check.
Module version 0.3 for xone-gip-chatpad.ko.xz
exactly matches what is already found in kernel 6.9.4-200.fc40.x86_64.
DKMS will not replace this module.
You may override by specifying --force.

xone-gip-madcatz-strat.ko.xz:
Running module version sanity check.
Module version 0.3 for xone-gip-madcatz-strat.ko.xz
exactly matches what is already found in kernel 6.9.4-200.fc40.x86_64.
DKMS will not replace this module.
You may override by specifying --force.

xone-gip-madcatz-glam.ko.xz:
Running module version sanity check.
Module version 0.3 for xone-gip-madcatz-glam.ko.xz
exactly matches what is already found in kernel 6.9.4-200.fc40.x86_64.
DKMS will not replace this module.
You may override by specifying --force.

xone-gip-pdp-jaguar.ko.xz:
Running module version sanity check.
Module version 0.3 for xone-gip-pdp-jaguar.ko.xz
exactly matches what is already found in kernel 6.9.4-200.fc40.x86_64.
DKMS will not replace this module.
You may override by specifying --force.
Error! Installation aborted.

After, simple case (this is what most users will ever see):

# dkms install -m xone/0.3
Installing /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-wired.ko.xz
Installing /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-dongle.ko.xz
Installing /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip.ko.xz
Installing /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip-gamepad.ko.xz
Installing /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip-headset.ko.xz
Installing /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip-chatpad.ko.xz
Installing /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip-madcatz-strat.ko.xz
Installing /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip-madcatz-glam.ko.xz
Installing /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip-pdp-jaguar.ko.xz

Running depmod.... done.

# dkms remove -m xone/0.3
Module xone-0.3 for kernel 6.9.4-200.fc40.x86_64 (x86_64).
Before uninstall, this module version was ACTIVE on this kernel.

Deleting /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-wired.ko.xz
Deleting /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-dongle.ko.xz
Deleting /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip.ko.xz
Deleting /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip-gamepad.ko.xz
Deleting /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip-headset.ko.xz
Deleting /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip-chatpad.ko.xz
Deleting /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip-madcatz-strat.ko.xz
Deleting /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip-madcatz-glam.ko.xz
Deleting /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip-pdp-jaguar.ko.xz

Running depmod.... done.

After, more complex case with the same module already installed:

# dkms install -m xone/0.3

Module /lib/modules/6.9.4-200.fc40.x86_64/extra/xone/xone-wired.ko.xz already installed at version 0.3, override by specifying --force
Module /lib/modules/6.9.4-200.fc40.x86_64/extra/xone/xone-dongle.ko.xz already installed at version 0.3, override by specifying --force
Module /lib/modules/6.9.4-200.fc40.x86_64/extra/xone/xone-gip.ko.xz already installed at version 0.3, override by specifying --force
Module /lib/modules/6.9.4-200.fc40.x86_64/extra/xone/xone-gip-gamepad.ko.xz already installed at version 0.3, override by specifying --force
Module /lib/modules/6.9.4-200.fc40.x86_64/extra/xone/xone-gip-headset.ko.xz already installed at version 0.3, override by specifying --force
Module /lib/modules/6.9.4-200.fc40.x86_64/extra/xone/xone-gip-chatpad.ko.xz already installed at version 0.3, override by specifying --force
Module /lib/modules/6.9.4-200.fc40.x86_64/extra/xone/xone-gip-madcatz-strat.ko.xz already installed at version 0.3, override by specifying --force
Module /lib/modules/6.9.4-200.fc40.x86_64/extra/xone/xone-gip-madcatz-glam.ko.xz already installed at version 0.3, override by specifying --force
Module /lib/modules/6.9.4-200.fc40.x86_64/extra/xone/xone-gip-pdp-jaguar.ko.xz already installed at version 0.3, override by specifying --force

Error! Installation aborted.

And with an original module being older:

# dkms install -m xone/0.4

Found pre-existing /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-wired.ko.xz, archiving for uninstallation
Installing /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-wired.ko.xz
Found pre-existing /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-dongle.ko.xz, archiving for uninstallation
Installing /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-dongle.ko.xz
Found pre-existing /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip.ko.xz, archiving for uninstallation
Installing /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip.ko.xz
Found pre-existing /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip-gamepad.ko.xz, archiving for uninstallation
Installing /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip-gamepad.ko.xz
Found pre-existing /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip-headset.ko.xz, archiving for uninstallation
Installing /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip-headset.ko.xz
Found pre-existing /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip-chatpad.ko.xz, archiving for uninstallation
Installing /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip-chatpad.ko.xz
Found pre-existing /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip-madcatz-strat.ko.xz, archiving for uninstallation
Installing /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip-madcatz-strat.ko.xz
Found pre-existing /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip-madcatz-glam.ko.xz, archiving for uninstallation
Installing /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip-madcatz-glam.ko.xz
Found pre-existing /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip-pdp-jaguar.ko.xz, archiving for uninstallation
Installing /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip-pdp-jaguar.ko.xz

Running depmod.... done.
# dkms uninstall -m xone/0.4
Module xone-0.4 for kernel 6.9.4-200.fc40.x86_64 (x86_64).
Before uninstall, this module version was ACTIVE on this kernel.

Deleting /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-wired.ko.xz
Restoring archived original module
Deleting /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-dongle.ko.xz
Restoring archived original module
Deleting /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip.ko.xz
Restoring archived original module
Deleting /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip-gamepad.ko.xz
Restoring archived original module
Deleting /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip-headset.ko.xz
Restoring archived original module
Deleting /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip-chatpad.ko.xz
Restoring archived original module
Deleting /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip-madcatz-strat.ko.xz
Restoring archived original module
Deleting /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip-madcatz-glam.ko.xz
Restoring archived original module
Deleting /lib/modules/6.9.4-200.fc40.x86_64/extra/xone-gip-pdp-jaguar.ko.xz
Restoring archived original module

Running depmod.... done.

Removing original_module from DKMS tree for kernel 6.9.4-200.fc40.x86_64 (x86_64)

scaronni avatar Jun 25 '24 09:06 scaronni

Just did my update for Nvidia with this:

# dkms build -m nvidia/555.58.02 -k 6.9.7-200.fc40.x86_64
Sign command: /lib/modules/6.9.7-200.fc40.x86_64/build/scripts/sign-file
Signing key: /var/lib/dkms/mok.key
Public certificate (MOK): /var/lib/dkms/mok.pub

Cleaning build area... done.
Building module(s)....................... done.
Signing module /var/lib/dkms/nvidia/555.58.02/build/kernel-open/nvidia.ko
Signing module /var/lib/dkms/nvidia/555.58.02/build/kernel-open/nvidia-modeset.ko
Signing module /var/lib/dkms/nvidia/555.58.02/build/kernel-open/nvidia-drm.ko
Signing module /var/lib/dkms/nvidia/555.58.02/build/kernel-open/nvidia-uvm.ko
Signing module /var/lib/dkms/nvidia/555.58.02/build/kernel-open/nvidia-peermem.ko
Cleaning build area... done.

@evelikov any chance you can review it?

scaronni avatar Jul 03 '24 06:07 scaronni

Sorry for the delay, just catching up from being offline.

Personally I like the leading slashes, but I'm not strongly attached. Reeeeally like the "done" piece though.

Apart from the few comments, please update the test expectations.

evelikov avatar Jul 05 '24 12:07 evelikov

Adjusted for the review above, now checking the test expectations.

scaronni avatar Jul 07 '24 13:07 scaronni

The tests apparently show some pre-existing race condition as I'm not able to get consistent output between Ubuntu and Alpine in a section I haven't touched. Will try to fix it soon.

scaronni avatar Jul 07 '24 18:07 scaronni

@evelikov only on the Ubuntu VM Test, I get an extra newline, which does not seem to be there in the code, I guess it's some mangled output from the make command:

https://github.com/dell/dkms/actions/runs/9859049192/job/27221831634?pr=425

Everything else is green. Can't we consider all the container tests enough?

scaronni avatar Jul 09 '24 14:07 scaronni

Temporarily rebased on the tests branch to move on...

scaronni avatar Jul 14 '24 08:07 scaronni

@evelikov only on the Ubuntu VM Test, I get an extra newline, which does not seem to be there in the code, I guess it's some mangled output from the make command

I proposed a possible solution to this at https://github.com/dell/dkms/pull/428#pullrequestreview-2232085511

zeroepoch avatar Aug 12 '24 06:08 zeroepoch