Open tazihad opened 8 months ago
Does losetup -d
work for you? I see it's set as autoclear=1
, perhaps it's still used by the system. E.g. /run/media/user/LMDE 5 Cinnamon 64-bit
. Try unmounting that before calling loop detach.
@tbzatek sudo losetup -d /dev/loop0
doesn't do anything with no output.
@tbzatek
sudo losetup -d /dev/loop0
doesn't do anything with no output.
Then I think it works as expected. See the losetup(8)
manpage:
-d, --detach loopdev...
Detach the file or device associated with the specified loop device(s). Note that since Linux v3.7 kernel uses "lazy device
destruction". The detach operation does not return EBUSY error anymore if device is actively used by system, but it is marked by
autoclear flag and destroyed later.
When you unmount partitions from the loop device, does it disappear?
@tbzatek using losetup -d
does give Autoclear=1
. But how do I delete the loop device without sudo?
❯ losetup -l
NAME SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE DIO LOG-SEC
/dev/loop0 0 0 0 1 /var/home/user/Downloads/lmde-5-cinnamon-64bit.iso 0 512
❯ sudo losetup -d /dev/loop0
[sudo] password for user:
❯ losetup -l
NAME SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE DIO LOG-SEC
/dev/loop0 0 0 1 1 /var/home/user/Downloads/lmde-5-cinnamon-64bit.iso 0 512
Check your previous lsblk
output:
├─loop0p1 259:0 0 1.9G 1 part /run/media/user/LMDE 5 Cinnamon 64-bit
You need to unmount this first.
Any luck?
@tbzatek no. I tried to create a Plasma widget. But I wanted remove disk without using sudo. Unfortunately I can't. Maybe you can close the issue with close as not planned.
Well as I said, you need to unmount everything that comes out of the loop block device first. I.e. if any partitions are detected as part of a loop setup, you need to iterate through these object and unmount those first.
OS: Fedora Kinoite 39 udisks2 ver: udisks2-2.10.1-1.fc39.x86_64
Trying to delete loop device using
loop-delete
but it doesn't work.No output. Disk still exist.
lsblk
shows this: