Bug 493333

Summary: anaconda ntfsresize mount error
Product: [Fedora] Fedora Reporter: Robert de Rooy <rderooy>
Component: anacondaAssignee: David Cantrell <dcantrell>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: low    
Version: rawhideCC: anaconda-maint-list, davidz, katzj, pjones, rmaximo, tcallawa, vanmeeuwen+fedora
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-04-29 16:27:35 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
traceback none

Description Robert de Rooy 2009-04-01 13:42:39 UTC
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:
trackback

Expected results:
resize to work

Additional info:

Comment 1 Robert de Rooy 2009-04-01 13:43:15 UTC
Created attachment 337524 [details]
traceback

Comment 2 David Cantrell 2009-04-03 20:31:01 UTC
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 20:39:22 UTC
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 21:06:57 UTC
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 15:32:16 UTC
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 18:20:41 UTC
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 19:23:36 UTC
Should be fixed in anaconda-11.5.0.42-1

Comment 8 Robert de Rooy 2009-04-29 16:27:35 UTC
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.