dkms script is missing function find_module

Bug #1838245 reported by Alex G on 2019-07-29
32
This bug affects 4 people
Affects Status Importance Assigned to Milestone
DKMS
Critical
Alex Tu
dkms (Ubuntu)
Status tracked in Focal
Bionic
Undecided
Unassigned
Disco
Undecided
Unassigned
Eoan
Undecided
Unassigned
Focal
Critical
Unassigned

Bug Description

update for SRU process:
[Impact]
1. dkms script is missing function find_module
2. priority of OBSOLETE_BY should higher than "force". #89 https://github.com/dell/dkms/issues/89

[Test case]
install the dkms which already patched (also can be found in my ppa[1])
1. install a dkms which for a kernel module system already installed.
e.g. ath10k of my testing ppa : [1]
1.1. the dkms can be installed well.

2. install a dkms which has OBSOLETE_BY and FORCE
e.g.ath10k of my testing ppa : [1] (source code in [2])
 - the target dkms defined OBSOLETE_BY and FORCE
 - user install dkms on a system which installed kernel version less than OBSOLETE_BY and another kernel higher than OBSOLETE_BY
 - the dkms can be installed well.

[Regression potential]
medium as it touched the version sanity. This change correct the code logic and land one more change from upstream as well.
The logic has been verified by #5 and me.

------------------------------------------------------------------------
Building a kernel module using dkms in Linux Mint 19.1 shows the following error:

Running module version sanity check.
/usr/sbin/dkms: Zeile 784: find_module: Befehl nicht gefunden
modinfo: ERROR: missing module or filename.

Checking the file the function is indeed missing and another user confirmed, that it was removed at some point: https://github.com/linuxmint/linuxmint/issues/142

Possible solution: Readd

find_module()
{
    # tree = $1
    # module = $2
    find "$1" -name "$2$module_uncompressed_suffix" -o -name "$2$module_suffix" -type f
    return $?
}

as found in https://github.com/dell/dkms/blob/master/dkms

Alex G (flamefire) wrote :

Bug was introduced in by 2.3-3ubuntu9.4 the following commit: https://git.launchpad.net/ubuntu/+source/dkms/commit/?id=4cfc905dc605628eb6d3ceddb21fb12cac9543d5:

Relevant diff:
- read -a kernels_module < <(find $lib_tree -name ${4}$module_suffix)
+ read -a kernels_module < <(find_module "$lib_tree" "${4}")

Reverting this should fix this bug

Alex G (flamefire) wrote :

But there is another bug: The following line reads `[ -z $kernels_module ] || return 0`

Previously the related section was:

    if [ -z $kernels_module ]; then
        # Magic split into array syntax saves trivial awk and cut calls.
        local -a obs=(${3//-/ })
        local -a my=(${1//-/ })
        local obsolete=0
        if [[ ${obs} && ${my} ]]; then
            if [[ $(VER ${obs}) == $(VER ${my}) && ! $force ]]; then
                # They get obsoleted possibly in this kernel release
                if [[ ! ${obs[1]} ]]; then
                    # They were obsoleted in this upstream kernel
                    obsolete=1
                elif [[ $(VER ${my[1]}) > $(VER ${obs[1]}) ]]; then
                    # They were obsoleted in an earlier ABI bump of the kernel
                    obsolete=1
                elif [[ $(VER ${my[1]}) = $(VER ${obs[1]}) ]]; then
                    # They were obsoleted in this ABI bump of the kernel
                    obsolete=1
                fi
            elif [[ $(VER ${my}) > $(VER ${obs}) && ! $force ]]; then
                # They were obsoleted in an earlier kernel release
                obsolete=1
            fi
        fi

        if ((obsolete == 1)); then
            echo $"" >&2
            echo $"Module has been obsoleted due to being included" >&2
            echo $"in kernel $3. We will avoid installing" >&2
            echo $"for future kernels above $3." >&2
            echo $"You may override by specifying --force." >&2
            return 1
  else
          return 0
        fi
    fi

See that misformatted `else`? This probably tricked the patch author. Essence is: If `[ -z $kernels_module ]` then either return with 1 or 0 depending on `obsolete`.

The correct line would hence be: `[ -z $kernels_module ] && return 0`

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in dkms (Ubuntu):
status: New → Confirmed
Alex Tu (alextu) wrote :

indeed, I was tricked by that misformatted `else`.
Thanks for reporting the issue.

I agree the correct line should be `[ -z $kernels_module ] && return 0`, because the following code is used to compare the version of target DKMS and existed module on the system.

So, I'm processing to proposed another patch to fix it.

Changed in dkms:
assignee: nobody → Alex Tu (alextu)
status: New → In Progress
Alex G (flamefire) wrote :

I tested this patch locally and it (seems to) work:

- read -a kernels_module < <(find_module "$lib_tree" "${4}")
+ read -a kernels_module < <(find $lib_tree -name ${4}$module_suffix)

- [ -z $kernels_module ] || return 0
+ [ -z $kernels_module ] && return 0

Alex Tu (alextu) wrote :

the patched package is ready for test, I'll continue to process SRU, please interrupt me if any regression be found.

https://code.launchpad.net/~alextu/+archive/ubuntu/dkms-2.3-lp1838245

Alex Tu (alextu) wrote :

btw, the fix already be merged by upstream on github:
https://github.com/dell/dkms/commit/9976fa6c9665d78d4c8125ce4825507cd0dfb247

Alex Tu (alextu) wrote :
Alex Tu (alextu) wrote :

the case I tested:
install the dkms which already patched (also can be found in my ppa[1])
1. install a dkms which for a kernel module system already installed.
e.g. ath10k of my testing ppa : [1]
1.1. the dkms can be installed well.

2. install a dkms which has OBSOLETE_BY and FORCE
e.g.ath10k of my testing ppa : [1] (source code in [2])
 + the target dkms defined OBSOLETE_BY and FORCE
   - OBSOLETE_BY="4.15.0-1033": https://git.launchpad.net/~alextu/+git/oem-wifi-qualcomm-ath10k-lp1803647-4.15-dkms/tree/oem-wifi-qualcomm-ath10k-lp1803647-4.15/dkms.conf?h=lp1838245#n8
   - https://git.launchpad.net/~alextu/+git/oem-wifi-qualcomm-ath10k-lp1803647-4.15-dkms/tree/oem-wifi-qualcomm-ath10k-lp1803647-4.15.force?h=lp1838245
 + user install dkms on a system which installed kernel version less than OBSOLETE_BY and another kernel higher than OBSOLETE_BY
  - in my system there're 2 kernels 4.15.0-1030 and 4.15.0-1045
 + the dkms can be installed well with kernel 4.15.0-1030, and not be installed with 4.15.0-1045

also attached the log came from patched dkms script during install dkms [2]

[1]:https://code.launchpad.net/~alextu/+archive/ubuntu/dkms-2.3-lp1838245
[2]:https://code.launchpad.net/~alextu/+git/oem-wifi-qualcomm-ath10k-lp1803647-4.15-dkms/+ref/lp1838245

description: updated
Steve Langasek (vorlon) on 2019-08-01
Changed in dkms (Ubuntu):
importance: Undecided → Critical
Steve Langasek (vorlon) on 2019-08-01
tags: added: regression-update

Hello Alex, or anyone else affected,

Accepted dkms into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/dkms/2.3-3ubuntu9.5 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in dkms (Ubuntu Bionic):
status: New → Fix Committed
tags: added: verification-needed verification-needed-bionic
Alex Tu (alextu) on 2019-08-02
Changed in dkms:
importance: Undecided → Critical
Alex Tu (alextu) wrote :

the proposed version not include the patch of "priority of OBSOLETE_BY should higher than "force". #89 https://github.com/dell/dkms/issues/89" , so I created another ppa [1] to test the regression only

my system installed kernel 4.15.0-1030-oem and 4.15.0-1045-oem and new dkms from #10, then install the oem-wifi-qualcomm-ath10k-lp1803647-4.15-dkms, it works as expected.
 - for kernel 4.15.0-1030-oem, it checked the version of existed module.(line 4763 of my attached log)
 - for kernel 4.15.0-1045-oem, it checked the OBSOLETE_BY.(line 9241 of my attached log)

[1]:https://launchpad.net/~alextu/+archive/ubuntu/lp1838245-test-regression

tags: added: verification-done-bionic
removed: verification-needed-bionic

The verification of the Stable Release Update for dkms has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package dkms - 2.3-3ubuntu9.5

---------------
dkms (2.3-3ubuntu9.5) bionic; urgency=medium

  * Fixup previous upload: find_module doesn't exist yet, and there's bad
    boolean logic in the check if we've already dealt with obsoleted modules.
    (LP: #1838245)

 -- Mathieu Trudel-Lapierre <email address hidden> Thu, 01 Aug 2019 17:17:58 -0400

Changed in dkms (Ubuntu Bionic):
status: Fix Committed → Fix Released
Alex Tu (alextu) wrote :

this release not include the change of "priority of OBSOLETE_BY should higher than "force". #89 https://github.com/dell/dkms/issues/89" , so I created another ticket for that change:
https://bugs.launchpad.net/oem-priority/+bug/1838921

Timo Aaltonen (tjaalton) wrote :

should be fixed in eoan

Changed in dkms (Ubuntu):
status: Confirmed → Fix Released
Changed in dkms:
status: In Progress → Fix Released
tags: removed: verification-needed
Tom Cook (tom-k-cook) wrote :

I'm still seeing this on Eoan, which has dkms 2.7.1-4ubuntu2 - the symptom is that virtualbox-dkms does not correctly build and install its kernel modules with the message `modinfo: ERROR: missing module or filename.`

Tom Cook (tom-k-cook) wrote :

For me, the fix is to change line 812 of /usr/sbin/dkms from:

    [ -z $kernels_module ] || return 0

to

    [ -z $kernels_module ] && return 0

This was fixed upstream here:

https://github.com/dell/dkms/commit/b95779938805aca8e98d57492b18dee07d35d285

Brian Murray (brian-murray) wrote :

This changes seems to have been dropped in Ubuntu 19.10 and Focal.

Changed in dkms (Ubuntu):
status: Fix Released → Confirmed
tags: added: rls-ff-incoming
Alex Tu (alextu) wrote :

The new feature landing missed that fix.
It impacts eoan and disco.
The bionic carried that fix , and Focal is supposed to just land latest code from upstream, so they will not be impacted.

Sorry for inconvenient, I'll send a new patch to fix it on eoan and disco today.

Changed in dkms:
status: Fix Released → Confirmed
Changed in dkms (Ubuntu Eoan):
status: New → Triaged
Changed in dkms (Ubuntu Focal):
status: Confirmed → Triaged
Alex Tu (alextu) wrote :

the patch for eoan is there:
https://code.launchpad.net/~alextu/+git/dkms/+ref/eoan-lp1838245

7db3297 for bump version

b0921f3 for the patch

------------------------------------
the patch for disco is there:
https://code.launchpad.net/~alextu/+git/dkms/+ref/disco-lp1838245

2af553b for bump version

aad29bc for the patch

Alex Tu (alextu) wrote :

Thanks to the sponsor,
the patched dkms for eoan is on the queue:
https://launchpad.net/ubuntu/eoan/+queue?queue_state=1
version : 2.7.1-4ubuntu2.1

Alex Tu (alextu) wrote :

This patch is not needed for Focal as it got the existed patch from upstream.

Hello Alex, or anyone else affected,

Accepted dkms into eoan-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/dkms/2.7.1-4ubuntu2.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-eoan to verification-done-eoan. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-eoan. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in dkms (Ubuntu Eoan):
status: Triaged → Fix Committed
tags: added: verification-needed verification-needed-eoan
Changed in dkms (Ubuntu Focal):
status: Triaged → Fix Released
Changed in dkms (Ubuntu Disco):
status: New → Fix Committed
tags: added: verification-needed-disco
Brian Murray (brian-murray) wrote :

Hello Alex, or anyone else affected,

Accepted dkms into disco-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/dkms/2.6.1-4ubuntu2.5 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-disco to verification-done-disco. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-disco. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Alex Tu (alextu) wrote :

for eoan dkms 2.7.1-4ubuntu2.1:
 + confirmed the patch is there on proposed package
 + verified version-override
  - verbose installation message : http://paste.ubuntu.com/p/YyFBZkhQBR/

 + verified obseleted-by
   - verbose installation message : http://paste.ubuntu.com/p/DvFHkRmrCf/

 + verified force
   - verbose installation message : http://paste.ubuntu.com/p/R5YNPQsKRH/

Alex Tu (alextu) wrote :

for disco dkms 2.6.1-4ubuntu2.5:
 + confirmed the patch is there on proposed package
 + verified version-override
  - verbose installation message : http://paste.ubuntu.com/p/PQJXKWSZRC/

 + verified obseleted-by
   - verbose installation message : http://paste.ubuntu.com/p/FrMJFz8KYK/

 + verified force
   - verbose installation message : http://paste.ubuntu.com/p/GDf9zz5btM/

tags: added: verification-done-disco verification-done-eoan
removed: verification-needed-disco verification-needed-eoan
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package dkms - 2.7.1-4ubuntu2.1

---------------
dkms (2.7.1-4ubuntu2.1) eoan; urgency=medium

  * cherry-pick from upstream b957799 for LP: #1838245

 -- Alex Tu <email address hidden> Thu, 07 Nov 2019 15:17:48 +0800

Changed in dkms (Ubuntu Eoan):
status: Fix Committed → Fix Released
Alex Tu (alextu) on 2019-11-21
Changed in dkms:
status: Confirmed → Fix Released
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package dkms - 2.6.1-4ubuntu2.5

---------------
dkms (2.6.1-4ubuntu2.5) disco; urgency=medium

  * cherry-pick from upstream b957799 for LP: #1838245

 -- Alex Tu <email address hidden> Thu, 07 Nov 2019 15:37:47 +0800

Changed in dkms (Ubuntu Disco):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.