EDIT 2023-07-25: This answer was written before 22.04 when they changed df
to no longer list loop
mounts. Now you can use lsblk
to show the loops.
It is giving you that message because /dev/loop0
is already in use. If you run the command of df -h
(disk free) which shows you all your mounts that are in use as well as all the /dev/loop#
mounts. Pick the next /dev/loop#
that is not in use for your command.
Example:
df -h
Filesystem Size Used Avail Use% Mounted on
udev 7.8G 0 7.8G 0% /dev
tmpfs 1.6G 6.9M 1.6G 1% /run
/dev/sde1 212G 92G 109G 46% /
tmpfs 7.9G 49M 7.8G 1% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 7.9G 0 7.9G 0% /sys/fs/cgroup
/dev/loop0 9.2M 9.2M 0 100% /snap/canonical-livepatch/95
/dev/loop1 172M 172M 0 100% /snap/qt551/27
/dev/loop2 161M 161M 0 100% /snap/gnome-3-28-1804/116
/dev/loop3 227M 227M 0 100% /snap/wine-platform-runtime/136
/dev/loop4 63M 63M 0 100% /snap/gtk-common-themes/1506
/dev/loop5 94M 94M 0 100% /snap/core/9066
/dev/loop6 173M 173M 0 100% /snap/qt551/28
/dev/loop7 55M 55M 0 100% /snap/core18/1705
/dev/loop8 94M 94M 0 100% /snap/core/8935
/dev/loop9 55M 55M 0 100% /snap/gtk-common-themes/1502
/dev/loop10 74M 74M 0 100% /snap/wine-platform-3-stable/6
/dev/loop11 141M 141M 0 100% /snap/gnome-3-26-1604/98
/dev/loop12 55M 55M 0 100% /snap/core18/1754
/dev/loop13 55M 55M 0 100% /snap/bitwarden/24
/dev/loop14 227M 227M 0 100% /snap/wine-platform-runtime/123
/dev/loop15 55M 55M 0 100% /snap/bitwarden/23
/dev/loop16 157M 157M 0 100% /snap/gnome-3-28-1804/110
/dev/loop17 141M 141M 0 100% /snap/gnome-3-26-1604/97
/dev/sdf2 224G 173G 51G 78% /media/Windows
/dev/sdh1 932G 774G 159G 84% /media/1TB_SHARE
/dev/sdg1 466G 268G 199G 58% /media/WD500GB
/dev/sda1 233G 177G 57G 76% /media/250GB_SHARE
/dev/sdd1 466G 85G 382G 19% /media/ST500GB
/dev/sdc1 466G 284G 182G 61% /media/500GB
/dev/sdb1 2.8T 963G 1.8T 35% /media/Seagate
as we can see in the above /dev/loop0-17
are all in use, so the next one we can use is /dev/loop18
for the command.
sudo losetup /dev/loop18 raspbian-20200505.img -o $((532480*512))
df -h
it will show you all the/dev/loop#
that are in use. Pick the next one that is not in use like/dev/loop18
or something like that. – Terrance May 24 '20 at 05:12