sys.exit(1)
logging.debug("New partition table:\n" + str(target.label))
- argv = ['sfdisk', '--wipe-partitions', 'always', Device]
+ argv = ['sfdisk', '--no-reread', '--wipe-partitions', 'always', Device]
logging.debug(" ".join(argv))
proc = subprocess.run(argv,
stdout=None,
logging.error(f"New partition table:\n" + str(target.label))
sys.exit(1)
+ logging.debug("Requesting kernel to re-read partition table:\n" + str(target.label))
+ argv = ['blockdev', '--rereadpt', Device]
+ logging.debug(" ".join(argv))
+ proc = subprocess.run(argv,
+ stdout=None,
+ stderr=None)
+ if proc.returncode != 0:
+ logging.error(f"Failed to request kernel to reread partition table on {Device}. (Insufficient permissions?)")
+ sys.exit(1)
+
if target.bootcode:
logging.debug("Writing bootcode\n")
with open(Device, "wb") as f: