Running CMS OpenData containers in WSL2

The CMS OpenData containers (or other containers based on CentOS6 or older) exit without doing anything in WSL2 when you run e.g.

docker run --name opendata -it cmsopendata/cmssw_5_3_32 /bin/bash

If you run docker events in another terminal at the same time, you can observe that it dies with exit=139 (seg. fault).

This is solved by adding a new file .wslconfig with

[wsl2]
kernelCommandLine = vsyscall=emulate

in \Users[username] (without extension), shutting down with wsl --shutdown and restarting again.

Test that the settings are properly passed with

docker run -ti ubuntu cat /proc/cmdline      

The output should contain vsyscall=emulate , e.g.:

initrd=\initrd.img panic=-1 pty.legacy_count=0 nr_cpus=4 vsyscall=emulate  

Take note that a common problem is that when the file .wslconfig is created, Windows assigns a filename extension (e.g. .txt) to it and the new settings do not take effect. Rename the file and retry. You can see the files of the Windows filesystem also in the Linux shell in path /mnt/c.
For example, this file is visible in

$ ls /mnt/c/Users/<your-windows-user-name>/.wsl*
/mnt/c/Users/<your-windows-user-name>/.wslconfig

If it appears as .wslconfig.txt, rename is to .wslconfig