Bug 743647 - AttributeError: 'NoneType' object has no attribute 'path'
Summary: AttributeError: 'NoneType' object has no attribute 'path'
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Fedora
Classification: Fedora
Component: anaconda
Version: 16
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Anaconda Maintenance Team
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:48f9647a415c03452874b3584f9...
: 737306 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-10-05 15:56 UTC by Diego Calleja
Modified: 2012-07-08 19:04 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-10-05 17:05:36 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
File: anaconda-tb-qd0Q18 (740.11 KB, text/plain)
2011-10-05 15:56 UTC, Diego Calleja
no flags Details
storage.log obtained from after anaconda crashes (76.20 KB, text/plain)
2012-07-07 16:06 UTC, John Lumby
no flags Details

Description Diego Calleja 2011-10-05 15:56:09 UTC
libreport version: 2.0.5.982
executable:     /usr/bin/python
hashmarkername: anaconda
kernel:         3.1.0-0.rc6.git0.3.fc16.x86_64
product:        Fedora
reason:         AttributeError: 'NoneType' object has no attribute 'path'
time:           Wed Oct  5 17:55:37 2011
version:        16-Beta

anaconda-tb-qd0Q18: Binary file, 757870 bytes

description:
:The following was filed automatically by anaconda:
:anaconda 16.20 exception report
:Traceback (most recent call first):
:  File "/usr/lib64/python2.7/site-packages/pyanaconda/storage/__init__.py", line 2293, in mkDevRoot
:    dev = "%s/%s" % (instPath, root.path)
:  File "/usr/lib64/python2.7/site-packages/pyanaconda/storage/__init__.py", line 1336, in mkDevRoot
:    self.fsset.mkDevRoot()
:  File "/usr/lib64/python2.7/site-packages/pyanaconda/upgrade.py", line 241, in upgradeMountFilesystems
:    anaconda.storage.mkDevRoot()
:  File "/usr/lib64/python2.7/site-packages/pyanaconda/dispatch.py", line 373, in dispatch
:    self.dir = self.steps[self.step].target(self.anaconda)
:  File "/usr/lib64/python2.7/site-packages/pyanaconda/dispatch.py", line 241, in go_forward
:    self.dispatch()
:  File "/usr/lib64/python2.7/site-packages/pyanaconda/gui.py", line 1203, in nextClicked
:    self.anaconda.dispatch.go_forward()
:AttributeError: 'NoneType' object has no attribute 'path'

Comment 1 Diego Calleja 2011-10-05 15:56:24 UTC
Created attachment 526534 [details]
File: anaconda-tb-qd0Q18

Comment 2 Diego Calleja 2011-10-05 16:01:21 UTC
This happened with a F16 Beta install DVD after anaconda detected my current fedora15 install, it offered me to upgrade, and I clicked on "continue". The root filesystem is a btrfs subvolume.

Comment 3 David Lehman 2011-10-05 17:05:36 UTC
The only btrfs configurations supported at this time are single-device filesystems. We also do not support subvolumes unless the default subvolume is the only one mentioned in /etc/fstab.

Full support for most of btrfs' features will appear in F17.

Comment 4 Ales Kozumplik 2011-10-06 09:04:52 UTC
*** Bug 737306 has been marked as a duplicate of this bug. ***

Comment 5 Tomasz Torcz 2011-10-24 10:09:55 UTC
I hit this problem on preupgrade, on plain, single-partition, not subvolume btrfs filesystem. Anaconda's bugzilla reporter tells me that my bug is duplicate of #737306.


# findmnt -t btrfs
TARGET SOURCE    FSTYPE OPTIONS
/      /dev/sda3 btrfs  rw,relatime,seclabel

# btrfs sub list /
#


# btrfs f show
Label: none  uuid: 51e311d5-aeda-4432-aaa7-0f9211b60def
	Total devices 1 FS bytes used 11.03GB
	devid    1 size 17.56GB used 17.56GB path /dev/sda3

Comment 6 Jean-Luc 2011-11-13 10:31:43 UTC
I have this bug and thus no way to pass on Fedora 16, is there a solution to this problem?

Comment 7 Jorge 2011-11-16 02:24:57 UTC
I got this bug, with preupgrade. But I try to report, but bugzilla tells me is duplicated. I got no btrfs, since all partition are ext4. Whats wrong???

Comment 8 Marcel Mol 2011-11-16 20:40:32 UTC
preupgrade from F14 to F16.
debug screen shows that the root variable is None.

Comment 9 John Lumby 2012-06-11 01:24:59 UTC
I have also hit this same problem when upgrading from F15 to F16.
In my case my F15 root partition is ext3.

One common factor I see in the ones reported here and mine is that GRUB2 has been installed as bootloader.    Obviously the user (me) did that as F15 had GRUB1 v0.97+ as standard.

However,  here is a strange thing  -   to test this,  I re-installed GRUB 0.97+ on my root partition in place of GRUB2 -  and tested that it boots GRUB 0.97 ,  which it does  -
but when I again try the F16 upgrade,  it *still* reports that the bootloader is GRUB2.

snippet from anaconda log attached below:

Question  -     how does anaconda decide which is the bootloader?    What is it inspecting?

John Lumby

-------------------------------------------------------------------------------------
anaconda 16.25 exception report
Traceback (most recent call first):
  File "/usr/lib/python2.7/site-packages/pyanaconda/storage/__init__.py", line 2312, in mkDevRoot
    dev = "%s/%s" % (instPath, root.path)
  File "/usr/lib/python2.7/site-packages/pyanaconda/storage/__init__.py", line 1342, in mkDevRoot
    self.fsset.mkDevRoot()
  File "/usr/lib/python2.7/site-packages/pyanaconda/upgrade.py", line 241, in upgradeMountFilesystems
    anaconda.storage.mkDevRoot()
  File "/usr/lib/python2.7/site-packages/pyanaconda/dispatch.py", line 373, in dispatch
    self.dir = self.steps[self.step].target(self.anaconda)
  File "/usr/lib/python2.7/site-packages/pyanaconda/dispatch.py", line 241, in go_forward
    self.dispatch()
  File "/usr/lib/python2.7/site-packages/pyanaconda/gui.py", line 1201, in nextClicked
    self.anaconda.dispatch.go_forward()
AttributeError: 'NoneType' object has no attribute 'path'

Local variables in innermost frame:
self: <pyanaconda.storage.FSSet object at 0xb6ca48cc>
root: None
instPath: /mnt/sysimage

 [...]



_bootloader: GRUB2 instance, containing members:
  _bootloader.encrypted_password: 
  _bootloader.console_options: 
  _bootloader.console: 
  _bootloader.errors: []
  _bootloader.skip_bootloader: False
  _bootloader.warnings: []
  _bootloader.chain_images: []
  _bootloader.stage2_is_preferred_stage1: False
  _bootloader._drives: []
  _bootloader.storage: Storage instance, containing members:
    _bootloader.storage.clearPartChoice: None
    _bootloader.storage._intf: None
    _bootloader.storage._platform: None
    _bootloader.storage.anaconda: Already dumped (Anaconda instance)
    _bootloader.storage.dasd: DASD instance, containing members:
      _bootloader.storage.dasd.dasdfmt: /sbin/dasdfmt
      _bootloader.storage.dasd.commonArgv: [-y, -d, cdl, -b, 4096]
      _bootloader.storage.dasd.started: True
      _bootloader.storage.dasd.totalCylinders: 0
      _bootloader.storage.dasd._maxFormatJobs: 0
      _bootloader.storage.dasd._devices: []
      _bootloader.storage.dasd._completedCylinders: 0.0
      _bootloader.storage.dasd._dasdlist: []
    _bootloader.storage.autoPartEscrowCert: None
    _bootloader.storage.autoPartAddBackupPassphrase: False
    _bootloader.storage.escrowCertificates: {}
    _bootloader.storage.fsset: FSSet instance, containing members:
      _bootloader.storage.fsset.origFStab: # Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info

Comment 10 John Lumby 2012-07-04 00:56:49 UTC
Actually,  I now see this has nothing to do with GRUB vs GRUB2,
that stanza which dumps the GRUB2 object is just a container that
anaconda is using for the grub information.

I have debugged this down to a problem with how anaconda determines the mountpoint of a filesystem.

This code in storage/__init__.py sets the rootDevice property of a FSset object:
  
    @property
    def rootDevice(self):
        for path in ["/", ROOT_PATH]:
            for device in self.devices:
                try:
                    mountpoint = device.format.mountpoint
                except AttributeError:
                    mountpoint = None

                if mountpoint == path:
                    return device

But in the case of my /dev/sda3,    the anaconda.storage.fsset.devices[8]
 (which corresponds to my /dev/sda3) has format.mountpoint = None.   See dump of this fsset below.  so then the above method fails to match on mountpoint and so fails to discover that sda3 is the rootDevice and thus the "Nonetype" root

I can't see how anaconda is determining what is the mountpoint of an ext3 file is -  it is really strange since it (anconda) has successfully read and parsed both my fstab (which shows the mountpoint as /) and the filesystem itself (from dumpe2fs) which also shows last mount point as /

Yet it thinks there isn't one!


-----------------------------------------------------
dump of my /dev/sda3 fsset object :
12:26:50,899 DEBUG storage:             DeviceTree.addUdevDevice: info: {'ANACBIN': '/sbin',
 'DEVLINKS': '/dev/disk/by-path/pci-0000:00:10.0-scsi-0:0:0:0-part3 /dev/disk/by-uuid/cd33c198-1554-4db5-b604-c17db10cc490 /dev/disk/by-label/OCFEDroot',
 'DEVNAME': 'sda3',
 'DEVPATH': '/devices/pci0000:00/0000:00:10.0/host2/target2:0:0/2:0:0:0/block/sda/sda3',
 'DEVTYPE': 'partition',
 'ID_BUS': 'scsi',
 'ID_FS_LABEL': 'OCFEDroot',
 'ID_FS_LABEL_ENC': 'OCFEDroot',
 'ID_FS_SEC_TYPE': 'ext2',
 'ID_FS_TYPE': 'ext3',
 'ID_FS_USAGE': 'filesystem',
 'ID_FS_UUID': 'cd33c198-1554-4db5-b604-c17db10cc490',
 'ID_FS_UUID_ENC': 'cd33c198-1554-4db5-b604-c17db10cc490',
 'ID_FS_VERSION': '1.0',
 'ID_MODEL': 'VMware_Virtual_S',
 'ID_MODEL_ENC': 'VMware\\x20Virtual\\x20S',
 'ID_PART_ENTRY_DISK': '8:0',
 'ID_PART_ENTRY_NUMBER': '3',
 'ID_PART_ENTRY_OFFSET': '21576240',
 'ID_PART_ENTRY_SCHEME': 'dos',
 'ID_PART_ENTRY_SIZE': '32009040',
 'ID_PART_ENTRY_TYPE': '0x83',
 'ID_PART_TABLE_TYPE': 'dos',
 'ID_PATH': 'pci-0000:00:10.0-scsi-0:0:0:0',
 'ID_PATH_TAG': 'pci-0000_00_10_0-scsi-0_0_0_0',
 'ID_REVISION': '1.0',
 'ID_SCSI': '1',
 'ID_TYPE': 'disk',
 'ID_VENDOR': 'VMware_',
 'ID_VENDOR_ENC': 'VMware\\x2c\\x20',
 'MAJOR': '8',
 'MINOR': '3',
 'MPATH_SBIN_PATH': '/sbin',
 'SUBSYSTEM': 'block',
 'TAGS': ':systemd:',
 'UDEV_LOG': '3',
 'UDISKS_PARTITION': '1',
 'UDISKS_PARTITION_ALIGNMENT_OFFSET': '0',
 'UDISKS_PARTITION_NUMBER': '3',
 'UDISKS_PARTITION_OFFSET': '11047034880',
 'UDISKS_PARTITION_SCHEME': 'mbr',
 'UDISKS_PARTITION_SIZE': '16388628480',
 'UDISKS_PARTITION_SLAVE': '/sys/devices/pci0000:00/0000:00:10.0/host2/target2:0:0/2:0:0:0/block/sda',
 'UDISKS_PARTITION_TYPE': '0x83',
 'UDISKS_PRESENTATION_NOPOLICY': '0',
 'name': 'sda3',
 'symlinks': ['/dev/disk/by-path/pci-0000:00:10.0-scsi-0:0:0:0-part3',
              '/dev/disk/by-uuid/cd33c198-1554-4db5-b604-c17db10cc490',
              '/dev/disk/by-label/OCFEDroot'],
 'sysfs_path': '/devices/pci0000:00/0000:00:10.0/host2/target2:0:0/2:0:0:0/block/sda/sda3'} ; name: sda3 ;
12:26:50,902 INFO storage: scanning sda3 (/devices/pci0000:00/0000:00:10.0/host2/target2:0:0/2:0:0:0/block/sda/sda3)...
12:26:50,911 DEBUG storage:              DeviceTree.getDeviceByName: name: sda3 ;
12:26:50,921 DEBUG storage:              DeviceTree.getDeviceByName returned None
12:26:50,923 INFO storage: sda3 is a partition
12:26:50,932 DEBUG storage:              DeviceTree.addUdevPartitionDevice: name: sda3 ;
12:26:50,941 DEBUG storage:               DeviceTree.getDeviceByName: name: sda ;
12:26:50,955 DEBUG storage:               DeviceTree.getDeviceByName returned existing 30520MB disk sda (1) with existing msdos disklabel
12:26:50,968 DEBUG storage:                  DiskDevice.addChild: kids: 2 ; name: sda ;
12:26:50,979 DEBUG storage:                  PartitionDevice._setFormat: sda3 ;
12:26:50,981 DEBUG storage: getFormat('None') returning DeviceFormat instance
12:26:50,993 DEBUG storage:                   PartitionDevice._setFormat: sda3 ; current: None ; type: None ;
12:26:50,995 DEBUG storage: looking up parted Partition: /dev/sda3
12:26:51,004 DEBUG storage:                PartitionDevice.probe: sda3 ; exists: True ;
12:26:51,017 DEBUG storage:                 PartitionDevice.getFlag: path: /dev/sda3 ; flag: 1 ;
12:26:51,028 DEBUG storage:                PartitionDevice.getFlag: path: /dev/sda3 ; flag: 10 ;
12:26:51,037 DEBUG storage:                PartitionDevice.getFlag: path: /dev/sda3 ; flag: 12 ;
12:26:51,039 INFO storage: added partition sda3 (id 4) to device tree
12:26:51,051 DEBUG storage:              DeviceTree.handleUdevDeviceFormat: name: sda3 ;
12:26:51,060 DEBUG storage:               DeviceTree.handleUdevDiskLabelFormat: device: sda3 ; label_type: None ;
12:26:51,070 DEBUG storage:                  Ext3FS.supported: supported: True ;
12:26:51,072 DEBUG storage: getFormat('ext3') returning Ext3FS instance
12:26:51,078 DEBUG storage: device sda3 does not contain a disklabel
12:26:51,080 INFO storage: type detected on 'sda3' is 'ext3'
12:26:51,091 DEBUG storage:                 Ext3FS.supported: supported: True ;
12:26:52,104 DEBUG storage:                 Ext3FS.supported: supported: True ;
12:26:52,112 DEBUG storage: getFormat('ext3') returning Ext3FS instance
12:26:52,141 DEBUG storage:                PartitionDevice._setFormat: sda3 ;
12:26:52,165 DEBUG storage:                 PartitionDevice._setFormat: sda3 ; current: None ; type: ext3 ;
12:26:52,188 DEBUG storage: looking up parted Device: /dev/sda3
12:26:52,237 INFO storage: got device: PartitionDevice instance (0xb6bfc3cc) --
  name = sda3  status = True  kids = 0 id = 4
  parents = ['existing 30520MB disk sda (1) with existing msdos disklabel']
  uuid = None  size = 15629.4140625
  format = existing ext3 filesystem
  major = 8  minor = 3  exists = True  protected = False
  sysfs path = /devices/pci0000:00/0000:00:10.0/host2/target2:0:0/2:0:0:0/block/sda/sda3  partedDevice = parted.Device instance --
  model: Unknown  path: /dev/sda3  type: 0
  sectorSize: 512  physicalSectorSize:  512
  length: 32009040  openCount: 0  readOnly: False
  externalMode: False  dirty: False  bootDirty: False
  host: 608  did: -18585  busy: False
  hardwareGeometry: (1992, 255, 63)  biosGeometry: (1992, 255, 63)
  PedDevice: <_ped.Device object at 0xb6bd292c>
  target size = 0  path = /dev/sda3
  format args = []  originalFormat = None  grow = None  max size = 0  bootable = None
  part type = 0  primary = None
  partedPartition = parted.Partition instance --
  disk: <parted.disk.Disk object at 0xb6bfb6ac>  fileSystem: <parted.filesystem.FileSystem object at 0xb6bfb9ec>
  number: 3  path: /dev/sda3  type: 0
  name: None  active: True  busy: False
  geometry: <parted.geometry.Geometry object at 0xb6bfba8c>  PedPartition: <_ped.Partition object at 0xb6bf74ac>
  disk = existing 30520MB disk sda (1) with existing msdos disklabel
  start = 21576240  end = 53585279  length = 32009040
  flags = 
12:26:52,263 DEBUG storage:                Ext3FS.supported: supported: True ;
12:26:52,270 INFO storage: got format: Ext3FS instance (0xb6bfce2c) --
  type = ext3  name = ext3  status = False
  device = /dev/sda3  uuid = cd33c198-1554-4db5-b604-c17db10cc490  exists = True
  options = defaults  supported = True  formattable = True  resizable = True
  mountpoint = None  mountopts = None
  label = OCFEDroot  size = 15629.0  targetSize = 15629.0

Comment 11 David Lehman 2012-07-04 02:00:33 UTC
(In reply to comment #9)

Please attach /tmp/storage.log from the installer (collected after you hit the error) to this bug report as an attachment of type text/plain (do not paste it into a comment). Thanks.

Comment 12 John Lumby 2012-07-07 16:06:31 UTC
Created attachment 596776 [details]
storage.log obtained from after anaconda crashes

as requested by Comment #11 from David Lehman 

I re-ran the upgrade,   hit the problem,
then vtswitched to ttyt2 and ftp'd all files in /tmp out to my own machine

Comment 13 John Lumby 2012-07-08 19:04:49 UTC
Well,   I tinkered with it some more and managed to develop a fix which got it working.  patch to storage/__init__.py  below

This fix extends the code in rootDevice(self) to include a check of the current mountpoint if the device is a mounted filesystem,  which  (in the context of this bug) it is.     So the fix depends on the filesystem being mounted.
Whether this is actually the correct fix for the problem I am not sure  -   as mentioned before,   it is slightly weird that anaconda is able to recognize that the filesystem is the one to be upgraded,  and mount it,  but then doesn't realize it is the rootDevice.    Maybe a case of left hand not knowing what right hand is doing.

To apply this fix,  ideally it would be applied to the python code in the iso image,  but since I cannot un-build this iso format,   I applied it dynamically :
  1.   boot the buggy iso and start the upgrade
  2.    when it puts up the prompt for whether user want to run read verificatino on the media,
  3.  vtswitch to tty2,  cd down to the dir containing storage/__init__.py,
      i.e.
     cd /usr/lib/python2.7/site-packages/pyanaconda/storage
  4.  rm -f __init__.py    ##############   but see Note below
  5.  somehow get the fixed file -  e.g. I ifconfig my net device up and ftp the fixed _init__.py
  6.  (note  -  at this point there is a also a symlink __init__.pyc -> /dev/null  -  leave it alone)
  7.  vtswitch back to tty1   (I think it was on tty1,  I forget,  several vttys  are in use at this point) and resume the installer
  

##############    Note also this patch is to be applied to the F16 version of the file ,  anaconda-16.25,   so unless you happen to have that source code,  you will need to first ftp that one out and patch it in order to ftp the fixed one back

John


--- storage/__init__.py.orig	2011-11-02 21:10:30.000000000 -0400
+++ storage/__init__.py	2012-07-08 11:37:02.000000000 -0400
@@ -2330,7 +2330,13 @@ class FSSet(object):
                     mountpoint = device.format.mountpoint
                 except AttributeError:
                     mountpoint = None
-
+                #   try fix to https://bugzilla.redhat.com/show_bug.cgi?id=743647
+                if not mountpoint:
+                    try:
+                        #   if this device actually is mounted on rootpath,  then it must be the rootdevice!
+                        mountpoint = device.format._mountpoint
+                    except AttributeError:
+                        mountpoint = None
                 if mountpoint == path:
                     return device


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