How to use mhwd-kernel in chroot?

I would like to install kernels with

 mhwd-kernel i <kernels>

in a chroot to a system with just base installed. I have been been using arch-chroot like this in my script:

 arch-chroot $MOUNTPOINT /bin/bash -c "mhwd-kernel -i"

However, mhwd-kernel returns this pacman error:

 error: no targets specified (use -h for help)

Mhwd itself recognizes the inputted kernels, because if it does not, it gives this error:

Error: Invalid argument.
Please choose one of the available kernels:
   * linux310
   * linux312
   * linux316
   * linux318
   * linux41
   * linux410
   * linux44
   * linux48
   * linux49
   * linux-rt-lts-manjaro
   * linux-rt-manjaro

So for some reason, mhwd-kernel does not pass any packages to pacman when ran in chroot.

Any ideas how to get around this?

Hi. I think the reason is that mhwd-kernel uses uname -r to detect what kernel is currently running. With chroot it gives kernel running on main system, that might not be installed on chrooted system. So pacman -Qqs "$current" gives empty list instead of valid list of installed packages.

1 Like

Thanks! So I probably can't fix it with forking mhwd... Or maybe I could echo the right kernel name somewhere in /mnt before chrooting? Need to check where uname reads its values...

Hmm... https://bbs.archlinux.org/viewtopic.php?id=82334

Maybe I could install fakeuname (temporarily?) in /mnt, use it to run mhwd-kernel kernel and possibly remove it afterwards... I'll look into this.

Try manjaro-chroot, its part of manjaro-tools.

I tried, it seems that

 manjaro-chroot $MOUNTPOINT "mhwd-kernel -i"

Does the same as the arch-chroot thing I had. I switched the script to use it few hours ago, so I can drop arch-install-scripts dependency. It still has the same issue with mhwd-kernel though.

Okay, that fakeuname thingy works as intented, but it seems that it does not help with mhwd-kernel.

Is mhwd-chroot worth a try at least for a test case? It actually does the steps of manual chrooting.

Tried now. Does not work. The chroot is fine, its just that mhwd-kernel does not work in chroot

Maybe you can try to modify mhwd-kernel? Add a parameter that will override or force what kernel is currently running. Then you can set that parameter to kernel installed in chrooted system and it should work.

Good idea, but it will not work because uname already reports the running kernel in chroot. The issue must be something else.

Also, I just took a look at mhwd-kernel code. I can't find the part that would detect needed kernel modules based on hardware. It seems mhwd does this outside mhwd-kernel somehow, so using mhwd-kernel does not achieve what I want anyway.

Well, it seems that mhwd-kernel just determines what modules are installed for current kernel and then installs the same modules for new kernel.

Yeah. So it is probably something in the manjaro-live-utils that actually determines the modules.

2 Likes

Okay, I looked through live-cd stuff. I didn't see any point where it would detect and install say.. broadcom-wl. It just runs mhwd {non}free, based on how system was started. I'll take a look at if that command actually looks for wireless drivers.

I remember I use to get the boot message "Running mhwd-live cript..."

Yeah, I read the script. It just checks if you booted live media with free, nonfree or vesa drivers and runs mhwd command to install those drivers.

Found it, it seems that kernel modules are chosen by the same mhwd that installs graphics drivers:

So theoretically manjaro-architect should already install the right drivers unless user skips the graphics driver installation part.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by