site  contact  subhomenews

Busybox umount does not free loop device

April 01, 2020 — BarryK

This one took me by surprise. If a loop device, say /dev/loop0, is mounted on a mount-point, running the 'umount' command from the util-linux package on the mount-point, will unmount it and also automatically free the loop device.
I have been expecting this behaviour for so many years, that I got caught out when I discovered that the busybox 'umount' does not automatically free the loop device.

lp-dolittle (Puppy Forum name) had reported that he updated EasyPup and when it booted up, it found the save-file for the previous version, and asked if want to use it. He declined, then on the desktop found that the save-file was still mounted, though not actually being used. Also, the partition where the save-file was located, was also mounted and could not be unmounted. EasyPup is running in RAM, so there shouldn't be any partitions mounted.

I have been puzzling over this most of today, studying the 'init' script in the initrd. Finally, the penny dropped, I discovered that Busybox umount needs an explicit "-d" to free the loop device, like "umount -d <mount point>".

Success, it booted up into RAM only, no save-file or partitions mounted.  Note, Busybox in the initrd is version 1.30.1. 

Tags: easy