Univention UCS as KVM guest - Discard operation not supported

Hi folks,

I currently run a proxmox pve as my VM host and this bad boy recently got NVMe disks. So far, so good.
For my guests - whereas the ucs is one of them - I need to run fstrim (which also enables thin provisioned disks to reclaim space in that case)

Sadly I run into the following error message:

root@ucs:~# fstrim -v /
fstrim: /: the discard operation is not supported

So I did some digging and found out that you need a kernel greater than 5 to get fstrim running. Sadly UCS runs a pretty debian kernel.

root@ucs:~# uname -a
Linux ucs 4.9.0-12-amd64 #1 SMP Debian 4.9.210-1+deb9u1 (2020-06-07) x86_64 GNU/Linux

Do you guys have a backports repo that could be used?

UCS 4.4-x is based on Debian 9 and Univention has eventually settled on shipping only a slightly modified (and for UEFI secure boot: signed) Kernel. There is a likelyhood you could run a Debian kernel with it but it won’t be supported and should be used in a production environment as only the Kernel shipped with UCS is supported by Univention. :slight_smile:

There is no backport kernel as of writing and you should expect a more recent kernel within 5.0 when it gets released.

That’s what I was afraid of.

I built an upstream-kernel by using the config from /boot to get discard working as backports do not have a kernel greater v5 - for anyone interested, here’s a quick way of doing so:

  1. Install build tools: apt-get install build-essential linux-source bc kmod cpio cpio libncurses5-dev and get a flex package from debian 9
  2. Get the kernel sources from kernel.org
    Kernel sources are shipped in the xz format of writing this post
  3. Unpack the kernel by using tar
    example: tar xJf linux-5.7.9.tar.xz
  4. Copy the running kernel config over to the unpacked sources to be .config
    example: cd path/to/kernel-sources/ && cp /boot/config-4.9.0-12-amd64 .config
  5. Run make oldconfig (you will be asked a few questions - defaults are ok most of the time)
    5.1 If you are familiar with building kernels, you can review its options and slim it down by removing unneeded drivers using make menuconfig
  6. Run make deb-pkg
  7. Install the new kernel by installing the resulting .deb packages from the parent directory using dpkg -i
  8. Reboot and test

If you messed up, you can revert to your old kernel by selecting it from the GRUB boot screen and remove the kernel and run update-grub to revert things done.