DamionGans / ubuntu-wsl2-systemd-script

[Does not work anymore!] Script to enable systemd support on current Ubuntu WSL2 images
1.56k stars 382 forks source link

Installation prints an error "File does not contain a valid CIL image." #88

Open Yury-Fridlyand opened 1 year ago

Yury-Fridlyand commented 1 year ago

Hi The script returns an error:

Cannot open assembly '/mnt/c/Windows/System32/cmd.exe': File does not contain a valid CIL image.

Full output:

$ bash ubuntu-wsl2-systemd-script.sh
Hit:1 https://cli.github.com/packages stable InRelease
Get:2 https://download.mono-project.com/repo/ubuntu stable-focal InRelease [4416 B]
Get:3 https://packages.microsoft.com/ubuntu/20.04/prod focal InRelease [10.5 kB]
Get:4 https://download.mono-project.com/repo/ubuntu stable-focal/main amd64 Packages [46.9 kB]
Get:5 https://packages.microsoft.com/ubuntu/20.04/prod focal/main amd64 Packages [198 kB]
Get:6 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Hit:7 http://archive.ubuntu.com/ubuntu focal InRelease
Get:8 https://packages.microsoft.com/ubuntu/20.04/prod focal/main armhf Packages [27.5 kB]
Get:9 https://packages.microsoft.com/ubuntu/20.04/prod focal/main arm64 Packages [39.0 kB]
Get:10 https://packages.microsoft.com/ubuntu/20.04/prod focal/main amd64 Contents (deb) [2650 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:12 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [1780 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [2153 kB]
Get:15 http://security.ubuntu.com/ubuntu focal-security/main Translation-en [295 kB]
Get:16 http://security.ubuntu.com/ubuntu focal-security amd64 Contents (deb) [135 MB]
Get:17 http://archive.ubuntu.com/ubuntu focal-updates/main Translation-en [379 kB]
Get:18 http://archive.ubuntu.com/ubuntu focal-updates amd64 Contents (deb) [148 MB]
Get:19 http://security.ubuntu.com/ubuntu focal-security/main amd64 c-n-f Metadata [11.1 kB]
Get:20 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [1240 kB]
Get:21 http://security.ubuntu.com/ubuntu focal-security/restricted Translation-en [176 kB]
Get:22 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [735 kB]
Get:23 http://security.ubuntu.com/ubuntu focal-security/universe Translation-en [135 kB]
Get:24 http://security.ubuntu.com/ubuntu focal-security/universe amd64 c-n-f Metadata [15.2 kB]
Get:25 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 c-n-f Metadata [16.0 kB]
Get:26 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [1330 kB]
Get:27 http://archive.ubuntu.com/ubuntu focal-updates/restricted Translation-en [188 kB]
Get:28 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [964 kB]
Get:29 http://archive.ubuntu.com/ubuntu focal-updates/universe Translation-en [220 kB]
Get:30 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 c-n-f Metadata [21.6 kB]
Fetched 296 MB in 39s (7573 kB/s)
Reading package lists... Done
Cannot open assembly '/mnt/c/Windows/System32/cmd.exe': File does not contain a valid CIL image.
Cannot open assembly '/mnt/c/Windows/System32/cmd.exe': File does not contain a valid CIL image.

$ sudo !!
sudo bash ubuntu-wsl2-systemd-script.sh
It appears you have already installed the systemd hack.
To forcibly reinstall, run this script with the `--force` parameter.

$ sudo bash ubuntu-wsl2-systemd-script.sh --force
Hit:1 https://download.mono-project.com/repo/ubuntu stable-focal InRelease
Hit:2 https://cli.github.com/packages stable InRelease
Hit:3 https://packages.microsoft.com/ubuntu/20.04/prod focal InRelease
Hit:4 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:5 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:6 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:7 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Reading package lists... Done
Cannot open assembly '/mnt/c/Windows/System32/cmd.exe': File does not contain a valid CIL image.
Cannot open assembly '/mnt/c/Windows/System32/cmd.exe': File does not contain a valid CIL image.

Even though systemctl seems working. Perhaps, something might doesn't work properly