Device or resource busy while trying to open

Bug #656526 reported by Subjucha on 2010-10-07
68
This bug affects 14 people
Affects Status Importance Assigned to Milestone
e2fsprogs (Ubuntu)
Undecided
Unassigned
Nominated for Lucid by Subjucha
Nominated for Maverick by Subjucha

Bug Description

Binary package hint: e2fsprogs

After a system crash my Ubuntu didn´t want to boot due some problems in Ext4 filesystem. I was trying to repair filesystem with booting from Ubuntu LiveCD and run fsck.ext4 and e2fsck. But both programs said me that:

fsck.ext4: Device or resource busy while trying to open /dev/sda1
Filesystem mounted or opened exclusively by another program?

But this partition wasn´t mounted, I checked it with mount command.

ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: e2fsprogs 1.41.11-1ubuntu2
ProcVersionSignature: Ubuntu 2.6.32-25.44-generic 2.6.32.21+drm33.7
Uname: Linux 2.6.32-25-generic i686
Architecture: i386
Date: Fri Oct 8 00:25:35 2010
InstallationMedia: Ubuntu-Netbook 10.04 "Lucid Lynx" - Release i386 (20100429.4)
ProcEnviron:
 LANG=ru_RU.UTF-8
 SHELL=/bin/bash
SourcePackage: e2fsprogs

Subjucha (subjucha) wrote :
Subjucha (subjucha) on 2010-10-07
description: updated
Ulisses Penna (uspenna) wrote :

Exactly the same problem here.
After Ubuntu 10.04 crashed I tried, using a 10.10 live CD, run a "fsck -y" and received the following message:

ubuntu@ubuntu:~$ LANG=en sudo fsck -y /dev/sda10
fsck from util-linux-ng 2.17.2
fsck.ext4: Device or resource busy while trying to open /dev/sda10
Filesystem mounted or opened exclusively by another program?

Even the FS is not mounted as you can see:

ubuntu@ubuntu:~$ mount
aufs on / type aufs (rw)
none on /proc type proc (rw,noexec,nosuid,nodev)
none on /sys type sysfs (rw,noexec,nosuid,nodev)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
none on /dev type devtmpfs (rw,mode=0755)
none on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
/dev/sr0 on /cdrom type iso9660 (ro,noatime)
/dev/loop0 on /rofs type squashfs (ro,noatime)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
none on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev)
none on /var/run type tmpfs (rw,nosuid,mode=0755)
none on /var/lock type tmpfs (rw,noexec,nosuid,nodev)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
gvfs-fuse-daemon on /home/ubuntu/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=ubuntu)
ubuntu@ubuntu:~$

The disk partition table is:

ubuntu@ubuntu:~$ LANG=en sudo fdisk -l /dev/sda

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x31883188

   Device Boot Start End Blocks Id System
/dev/sda1 * 1 650 5221093+ b W95 FAT32
/dev/sda2 651 9729 72927067+ f W95 Ext'd (LBA)
/dev/sda5 651 663 104391 82 Linux swap / Solaris
/dev/sda6 664 676 104391 83 Linux
/dev/sda7 677 689 104391 82 Linux swap / Solaris
/dev/sda8 690 754 522081 82 Linux swap / Solaris
/dev/sda9 755 3941 25599546 83 Linux
/dev/sda10 3942 7128 25599546 83 Linux
/dev/sda11 7129 9729 20892501 83 Linux
ubuntu@ubuntu:~$

If I run fsck in ext3 partitions everything goes ok:

ubuntu@ubuntu:~$ LANG=en sudo fsck -a /dev/sda11
fsck from util-linux-ng 2.17.2
/dev/sda11: clean, 217060/2616320 files, 3828007/5223125 blocks
ubuntu@ubuntu:~$

Ulisses Penna (uspenna) wrote :

Using a Ubuntu 10.04 live CD the problem does nota happen and the "fsck -y /dev/sda10" fixes the file system.
Coincidence?

Subjucha (subjucha) wrote :

I also was using a 10.10 live CD after crash of Ubuntu 10.04.
The vesrions of e2fsprogs that contains fsck are different in Ubuntu 10.04 and 10.10:

10.10 has newer version 1.41.12-1ubuntu2
http://packages.ubuntu.com/search?keywords=e2fsprogs&searchon=names&suite=maverick&section=all

and 10.04 has older version 1.41.11-1ubuntu2
http://packages.ubuntu.com/search?keywords=e2fsprogs&searchon=names&suite=lucid&section=all

Is it possible that new version has a bug?

I'm having the same problem. Unable to rescue 10.04 with 10.10 livecd. I probably should have recorded the initial error message, but it has now changed to "No init found. Try passing init= bootarg." then drops me to a very minimal shell with the prompt "(initramfs) "

I will be trying the aforementioned attempts at running fsck.ext4 with a 10.04 livecd.

I've tried to run fsck.ext4 from an Ubuntu 10.04 LiveCD, but I can't boot the LiveCD. It hangs at the loading screen, where the dots alternate between white and orange.

When I try to boot my HD installation of 10.04, I get a message saying: "no init found, Try passing init= bootarg"

I've also tried to do a fresh install with 10.10, but the installation freezes. I'm starting to believe my hard drive is hosed.

Adam Reichold (adamreichold) wrote :

This is especially frustrating, as a even a user who has understood the concept of a necessary filesystem check is left with the "No init found. Try passing init= bootarg." error message without reference to a silently failed e2fsck or the ability to run it from the livecd. Also, a simple use of Knoppix or some other livecd will probably fix the filesystem corruption in minutes. (At least, it did for me.)

(By the way, the palimpsest also fails silently under these conditions.)

Walter Jerusalinsky (walterjj) wrote :

Same problem here... my root desktop fs running 10.04 crashed and 10.10 liveCD did not work for fsck ( device busy, bla bla ) ....but an old 9.10 liveCD solved the situation in minutes.-

blinkblink (thomasthoma) wrote :

I confirm that this bug affects ubuntu 10.10 live CD, and that a 9.10 liveCD works perfectly.
A friend of mine couldn't boot into Ubuntu 10.10 anymore, after a hard shutdown ("no init found" etc)
Luckily I found this bug report, thank you guys!

It would be nice for the noobs to have an easy way to fix the filesystem when grub can't boot it.
Thanks again.

siriusab (wen8411) wrote :

Exactly same problem here. After struggling with the live CD of 10.04 and 10.10 for several hours without success, Ubuntu 9.10 live cd fixed my unbootable ext4 partition in minutes. Thanks for the early posts.

Adam Koczur (sbv) wrote :

So, it has been half a year now and this bug is still "new" and the importance is "Undecided"? This bug is not new any more and it is critical! I have 10.10 based file server and for some reason one of its file systems got corrupted (the other one has quotas corrupted, they need to be recalculated, but that's a different story) and I can't use LiveCD to repair it. It should be doable without OS restart required. Gents, some of our systems are not just a home toys.
Can I have a clear answer when this serious issue is planned to be fixed?

Subjucha (subjucha) wrote :

I'm who started this bug report. Right now I noticed that Launchpad writes "e2fsprogs doesn't use Launchpad to track its bugs". If so, the developers doesn't know about this bug report. I'm sorry if this happens through the mistaken project name. Maybe we have to choose another project name that affected by this bug? Which?

Subjucha (subjucha) on 2011-06-08
Changed in e2fsprogs (Ubuntu):
status: New → Incomplete
Theodore Ts'o (tytso) wrote :

E2fsprogs upstream doesn't use Launchpad to track its bugs, because the interface is horrible from a developer's perspective. That's a separate issue though.

This is a known problem which is fixed upstream in the latest maintenance release of e2fsprogs.

When and how Ubuntu decides to backport fixes to older releases of Ubuntu us not under my control.

Theodore Ts'o (tytso) wrote :

By the way, this problem doesn't happen for all file systems, just for ones where both the primary and backup superblock or block group descriptors look corrupted.

Adam Koczur (sbv) wrote :

Well, whatever it is, I know this has been fixed upstream and apparently it's only a matter of backporting it to 10.10 and other releases. Anyway, I am trying to backport Natty's version myself and will upload it to my ppa once it's ready.

Adam Koczur (sbv) wrote :

I have successfully ported Natty's e2fsprogs back to Maverick and still there is a problem. Looks like it is related to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=549691 which is rather LVM / Device Mapper issue and not e2fsprogs.
Basically, I have a logical volume with ext4 on it, which got corrupted. The filesystem is unmounted and fsck, even the recent version, keeps saying:

e2fsck 1.41.14 (22-Dec-2010)
fsck.ext4: Device or resource busy while trying to open /dev/mapper/vg-trash
Filesystem mounted or opened exclusively by another program?

then:
lvchange -v -a n /dev/vg/trash
    Using logical volume(s) on command line
    Deactivating logical volume "trash"
    Found volume group "vg"
  LV vg/trash in use: not deactivating

and finally:
dmsetup remove /dev/mapper/vg-trash
device-mapper: remove ioctl failed: Device or resource busy
Command failed

Looks like I am nowhere with it...

spirit (account-1) wrote :

I got this problem as well. This is the system of one of my roommates.

She has Windows XP and Ubuntu 10.04 in dual-boot, after a crash Ubuntu won't start and complains that init was missing at boot:

  "No init found. Try passing init= bootarg."

I started from an Ubuntu 10.10 live CD and ran fsck from a terminal, but it says:

  fsck.ext4: Device or resource busy while trying to open /dev/mapper/vg-trash
  Filesystem mounted or opened exclusively by another program?

What's the solution to all this? Would it be possible to fix this bug by downloading and using a newer Live CD of Ubuntu? If so, which version is the first one that will work?

Can I fix the bug with a newer CD but still keep the old system (10.04)? She's not interested in updating her whole system every other day (every 6 months) and it's no coincidence she is running the LTS version, but if only installing a newer version of the OS helps I'd do that, too.

Thanks for any hints,

spirit

Adam Reichold (adamreichold) wrote :

@spirit: You can fix the file system using the newest live CD without upgrading the system. Just run fsck from the live CD, it won't change the installed system. (Actually, you can use a live CD from a completely different distribution such as Knoppix as well.)

Colin-mcewan (colin-mcewan) wrote :

I've just run into this issue. Having checked out and built the latest e2fsprogs from git, I get the same error:

colin@myth:~/Programs/e2$ sudo ./e2fsck/e2fsck /dev/sdb1
e2fsck 1.42-WIP (02-Jul-2011)
./e2fsck/e2fsck: Device or resource busy while trying to open /dev/sdb1
Filesystem mounted or opened exclusively by another program?

So, not <em>entirely</em> fixed upstream :/

John Rose (johnaaronrose) wrote :

Yesterday I made a clean install of Lucid on a full hard disk using 10.04.2 LiveCD and upgraded fully (but not to subsequent releases). After problem with freezing screen, I attempted to fix with one of solutions documented elsewhere. This lead to computer refusing to reboot: it came up with problem on boot (stopped at busybox initramfs prompt). When I attempted to fix this using Lucid 10.04.2 LiveCD it hung. So I attempted to fix with CLI commands resulting in mount problems. So I used a boot-repair cd (download iso from http://sourceforge.net/projects/boot-repair-cd/files/) to reboot. Worked perfectly (even fixing hard disk problems) without even having to fix grub and then booted directly into hard disk resident Lucid.

Tomse (tomse-tomse) wrote :

still an issue here.

trying to fix 10.04LTS server
Having tried the following CDs 9.10 server, 10.04LTS server, 12.04LTS server

All of them returning

Device or resource busy while trying to open /dev/sda5
Filesystem mounted or opened exclusively by another program?

Sam Hamilton (sam-sh81) wrote :

I am also getting this issue when using 12.04.1

Subjucha (subjucha) on 2012-10-11
Changed in e2fsprogs (Ubuntu):
status: Incomplete → Confirmed
Subjucha (subjucha) wrote :

Here is similar bug report on Launchpad where the developer of e2fsprogs (affected package) participates the discussion:
https://bugs.launchpad.net/ubuntu/+source/e2fsprogs/+bug/711799

The developer of e2fsprogs is Theodore Ts'o:
https://launchpad.net/~tytso
http://en.wikipedia.org/wiki/Theodore_Ts'o

I've asked him to take a look at this bug report.

Theodore Ts'o (tytso) wrote :

This is not a problem which anyone else (using Fedora, Debian, etc) has complained about. Nor have I ever seen the problem on Lucid on my Goobuntu laptop running Lucid or Precise.

What I would suggest is that you download the e2fsprogs sources, and then after you build it, build lib/ext2fs/tst_ismounted

cd lib/ext2fs
make tst_ismounted

This is a debugging program which uses the mechanism used by e2fsprogrs to determine whether a device is busy or not:

# ./tst_ismounted /dev/closure/u1
Device /dev/closure/u1 reports flags 00
# mount /dev/closure/u1
# ./tst_ismounted /dev/closure/u1
Device /dev/closure/u1 reports flags 11
 /dev/closure/u1 is apparently in use.
 /dev/closure/u1 is mounted.
 /dev/closure/u1 is mounted on /u1.
# umount /dev/closure/u1
# e2fsck -f /dev/closure/u1
e2fsck 1.43-WIP (21-Sep-2012)
Pass 1: Checking inodes, blocks, and sizes
^Z
[1]+ Stopped e2fsck -f /dev/closure/u1
# ./tst_ismounted /dev/closure/u1
Device /dev/closure/u1 reports flags 10
 /dev/closure/u1 is apparently in use.

# ./tst_ismounted /dev/sdb1
Device /dev/sdb1 reports flags 13
 /dev/sdb1 is apparently in use.
 /dev/sdb1 is mounted.
 /dev/sdb1 is the root filesystem.
 /dev/sdb1 is mounted on /.

# ./tst_ismounted /dev/sdb5
Device /dev/sdb5 reports flags 19
 /dev/sdb5 is apparently in use.
 /dev/sdb5 is mounted.
 /dev/sdb5 is a swap device.
 /dev/sdb5 is mounted on <swap>.

Vadim Kotov (kotov) wrote :

Found a solution for this, posted here : http://superuser.com/a/427005
* Boot from a live Ubuntu CD
* Remove the first inode
sudo debugfs -w /dev/sda1
debugfs 1.41.11 (14-Mar-2010)
debugfs: clri <8>
debugfs: quit
* Restart into Live CD again and do
sudo fsck -yv /dev/sda1

It will work this time.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.