Ubuntu

From BitFolk
Jump to: navigation, search

Issues to be aware of when using Ubuntu at BitFolk.

Note that non-LTS releases will not be discussed here, so for example none of the 19.x releases will be covered.

20.04 (Focal Fossa) and beyond

No support for 32-bit

As of 20.04 Ubuntu no longer supports 32-bit x86, so those currently on 32-bit 18.04 will be unable to upgrade.

Resolution

Users will need to reinstall.

Or could try to cross-grade 32- to 64-bit, which is certainly possible but is completely unsupported by both Ubuntu and BitFolk and is arguably more work than just reinstalling.

Workarounds

There are no workarounds. 18.04 is in theory supported by Ubuntu until 2023 even on i686 but if upgrading further you will have to reinstall.

No support for LZ4-compressed kernels at BitFolk

As of 19.10 Ubuntu switched to compressing its kernels with LZ4. At the time of writing (May 2020) BitFolk's boot loader does not support LZ4 kernels. It will report something like:

not a Xen kernel

…and then go back to the bootloader menu. This is because the PV kernel part of the grub bootloader doesn't recognise LZ4 compression.

Resolution

Either LZ4 support will need to be added to pvgrub or BitFolk will need to switch to PVH mode. BitFolk is (at the time of writing) preparing to switch to PVH mode but isn't ready yet.

Workarounds

Decompress your kernel

Since the problem here is the type of compression used on the kernel image and not any actual functionality of the kernel, you can decompress your kernel image manually and then it will work without issue. This can be done in a kernel post-install hook script.

This workaround has already been applied to VMs ordered brand new or installed using the BitFolk installer. Only those upgrading from a previous version of Ubuntu need to do something like this.

Requirements
  • A working VM. If your VM doesn't currently boot you can select the previous (18.04) kernel and that will work well enough to complete this procedure.
  • lz4 utility which is part of the lz4 package; normally comes with the base Ubuntu install.
  • readelf utility which is part of the binutils package.
  • extract-vmlinux script available from the Linux kernel repository. Put in /usr/local/sbin/.
  • BitFolk's kernel post-install hook. Put it in /etc/kernel/postinst.d/.
Procedure
$ sudo apt install binutils lz4
### Download "extract-vmlinux" script and make it executable
$ curl https://raw.githubusercontent.com/torvalds/linux/master/scripts/extract-vmlinux | sudo tee /usr/local/sbin/extract-vmlinux >/dev/null
$ sudo chmod -c +x /usr/local/sbin/extract-vmlinux
### Download the kernel post-install hook and make it executable
$ curl https://raw.githubusercontent.com/bitfolk/decompress-lz4-kernels/master/bitfolk-decompress-lz4-kernels | sudo tee /etc/kernel/postinst.d/bitfolk-decompress-lz4-kernels >/dev/null
$ sudo chmod -c +x /etc/kernel/postinst.d/bitfolk-decompress-lz4-kernels
### Verify that the current kernel is compressed (bzImage). Note that the kernel version number may be different to that shown below.
$ sudo file /boot/vmlinuz-5.4.0-29-generic
/boot/vmlinuz-5.4.0-29-generic: Linux kernel x86 boot executable bzImage, version 5.4.0-29-generic (buildd@lgw01-amd64-035) #33-Ubuntu SMP Wed Apr 29 14:32:27 UTC 2020, RO-rootFS, swap_dev 0xB, Normal VGA
### Force reinstall of the kernel package so the hook gets called. Note that the package name may be different due to a different version number.
$ sudo apt reinstall linux-image-5.4.0-29-generic
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 to upgrade, 0 to newly install, 1 reinstalled, 0 to remove and 0 not to upgrade.
Need to get 8,871 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://apt-cacher.lon.bitfolk.com/ubuntu/gb.archive.ubuntu.com/ubuntu focal-updates/main amd64 linux-image-5.4.0-29-generic amd64 5.4.0-29.33 [8,871 kB]
Fetched 8,871 kB in 0s (25.8 MB/s)                     
(Reading database ... 50238 files and directories currently installed.)
Preparing to unpack .../linux-image-5.4.0-29-generic_5.4.0-29.33_amd64.deb ...
Unpacking linux-image-5.4.0-29-generic (5.4.0-29.33) over (5.4.0-29.33) ...
Setting up linux-image-5.4.0-29-generic (5.4.0-29.33) ...
Processing triggers for linux-image-5.4.0-29-generic (5.4.0-29.33) ...
/etc/kernel/postinst.d/bitfolk-decompress-lz4-kernels:
LZ4-compressed kernel /boot/vmlinuz-5.4.0-29-generic found; decompressing...
(This is a BitFolk-specific customisation. Please see https://tools.bitfolk.com/wiki/Ubuntu for more information.)
Successfully decompressed /boot/vmlinuz-5.4.0-29-generic.
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.4.0-29-generic
/etc/kernel/postinst.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.4.0-29-generic
Found initrd image: /boot/initrd.img-5.4.0-29-generic
done
### Verify that the kernel image is no longer compressed (ELF 64-bit LSB executable).
$ sudo file /boot/vmlinuz-5.4.0-29-generic
/boot/vmlinuz-5.4.0-29-generic: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, BuildID[sha1]=e54a270642a361346d36d5be07edb8d2bfa3fe10, stripped

Now reboot.

Recompile a kernel that doesn't use LZ4 compression

It should work to:

  1. Take the regular Ubuntu kernel source package.
  2. Adjust its kernel config so that it doesn't use LZ4 compression. Choosing any of XZ, Bzip2, Gzip or even no compression should work.
  3. Rebuild it without any other changes.

That sounds a lot harder than the above option so it isn't yet documented here but if you do this please feel free to add your instructions here.

18.04 (Bionic Beaver) and beyond

The switch to netplan for configuring networking

By default in this release Ubuntu stopped using ifupdown (as configured in /etc/network/interfaces) to configure its networking, instead using netplan. netplan is supposed to ignore interfaces that are defined in /etc/network/interfaces but it doesn't seem to do that reliably, so those upgrading from earlier Ubuntu releases can experience networking problems. This is not a BitFolk bug.

Resolution

Migrate to netplan

BitFolk recommends that all Ubuntu users migrate their configuration to netplan before upgrading to 18.04. A typical netplan configuration (in /etc/netplan/01-netcfg.yaml) at BitFolk looks like this:

network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      addresses:
        - "85.119.82.225/21"
        - "85.119.83.73/32"
        - "2001:ba8:1f1:f004::2/64"
        - "2001:ba8:1f1:f004::22/128"
        gateway4: "85.119.80.1"
        gateway6: "2001:ba8:1f1:f004::1"

This assumes:

  • A main IPv4 address of 85.119.82.225.
  • An additional IPv4 address of 85.119.83.73.
  • An assigned IPv6 network of 2001:ba8:1f1:f004::/64.
  • An extra IPv6 address of 2001:ba8:1f1:f004::22/128 configured.

To update the config and then make it live:

$ sudo netplan generate
$ sudo netplan apply