Categories: GamingRetro gamesTech

PiShrink using Windows 10 Windows Subsystem for Linux 2 (WSL 2) – Part 1

PiShrink in WSL2 works if you create the proper symlink

This finally works. No more Virtual machines just to run PiShrink.

That said – there is one workaround (very simple) you must do.
I’ll walk through the steps of confirming you have or installing WSL2, Debian, PiShrink and “patch” in other posts but assuming you’ve already followed the WSL2 install, and have installed Ubuntu or Debian, and mounted your external drive in Linux (via WSL2), and downloaded PiShrink, you might be getting this error:

ext2fs_check_if_mount: Can’t check if filesystem is mounted due to missing mtab file while determining whether /dev/loop0 is mounted

So before I go through the process for those that are starting from scratch, the fix for that error is quite easy. I’ll explain the cause of it later, but first – the fix.

You simply need to create a symlink between the /proc/self/mounts file and the (non-existent in WSL/WSL2) /etc/mtab by entering the following line:
sudo ln -s /proc/self/mounts /etc/mtab

Et voila, now run PiShrink and it should work.

For those of you that need the step by step process starting from upgrading your Windows 10 to use WSL2, follow this link to my instruction page: How to use WSL2 for PiShrink

 

————- More info on /etc/mtab and /proc/self/mounts in WSL/WSL2 and newer Linux distros if you’re interested below ——————–

Debian (or Ubuntu and likely other images) fail in WSL2 with pishrink because pishrink looks for the /etc/mtab file to determine mounts.

The mtab file (/etc/mtab) is a legacy from Unix to store mounted locations. It was included in many (most) Linux distros to ensure backward compatibility and Posix/Unix compatibility.

More recently, most Linux distros create a symlink between the replacement file (/proc/self/mounts) and the legacy /etc/mtab file.

Windows Subsystem for Linux (1 and 2) do not include that symlink, which is why you must create yourself.

timekills

Recent Posts

2022 Buffalo Bills season games

You can select the week you want to watch by pressing the cog icon in…

3 months ago

PiShrink using Windows 10 Windows Subsystem for Linux 2 (WSL 2) – Part 2 or “How I Learned to Stop Worrying and Install WSL2)

1. How to tell if you have Windows Subsystem for Linux (WSL) version 1 or…

4 years ago

Grant Excerpt

Grant is tired of hearing about Lee's mystique

4 years ago

Win32 Disk Imager fails to start

There are a number of reasons online that are given for Win32 Disk Imager failing…

4 years ago

Free Bird: The Return of the Buffalo Bills

If you aren't already familiar with his work as a Bills fan, check out Connor…

4 years ago

29 December 2019: Jets at Bills

Although this game didn't matter because the Bills lost to the Patriots the week prior…

4 years ago