I'm trying to update the kernel in the Debian Template of
Qubes OS, following the official documentations, but it seems I'm missing something or doing something wrong.
Installing kernel in Debian VM
In Debian based VM, you need to install qubes-kernel-vm-support package. This package include required additional kernel module and initramfs addition required to start Qubes VM (for details see template implementation). Additionally you need some GRUB tools to create it’s configuration. Note: you don’t need actual grub bootloader as it is provided by dom0. But having one also shouldn’t harm.
sudo apt-get update sudo apt-get install qubes-kernel-vm-support grub2-common
Then install whatever kernel you want. If you are using distribution kernel package (linux-image-amd64 package), initramfs and kernel module should be handled automatically. If not, or you are building kernel manually, do this on using dkms and initramfs-tools:
sudo dkms autoinstall -k <kernel-version> # replace this <kernel-version> with actual kernel version sudo update-initramfs -u
When kernel is installed, you need to create GRUB configuration. You may want to adjust some settings in /etc/default/grub, for example lower GRUB_TIMEOUT to speed up VM startup. Then you need to generate actual configuration: In Fedora it can be done using update-grub2 tool:
sudo mkdir /boot/grub sudo update-grub2
Then shutdown the VM. From now you can set pvgrub2 as VM kernel and it will start kernel configured within VM.
Don't be afraid to try compiling the kernel. It's fun and profitable.
To compile a kernel the Debian way, you need some packages: fakeroot, kernel-package, linux-source-version.
Hereafter, we'll assume you have free rein over your machine and will extract your kernel source to somewhere in your home directory. Make sure you are in the directory to where you want to unpack the kernel sources, extract them using tar xf /usr/src/linux-source-version.tar.xz and change to the directory linux-source-version that will have been created.
Now, you can configure your kernel. Run make xconfig if X11 is installed, configured and being run; run make menuconfig otherwise (you'll need libncurses5-dev installed). Take the time to read the online help and choose carefully. When in doubt, it is typically better to include the device driver (the software which manages hardware peripherals, such as Ethernet cards, SCSI controllers, and so on) you are unsure about. Be careful: other options, not related to a specific hardware, should be left at the default value if you do not understand them. Do not forget to select “Kernel module loader” in “Loadable module support” (it is not selected by default). If not included, your Debian installation will experience problems.
Clean the source tree and reset the kernel-package parameters:
Now, compile the kernel:
fakeroot make-kpkg --initrd
Once the compilation is complete, you can install your custom kernel like any package. As root, do dpkg -i ../linux-image-version-subarchitecture.deb. For instance, the System.map will be properly installed and /boot/config-3.16 will be installed, containing your current configuration set. Your new kernel package is also clever enough to automatically update your boot loader to use the new kernel. If you have created a modules package, you'll need to install that package as well.
The Debian Way Output:
... ... ... This is kernel package version 13.014+nmu1. install -p -d -o root -g root -m 755 /usr/src/linux-source-4.8/debian/linux-image-4.8.15-rt10-11.pvops.qubes.x86_64/DEBIAN sed -e 's/=V/4.8.15-rt10-11.pvops.qubes.x86_64/g' -e 's/=IB//g' \ -e 's/=ST/linux/g' -e 's/=R//g' \ -e 's/=KPV/13.014+nmu1/g' \ -e 's/=K/vmlinuz/g' \ -e 's/=I/YES/g' -e 's,=D,/boot,g' \ -e 's@=A@amd64@g' \ -e 's@=B@x86_64@g' \ ... dpkg-gencontrol: error: illegal package name 'linux-image-4.8.15-rt10-11.pvops.qubes.x86_64': character '_' not allowed debian/ruleset/targets/image.mk:230: recipe for target 'debian/stamp/binary/linux-image-4.8.15-rt10-11.pvops.qubes.x86_64' failed make: *** [debian/stamp/binary/linux-image-4.8.15-rt10-11.pvops.qubes.x86_64] Error 255
linux-source-4.8from Debian and I've extracted it in
make defconf make menuconf # custom settings make
Same error as above:
dpkg-gencontrol: error: illegal package name 'linux-image-4.8.15-rt10-11.pvops.qubes.x86_64': character '_' not allowed
I think this can be solved easily, but if I can compile the kernel manually, then how should I procede?
make modules_installare required or I have to use
dkms autoinstalldirectly? This isn't specified...
Installing directly the Debian package
linux-image-amd64 make the console disappeared and the VM work unproperly, I tried to reboot it, but I could use it only by attaching to the serial console.
I noticed the
dpkg crashed during installation, so I ran
dpkg --configure -a and it finished the installation, but it showed a warning message that told with that
initramfs, the machine would have never booted, in fact I updated
GRUB and rebooted, but
initramfs couldn't mount root.