DevHeads.net

problems packaging kernel

Hello List,

hope this is the right place for this question. If not please give me a
hint.
I try to compile and package current 4.4.0 kernel from Ubuntu 16 in an
Ubuntu 14 Environment. Compiling itself works, but packaging fails with
weird message.
I explain my procedure.
On Ubuntu 16 i aquired sources with: apt-get source
linux-image-unsigned-4.4.0-154-generic
I transfered this to a Ubuntu 14 Server, installed all dependencies and
start packaging with: dpkg-buildpackage
Compiling works, late i get this error:

echo "interest linux-update-4.4.0-154-generic"

This sequence can be found in debian/rules.d/2-binary-arch.mk and for me
there is nothing unusual:

ifeq ($(do_extras_package),true)
        # Install the postinit/postrm scripts in the extras package.
        if [ -f $(DEBIAN)/control.d/$(target_flavour).inclusion-list ]
; then   \
                $(call
install_control,$(mods_extra_pkg_name)-$*,extra,postinst postrm); \
        fi
endif

I have no idea why this is happening. I upgraded bash and some other
compile-packages to Ubuntu16 level, but this has no  effect and error
message repeats.
Does anybody have a hint? I expect that an unknown package should be
upgraded too or some system env is required. not a clue...
What do you think?

Thanks,
Hajo

Comments

Re: problems packaging kernel

By oxy via ubuntu-users at 07/08/2019 - 05:25

On Thu, 4 Jul 2019 15:23:56 +0200, Hajo Locke wrote:
"fakeroot debian/rules editconfigs # you need to go through each (Y, Exit, Y, Exit..) or get a complaint about config later"
- <a href="https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel" title="https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel">https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel</a>

Re: problems packaging kernel

By Dr Rainer Woitok at 07/04/2019 - 12:26

Hajo,

This "if" clause is indeed syntactically incorrect: the "then" part must
not be empty! Shells provide an empty command ":" for this purpose.

Obviously the "$(call ...)" returns an empty string.

Sincerely,
Rainer

Re: problems packaging kernel

By Hajo Locke at 07/08/2019 - 02:05

Hello,

Am 04.07.2019 um 18:26 schrieb Dr Rainer Woitok:

Re: problems packaging kernel

By oxy via ubuntu-users at 07/08/2019 - 02:59

On Mon, 8 Jul 2019 08:05:35 +0200, Hajo Locke wrote:
Hi,

the users mailing list is

1. definitively the right mailing list for this kinds of questions.

2. even if the developers list would be the right place (again, it
isn't), your request is missing all the information to reproduce it.

Why are you trying to build a kernel package exactly that way:

On Thu, 4 Jul 2019 15:23:56 +0200, Hajo Locke wrote:
?

And way more important, how about posting the used commands with all of
their output?

Did you try to build the kernel without control and rules files the
source file might contain? You could use the config provided by the
source, you could apply patches manually, assuming the source does
contain any patches and then build a package the old faithful Debian
way.

Assuming the source contains control and rules files, then you might
need to do some editing.

Actually nobody knows what you really did. That's fine for a user's
list, but doesn't fit to the requirements of a developers list, even if
it would be the right place to ask (again, even then it wouldn't be the
right mailing list, this one is the right place for your request).

Maybe we are able to help, if you post all steps, with complete
commands, output, editing.

Regards,
Ralf

Re: problems packaging kernel

By Hajo Locke at 07/08/2019 - 03:38

Hello,

Am 08.07.2019 um 08:59 schrieb Ralf Mardorf via ubuntu-users:
There is a lot of output, many pages, so i restricted to error itself.
compilation itself works, so i expect problem in dpkg or debhelper
environment.
I dont expect that you really reproduce this. I think this is too much
effort. So i just hoped that some pro gives me a short hint ala " you
need package a in version b as well to package"

Re: problems packaging kernel

By oxy via ubuntu-users at 07/08/2019 - 05:10

While I used make-kpkg to build kernel packages for Ubuntu in the past
without issues, but I didn't use an Ubuntu source, instead I downloaded
sources for the kernels and in my case the rt patches from kernel.org,
you could try to do it as described by the Ubuntu Wiki, that was last
edited 2019-06-23 01:33:55, <a href="https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel" title="https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel">https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel</a>.

[weremouse@moonstudio tmp]$ apt-get source linux-image-unsigned-4.4.0-154-generic
[snip]
[weremouse@moonstudio tmp]$ ls -hAl
total 142M
drwxrwxr-x 29 weremouse weremouse 840 Jul 8 10:34 linux-4.4.0
-rw-r--r-- 1 weremouse weremouse 15M Jun 25 18:58 linux_4.4.0-154.181.diff.gz
-rw-r--r-- 1 weremouse weremouse 12K Jun 25 18:58 linux_4.4.0-154.181.dsc
-rw-r--r-- 1 weremouse weremouse 127M Jan 21 2016 linux_4.4.0.orig.tar.gz

linux-4.4.0/ contains a README, I ignored it and extracted the tarball:

[weremouse@moonstudio tmp]$ tar xzf linux_4.4.0.orig.tar.gz
[weremouse@moonstudio tmp]$ ls -hAl
total 142M
drwxrwxr-x 24 weremouse weremouse 700 Jan 11 2016 linux-4.4
drwxrwxr-x 29 weremouse weremouse 840 Jul 8 10:34 linux-4.4.0
-rw-r--r-- 1 weremouse weremouse 15M Jun 25 18:58 linux_4.4.0-154.181.diff.gz
-rw-r--r-- 1 weremouse weremouse 12K Jun 25 18:58 linux_4.4.0-154.181.dsc
-rw-r--r-- 1 weremouse weremouse 127M Jan 21 2016 linux_4.4.0.orig.tar.gz
[weremouse@moonstudio tmp]$ diff -r linux-4.4/ linux-4.4.0/
[snip]
[weremouse@moonstudio tmp]$ diff linux-4.4/ linux-4.4.0/ | grep -e Only\ in -e Common\ subdirectories
Common subdirectories: linux-4.4/arch and linux-4.4.0/arch
Common subdirectories: linux-4.4/block and linux-4.4.0/block
Common subdirectories: linux-4.4/certs and linux-4.4.0/certs
Common subdirectories: linux-4.4/crypto and linux-4.4.0/crypto
Only in linux-4.4.0/: debian
Only in linux-4.4.0/: debian.master
Common subdirectories: linux-4.4/Documentation and linux-4.4.0/Documentation
Common subdirectories: linux-4.4/drivers and linux-4.4.0/drivers
Only in linux-4.4.0/: dropped.txt
Common subdirectories: linux-4.4/firmware and linux-4.4.0/firmware
Common subdirectories: linux-4.4/fs and linux-4.4.0/fs
Common subdirectories: linux-4.4/include and linux-4.4.0/include
Common subdirectories: linux-4.4/init and linux-4.4.0/init
Common subdirectories: linux-4.4/ipc and linux-4.4.0/ipc
Common subdirectories: linux-4.4/kernel and linux-4.4.0/kernel
Common subdirectories: linux-4.4/lib and linux-4.4.0/lib
Common subdirectories: linux-4.4/mm and linux-4.4.0/mm
Common subdirectories: linux-4.4/net and linux-4.4.0/net
Common subdirectories: linux-4.4/samples and linux-4.4.0/samples
Common subdirectories: linux-4.4/scripts and linux-4.4.0/scripts
Common subdirectories: linux-4.4/security and linux-4.4.0/security
Only in linux-4.4.0/: snapcraft.yaml
Common subdirectories: linux-4.4/sound and linux-4.4.0/sound
Only in linux-4.4.0/: spl
Common subdirectories: linux-4.4/tools and linux-4.4.0/tools
Only in linux-4.4.0/: ubuntu
Common subdirectories: linux-4.4/usr and linux-4.4.0/usr
Common subdirectories: linux-4.4/virt and linux-4.4.0/virt
Only in linux-4.4.0/: zfs

Consider to try the way described by the Wiki and don't use the tarball, but the linux-4.4.0/ directory, since it contains additional information.

FWIW, I found a script, but don't remember if it worked, probably I did it manually in a similar way, but for sure using make-kpkg:

[root@archlinux rocketmouse]# cat /mnt/q/usr/src/ubuntu_quantal_rt.sh
#!/bin/sh
# sh ubuntu_quantal_rt.sh
TODAY=2013-Aug-27

GENERIC=3.6.5-rt14
ARCH=x86_64
export CONCURRENCY_LEVEL=2

# Kernel to build is version
KMAJOR=3.10
KMINOR=.9
KMICRO=-rt5
KERNEL_UNAME=${KMAJOR}${KMINOR}${KMICRO}

# Directory where the source codes should be saved
SRC_DIR=/usr/src

clear
if [ $USER = "root" ] ; then
if [ $(uname -m) != ${ARCH} ] ; then
echo "#######################################"
echo "You're running the wrong architecture"
echo "Continuing anyway"
echo "#######################################"
fi
if [ $(uname -r) != ${GENERIC} ] ; then
echo "#######################################"
echo "You're running the wrong kernel"
echo "Continuing anyway"
echo "#######################################"
fi

# Backup configuration, delete sources and packages in SRC_DIR
cd $SRC_DIR
cp linux-${KERNEL_UNAME}/.config config-${KERNEL_UNAME}_$(date +"%b-%d-%Y_%H-%M-%S")
rm -r linux-${KERNEL_UNAME}
rm linux-headers-${KERNEL_UNAME}_${KERNEL_UNAME}-10.00.Custom_*.deb
rm linux-image-${KERNEL_UNAME}_${KERNEL_UNAME}-10.00.Custom_*.deb
rm linux-${KMAJOR}${KMINOR}.tar.bz2 patch-${KERNEL_UNAME}.patch.bz2

# Download all sources to source directory
wget <a href="https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.10.9.tar.bz2" title="https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.10.9.tar.bz2">https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.10.9.tar.bz2</a>
wget <a href="https://www.kernel.org/pub/linux/kernel/projects/rt/3.10/patch-3.10.9-rt5.patch.bz2" title="https://www.kernel.org/pub/linux/kernel/projects/rt/3.10/patch-3.10.9-rt5.patch.bz2">https://www.kernel.org/pub/linux/kernel/projects/rt/3.10/patch-3.10.9-rt...</a>

# Extracting and patching
tar -jxf linux-${KMAJOR}${KMINOR}.tar.bz2
mv linux-${KMAJOR}${KMINOR} linux-${KERNEL_UNAME}
cd linux-${KERNEL_UNAME}
bzip2 -dc ../patch-${KERNEL_UNAME}.patch.bz2 | patch -p1
rm ../linux-${KMAJOR}${KMINOR}.tar.bz2
rm ../patch-${KERNEL_UNAME}.patch.bz2

# Configuration
cp /boot/config-$(uname -r) .config
# Optimize to CPU
# e.g. set to CONFIG_MK8=y (Opteron/Athlon64/Hammer/K8), command out for default
echo "CONFIG_MK8=y" >> .config

# 32-bit only
# HIGHMEM from 4G to 64G
# echo "CONFIG_HIGHMEM4G is not set" >> .config
# echo "CONFIG_HIGHMEM64G=y" >> .config

# [...]
SECONDS=0
make oldconfig
sec_oldconfig=$SECONDS
SECONDS=0

# Building the kernel
make-kpkg clean
make-kpkg --rootcmd fakeroot --initrd kernel-image kernel-headers

# Installing new packages
make-kpkg clean
dpkg -i ../linux-headers-${KERNEL_UNAME}_${KERNEL_UNAME}-10.00.Custom_*.deb
dpkg -i ../linux-image-${KERNEL_UNAME}_${KERNEL_UNAME}-10.00.Custom_*.deb
echo "-------------------------------"
echo "Config : $sec_oldconfig sec"
echo "Build and install: $SECONDS sec"
else
echo "Run as \"root\""
fi
exit 0

I definitively build the rt kernels exactly like that or at least very
similar for Ubuntu 12.10 (Quantal Quetzal), it's still installed and I
still can boot vmlinuz-3.6.5-rt14 and I most likely build rt kernels
like that for Ubuntu 14.04 LTS (Trusty Tahr), too, but it's not installed anymore.

[root@archlinux rocketmouse]# ls -hld /mnt/q/usr/src/*linux*3*
drwxrwxr-x 23 root root 4.0K Dec 28 2017 /mnt/q/usr/src/linux-3.10.9-rt5
-rw-r--r-- 1 root root 8.4M Aug 27 2013 /mnt/q/usr/src/linux-headers-3.10.9-rt5_3.10.9-rt5-10.00.Custom_amd64.deb
drwxr-xr-x 24 root root 4.0K Dec 28 2017 /mnt/q/usr/src/linux-headers-3.5.0-18
drwxr-xr-x 7 root root 4.0K Dec 28 2017 /mnt/q/usr/src/linux-headers-3.5.0-18-lowlatency
drwxr-xr-x 23 root root 4.0K Dec 28 2017 /mnt/q/usr/src/linux-headers-3.6.5-rt14
-rw-r--r-- 1 root root 40M Aug 27 2013 /mnt/q/usr/src/linux-image-3.10.9-rt5_3.10.9-rt5-10.00.Custom_amd64.deb
[root@archlinux rocketmouse]# ls -hl /.boot/ubuntu_q/boot/vmlinuz-*
-rw-r--r-- 1 root root 5.1M Aug 27 2013 /.boot/ubuntu_q/boot/vmlinuz-3.10.9-rt5
-rw------- 1 root root 5.0M Oct 20 2012 /.boot/ubuntu_q/boot/vmlinuz-3.5.0-18-lowlatency
-rw-r--r-- 1 root root 5.0M Nov 2 2012 /.boot/ubuntu_q/boot/vmlinuz-3.6.5-rt14
[root@archlinux rocketmouse]# grep LABEL\ Light -A4 /boot/syslinux/syslinux.cfg
LABEL Light
MENU LABEL Ubuntu ^Q LightScribe Rt (no bind to /boot)
LINUX /.boot/ubuntu_q/boot/vmlinuz-3.6.5-rt14
APPEND root=LABEL=q ro nomodeset
INITRD /.boot/ubuntu_q/boot/initrd.img-3.6.5-rt14

Regards,
Ralf

Re: problems packaging kernel

By Oliver Grawert at 07/04/2019 - 09:52

hi,
Am Donnerstag, den 04.07.2019, 15:23 +0200 schrieb Hajo Locke:
is there any particular reason you do not simply use the 4.4 kernel
from the HWE enablement stack ?

<a href="https://wiki.ubuntu.com/Kernel/LTSEnablementStack#Ubuntu_14.04_LTS_-_Tr" title="https://wiki.ubuntu.com/Kernel/LTSEnablementStack#Ubuntu_14.04_LTS_-_Tr">https://wiki.ubuntu.com/Kernel/LTSEnablementStack#Ubuntu_14.04_LTS_-_Tr</a>
usty_Tahr

ciao
oli

Re: problems packaging kernel

By Hajo Locke at 07/04/2019 - 10:22

Hello,

Am 04.07.2019 um 15:52 schrieb Oliver Grawert:
Thanks,
Hajo

Re: problems packaging kernel

By Liam Proven at 07/08/2019 - 07:37

OK. Good answer.

OK, so, next question. If you need to run something on 14.04 and it's
out of support: why? What are you using that makes it necessary to
keep an old version around?

Depending on the answer:

Could you run it in an LXD container on 18.04? That way your app runs
on a newer, current, supported kernel.

Re: problems packaging kernel

By oxy via ubuntu-users at 07/08/2019 - 08:03

On Mon, 8 Jul 2019 13:37:43 +0200, Liam Proven wrote:
The OP mentioned that it's a temporary solution:

On Mon, 8 Jul 2019 09:38:50 +0200, Hajo Locke wrote:

Re: problems packaging kernel

By Hajo Locke at 07/08/2019 - 08:59

Hello,

Am 08.07.2019 um 14:03 schrieb Ralf Mardorf via ubuntu-users:
I do some tests with the stuff and write back if i know something better.
I followed the steps here: <a href="https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel" title="https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel">https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel</a>
I received xenial sources that way and compiled like described, but ends
up with same errormessage:

# Some initramfs-tools specific modules
install -d
/usr/src/ubuntu-xenial/debian/linux-modules-4.4.0-154-generic/lib/modules/4.4.0-154-generic/initrd
if [ -f
/usr/src/ubuntu-xenial/debian/linux-modules-4.4.0-154-generic/lib/modules/4.4.0-154-generic/kernel/drivers/video/vesafb.ko
]; then\
          ln -sf
/usr/src/ubuntu-xenial/debian/linux-modules-4.4.0-154-generic/lib/modules/4.4.0-154-generic/kernel/drivers/video/vesafb.ko
\
/usr/src/ubuntu-xenial/debian/linux-modules-4.4.0-154-generic/lib/modules/4.4.0-154-generic/initrd/;
\
        fi
echo "interest linux-update-4.4.0-154-generic"
same tripwires... may be ubuntu needs some reasons for selling
esm-service ;)

Last week i tried another appoach. i kept original-kernel (3.13) and
created patches  with quilt from debian jessie (3.16 - still maintained)
package. basically i did the same way and this was working but compared
to just recompiling a xenial-package much more effort. and effort will
increase with growing differences between a maintained and outdated kernel.
Its just a try to be prepared for next kernel bug which can not be
resolved with a workaround.

Hmm, i try some other ideas...

Re: problems packaging kernel

By Hajo Locke at 07/10/2019 - 09:15

Hello,

Am 08.07.2019 um 14:59 schrieb Hajo Locke:
Thanks,
Hajo

Re: problems packaging kernel

By oxy via ubuntu-users at 07/10/2019 - 09:49

On Wed, 10 Jul 2019 15:15:35 +0200, Hajo Locke wrote:
You are welcome!

Re: problems packaging kernel

By oxy via ubuntu-users at 07/08/2019 - 10:18

On Mon, 8 Jul 2019 14:59:43 +0200, Hajo Locke wrote:
It still maintained by Debian, since it's a longterm kernel, see
<a href="https://www.kernel.org/:" title="https://www.kernel.org/:">https://www.kernel.org/:</a>

mainline: 5.2 2019-07-07
stable: 5.1.16 2019-07-03
longterm: 4.19.57 2019-07-03
longterm: 4.14.132 2019-07-03
longterm: 4.9.184 2019-06-27
longterm: 4.4.184 2019-06-27
longterm: 3.16.69 2019-06-20

Re: problems packaging kernel

By oxy via ubuntu-users at 07/08/2019 - 10:37

The described make-kpkg method at least still worked for Ubuntu 15.10
Wily Werewolf. By a quick search I found this:

<a href="https://lists.ubuntu.com/archives/ubuntu-devel-discuss/2015-August/015777.html" title="https://lists.ubuntu.com/archives/ubuntu-devel-discuss/2015-August/015777.html">https://lists.ubuntu.com/archives/ubuntu-devel-discuss/2015-August/01577...</a>

# export CONCURRENCY_LEVEL=2;wget <a href="https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.10.61.tar.gz" title="https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.10.61.tar.gz">https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.10.61.tar.gz</a> <a href="https://www.kernel.org/pub/linux/kernel/projects/rt/3.10/older/patch-3.10.61-rt65.patch.gz" title="https://www.kernel.org/pub/linux/kernel/projects/rt/3.10/older/patch-3.10.61-rt65.patch.gz">https://www.kernel.org/pub/linux/kernel/projects/rt/3.10/older/patch-3.1...</a>
&& tar zxf linux-3.10.61.tar.gz
&& mv linux-3.10.61 linux-3.10.61-rt65
&& cd linux-3.10.61-rt65 && gzip -dc ../patch-3.10.61-rt65.patch.gz | patch -p1
&& cp ../config-3.10.61-rt65-1-rt-lts.01.edit .config
&& make oldconfig && make menuconfig && make oldconfig
&& date
&& make-kpkg clean && make-kpkg --initrd kernel-image kernel-headers && make-kpkg clean
&& date

Re: problems packaging kernel

By oxy via ubuntu-users at 07/08/2019 - 10:03

On Mon, 2019-07-08 at 14:59 +0200, Hajo Locke wrote:
Hi,

I would try to build longterm 4.4.184 from <a href="https://www.kernel.org/" title="https://www.kernel.org/">https://www.kernel.org/</a> by
downloading and extracting the source (perhaps verifying, too, see
<a href="https://www.kernel.org/category/signatures.html" title="https://www.kernel.org/category/signatures.html">https://www.kernel.org/category/signatures.html</a>) cd into the extracted
directory and run

sudo -i

theoretically, since fakeroot is involved, it should work without root
privileges, but IIRC there was an issue and I tend to build with root
privileges

cp /boot/config-$(uname -r) .config

if already provided run

make olddefconfig

if not run

make oldconfig

then continue by running

make-kpkg clean
make-kpkg --rootcmd fakeroot --initrd kernel-image kernel-headers
make-kpkg clean
dpkg -i ../linux-headers-*.deb
dpkg -i ../linux-image-*.deb

Regards,
Ralf

Re: problems packaging kernel

By Oliver Grawert at 07/08/2019 - 10:30

hi,
Am Montag, den 08.07.2019, 16:03 +0200 schrieb Ralf Mardorf via ubuntu-
users:
if you want mainline kernels to just dpkg -i them, better use:

<a href="https://wiki.ubuntu.com/Kernel/MainlineBuilds" title="https://wiki.ubuntu.com/Kernel/MainlineBuilds">https://wiki.ubuntu.com/Kernel/MainlineBuilds</a>

but these kernels will miss a good bunch of (security related) patches
that ubuntus userspace expects and will also likely not come with the
ubuntu-geneic config that sets various configs that are expected
defaults for the userspace as well (indeed you can workout the missing
bits from teh upstream defconfig, but the "Ubuntu Sauce" patches
specifically for LSM/apparmor as well as a good bunch of HWE patches
will simply be missing) ... 

in any case, as i said before, i'd rather ask on the kernel mailing
list than on ubuntu-users if i was hajo, over there are the experts ...

ciao
oli

Re: problems packaging kernel

By oxy via ubuntu-users at 07/08/2019 - 10:08

On Mon, 08 Jul 2019 16:03:13 +0200, Ralf Mardorf via ubuntu-users wrote:
Or try building longterm 3.16.69 from kernel.org.

Re: problems packaging kernel

By Oliver Grawert at 07/08/2019 - 06:01

hi,
Am Donnerstag, den 04.07.2019, 16:22 +0200 schrieb Hajo Locke:

try following the kernel build guide from the ubuntu kernel team then:

<a href="https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel" title="https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel">https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel</a>

(note that you should not use dpkg-buildpackage but:
fakeroot debian/rules binary-headers binary-generic binary-perarch
(though typically binary-headers and binary-generic is enough)
)

also, the kernel team has its own mailing list if you want to ask about
more details:

<a href="https://lists.ubuntu.com/mailman/listinfo/kernel-team" title="https://lists.ubuntu.com/mailman/listinfo/kernel-team">https://lists.ubuntu.com/mailman/listinfo/kernel-team</a>

ciao
oli

Re: problems packaging kernel

By oxy via ubuntu-users at 07/08/2019 - 07:01

On Mon, 08 Jul 2019 12:01:13 +0200, Oliver Grawert wrote:
Yes, however, I guess the main mistake already was, that the OP used
the tarball. Take a look at the diff, the "rules" file obviously is
provided by the directory that isn't packed, not by the tarball:
<a href="https://lists.ubuntu.com/archives/ubuntu-users/2019-July/297498.html" title="https://lists.ubuntu.com/archives/ubuntu-users/2019-July/297498.html">https://lists.ubuntu.com/archives/ubuntu-users/2019-July/297498.html</a>

It might even work the way tried by the OP and even without editing the
rules file, as long as a rules files does exist at all.