Bug 892747

Summary: mountpoint not set for existing btrfs subvol when specified via kickstart
Product: [Fedora] Fedora Reporter: Gene Czarcinski <gczarcinski>
Component: anacondaAssignee: David Lehman <dlehman>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: anaconda-maint-list, g.kaviyarasu, jonathan, samuel-rhbugs, sbueno, vanmeeuwen+fedora, vgulch
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: anaconda-20.25.4-1.fc20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1019510 (view as bug list) Environment:
Last Closed: 2013-11-05 03:39:14 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1019510    
Attachments:
Description Flags
Patch to kickstart.py for Fedora 19
none
fix btrfs subvolume support for existing subvolumes
none
Fedora 19 (anaconda 19.30.13-1) support exiting BTRFs subvolume
none
Fedora 20 (anaconda 20-22-1) existing BTRFS support with --noformat
none
anaconda-19.30.13-1 patch (for creating updates)
none
anaconda-20-22-1
none
fix anaconda-20.25.1-1
gczarcinski: review+
set subvol UUID so UUID is used in fstab - for anaconda-20.25.4-1 none

Description Gene Czarcinski 2013-01-07 18:08:18 UTC
Description of problem:
OK, support for btrfs has improved for single device btrfs volume.  Using kickstart, I can install into a new root subvol.  I can also specify reuse of an axisting subvol such as home IF I specify --useexisting.  Without that --useexisting anaconda crashes and it is instant reboot (could not gather any info)

Note: This contradicts current anaconda kickstart documentation which says --useexisting is not meaningful for s btrfs subvol.

Version-Release number of selected component (if applicable):
Fedora 18 RC1, anaconda 18.37.10

How reproducible:
everytime

Comment 1 Gene Czarcinski 2013-09-23 16:17:55 UTC
Still true.  Documentation still says that --useexisting has no meaning.  Yeah, right.

Comment 2 David Lehman 2013-09-27 21:31:53 UTC
Fixed kickstart doc on wiki today. I have a patch for the failure to set a mountpoint (which I see is not mentioned here at all) -- will send it for review on monday.

Comment 3 Gene Czarcinski 2013-09-28 06:40:30 UTC
Indeed!!!  The failure to set the mountpoint is the next problem I started to look at.  Lucky for me, you have already identified this and have a patch!  Thank you.  If you have an update file I can use to test against (F20 alpha or whatever), I will test it.

Comment 4 Gene Czarcinski 2013-09-28 13:26:22 UTC
I assume that this current response is the result of my messages on the mailing lists.  I have no idea why my initial report did not mention that, while --useexisting get rid of the error condition, the subvolume was not in /etc/fstab as a mount point.

Actually, this has only become a larger problem for me as I have begun to make more use of btrfs and more use of multiple, separate btrfs volumes.  My extreme case is where I have a "system" btrfs volume on a small SSD, a separate btrfs volume which has the home subvolume among others, and a third btrfs subvolume for data storage.

Currently, I am using a post install script to append entries to /etc/fstab to get around the problem of missing mount points.

Comment 5 Gene Czarcinski 2013-10-07 18:42:25 UTC
ping.

I only recently (today) became aware that there was an anaconda patch mailing list.  Checking that and the git repository, I do not see any fix for this problem.

I tried coming up with something myself but it is not as easy as it appears.  On the surface of it, it looks like adding a couple of lines of code --

class BTRFSData(commands.btrfs.F17_BTRFSData):
...
        if self.preexist: 
...
           dev.format.mountpoint = self.mountpoint
           dev.format.mountopts = "subvol=%s" % (self.name)

This is similar to what is done for logvol and partitions BUT ... it does not work
and the actual root is home/root2

If I do not define mountopts, the the /etc/fstab has subvolid=0 and things are still screwed up.

Like a said, a bit more complicated and well beyond my understanding of how anaconda and python work.

Sure would like to test your patch.

Comment 6 Gene Czarcinski 2013-10-10 16:19:28 UTC
The light-bulb just lit up ... once I figured out what was right/wrong, the fix is simple.  I will post my version of a patch later today.

Two questions/problems:

1.  I am getting a device rather than a UUID in /etc/fstab ... need to see how to drive getting UUID.

2.  Currently, the test if for self.preexist ... should not the test also include "not self.format" since for the btrfs command, they can be used interchangably?

Comment 7 Gene Czarcinski 2013-10-10 19:20:16 UTC
Created attachment 810721 [details]
Patch to kickstart.py for Fedora 19

1, still not getting UUID in /etc/fstab
2. tested against anaconda-19.30-13 installing Fedora 19
3. Working on similar patch for Fedora 20 anaconda 20.22-1

Comment 8 Gene Czarcinski 2013-10-10 19:44:38 UTC
Created attachment 810724 [details]
fix btrfs subvolume support for existing subvolumes

Build on Fedora 20 TC1 system, tested installing Fedora 20 TC2 system with anaconda-20-22-1.

Comment 9 Gene Czarcinski 2013-10-11 17:31:49 UTC
OK, the UUID thing looks like it really is a bug ... the problem is that the fstabSpec attribute for the the "existing" btrfs subvolume has a value of /dev/___ that than UUID=____

Other regular partitions or new BTRFS subvolumes correctly have UUID= in /etc/fstab

Comment 10 Gene Czarcinski 2013-10-12 14:25:03 UTC
Created attachment 811586 [details]
Fedora 19 (anaconda 19.30.13-1) support exiting BTRFs subvolume

The patch add support for existing BTRFS subvolumes to be added to /etc/fstab if --noformat is specified.  Also, if either --useexiting or --noformat can now be specified for a BTRFS existing volume.

Comment 11 Gene Czarcinski 2013-10-12 14:33:10 UTC
Created attachment 811587 [details]
Fedora 20 (anaconda 20-22-1) existing BTRFS support with --noformat

This fix adds support for an existing BTRFS subvolume with --noformat specified to be added to /etc/fstab with the correct UUID= of the parent BTRFS volume.

This patch also changes things so that either --noformat or --useexisting can be used on an existing BTRFS volume specification.

A BTRFS specification with --useexisting specified is currently ignored.  This could "easily" be turned into the equivalent of "reformat" by scheduling a subvolume delete action before then doing the create.

Yes, there was nothing wrong with the fstabSpec property code, the property being executed was different from the one I expected.

Comment 12 Gene Czarcinski 2013-10-12 19:51:51 UTC
Another point ... although the documentation has been updated, it is still incorrect.  Both --useexisting and --noformat have NO meaning for a BTRFS volume and the volume specification is ONLY done when the volume is created.  One or more partition statements are used to define and existing BTRFS volume.

Therefore, --noformat (and possibly --useexisting) can only have a possible meaning with respect to a subvolume.

It has taken me a little time to realize that this is how the code really works.

Comment 13 Gene Czarcinski 2013-10-13 12:28:20 UTC
Created attachment 811736 [details]
anaconda-19.30.13-1 patch (for creating updates)

slightly revised

Comment 14 Gene Czarcinski 2013-10-13 12:31:12 UTC
Created attachment 811737 [details]
anaconda-20-22-1

slightly revised.  Build on Fedora 20 beta-TC1+ system and then tested by installing with Beta-TC2+all-repos

Comment 15 Fedora Update System 2013-10-17 00:25:43 UTC
anaconda-20.25.1-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/anaconda-20.25.1-1.fc20

Comment 16 Fedora Update System 2013-10-17 20:30:22 UTC
Package anaconda-20.25.1-1.fc20, python-blivet-0.23.1-1.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing anaconda-20.25.1-1.fc20 python-blivet-0.23.1-1.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-19194/python-blivet-0.23.1-1.fc20,anaconda-20.25.1-1.fc20
then log in and leave karma (feedback).

Comment 17 Gene Czarcinski 2013-10-18 07:54:41 UTC
OK, since I need python-blivet-0.23.1-1, AND it is in Beta-TC5, I gave that a try.

NOTHING IS FIXED!  And from what I see in the code, this is what I expect!

Please, PLEASE look at the patches attached to this report AND the code that is done for both logical volume and regular partitions.  That is what I did.

You need two additional lines of code after the 
    device.format.mountpoint = self.mountpoint
and they are:
    device.format.mountopts = "subvol=%s" % (self.name)
    device.format.uuid = dev.uuid

The first one sets the proper subvol name and the second provides the UUID of the parent (the BTRFS volume).  Without the UUID, the /dev/___ will be used.

Comment 18 Gene Czarcinski 2013-10-18 08:12:25 UTC
I also noticed that swap is no longer listed in /etc/fstab ... was this intentional?  I am not sure (and from comments in the code, other are not either) why it ever was listed.

However, I can also understand that just because you have a volume that looks like it is swap does not mean that you want it used for swap so there is a good reason for having it listed in /etc/fstab.  I hope this does not break something.

BTW, to arrive at needing all three of the above three lines of code, I sat patently tracing anaconda install both the kickstart part and the install part to see what actually happened and what code actually was executed.

Comment 19 Gene Czarcinski 2013-10-18 12:07:40 UTC
swap is a bug: https://bugzilla.redhat.com/show_bug.cgi?id=1020867

Comment 20 Gene Czarcinski 2013-10-18 13:19:45 UTC
Oh my, one step forward, fourteen back. I took mu "little" advice and created an updates image for TC5 ... oops, still no existing BTRFS subvol in /etc/fstab.  I am suspicious of the changes to python-blivet.

Comment 21 Gene Czarcinski 2013-10-18 13:21:58 UTC
Question: what was "wrong" with my proposed patch for fixing existing subvolumes?  It used exactly the same approach as that used for regular partitions and logical volumes.  Whatever change was made seems to have screwed up handling of swap as a side effect.

Comment 22 Gene Czarcinski 2013-10-18 15:42:38 UTC
Created attachment 813828 [details]
fix anaconda-20.25.1-1

OK, this will fix 20.25.1 so that it really works.

device.format needs some stuff se ... not device.  Setting:
    device.format.mountpoint = self.mountpoint
actually gets it added to the queue.

Comment 23 Fedora Update System 2013-10-22 05:37:17 UTC
anaconda-20.25.1-1.fc20, python-blivet-0.23.1-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 24 Gene Czarcinski 2013-10-22 18:07:37 UTC
This problem is not fixed by anaconda-20.25.1 and python-blivet-0.23.1-1 as available in Fedora-20-Beta-TC5 as I have previously stated.

Comment 25 Fedora Update System 2013-10-26 01:10:50 UTC
anaconda-20.25.4-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/anaconda-20.25.4-1.fc20

Comment 26 Fedora Update System 2013-10-26 18:49:27 UTC
Package anaconda-20.25.4-1.fc20, pykickstart-1.99.44-1.fc20, python-blivet-0.23.2-1.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing anaconda-20.25.4-1.fc20 pykickstart-1.99.44-1.fc20 python-blivet-0.23.2-1.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-20033/pykickstart-1.99.44-1.fc20,python-blivet-0.23.2-1.fc20,anaconda-20.25.4-1.fc20
then log in and leave karma (feedback).

Comment 27 Gene Czarcinski 2013-10-27 16:51:19 UTC
Already did that.  Fixes "good enough for now" and submitted patch to fix getting UUID in fstab.  I will also attach that patch here.

Comment 28 Gene Czarcinski 2013-10-27 16:54:42 UTC
Created attachment 816542 [details]
set subvol UUID so UUID is used in fstab - for anaconda-20.25.4-1

Comment 29 Fedora Update System 2013-11-05 03:39:14 UTC
anaconda-20.25.4-1.fc20, pykickstart-1.99.44-1.fc20, python-blivet-0.23.2-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.