Bug 493333 - anaconda ntfsresize mount error
anaconda ntfsresize mount error
Product: Fedora
Classification: Fedora
Component: anaconda (Show other bugs)
All Linux
low Severity high
: ---
: ---
Assigned To: David Cantrell
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2009-04-01 09:42 EDT by Robert de Rooy
Modified: 2009-04-29 12:27 EDT (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-04-29 12:27:35 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
traceback (116.03 KB, text/plain)
2009-04-01 09:43 EDT, Robert de Rooy
no flags Details

  None (edit)
Description Robert de Rooy 2009-04-01 09:42:39 EDT
Description of problem:
Launching F11 Beta i586 LiveCD on an ThinkPad X22 with WinXP installed on NTFS.

Choosing the option to install to HDD and selecting to resize existing partition.

This causes a traceback. It seems that it mounts the NTFS partition to detect the size and the later ntfsresize fails because the partition is already mounted.

Version-Release number of selected component (if applicable):
F11 Beta i586 LiveCD

How reproducible:
try to resize NTFS partition during install

Steps to Reproduce:
1. System with NTFS partition
2. start F11 Beta LiveCD
3. start install to HDD and choose to resize existing partition
Actual results:

Expected results:
resize to work

Additional info:
Comment 1 Robert de Rooy 2009-04-01 09:43:15 EDT
Created attachment 337524 [details]
Comment 2 David Cantrell 2009-04-03 16:31:01 EDT
Based on what I can see, the problem is that /etc/mtab is not getting updated when the filesystem is unmounted.  On the regular install media, /etc/mtab is a symlink to /proc/mounts.  On the livecd, it appears to be a real file.

The filesystem does actually get unmounted and mount point is removed, but the /etc/mtab file still contains a line which confuses ntfsresize, among other programs.

You can use the F-11 Beta Live CD to perform an install in your case, you'll just need to change /etc/mtab before running 'Install to Hard Drive'.  Do this:

1) From Applications, System Tools, choose Terminal
2) In the terminal window, run the following commands:

su -
ln -sf /proc/mounts /etc/mtab

Then you can run the installer.

For livecd-tools maintainer(s):

My guess is around line 540 in imgcreate/creator.py that removes mtab is the culprit.  The symlink to /proc/mounts is made, but then it's removed.  But this is just a guess, I did not run livecd-creator or anything.
Comment 3 Jeremy Katz 2009-04-03 16:39:22 EDT
In the live environment, /etc/mtab is intentionally a normal file and not the symlink; we only use the symlink when building a livecd not during operation.

The problem is that anaconda's unmount just calls umount(2) and doesn't do anything to care about /etc/mtab
Comment 4 Jeremy Katz 2009-04-03 17:06:57 EDT
16.53.54 <halfline> anything that reads /etc/mtab is broken too
16.54.17 <halfline> since it's not public api, just a private implementation detail
16.58.04 <dcantrell> jeremy: yeah, so libntfs/volume.c in ntfsprogs has ntfs_check_if_mounted() which first tries to read mtab.  reassign the bug there
Comment 5 Tom "spot" Callaway 2009-04-06 11:32:16 EDT
Okay, so I tried to fix this in libntfs, but here's the problems:

libntfs is using the {set,get,end}mntent() calls to check whether a device node is mounted. Contrary to what Ray said in comment 4, those are public API for glibc. It also looks to see if the mount is read-only, or if the device is mounted at /.

We could scrape the mount flags out of /proc/mounts, but because of how /proc/mounts works, we have no way to see if the device node is mounted at /.

For example, on my laptop, /dev/sda3 is mounted at /:

[spot@velociraptor devel]$ grep /dev/sda3 /etc/mtab
/dev/sda3 / ext3 rw 0 0

But, if I search /proc/mounts for /dev/sda3:

[spot@velociraptor devel]$ grep /dev/sda3 /proc/mounts 
[spot@velociraptor devel]$ 

[spot@velociraptor devel]$ grep "/ " /proc/mounts 
rootfs / rootfs rw 0 0
/dev/root / ext3 rw,relatime,errors=continue,user_xattr,acl,data=ordered 0 0

So, we can't scrape through /proc/mounts reliably. You're going to need to make an /etc/mtab. Reassigning to anaconda.
Comment 6 David Zeuthen 2009-04-06 14:20:41 EDT
You can use /proc/self/mountinfo; that file exposes dev_t to fix the problem with using device nodes for identification (which in itself is broken). Available since at least 2.6.26, maybe earlier.

Or you can wait for libmount in an upcoming util-linux-ng release.
Comment 7 David Cantrell 2009-04-09 15:23:36 EDT
Should be fixed in anaconda-
Comment 8 Robert de Rooy 2009-04-29 12:27:35 EDT
I tried again with the F11-Preview-i686-Live LiveCD.

The first time I got an error:1 which was not really informative, as no additional information was displayed.

I booted back into windows, to make sure the filesystem was consistent and did a clean shutdown. after this the resize succeeded.

Note You need to log in before you can comment on or make changes to this bug.