How to install older version of kernel on R4.1 - please help with a clear straightforward guide?

How to install older version of kernel on R4.1 - please help with a clear straightforward guide.

Background

I have problems with PCIe USB Controller turning off just after I’m starting to write to a flash disk connected to it. It seems to be an issue of Linux kernel, that was introduced in 4.15 or a bit later.

Task

To confirm this assumption I want to install the kernel 4.14 in the AppVM. It’s a LTS kernel and will be supported till 2024.
But I don’t know how, because doc page Managing qube kernels is not good and does not provide a good painless guidance to install older kernel that is not present in Qubes OS repo. I also searched forum, but topic that I found did not help me either, not proper guide for my case there too.

So, please help me to install kernel 4.14. to one of AppVMs in Qubes OS R4.1.

Step-by-step guide would be great and preferable!

In this case, I am sure, this topic will also help other people who will search for the same task in the future.

To install regular non-qubes kernels in VMs, do the following in dom0:

# Make a backup of your template, just in case:
$ qvm-clone $source_template $template_vm
# Install the required package in dom0
$ sudo qubes-dom0-update grub2-xen-pvh
# Install the required packages in your TemplateVM
$ qvm-run -p -u root $template_vm "apt install -y --no-install-recommends grub2 linux-headers-amd64 linux-image-amd64 qubes-kernel-vm-support"
$ qvm-shutdown --wait $template_vm
# Change template of your target VM
$ qvm-prefs $target_vm template $template_vm
# Change kernel on your target VM
$ qvm-prefs $target_vm kernel pvgrub2-pvh

The above will allow you to install whatever kernel you want in a vm. You just need to make sure to define $source_template and $template_vm (a template) and $target_vm (sys-usb ?), and change the apt command to dnf if your template is fedora-based.

Also, if you’re changing kernel on an HVM vm (like sys-usb and sys-net), you may need to set the kernel parameter to None:

$ qvm-prefs $target_vm kernel ''

Are you sure it’s not just a VM RAM issue?

# Check available RAM
$ qvm-prefs $target_vm memory
# Increase RAM
$ qvm-prefs $target_vm memory 1500
# Restart the VM
$ qvm-shutdown --wait $target_vm
$ qvm-start $target_vm

I’d say it’s worth a try.

You could also check VM logs:

$ less /var/log/qubes/$target_vm.log
2 Likes

Firstly, thank you for a great instruction.
It will be useful not only for me. Maybe it should be added to the docs I provided link to.

I was excepting something like installing older kernel in the way it’s possible to choose it in qubes-vm-settings from a combobox (I did it on R4.0). Probably it has to be installed in dom0. Is it possible for older kernels like 4.14?

Secondly, about VM RAM issue - good point, I indeed have a memory issue with this particular qube - I gave it only 1000 MiB, because of this Qubes OS bug:

If I give it 1500 as you proposed - the VM does not start due to this bug.
Starting VM with 1200 did not change the controller dying situation.

But why do you think it can be connected to the memory amount? I thought 1000 is enough for sys-usb-type of qube, are there any tricks I don’t know?

And lastly, logs are named a bit differently in my case, and I found nothing suspicions there for this usb qube unfortunately.

1000M should be plenty, I went with 1500M just to be on the safer side, since some users reported similar problems which were linked to low ram.

Instead of installing linux-headers-amd64 linux-image-amd64 with the package manager, try downloading a .deb or .rpm file (depending on your template) from the debian or fedora website, that way you can choose the version that you require (that is assuming you cannot find the specific version through apt/dnf)