losetup -d /dev/loop3: ioctl: LOOP_CLR_FD: Device or resource busy?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
losetup -d /dev/loop3: ioctl: LOOP_CLR_FD: Device or resource busy?
Hi, I'm trying to delete a loop device, but I keep getting the setting "ioctl: LOOP_CLR_FD: Device or resource busy". I thought it might be because it's still mounted, but it's not mounted.
# losetup -d /dev/loop3
ioctl: LOOP_CLR_FD: Device or resource busy
# mount
/dev/sda4 on / type ext3 (rw,noatime,errors=remount-ro)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
usbfs on /proc/bus/usb type usbfs (rw)
tmpfs on /lib/modules/2.6.12-9-amd64-generic/volatile type tmpfs (rw,mode=0755)
/dev/sda2 on /boot type ext2 (rw,noatime)
tmpfs on /dev type tmpfs (rw,size=10M,mode=0755)
# losetup -d /dev/loop3
ioctl: LOOP_CLR_FD: Device or resource busy
A call to ps ax | grep loop3 gives me the following:
# ps ax | grep loop3
31319 ? S< 0:00 [loop3]
2465 pts/8 R+ 0:00 grep loop3
So I think ps 31319 is a zombie. I tried to kill -9 that 31319 process, but nothing. Is it time for a reboot?
Using the mount command obviously doesn't show what /dev/loop3 is attached to. Try using losetup -a. That will show the loop devices and their targets. If the problem and its resolution doesn't become immediately clear to you then post the results of the losetup -a command.
# losetup --a
losetup: unrecognized option --a
usage:
losetup loop_device # give info
losetup -d loop_device # delete
losetup -f # find unused
losetup [ options ] {-f|loop_device} file # setup
where options include
--offset <num>, -o <num>
start at offset <num> into file.
--pass-fd <num>, -p <num>
read passphrase from file descriptor <num>
instead of the terminal.
--encryption <cipher>, -e <cipher>
encrypt with <cipher>.
Check /proc/crypto or /proc/crypto/cipher for available ciphers.
--nohashpass, -N
Don't hash the password given. (previous versions hash, non-debian doesn't.
--keybits <num>, -k <num>
specify number of bits in the hashed key given
to the cipher. Some ciphers support several key
sizes and might be more efficient with a smaller
key size. Key sizes < 128 are generally not
recommended
Did you read the posting rules?? You reopened a FIVE YEAR OLD thread. Open your own thread for your own question.
Did you read the previous posts, too?? The losetup -a will SHOW YOU what's there. Read the man page, and pay attention to the -d (hint: the DELETE option)
Yes I read it. It says duplicate discussions might be frustrating for readers
And there are also things about reopening dead threads, and posting your own question in someone elses.
Quote:
And I do not know how five years matter
You don't???? Did it not occur to you that the software may have CHANGED in five years??
Quote:
And ya I know losetup -a just "shows me". I just showed you what it showed me
losetup -d loop_device -> this must have detached the device. But it still gives the same device busy error. It still shows up in losetup -a.
And reboot caused a bit havoc.
man page:
"-d Detach the file or device associated with the specified loop device"
Well. I'll get back with the solution and the reason soon.
Thanks TBOne
You never bothered posting what you did with the "-d", or mention anything about getting a device busy error before now. Again, read the posting rules and guidelines. Providing ALL details about a question will get you answers....not providing them won't. You are still not telling us version/distro of Linux you're using, what the EXACT message(s) are when you type in the command, or what the exact command you're typing in IS. From what you've told us:
You're getting a device busy error ("same as" what, we don't know)
You're using Linux (version/distro we don't know)
You're trying to detach a loop device (you provided a list, but didn't say which one you're having problems with)
You rebooted, and have "a bit havoc" (you don't say WHAT happened after the reboot.
Unless you provide details and ask a clear question, no one can help you.
As it is in my very 1st post,
from "above", I meant same as what phyx faced, And the fact that I'm still facing the same issue after 5years, tells me that nothing much has changed.
Was RHEL5 available 5 years ago? How about the version of losetup...that unchanged after five years?? Do not reopen old threads, period....open your own.
Quote:
Here is my story(sorry as it might seem the duplicate of phyx's):
There are 3 loop devices being used by 3 iso files.
losetup -a shows:
which is giving me:
ioctl: LOOP_CLR_FD: Device or resource busy
Note that /dev/loop2 got detached without complaints. Reboot caused "full_02_1002.iso" to get deleted!!!
Linux distro: RHEL-5
Ok. Have you tried doing an a losetup -d on the specific device, like "/dev/loop0" and "/dev/loop1"? Have you checked the permissions on the ISO images, and the mount point they point to? Also, have you just tried mounting the ISO's with the mount command instead?
Code:
mount -o loop /path/to/ISO/filename.iso
then use the standard umount command on it? Does dmesg have anything to say about the /dev/loopxx devices?
Since you've told us you're using RHEL, have you contacted RHEL support, since you're paying for it with your RHEL subscription?? From their knowledgebase, there was a bug reported (and fixed) in RHEL5, regarding this very issue. If you're paying for patches/updates, it should be easy to fix. If you're not....then you can either pay and get the patches, or reload CentOS instead.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.