libfranka: Realtime Kernel build instructions not working on ubuntu 18.04 and higher

Just a quick heads-up about the real-time kernel instructions found in your online documentation. These instructions do not seem to work anymore on ubuntu versions higher than 18.04 and kernel versions higher than 5.0. I was, however, able to build real-time kernel (v5.4.26) on ubuntu 18.04 using the steps below:

See the OLD steps

⚠️ UPDATE: The instructions below are not working anymore on my new system. For installing the real-time kernel on ubuntu 20.04 or higher see my new comment.

Ubuntu 18.04 (kernel 5.4.26) instructions

  1. Install the following necessary dependencies apt-get install build-essential bc curl ca-certificates fakeroot gnupg2 libssl-dev lsb-release libelf-dev bison flex liblz4-tool libncurses-dev libssl-dev (The liblz4-tool dependency is added here since it is not installed by default on ubuntu 18.04)
  2. Download the regular kernel and the patch from the Linux Kernel archive
  3. Verifying file integrity
  4. Unzip the Linux kernel tar -xvf Linux-5.4.26.tar
  5. Go into the kernel folder cd linux-5.4.26
  6. Apply the patch patch -p1 < ../patch-5.4.26-rt17.patch
  7. Run make menuconfig and change the Preemption Model to Fully Preemptible Kernel (RT) (PREEMPT_RT_FULL) (NEW) (see this stack question for more info)
  8. Disable debug info scripts/config --disable DEBUG_INFO (Not needed but recommended).
  9. Run make clean
  10. Make the bzImage make -j $(nproc) bzImage
  11. Make the modules make -j $(nproc) modules
  12. Install the modules make -j $(nproc) modules_install
  13. Install the kernel make -j $(nproc) install

I did not test your instructions for kernel versions lower than 5.0 or ubuntu versions lower than 18.04.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 4
  • Comments: 20 (2 by maintainers)

Commits related to this issue

Most upvoted comments

@rickstaa I tried your (OLD) instructions with the same Ubuntu version (18.04) and kernel version (5.4.26) and got the following error. Did you encounter any errors like this?

caris@machine:~/linux-5.4.26$ make -j $(nproc) modules_install
cp: cannot stat './modules.builtin.modinfo': No such file or directory
Makefile:1307: recipe for target '_modinst_' failed
make: *** [_modinst_] Error 1

Hi @rickstaa , Thanks for your elaborate testing on this bit! I am trying to install a real-time kernel with Ubuntu 2204. I tried to install the RT kernel following the document, however it failed in the ‘make -j$(nproc) deb-pkg’ process where I got some error similar to this one. Specifically, I first tried to install the RT 6.2.1 kernel with my current 6.2.0-34-generic kernel running, as the document says we’d better pick the closest version, the full commands are:

 $   uname -a
 $   sudo apt-get install build-essential bc curl ca-certificates gnupg2 libssl-dev lsb-release libelf-dev bison flex dwarves zstd libncurses-dev
 $   mkdir rtk
 $   cd rtk/
 $   curl -SLO https://www.kernel.org/pub/linux/kernel/v6.x/linux-6.2.1.tar.xz
 $   curl -SLO https://www.kernel.org/pub/linux/kernel/v6.x/linux-6.2.1.tar.sign
 $   curl -SLO https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/6.2/patch-6.2-rt3.patch.xz
 $   curl -SLO https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/6.2/patch-6.2-rt3.patch.sign
 $   xz -d *.xz
 $   gpg2 --verify linux-*.tar.sign
 $   gpg2 --verify patch-*.patch.sign
 $   tar xf linux-*.tar
 $   cd linux-*/
 $   patch -p1 < ../patch-*.patch
 $   cp -v /boot/config-$(uname -r) .config
 $   make olddefconfig
 $   make menuconfig
 $   make -j$(nproc) deb-pkg

This failed after around 15 mins and showed something like:

...
  CC [M]  drivers/comedi/drivers/ni_labpc_common.o
  CC [M]  drivers/comedi/drivers/ni_labpc_isadma.o
  LD [M]  drivers/iio/pressure/st_pressure.o
  CC [M]  drivers/comedi/drivers/comedi_8255.o
  CC [M]  drivers/infiniband/hw/hfi1/debugfs.o
  CC [M]  drivers/comedi/drivers/8255.o
  CC [M]  drivers/comedi/drivers/amplc_dio200_common.o
  CC [M]  drivers/comedi/drivers/amplc_pc236_common.o
  CC [M]  drivers/comedi/drivers/das08.o
  LD [M]  drivers/comedi/drivers/ni_routing.o
  LD [M]  drivers/infiniband/hw/hfi1/hfi1.o
make[3]: *** [Makefile:2021: .] Error 2
make[2]: *** [debian/rules:7: build-arch] Error 2
dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2
make[1]: *** [scripts/Makefile.package:90: deb-pkg] Error 2
make: *** [Makefile:1665: deb-pkg] Error 2

Later, I also tried first installing the 6.2.1 kernel with a tool called Ukuu Mainline following here, and then rebooted and selected the 6.2.1 kernel (used “uname -r” to confirm it). After that, I ran exactly the same steps from the Franka document. And it still met the same error. Could you please give me some suggestions on this bit? Many thanks, Bourne

By the way, when I tried to run the command ‘make -j$(nproc) deb-pkg’ again after the previous error showed up, this time it didn’t do the build that long and stopped within 10 seconds with this error:

(franka) bourne@bourne:~/dev/franka/rtk/linux-6.2.1$ make -j$(nproc) deb-pkg
make clean
  CLEAN   arch/x86/lib
  CLEAN   crypto/asymmetric_keys
  CLEAN   arch/x86/crypto
  CLEAN   init
  CLEAN   arch/x86/kvm
  CLEAN   arch/x86/entry/vdso
  CLEAN   drivers/accessibility/speakup
  CLEAN   kernel/debug/kdb
  CLEAN   security/apparmor
  CLEAN   arch/x86/kernel/cpu
  CLEAN   net/bpfilter
  CLEAN   usr
  CLEAN   arch/x86/kernel
  CLEAN   lib/raid6
  CLEAN   arch/x86/purgatory
  CLEAN   arch/x86/realmode/rm
  CLEAN   security/selinux
  CLEAN   lib
  CLEAN   arch/x86/tools
  CLEAN   security/tomoyo
  CLEAN   kernel
  CLEAN   drivers/eisa
  CLEAN   drivers/firmware/efi/libstub
  CLEAN   net/wireless
  CLEAN   fs/unicode
  CLEAN   drivers/gpu/drm/radeon
  CLEAN   drivers/net/wan
  CLEAN   drivers/scsi/aic7xxx
  CLEAN   drivers/tty/vt
  CLEAN   drivers/scsi
  CLEAN   .
sh ./scripts/package/mkdebian
  TAR     linux-upstream.tar.gz
origversion=$(dpkg-parsechangelog -SVersion |sed 's/-[^-]*$//');\
	mv linux-upstream.tar.gz ../linux-upstream_${origversion}.orig.tar.gz
dpkg-buildpackage -r"fakeroot -u" -a$(cat debian/arch)  -i.git -us -uc
dpkg-buildpackage: info: source package linux-upstream
dpkg-buildpackage: info: source version 6.2.1-rt3-2
dpkg-buildpackage: info: source distribution jammy
dpkg-buildpackage: info: source changed by bourne <bourne@bourne>
dpkg-buildpackage: info: host architecture amd64
 dpkg-source -i.git --before-build .
 debian/rules clean
rm -rf debian/*tmp debian/files
make clean
 dpkg-source -i.git -b .
dpkg-source: info: using source format '1.0'
dpkg-source: warning: source directory 'linux-6.2.1' is not <sourcepackage>-<upstreamversion> 'linux-upstream-6.2.1-rt3'
dpkg-source: warning: .orig directory name linux-6.2.1.orig is not <package>-<upstreamversion> (wanted linux-upstream-6.2.1-rt3.orig)
dpkg-source: info: building linux-upstream using existing linux-upstream_6.2.1-rt3.orig.tar.gz
dpkg-source: info: building linux-upstream in linux-upstream_6.2.1-rt3-2.diff.gz
dpkg-source: error: cannot represent change to vmlinux-gdb.py:
dpkg-source: error:   new version is symlink to /home/bourne/dev/franka/rtk/linux-6.2.1/scripts/gdb/vmlinux-gdb.py
dpkg-source: error:   old version is nonexistent
dpkg-source: warning: ignoring deletion of file .scmversion
dpkg-source: warning: the diff modifies the following upstream files: 
 .clang-format
 .cocciconfig
 .config.old
 .get_maintainer.ignore
 .mailmap
 .rustfmt.toml
 .version
 CREDITS
 MAINTAINERS
 README
dpkg-source: info: use the '3.0 (quilt)' format to have separate and documented changes to upstream files, see dpkg-source(1)
dpkg-source: error: unrepresentable changes to source
dpkg-buildpackage: error: dpkg-source -i.git -b . subprocess returned exit status 1
make[1]: *** [scripts/Makefile.package:90: deb-pkg] Error 1
make: *** [Makefile:1665: deb-pkg] Error 2

I am able to install the RT kernel with Ubuntu 22.04 now thanks to my genius fellow. And here is the solution:

Follow all the lines posted here.

Before sudo make, you need to modify these lines in the .config file copied from /boot/config-xxxx-generic:

CONFIG_SYSTEM_TRUSTED_KEYS="debian/canonical-certs.pem"

Change this to this:

CONFIG_SYSTEM_TRUSTED_KEYS=""

And

CONFIG_SYSTEM_REVOCATION_KEYS="debian/canonical-revoked-certs.pem"

to

CONFIG_SYSTEM_REVOCATION_KEYS=""

(The latter key has been added to the default Canonical kernel configuration since some time.)

As we disable the keys, instead of make -j$(nproc) deb-pkg, we just used make -j$(nproc) omitting deb-pkg. Otherwise we would meet some errors related to the dpkgs-source.

FYI, my current kernel is 6.2.0-34-generic and the RT kernel I installed is 6.2.1-rt3. I tried kernel 5.15.96-rt61 which also worked. My experience is: when you do make -j$(nproc) deb-pkg, if there is any error prompt, it probably does not show the real error caused by debian package or configuration. Might be wrong with this bit.

Reference:

  1. https://www.acontis.com/en/building-a-real-time-linux-kernel-in-ubuntu-preemptrt.html
  2. https://askubuntu.com/questions/1329538/compiling-the-kernel-5-11-11
  3. My genius fellow.

It’s good to learn that you cracked the code on your issue! Thanks for sharing the solution here so other users can use it in the future! 🌟

Hi @rickstaa ,

Thanks for your elaborate testing on this bit!

I am trying to install a real-time kernel with Ubuntu 2204. I tried to install the RT kernel following the document, however it failed in the ‘make -j$(nproc) deb-pkg’ process where I got some error similar to this one.

Specifically, I first tried to install the RT 6.2.1 kernel with my current 6.2.0-34-generic kernel running, as the document says we’d better pick the closest version, the full commands are:

 $   uname -a
 $   sudo apt-get install build-essential bc curl ca-certificates gnupg2 libssl-dev lsb-release libelf-dev bison flex dwarves zstd libncurses-dev
 $   mkdir rtk
 $   cd rtk/
 $   curl -SLO https://www.kernel.org/pub/linux/kernel/v6.x/linux-6.2.1.tar.xz
 $   curl -SLO https://www.kernel.org/pub/linux/kernel/v6.x/linux-6.2.1.tar.sign
 $   curl -SLO https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/6.2/patch-6.2-rt3.patch.xz
 $   curl -SLO https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/6.2/patch-6.2-rt3.patch.sign
 $   xz -d *.xz
 $   gpg2 --verify linux-*.tar.sign
 $   gpg2 --verify patch-*.patch.sign
 $   tar xf linux-*.tar
 $   cd linux-*/
 $   patch -p1 < ../patch-*.patch
 $   cp -v /boot/config-$(uname -r) .config
 $   make olddefconfig
 $   make menuconfig
 $   make -j$(nproc) deb-pkg

This failed after around 15 mins and showed something like:

...
  CC [M]  drivers/comedi/drivers/ni_labpc_common.o
  CC [M]  drivers/comedi/drivers/ni_labpc_isadma.o
  LD [M]  drivers/iio/pressure/st_pressure.o
  CC [M]  drivers/comedi/drivers/comedi_8255.o
  CC [M]  drivers/infiniband/hw/hfi1/debugfs.o
  CC [M]  drivers/comedi/drivers/8255.o
  CC [M]  drivers/comedi/drivers/amplc_dio200_common.o
  CC [M]  drivers/comedi/drivers/amplc_pc236_common.o
  CC [M]  drivers/comedi/drivers/das08.o
  LD [M]  drivers/comedi/drivers/ni_routing.o
  LD [M]  drivers/infiniband/hw/hfi1/hfi1.o
make[3]: *** [Makefile:2021: .] Error 2
make[2]: *** [debian/rules:7: build-arch] Error 2
dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2
make[1]: *** [scripts/Makefile.package:90: deb-pkg] Error 2
make: *** [Makefile:1665: deb-pkg] Error 2

Later, I also tried first installing the 6.2.1 kernel with a tool called Ukuu Mainline following here, and then rebooted and selected the 6.2.1 kernel (used “uname -r” to confirm it). After that, I ran exactly the same steps from the Franka document. And it still met the same error.

Could you please give me some suggestions on this bit?

Many thanks, Bourne

By the way, when I tried to run the command ‘make -j$(nproc) deb-pkg’ again after the previous error showed up, this time it didn’t do the build that long and stopped within 10 seconds with this error:

(franka) bourne@bourne:~/dev/franka/rtk/linux-6.2.1$ make -j$(nproc) deb-pkg
make clean
  CLEAN   arch/x86/lib
  CLEAN   crypto/asymmetric_keys
  CLEAN   arch/x86/crypto
  CLEAN   init
  CLEAN   arch/x86/kvm
  CLEAN   arch/x86/entry/vdso
  CLEAN   drivers/accessibility/speakup
  CLEAN   kernel/debug/kdb
  CLEAN   security/apparmor
  CLEAN   arch/x86/kernel/cpu
  CLEAN   net/bpfilter
  CLEAN   usr
  CLEAN   arch/x86/kernel
  CLEAN   lib/raid6
  CLEAN   arch/x86/purgatory
  CLEAN   arch/x86/realmode/rm
  CLEAN   security/selinux
  CLEAN   lib
  CLEAN   arch/x86/tools
  CLEAN   security/tomoyo
  CLEAN   kernel
  CLEAN   drivers/eisa
  CLEAN   drivers/firmware/efi/libstub
  CLEAN   net/wireless
  CLEAN   fs/unicode
  CLEAN   drivers/gpu/drm/radeon
  CLEAN   drivers/net/wan
  CLEAN   drivers/scsi/aic7xxx
  CLEAN   drivers/tty/vt
  CLEAN   drivers/scsi
  CLEAN   .
sh ./scripts/package/mkdebian
  TAR     linux-upstream.tar.gz
origversion=$(dpkg-parsechangelog -SVersion |sed 's/-[^-]*$//');\
	mv linux-upstream.tar.gz ../linux-upstream_${origversion}.orig.tar.gz
dpkg-buildpackage -r"fakeroot -u" -a$(cat debian/arch)  -i.git -us -uc
dpkg-buildpackage: info: source package linux-upstream
dpkg-buildpackage: info: source version 6.2.1-rt3-2
dpkg-buildpackage: info: source distribution jammy
dpkg-buildpackage: info: source changed by bourne <bourne@bourne>
dpkg-buildpackage: info: host architecture amd64
 dpkg-source -i.git --before-build .
 debian/rules clean
rm -rf debian/*tmp debian/files
make clean
 dpkg-source -i.git -b .
dpkg-source: info: using source format '1.0'
dpkg-source: warning: source directory 'linux-6.2.1' is not <sourcepackage>-<upstreamversion> 'linux-upstream-6.2.1-rt3'
dpkg-source: warning: .orig directory name linux-6.2.1.orig is not <package>-<upstreamversion> (wanted linux-upstream-6.2.1-rt3.orig)
dpkg-source: info: building linux-upstream using existing linux-upstream_6.2.1-rt3.orig.tar.gz
dpkg-source: info: building linux-upstream in linux-upstream_6.2.1-rt3-2.diff.gz
dpkg-source: error: cannot represent change to vmlinux-gdb.py:
dpkg-source: error:   new version is symlink to /home/bourne/dev/franka/rtk/linux-6.2.1/scripts/gdb/vmlinux-gdb.py
dpkg-source: error:   old version is nonexistent
dpkg-source: warning: ignoring deletion of file .scmversion
dpkg-source: warning: the diff modifies the following upstream files: 
 .clang-format
 .cocciconfig
 .config.old
 .get_maintainer.ignore
 .mailmap
 .rustfmt.toml
 .version
 CREDITS
 MAINTAINERS
 README
dpkg-source: info: use the '3.0 (quilt)' format to have separate and documented changes to upstream files, see dpkg-source(1)
dpkg-source: error: unrepresentable changes to source
dpkg-buildpackage: error: dpkg-source -i.git -b . subprocess returned exit status 1
make[1]: *** [scripts/Makefile.package:90: deb-pkg] Error 1
make: *** [Makefile:1665: deb-pkg] Error 2

Sorry, I didn’t know that. Thanks for letting me know.

Hello @medashan,

you do know that libfranka is used for Panda robots not UR5s right? I suggest you open a ticket in their Github or, better yet, buy our robot 😉

Thank you all for solving this issue. We updated the documentation with the findings from you

I was actually able to resolve it by changing one of the config options based on this post.

scripts/config --set-str SYSTEM_TRUSTED_KEYS ""