WSL Ubuntu 22.04 LTS gzip:/usr/bin/gunzip: 57: exec: gzip: Exec format error

created at 05-30-2022 views: 82


Recently tried Ubuntu 22.04 LTS in WSL and found a strange bug in the unzipped file:

/usr/bin/gunzip: 57: exec: gzip: Exec format error

The first reaction was to reinstall gzip and found that the problem was still there. Tried removing gzip and got the following message about forbidden removal:

The following packages will be REMOVED:
WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 250 kB disk space will be freed.
E: Removing essential system-critical packages is not permitted. This might break the system.


Instantly dumbfounded. Googled for a long time but still no solution. Suddenly a flash of light, could it be that the WSL version is too low and incompatible with Ubuntu 22.04 LTS? Take a look at the WSL version is 1, upgrade to 2 generation:

wsl --set-version Ubuntu-22.04 2

Problem solved after update~

created at:05-30-2022
edited at: 05-30-2022: