Re: `losetup --remove` is confusing, and misuse silently fails
Nuno Silva <[email protected]> Sat, 11 Oct 2025 11:16:45 +0100
| Newsgroups | org.kernel.vger.util-linux |
|---|---|
| Message-ID | <[email protected]> |
On 2025-10-10, Benno Schulenberg wrote: > After setting up a loop device with: > > # ./losetup loop4 some.img > > I wanted to see what happens when trying to "remove" it > (since the man page says it is "not recommended"): > > # ./losetup -R loop4 > > There is no feedback, but it failed: > > # echo $? > 1 > > When a command fails, shouldn't it print an error message? For all commands after this one in your message, where there was no output, what was the exit status? [...] > Trying a different order of the options: > > # ./losetup -d -R loop4 > losetup: /dev/-R: detach failed: No such file or directory > > Huh? Why does it try to interpret an option as a loop device name? The online manual here says that -d takes one argument, so my understanding is that that is expected? (Just as for -R, apparently:) > # ./losetup -d loop4 -R > /home/ben/Sources/util-linux/.libs/losetup: option requires an argument -- 'R' > Try 'losetup --help' for more information. > > # ./losetup -d loop4 -R loop4 > > Oh. Surprisingly, this last invocation worked. [...] -- Nuno Silva