I've been experimenting with compiling my own kernel, and I'm having difficulty adding a local version modifier when following the instructions from BuildYourOwnKernel. This is the "Debian way" of compiling a kernel using fakefoot debian/rules binary-generic
instead of compiling from mainline using make bindeb-pkg
.
When following the instructions, I'm actually successful compiling the kernel. However, the +test1
suffix I added as a local version modifier is only added to the .deb
archive file and not on any of the binary packages. As a result, I have a conflict during installation, because the name matches the currently installed kernel.
I'm using Ubuntu 22.04 Server.
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.4 LTS
Release: 22.04
Codename: jammy
Current kernel:
$ uname -r
5.15.0-113-generic
Here are the steps I've followed:
1. Install dependencies
sudo apt build-dep linux linux-image-unsigned-$(uname -r)
sudo apt install fakeroot crash kexec-tools kernel-wedge libncurses5 libncurses5-dev binutils-dev
2. Download source
apt source linux-image-unsigned-$(uname -r)
3. Change into source directory
cd linux-5.15.0
4. Modify debian.master/changelog
Per the instructions:
In order to make your kernel "newer" than the stock Ubuntu kernel from which you are based, you should add a local version modifier. Add something like "+test1" to the end of the first version number in the debian.master/changelog file, before building.
Therefore, I've added +test1
to the end of the first version number as follows:
$ head -n1 debian.master/changelog
linux (5.15.0-113.123+test1) jammy; urgency=medium
5. Build kernel
fakeroot debian/rules clean
fakeroot debian/rules binary-headers binary-generic
After compiling, you'll see that the +test1
suffix has been added to all .deb
files:
$ tree -L 1 /home/mike
/home/mike
├── linux-5.15.0
├── linux_5.15.0-113.123.diff.gz
├── linux_5.15.0-113.123.dsc
├── linux_5.15.0.orig.tar.gz
├── linux-buildinfo-5.15.0-113-generic_5.15.0-113.123+test1_amd64.deb
├── linux-cloud-tools-5.15.0-113-generic_5.15.0-113.123+test1_amd64.deb
├── linux-headers-5.15.0-113_5.15.0-113.123+test1_all.deb
├── linux-headers-5.15.0-113-generic_5.15.0-113.123+test1_amd64.deb
├── linux-image-unsigned-5.15.0-113-generic_5.15.0-113.123+test1_amd64.deb
├── linux-modules-5.15.0-113-generic_5.15.0-113.123+test1_amd64.deb
├── linux-modules-extra-5.15.0-113-generic_5.15.0-113.123+test1_amd64.deb
├── linux-modules-iwlwifi-5.15.0-113-generic_5.15.0-113.123+test1_amd64.deb
└── linux-tools-5.15.0-113-generic_5.15.0-113.123+test1_amd64.deb
The problem, however, is the +test1
suffix has not been added to any files within the .deb
file, and as a result, there's a conflict when installing the kernel.
$ sudo dpkg -i linux-image-unsigned-5.15.0-113-generic_5.15.0-113.123+test1_amd64.deb
dpkg: regarding linux-image-unsigned-5.15.0-113-generic_5.15.0-113.123+test1_amd64.deb containing linux-image-unsigned-5.15.0-113-generic:
linux-image-unsigned-5.15.0-113-generic conflicts with linux-image-5.15.0-113-generic
linux-image-5.15.0-113-generic (version 5.15.0-113.123) is present and installed.
dpkg: error processing archive linux-image-unsigned-5.15.0-113-generic_5.15.0-113.123+test1_amd64.deb (--install):
conflicting packages - not installing linux-image-unsigned-5.15.0-113-generic
Errors were encountered while processing:
linux-image-unsigned-5.15.0-113-generic_5.15.0-113.123+test1_amd64.deb
The headers, however, are installed:
$ sudo dpkg -i linux-headers-5.15.0-113-generic_5.15.0-113.123+test1_amd64.deb
(Reading database ... 138403 files and directories currently installed.)
Preparing to unpack linux-headers-5.15.0-113-generic_5.15.0-113.123+test1_amd64.deb ...
Unpacking linux-headers-5.15.0-113-generic (5.15.0-113.123+test1) over (5.15.0-113.123+test1) ...
Setting up linux-headers-5.15.0-113-generic (5.15.0-113.123+test1) ...
/etc/kernel/header_postinst.d/dkms:
* dkms: running auto installation service for kernel 5.15.0-113-generic
...done.
But take notice that no directory includes the local version suffix +test
. It appears that it simply overwrites the existing headers.
$ tree -L 1 /usr/src
/usr/src
├── linux-headers-5.15.0-113-generic
└── python3.10
Here is a snip of the contents of linux-headers-5.15.0-113-generic_5.15.0-113.123+test1_amd64.deb
:
$ dpkg -c linux-headers-5.15.0-113-generic_5.15.0-113.123+test1_amd64.deb | head -n20
drwxr-xr-x root/root 0 2024-07-07 16:31 ./
drwxr-xr-x root/root 0 2024-07-07 16:27 ./lib/
drwxr-xr-x root/root 0 2024-07-07 16:27 ./lib/modules/
drwxr-xr-x root/root 0 2024-07-07 16:27 ./lib/modules/5.15.0-113-generic/
drwxr-xr-x root/root 0 2024-07-07 16:31 ./usr/
drwxr-xr-x root/root 0 2024-07-07 16:31 ./usr/share/
drwxr-xr-x root/root 0 2024-07-07 16:31 ./usr/share/doc/
drwxr-xr-x root/root 0 2024-07-07 16:31 ./usr/share/doc/linux-headers-5.15.0-113-generic/
-rw-r--r-- root/root 714273 2024-07-07 15:58 ./usr/share/doc/linux-headers-5.15.0-113-generic/changelog.Debian.gz
-rw-r--r-- root/root 1292 2024-07-07 15:58 ./usr/share/doc/linux-headers-5.15.0-113-generic/copyright
drwxr-xr-x root/root 0 2024-07-07 16:27 ./usr/src/
drwxr-xr-x root/root 0 2024-07-07 16:27 ./usr/src/linux-headers-5.15.0-113-generic/
-rw-r--r-- root/root 261963 2024-07-07 16:27 ./usr/src/linux-headers-5.15.0-113-generic/.config
-rw-r--r-- root/root 39 2024-07-07 16:27 ./usr/src/linux-headers-5.15.0-113-generic/.gitignore
-rw-r--r-- root/root 1013 2024-07-07 16:27 ./usr/src/linux-headers-5.15.0-113-generic/.missing-syscalls.d
-rw-r--r-- root/root 1818060 2024-07-07 16:27 ./usr/src/linux-headers-5.15.0-113-generic/Module.symvers
drwxr-xr-x root/root 0 2024-07-07 16:27 ./usr/src/linux-headers-5.15.0-113-generic/arch/
drwxr-xr-x root/root 0 2024-07-07 16:27 ./usr/src/linux-headers-5.15.0-113-generic/arch/x86/
drwxr-xr-x root/root 0 2024-07-07 16:27 ./usr/src/linux-headers-5.15.0-113-generic/arch/x86/entry/
drwxr-xr-x root/root 0 2024-07-07 16:27 ./usr/src/linux-headers-5.15.0-113-generic/arch/x86/entry/syscalls/
Here is the contents of linux-image-unsigned-5.15.0-113-generic_5.15.0-113.123+test1_amd64.deb
:
$ dpkg -c linux-image-unsigned-5.15.0-113-generic_5.15.0-113.123+test1_amd64.deb
drwxr-xr-x root/root 0 2024-07-07 16:29 ./
drwxr-xr-x root/root 0 2024-07-07 16:26 ./boot/
-rw------- root/root 11680480 2024-07-07 16:26 ./boot/vmlinuz-5.15.0-113-generic
drwxr-xr-x root/root 0 2024-07-07 16:29 ./usr/
drwxr-xr-x root/root 0 2024-07-07 16:27 ./usr/lib/
drwxr-xr-x root/root 0 2024-07-07 16:27 ./usr/lib/linux/
drwxr-xr-x root/root 0 2024-07-07 16:27 ./usr/lib/linux/triggers/
drwxr-xr-x root/root 0 2024-07-07 16:29 ./usr/share/
drwxr-xr-x root/root 0 2024-07-07 16:29 ./usr/share/doc/
drwxr-xr-x root/root 0 2024-07-07 16:29 ./usr/share/doc/linux-image-unsigned-5.15.0-113-generic/
-rw-r--r-- root/root 714273 2024-07-07 15:58 ./usr/share/doc/linux-image-unsigned-5.15.0-113-generic/changelog.Debian.gz
-rw-r--r-- root/root 1292 2024-07-07 15:58 ./usr/share/doc/linux-image-unsigned-5.15.0-113-generic/copyright
Here is some tail output at the end of the build process. Take note of lines that indicate building package where the package does not contain +test1
yet the .deb
does.
dpkg-deb: building package 'linux-image-unsigned-5.15.0-113-generic' in '../linux-image-unsigned-5.15.0-113-generic_5.15.0-113.123+test1_amd64.deb'.
dh_installchangelogs -plinux-modules-5.15.0-113-generic
dh_installdocs -plinux-modules-5.15.0-113-generic
dh_compress -plinux-modules-5.15.0-113-generic
dh_fixperms -plinux-modules-5.15.0-113-generic -X/boot/
dh_shlibdeps -plinux-modules-5.15.0-113-generic
dh_installdeb -plinux-modules-5.15.0-113-generic
dh_installdebconf -plinux-modules-5.15.0-113-generic
flock -w 60 /home/mike/linux-5.15.0/debian/.LOCK dh_gencontrol -plinux-modules-5.15.0-113-generic -- -Vlinux:rprovides='spl-modules, spl-dkms, zfs-modules, zfs-dkms, v4l2loopback-modules, v4l2loopback-dkms, '
dpkg-gencontrol: warning: Depends field of package linux-modules-5.15.0-113-generic: substitution variable ${shlibs:Depends} used, but is not defined
dpkg-gencontrol: warning: Built-Using field of package linux-modules-5.15.0-113-generic: substitution variable ${linux:BuiltUsing} used, but is not defined
dh_md5sums -plinux-modules-5.15.0-113-generic
dh_builddeb -plinux-modules-5.15.0-113-generic
dpkg-deb: building package 'linux-modules-5.15.0-113-generic' in '../linux-modules-5.15.0-113-generic_5.15.0-113.123+test1_amd64.deb'.
if [ -f debian.master/control.d/generic.inclusion-list ] ; then \
dh_installchangelogs -plinux-modules-extra-5.15.0-113-generic; \
dh_installdocs -plinux-modules-extra-5.15.0-113-generic; \
dh_compress -plinux-modules-extra-5.15.0-113-generic; \
dh_fixperms -plinux-modules-extra-5.15.0-113-generic -X/boot/; \
dh_shlibdeps -plinux-modules-extra-5.15.0-113-generic ; \
dh_installdeb -plinux-modules-extra-5.15.0-113-generic; \
dh_installdebconf -plinux-modules-extra-5.15.0-113-generic; \
flock -w 60 /home/mike/linux-5.15.0/debian/.LOCK dh_gencontrol -plinux-modules-extra-5.15.0-113-generic -- -Vlinux:rprovides='spl-modules, spl-dkms, zfs-modules, zfs-dkms, v4l2loopback-modules, v4l2loopback-dkms, ' ; \
dh_md5sums -plinux-modules-extra-5.15.0-113-generic; \
dh_builddeb -plinux-modules-extra-5.15.0-113-generic; \
fi
dpkg-gencontrol: warning: Depends field of package linux-modules-extra-5.15.0-113-generic: substitution variable ${shlibs:Depends} used, but is not defined
dpkg-deb: building package 'linux-modules-extra-5.15.0-113-generic' in '../linux-modules-extra-5.15.0-113-generic_5.15.0-113.123+test1_amd64.deb'.
dh_installchangelogs -plinux-modules-iwlwifi-5.15.0-113-generic
dh_installdocs -plinux-modules-iwlwifi-5.15.0-113-generic
dh_compress -plinux-modules-iwlwifi-5.15.0-113-generic
dh_fixperms -plinux-modules-iwlwifi-5.15.0-113-generic -X/boot/
dh_shlibdeps -plinux-modules-iwlwifi-5.15.0-113-generic
dh_installdeb -plinux-modules-iwlwifi-5.15.0-113-generic
dh_installdebconf -plinux-modules-iwlwifi-5.15.0-113-generic
flock -w 60 /home/mike/linux-5.15.0/debian/.LOCK dh_gencontrol -plinux-modules-iwlwifi-5.15.0-113-generic -- -Vlinux:rprovides='spl-modules, spl-dkms, zfs-modules, zfs-dkms, v4l2loopback-modules, v4l2loopback-dkms, '
dpkg-gencontrol: warning: Built-Using field of package linux-modules-iwlwifi-5.15.0-113-generic: substitution variable ${linux:BuiltUsing} used, but is not defined
dh_md5sums -plinux-modules-iwlwifi-5.15.0-113-generic
dh_builddeb -plinux-modules-iwlwifi-5.15.0-113-generic;
dpkg-deb: building package 'linux-modules-iwlwifi-5.15.0-113-generic' in '../linux-modules-iwlwifi-5.15.0-113-generic_5.15.0-113.123+test1_amd64.deb'.
dh_installchangelogs -plinux-buildinfo-5.15.0-113-generic
dh_installdocs -plinux-buildinfo-5.15.0-113-generic
dh_compress -plinux-buildinfo-5.15.0-113-generic
dh_fixperms -plinux-buildinfo-5.15.0-113-generic -X/boot/
dh_shlibdeps -plinux-buildinfo-5.15.0-113-generic
dh_installdeb -plinux-buildinfo-5.15.0-113-generic
dh_installdebconf -plinux-buildinfo-5.15.0-113-generic
flock -w 60 /home/mike/linux-5.15.0/debian/.LOCK dh_gencontrol -plinux-buildinfo-5.15.0-113-generic -- -Vlinux:rprovides='spl-modules, spl-dkms, zfs-modules, zfs-dkms, v4l2loopback-modules, v4l2loopback-dkms, '
dpkg-gencontrol: warning: Depends field of package linux-buildinfo-5.15.0-113-generic: substitution variable ${shlibs:Depends} used, but is not defined
dpkg-gencontrol: warning: Built-Using field of package linux-buildinfo-5.15.0-113-generic: substitution variable ${linux:BuiltUsing} used, but is not defined
dh_md5sums -plinux-buildinfo-5.15.0-113-generic
dh_builddeb -plinux-buildinfo-5.15.0-113-generic
dpkg-deb: building package 'linux-buildinfo-5.15.0-113-generic' in '../linux-buildinfo-5.15.0-113-generic_5.15.0-113.123+test1_amd64.deb'.
dh_installchangelogs -plinux-headers-5.15.0-113-generic
dh_installdocs -plinux-headers-5.15.0-113-generic
dh_compress -plinux-headers-5.15.0-113-generic
dh_fixperms -plinux-headers-5.15.0-113-generic -X/boot/
dh_shlibdeps -plinux-headers-5.15.0-113-generic
dh_installdeb -plinux-headers-5.15.0-113-generic
dh_installdebconf -plinux-headers-5.15.0-113-generic
flock -w 60 /home/mike/linux-5.15.0/debian/.LOCK dh_gencontrol -plinux-headers-5.15.0-113-generic -- -Vlinux:rprovides='spl-modules, spl-dkms, zfs-modules, zfs-dkms, v4l2loopback-modules, v4l2loopback-dkms, '
dh_md5sums -plinux-headers-5.15.0-113-generic
dh_builddeb -plinux-headers-5.15.0-113-generic
dpkg-deb: building package 'linux-headers-5.15.0-113-generic' in '../linux-headers-5.15.0-113-generic_5.15.0-113.123+test1_amd64.deb'.
dh_installchangelogs -plinux-tools-5.15.0-113-generic
dh_installdocs -plinux-tools-5.15.0-113-generic
dh_compress -plinux-tools-5.15.0-113-generic
dh_fixperms -plinux-tools-5.15.0-113-generic -X/boot/
dh_shlibdeps -plinux-tools-5.15.0-113-generic
dh_installdeb -plinux-tools-5.15.0-113-generic
dh_installdebconf -plinux-tools-5.15.0-113-generic
flock -w 60 /home/mike/linux-5.15.0/debian/.LOCK dh_gencontrol -plinux-tools-5.15.0-113-generic -- -Vlinux:rprovides='spl-modules, spl-dkms, zfs-modules, zfs-dkms, v4l2loopback-modules, v4l2loopback-dkms, '
dh_md5sums -plinux-tools-5.15.0-113-generic
dh_builddeb -plinux-tools-5.15.0-113-generic
dpkg-deb: building package 'linux-tools-5.15.0-113-generic' in '../linux-tools-5.15.0-113-generic_5.15.0-113.123+test1_amd64.deb'.
dh_installchangelogs -plinux-cloud-tools-5.15.0-113-generic
dh_installdocs -plinux-cloud-tools-5.15.0-113-generic
dh_compress -plinux-cloud-tools-5.15.0-113-generic
dh_fixperms -plinux-cloud-tools-5.15.0-113-generic -X/boot/
dh_shlibdeps -plinux-cloud-tools-5.15.0-113-generic
dh_installdeb -plinux-cloud-tools-5.15.0-113-generic
dh_installdebconf -plinux-cloud-tools-5.15.0-113-generic
flock -w 60 /home/mike/linux-5.15.0/debian/.LOCK dh_gencontrol -plinux-cloud-tools-5.15.0-113-generic -- -Vlinux:rprovides='spl-modules, spl-dkms, zfs-modules, zfs-dkms, v4l2loopback-modules, v4l2loopback-dkms, '
dh_md5sums -plinux-cloud-tools-5.15.0-113-generic
dh_builddeb -plinux-cloud-tools-5.15.0-113-generic
dpkg-deb: building package 'linux-cloud-tools-5.15.0-113-generic' in '../linux-cloud-tools-5.15.0-113-generic_5.15.0-113.123+test1_amd64.deb'.
So what's going on?
- Is this a bug?
- Is this intentional and I don't understand the process correctly?
- Or am I doing something wrong?