Certain USB devices aren't handled correctly by
python-parted. As soon as the USB devices are
filled/rewritten with zeros (dd if=/dev/zero of=/dev/sdX)
they are recognized properly. The underlying issue
couldn't be identified yet, but since we know what
we get let's just fall back to the old boot device
detection and print an according warning message.
Thanks: to mika and Haudegen for debugging
Closes: #766964
GRML2USB_BASE = os.path.dirname(os.path.realpath(__file__))
GRML2USB_BASE = os.path.dirname(os.path.realpath(__file__))
+class HodorException(Exception):
+ """Throw exception if the exact error is not known and not fatal.
+
+ @Exception: message"""
+
+
class CriticalException(Exception):
"""Throw critical exception if the exact error is not known but fatal.
class CriticalException(Exception):
"""Throw critical exception if the exact error is not known but fatal.
try:
import parted
part = get_partition_for_path(device)
try:
import parted
part = get_partition_for_path(device)
+ if part is None:
+ raise HodorException("parted could not find partition")
if part.getFlag(parted.PARTITION_BOOT):
logging.debug("bootflag is enabled on %s" % device)
return
if part.getFlag(parted.PARTITION_BOOT):
logging.debug("bootflag is enabled on %s" % device)
return
+ except HodorException, e:
+ logging.info("%s, falling back to old bootflag detection", e)
except ImportError, e:
logging.debug("could not import parted, falling back to old bootflag detection")
except ImportError, e:
logging.debug("could not import parted, falling back to old bootflag detection")