By default open() reads in text which is not going to fly for a boot
sector.
Fatal: 'utf-8' codec can't decode byte 0x90 in position 6: invalid start byte
Exception:
Traceback (most recent call last):
File "/usr/sbin/grml2usb", line 1913, in main
install(iso, device)
File "/usr/sbin/grml2usb", line 1626, in install
install_grml(iso_mountpoint, device)
File "/usr/sbin/grml2usb", line 1653, in install_grml
check_boot_flag(device)
File "/usr/sbin/grml2usb", line 393, in check_boot_flag
data = image.read(520)
File "/usr/lib/python3.7/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x90 in position 6: invalid start byte
except ImportError as e:
logging.debug("could not import parted, falling back to old bootflag detection")
- with open(boot_dev, 'r') as image:
+ with open(boot_dev, 'rb') as image:
data = image.read(520)
bootcode = data[440:]
gpt_data = bootcode[70:80]