Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 93113 - parted.PedDisk.new fails on disk with invalid partition table
Summary: parted.PedDisk.new fails on disk with invalid partition table
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Release Media
Classification: Unclassified
Component: Installer (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Gentoo Linux Installer
URL:
Whiteboard:
Keywords:
: 93114 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-05-18 16:01 UTC by Steven Mertens
Modified: 2006-03-24 13:46 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
patch against x86ArchitectureTemplate.py (x86ArchitectureTemplate.py.diff,1.17 KB, patch)
2005-06-15 15:27 UTC, Steven Mertens
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Steven Mertens 2005-05-18 16:01:40 UTC
The __init__ constructor of the Device class in the module GLIStorageDevice class will fail if a disk doesnt contain a recognisable label. 

self._parted_disk = parted.PedDisk.new(self._parted_dev) --> this part will fail

There should be a check of the disk contains a label, if not something like

disk = device.disk_new_fresh(parted.disk_type_get(label))
disk.commit()

should be executed. 

Failure of parted.PedDisk.new(self._parted_dev) gives the following error


>>> dev = parted.PedDevice.get('/dev/sdb')
>>> disk = parted.PedDisk.new(dev)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
parted.error: Error: Unable to open /dev/sdb - unrecognised disk label.


Output of fdisk 

jabba root # fdisk -l /dev/sdb

Disk /dev/sdb: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table
Comment 1 Christopher Hotchkiss 2005-05-18 16:08:11 UTC
As a side note it seems that the install.log did not get anything written to it.
We need to allow for it to gracefully fail.
Comment 2 Carsten Lohrke (RETIRED) gentoo-dev 2005-05-18 16:22:54 UTC
*** Bug 93114 has been marked as a duplicate of this bug. ***
Comment 3 Andrew Gaffney (RETIRED) gentoo-dev 2005-05-18 17:17:49 UTC
This is a known issue. I've been meaning to fix it, but it's more complex than
just creating a new disklabel (different arches and all). The reason that you
have an empty install.log is because it failed in the FE before the install started.
Comment 4 Andrew Gaffney (RETIRED) gentoo-dev 2005-05-22 18:29:13 UTC
I've added some code so that the frontend doesn't fail:

        self._parted_dev = parted.PedDevice.get(self._device)
        try:
            self._parted_disk = parted.PedDisk.new(self._parted_dev)
        except:
            self._parted_disk =
self._parted_dev.disk_new_fresh(parted.disk_type_get(archinfo[self._arch]['disklabel']))

Comment 5 Andrew Gaffney (RETIRED) gentoo-dev 2005-06-02 21:48:52 UTC
test...ignore
Comment 6 Andrew Gaffney (RETIRED) gentoo-dev 2005-06-04 20:35:33 UTC
Even though I haven't implemented the backend part of this yet, the installer
doesn't work on other architectures yet, so it isn't currently an issue. Closing.
Comment 7 Steven Mertens 2005-06-15 15:25:51 UTC
First of all, my apologies for my late respons ...

I tested the snapshot installer-20050613.tar.bz2. 
I encounterd the same problem but in the x86ArchitectureTemplate class.
At the same time i noticed that the installer also tries to format the
'free' space on the disk. 

I wrote a quick patch (and i tested this) that solves both issues. 

brgds. 
Comment 8 Steven Mertens 2005-06-15 15:27:48 UTC
Created attachment 61305 [details, diff]
patch against x86ArchitectureTemplate.py


patch against x86ArchitectureTemplate.py
Comment 9 Steven Mertens 2005-06-15 15:36:10 UTC
(In reply to comment #8)
> Created an attachment (id=61305) [edit]
> patch against x86ArchitectureTemplate.py
> 
> 
> patch against x86ArchitectureTemplate.pyGLI: 

Also the contents of /var/log/install.log 

June 15 2005 19:30:43 - partitioning: Processing /dev/sdb...
GLI: June 15 2005 19:30:43 - Partitioning: Second pass...
GLI: June 15 2005 19:30:43 - Partitioning: Third pass....creating partitions
GLI: June 15 2005 19:30:43 -   Drive has 8388608 sectors
GLI: June 15 2005 19:30:43 -   Partition 1 has 1027MB
GLI: June 15 2005 19:30:43 -   Adding primary partition 1 from 0 to 2103296
GLI: June 15 2005 19:30:43 -   Formatting partition 1 as ext3 with: mkfs.ext3 
/dev/sdb1
GLI: June 15 2005 19:30:44 -   Partition 1.03125 has 3069MB
GLI: June 15 2005 19:30:44 - Exception received during 'Partition':
PartitionFormatError :FATAL: partition: Unknown partition type free
GLI: June 15 2005 19:30:44 - Traceback (most recent call last):
GLI: June 15 2005 19:30:44 - File "../../GLIClientController.py", line 151, in run
    self._install_steps[self._install_step][0]()
GLI: June 15 2005 19:30:44 - File "../../templates/x86ArchitectureTemplate.py",
line 335, in partition
    raise GLIException("PartitionFormatError", 'fatal', 'partition',"Unknown
partition type "+newpart['type'])
GLI: June 15 2005 19:30:44 - GLIException: PartitionFormatError :FATAL:
partition: Unknown partition type free






Comment 10 Andrew Gaffney (RETIRED) gentoo-dev 2005-06-16 09:07:32 UTC
A slightly modified version of that patch has been applied. I changed it to look
at tmp_parts_new[device].get_disklabel() first before going to the default
disklabel type for that particular arch. Thanks.
Comment 11 Jeffrey Forman (RETIRED) gentoo-dev 2006-03-24 13:46:29 UTC
Moving to Release Media/Installer.