Running Ubuntu 23.04 on Parallels Desktop 18

Sat, 22 Apr 2023 12:00:00 +0000

One way to run Linux on a M1 Mac is so use Parallels Desktop. However, Linux Kernel 6.2 is not yet supported by the Parallels Guest Tools, so we need a workaround.

Parallels Desktop 18 allows running Linux (and Windows) on macOS machines using aarch64 ("Apple Silicon") CPUs.

The official support list says that Ubuntu 22.04 (Jammy) is the latest supported version.

Ubuntu 23.04 was released recently, and I decided to dist-upgrade the Linux guest in Parallels VM to this new version, which comes with Linux Kernel version 6.2.

Trying to install/update the modules fails with these error messages:

ERROR: modpost: GPL-incompatible module prl_tg.ko uses GPL-only symbol 'log_post_write_mmio'
ERROR: modpost: GPL-incompatible module prl_tg.ko uses GPL-only symbol 'log_post_read_mmio'
ERROR: modpost: GPL-incompatible module prl_tg.ko uses GPL-only symbol 'log_read_mmio'
ERROR: modpost: GPL-incompatible module prl_tg.ko uses GPL-only symbol 'log_write_mmio'

The reason for this error seems to be that some new symbols in the kernel have been marked as GPL-only (meaning they cannot be linked to GPL-incompatible kernel modules), which have been introduced in this commit.

The sources in /usr/src/parallels-tools-18.2.0.53488 don't contain direct calls to these functions. The prl_tg.ko module is built from these sources and is apparently called the "Parallels ToolGate" kernel module.

However, the inline functions in include/asm-generic/io.h contain calls to the above-mentioned functions (and it seems to be the only place where those functions are called), and if you objdump -d the prl_tg.ko module, you can see that there are a few MMIO-related calls in various functions, such as tg_do_work(), tg_req_cancel_all(), prl_tg_interrupt() and others, most likely generated due to macro expansion and inlining.

Module License

The problem is that prl_tg.ko is declared as having a license of "Parallels", whereas the kernel expects any module linking against the GPL-only symbols to have a compatible license.

The license is specified in the following file:

/usr/src/parallels-tools-18.2.0.53488/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.c

The problematic line in this file is this:

MODULE_LICENSE("Parallels");

Now, if the module license would be "GPL", then the kernel would be happy to build the module. Maybe in the future Parallels releases their kernel module code in some way that's compatible with the Kernel license, or they update the module sources to not link against GPL-only modules.

See also this Stack Exchange answer and the articles linked from there dealing with GPL-only kernel symbols and non-GPL'd kernel modules and everything that this entails.

Workaround: Remove kernel 6.2.0

This results in an unbootable system, as the kernel modules are not built and the initramfs isn't updated. You can, however, still boot into the system by selecting an older kernel (in my case, 5.19.0-29-generic) that has been installed from a previous Ubuntu release (this can be done in the GRUB menu using "Advanced options for Ubuntu" and then selecting the kernel version).

Since it's tedious to do this, you can also for now just remove the incompatible kernel from your running system until Parallels releases a new version of their kernel modules:

sudo apt remove \
    linux-headers-6.2.0-20 \
    linux-image-6.2.0-20-generic \
    linux-modules-6.2.0-20-generic \
    linux-modules-extra-6.2.0-20-generic

This should then also update the bootloader and boot kernel 5.19.0 by default.

Reinstalling the latest kernel

In the future, when a new version of Parallels Tools is released that supports kernel 6.2.0 out of the box, you can reinstall the (as-of-then) latest kernel using:

sudo apt install \
    linux-image-generic \
    linux-headers-generic