You are not logged in.

#1 2020-05-25 17:33:45

elParaguayo
Member
Registered: 2018-03-30
Posts: 51

[SOLVED] DKMS: hook not installing/adding module

I posted last month about hoping to use Arch on my HTPC server but had some concerns about rebuilding modules for my TV tuner (thread is here).

Trilby helpfully pointed me to DKMS as a way to simplify this process so I've been seeing if I can make this work. As I don't want to break everything, I've been doing a test run using an installation of Arch on a USB drive (using LTS kernel), rather than wiping the existing server's operating system.

I installed DKMS and the tbs-linux_media-git-dkms package from the AUR. After installing the package, the DKMS hook runs but completes instantly with no message. Running `dkms status` did not return anything. I therefore tried running `dkms install` with the relevant module and version names. This did provide some output (the build failed after about 20 mins, but that's another issue which I have an idea how to fix) and running `dkms status` after that shows that the module has been added.

My first question is therefore to ask if anyone could think why the DKMS hook didn't add the module. From the source for the hook it looks like the hook is run with the `install` argument but I can't immediately see how it picks up the module and name and version from the source.

Am I missing something or am I expected to manually add the module to DKMS the first time?

EDIT: Remove second question. Second question (and far less important) - is it possible to run DKMS from within an arch-chroot? I can mount the USB drive on my laptop but building the module seems to get into a mess due to the kernel on my laptop (non-LTS) and the USB drive (LTS) as the header files in the chroot obviously don't match the kernel running on the laptop?

It would be easier if I could do the building on my laptop as, that way, I don't have to take the HTPC offline and my kids don't start complaining about having no films or music. This, clearly, isn't a deal breaker but I just wondered if I'm missing something obvious.


The good news is that I can build the module manually (i.e. outside of pacman, DKMS etc.) but I do not want to have unmanaged files floating around so I do want to get DKMS working.

Last edited by elParaguayo (2020-05-30 06:06:20)

Offline

#2 2020-05-25 20:00:54

twelveeighty
Member
Registered: 2011-09-04
Posts: 1,317

Re: [SOLVED] DKMS: hook not installing/adding module

I strongly recommend (and it's actually part of the code of conduct) to only post one question per post. You are much more likely to get responses that way.

This did provide some output (the build failed after about 20 mins, but that's another issue which I have an idea how to fix) and running `dkms status` after that shows that the module has been added

Most likely, the fact that the build failed is the reason that the hook doesn't seem to work, but you have to share the *actual* output of the build rather than your interpretation. Same goes for the output of "dkms status" - post the output.

Offline

#3 2020-05-25 20:19:06

elParaguayo
Member
Registered: 2018-03-30
Posts: 51

Re: [SOLVED] DKMS: hook not installing/adding module

twelveeighty,

Thanks for the reply. I've removed the second question and edited the thread title so we can focus on the main issue. I'll post the second one later.

I appreciate the request for output rather than interpretation and can try to do that later. However, what I can say is that "dkms status" returns nothing after the install hook has run but does show the module as "added" after manually running dkms install (despite the build failing). It therefore does seem reasonable to assume that the hook did not run the install command. In addition, the manual install fails after 20 minutes or so of building whereas the hook completes instantly. Again, this suggests that it's not the failure to build the module that's causing the issue with the hook.

I can't post actual outputs now but, if these would be helpful, I will happily re-run the process tomorrow.

Offline

#4 2020-05-26 18:33:59

elParaguayo
Member
Registered: 2018-03-30
Posts: 51

Re: [SOLVED] DKMS: hook not installing/adding module

I've started from a fresh install of Arch on a USB and the same symptoms as described above occured.

After installing dkms and the linux-lts-headers, I installed the tbs-linux_media-git-dkms package from the AUR:

==> Installing package tbs-linux_media-git-dkms with pacman -U...
[sudo] password for elpara: 
loading packages...
resolving dependencies...
looking for conflicting packages...

Packages (1) tbs-linux_media-git-dkms-r20200518.035522.bdcf53501-1

Total Installed Size:  876.00 MiB

:: Proceed with installation? [Y/n] y
(1/1) checking keys in keyring                                      [######################################] 100%
(1/1) checking package integrity                                    [######################################] 100%
(1/1) loading package files                                         [######################################] 100%
(1/1) checking for file conflicts                                   [######################################] 100%
(1/1) checking available disk space                                 [######################################] 100%
:: Processing package changes...
(1/1) installing tbs-linux_media-git-dkms                           [######################################] 100%
:: Running post-transaction hooks...
(1/2) Arming ConditionNeedsUpdate...
(2/2) Install DKMS modules
==> Cleaning up...

As you can see, there's no output from the DKMS hook. I therefore ran 'dkms status' to check if the module had been added:

[elpara@archserverusb tbs-linux_media-git-dkms]$ dkms status
[elpara@archserverusb tbs-linux_media-git-dkms]$ 

No output.

Next up, I try manually installing the modules:

[elpara@archserverusb tbs-linux_media-git-dkms]$ sudo dkms install tbs-linux_media-git/r20200518.035522.bdcf53501

Creating symlink /var/lib/dkms/tbs-linux_media-git/r20200518.035522.bdcf53501/source ->
                 /usr/src/tbs-linux_media-git-r20200518.035522.bdcf53501

DKMS: add completed.

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area...
cd media_build && make dir DIR=../media KERNELRELEASE=5.4.42-1-lts && make distclean KERNELRELEASE=5.4.42-1-lts && make KERNELRELEASE=5.4.42-1-lts...[Cutting out lots of dots]...........
Error!  Build of adv7511.ko failed for: 5.4.42-1-lts (x86_64)
Consult the make.log in the build directory
/var/lib/dkms/tbs-linux_media-git/r20200518.035522.bdcf53501/build/ for more information.

The build failed however, running 'dkms status' now give the following:

[elpara@archserverusb tbs-linux_media-git-dkms]$ dkms status
tbs-linux_media-git, r20200518.035522.bdcf53501: added

So now the module is at least added to DKMS.

If it's of interest:
- Pacman log: http://ix.io/2npZ
- DKMS make.log: http://ix.io/2nq1 (interestingly, the make.log doesn't have an error at the end and doesn't refer to adv7511.ko either...)

Happy to provide any other info that may be of use/interest.

Offline

#5 2020-05-26 18:47:48

loqs
Member
Registered: 2014-03-06
Posts: 18,425

Re: [SOLVED] DKMS: hook not installing/adding module

The make.log does not list adv7511.ko in its output.  Assuming that module was not generated but it is listed in BUILT_MODULE_NAME array of dkms.conf then DKMS will error on failing to find the module.
What is the contents of dkms.conf you are using?
Edit:
Have you tried running https://aur.archlinux.org/cgit/aur.git/ … a-git-dkms to update modules.list or https://aur.archlinux.org/packages/tbse … -git-dkms/ ?

Last edited by loqs (2020-05-26 19:04:01)

Offline

#6 2020-05-26 19:07:12

elParaguayo
Member
Registered: 2018-03-30
Posts: 51

Re: [SOLVED] DKMS: hook not installing/adding module

loqs,

Thanks. That would make sense. The dkms.conf file is here (http://ix.io/2nqK). As you suspected, it does indeed list the adv7511. I should probably cross-reference the make log with the conf file to see if there are any other missing modules.

However, that still doesn't explain why the hook didn't trigger the build.

Offline

#7 2020-05-26 19:31:41

loqs
Member
Registered: 2014-03-06
Posts: 18,425

Re: [SOLVED] DKMS: hook not installing/adding module

I can not replicate the hooks failure to trigger.  From a clean chroot build of tbs-linux_media-git-dkms as no kernel is in the chroot the hook triggers but fails

(2/2) Install DKMS modules
==> Missing mandatory directory: /usr/lib/modules. Exiting!
error: command failed to execute correctly

With linux-lts and linux-lts-headers added to the chroot

(2/2) Install DKMS modules
==> dkms install tbs-linux_media-git/r20200518.035522.bdcf53501 -k 5.4.42-1-lts
Error!  Build of adv7511.ko failed for: 5.4.42-1-lts (x86_64)
Consult the make.log in the build directory
/var/lib/dkms/tbs-linux_media-git/r20200518.035522.bdcf53501/build/ for more information.

Offline

#8 2020-05-26 20:00:10

twelveeighty
Member
Registered: 2011-09-04
Posts: 1,317

Re: [SOLVED] DKMS: hook not installing/adding module

I wonder if your locale settings are what's getting in the way of things - your pacman log complains about that. Did you set your locale (https://wiki.archlinux.org/index.php/In … calization) and run locale.gen?

I believe there should be something always following your last line of your pacman log:

[2020-05-26T18:32:43+0100] [ALPM] running '70-dkms-install.hook'...

You should see something like this immediately after that (i.e. no time delay):

[timestamp] [ALPM-SCRIPTLET] ==> dkms install [module-name] -k [kernel-name]

Where [module-name] is the dkms module you're installing and [kernel-name] is the kernel that it's being installed into.

And *then* the compilation starts.

Keep in mind that the package you're installing is not in the official repos, but AUR, so you may have to ask the maintainer there.

Offline

#9 2020-05-26 20:00:49

elParaguayo
Member
Registered: 2018-03-30
Posts: 51

Re: [SOLVED] DKMS: hook not installing/adding module

OK. Thanks so much for taking a look for me. That's really odd that it works for you but doesn't work for me. I don't know if this makes a difference but I'm booting this arch installation from a USB on my HTPC (rather than mounting it and using arch-chroot on my laptop).

I don't really know where to go from here. Could there be any packages that I've failed to install (although, I would have thought these would have been picked up as dependencies)? I've installed base, base-devel, dkms, linux-lts, linux-firmware, linux-lts-headers, sudo and tbs-firmware (from AUR).

EDIT: Just seen that I've missed loqs's earlier edit about the update script and twelveeighty's post. I'll take a look at both now...

twelveeighty: I saw that message in the pacman log but, as far as I can tell, my locale is set. As per the installation instructions I uncommented my preferred locale in /etc/locale.gen (en_GB.UTF-8 UTF-8) and ran locale-gen. I've also set "LANG=en_GB.UTF-8" in /etc/locale.conf.

Last edited by elParaguayo (2020-05-26 20:15:22)

Offline

#10 2020-05-26 20:18:18

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] DKMS: hook not installing/adding module

The dkms pacman hook really should not ever fail to trigger a "==> dkms install ........" line without either reporting a different error, or else removing a dkms module from the target list because it uses BUILD_EXCLUSIVE_KERNEL.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#11 2020-05-26 20:24:15

loqs
Member
Registered: 2014-03-06
Posts: 18,425

Re: [SOLVED] DKMS: hook not installing/adding module

If you build and install the following PKGBUILD is the dkms pacman hook triggered?

pkgname=dkms-test
pkgver=1
pkgrel=1
pkgdesc="Test dkms"
arch=('any')
url=""
license=('GPL')
depends=('dkms')

package() {
  install -d "$pkgdir/usr/src/$pkgname/"
  touch "$pkgdir/usr/src/$pkgname/dkms.conf"
}

Offline

#12 2020-05-26 20:31:51

elParaguayo
Member
Registered: 2018-03-30
Posts: 51

Re: [SOLVED] DKMS: hook not installing/adding module

loqs,

Interesting (and thank you again) - yes, the hook does get triggered:

[elpara@archserverusb dkms-test]$ makepkg -sci
==> Making package: dkms-test 1-1 (Tue 26 May 2020 21:30:31 BST)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
==> Extracting sources...
==> Entering fakeroot environment...
==> Starting package()...
==> Tidying install...
  -> Removing libtool files...
  -> Purging unwanted files...
  -> Removing static library files...
  -> Stripping unneeded symbols from binaries and libraries...
  -> Compressing man and info pages...
==> Checking for packaging issues...
==> Creating package "dkms-test"...
  -> Generating .PKGINFO file...
  -> Generating .BUILDINFO file...
  -> Generating .MTREE file...
  -> Compressing package...
==> Leaving fakeroot environment.
==> Finished making: dkms-test 1-1 (Tue 26 May 2020 21:30:34 BST)
==> Installing package dkms-test with pacman -U...
[sudo] password for elpara: 
loading packages...
resolving dependencies...
looking for conflicting packages...

Packages (1) dkms-test-1-1


:: Proceed with installation? [Y/n] y
(1/1) checking keys in keyring                                      [######################################] 100%
(1/1) checking package integrity                                    [######################################] 100%
(1/1) loading package files                                         [######################################] 100%
(1/1) checking for file conflicts                                   [######################################] 100%
(1/1) checking available disk space                                 [######################################] 100%
:: Processing package changes...
(1/1) installing dkms-test                                          [######################################] 100%
:: Running post-transaction hooks...
(1/2) Arming ConditionNeedsUpdate...
(2/2) Install DKMS modules
==> dkms install dkms/test -k 5.4.42-1-lts
dkms.conf: Error! No 'DEST_MODULE_LOCATION' directive specified.
dkms.conf: Error! No 'PACKAGE_NAME' directive specified.
dkms.conf: Error! No 'PACKAGE_VERSION' directive specified.
Error! Bad conf file.
File: /usr/src/dkms-test/dkms.conf
does not represent a valid dkms.conf file.
==> Cleaning up...

EDIT: Just tried reinstalling the tbs package again and the hook doesn't generate any output.

My bash scripting isn't great but that first script looks like it reads the make.log file and updates the modules.list file so should do exactly what I would need to do if the build fails because of a module being in the list but not getting built. As for the second AUR package, yes, I saw that in the AUR comments and had a look but the comments for that package also say the driver I need (saa716x) is not currently supported.

Last edited by elParaguayo (2020-05-27 06:59:04)

Offline

#13 2020-05-29 15:43:02

elParaguayo
Member
Registered: 2018-03-30
Posts: 51

Re: [SOLVED] DKMS: hook not installing/adding module

I've just installed arch on a new hard drive (SSD), rather than booting from a USB stick, installed the same packages as above and get the same symptoms. The hook doesn't generate any output.

I'm completely stumped by this given that loqs's dummy package successfully triggered the hook and also because the package triggered the hook successfully on loqs's machine.

eschwartz wrote:

The dkms pacman hook really should not ever fail to trigger a "==> dkms install ........" line without either reporting a different error, or else removing a dkms module from the target list because it uses BUILD_EXCLUSIVE_KERNEL.

If that's the case, is there any way I can force the output to be more verbose? The pacman log just ends with "running '70-dkms-install.hook'..." so it's hard to tell where this is failing.

EDIT: by adding some debugging output lines to the hook, it seems it triggers the test on line 100 of the code which is to do with build_exclusive. I'll confess I have no idea what that means and how I'd go about fixing this. Nor do I understand why that's the case on my system, but not on loqs's.

EDIT 2: So... that test seems to source the dkms.conf file and then, I assume, checks to see if the current kernel matches some pattern in the conf file. However, what seems to be happening is that, when the conf file is sourced, it just returns my environmental variables, all prefixed with "declare -x". I don't know if that's intended behaviour or not.

EDIT 3: OK - I guess it's supposed to add any variables defined in dkms.conf into the scope of the hook. If BUILD_EXCLUSIVE_KERNEL is defined in the config file, the current kernel is tested against that regex. However, as this config file doesn't have that line, there should be no match and BUILD_EXCLUSIVE_KERNEL should be empty. Instead BUILD_EXCLUSIVE_KERNEL seems to be populated with all the environmental variables.

Last edited by elParaguayo (2020-05-29 19:23:18)

Offline

#14 2020-05-30 06:06:03

elParaguayo
Member
Registered: 2018-03-30
Posts: 51

Re: [SOLVED] DKMS: hook not installing/adding module

OK - this is solved!

As per my previous post, I found out that the hook script didn't install the module because it triggered the check_buildexclusive test. Digging in to this, I saw that the hook sourced the dkms.conf file to look for the BUILD_EXCLUSIVE_KERNEL variable. This is where it went wrong on my computer.

Sourcing my dkms.conf outputted every environmental variable on my system. Looking at the file, the only line I could see that would trigger this condition was:

export $(grep -m1 '^MAKEFLAGS=' /etc/makepkg.conf)

My problem was that I didn't have "MAKEFLAGS" defined in makepkg.conf as the default value is commented out. This means the grep returns nothing and so the source just runs "export" with no parameter which therefore outputted all environmental variables. Adding a

MAKEFLAGS=""

to the makepkg.conf file fixed the issue. The reason loqs couldn't recreate the issue must be because he has MAKEFLAGS defined in his makepkg.conf.

Thanks to everyone for looking into this for me. Great fun doing the detective work to get to the bottom of this.

Installing package now looks like this:

[elpara@htpc ~]$ sudo pacman -U /var/cache/pacman/aur/tbs-linux_media-git-dkms-r20200518.035522.bdcf53501-1-x86_64.pkg.tar.xz 
loading packages...
warning: tbs-linux_media-git-dkms-r20200518.035522.bdcf53501-1 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Packages (1) tbs-linux_media-git-dkms-r20200518.035522.bdcf53501-1

Total Installed Size:  876.00 MiB
Net Upgrade Size:        0.00 MiB

:: Proceed with installation? [Y/n] y
(1/1) checking keys in keyring                                      [######################################] 100%
(1/1) checking package integrity                                    [######################################] 100%
(1/1) loading package files                                         [######################################] 100%
(1/1) checking for file conflicts                                   [######################################] 100%
(1/1) checking available disk space                                 [######################################] 100%
:: Running pre-transaction hooks...
(1/1) Remove DKMS modules
:: Processing package changes...
(1/1) reinstalling tbs-linux_media-git-dkms                         [######################################] 100%
:: Running post-transaction hooks...
(1/2) Arming ConditionNeedsUpdate...
(2/2) Install DKMS modules
==> dkms install tbs-linux_media-git/r20200518.035522.bdcf53501 -k 5.4.42-1-lts

Offline

#15 2020-06-01 03:13:30

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] DKMS: hook not installing/adding module

elParaguayo wrote:

OK - this is solved!

As per my previous post, I found out that the hook script didn't install the module because it triggered the check_buildexclusive test. Digging in to this, I saw that the hook sourced the dkms.conf file to look for the BUILD_EXCLUSIVE_KERNEL variable. This is where it went wrong on my computer.

Sourcing my dkms.conf outputted every environmental variable on my system. Looking at the file, the only line I could see that would trigger this condition was:

export $(grep -m1 '^MAKEFLAGS=' /etc/makepkg.conf)

My problem was that I didn't have "MAKEFLAGS" defined in makepkg.conf as the default value is commented out. This means the grep returns nothing and so the source just runs "export" with no parameter which therefore outputted all environmental variables. Adding a

MAKEFLAGS=""

to the makepkg.conf file fixed the issue. The reason loqs couldn't recreate the issue must be because he has MAKEFLAGS defined in his makepkg.conf.

The actual problem is this AUR package's dkms.conf must not try to retrieve MAKEFLAGS from /etc/makepkg.conf as this is supposed to be separately specified in /etc/dkms/framework.conf, and even if it were okay to do that, I can think of at least 3 separate problems with the 1 line they used to do so, and that's just off the top of my head.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#16 2020-06-01 06:06:33

elParaguayo
Member
Registered: 2018-03-30
Posts: 51

Re: [SOLVED] DKMS: hook not installing/adding module

Thanks.

That makes a lot of sense. I'll flag this to the AUR package maintainer.

EDIT: this has been fixed in the AUR (see commit: https://aur.archlinux.org/cgit/aur.git/ … f163d23e86)

Last edited by elParaguayo (2020-06-02 09:39:18)

Offline

Board footer

Powered by FluxBB