Skip to content

Commit

Permalink
Reread partition table after installing MBR to ensure devices exist
Browse files Browse the repository at this point in the history
We need to execute blockdev after installing the MBR, otherwise
the devices might not exist yet as expected and executing syslinux
can fail therefore.

Closes: #33
Thanks: Darshaka Pathirana for debugging
  • Loading branch information
mika committed Jun 3, 2020
1 parent aed7d83 commit fe662d8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions grml2usb
Expand Up @@ -875,6 +875,14 @@ def install_mbr(mbrtemplate, device, partition, ismirbsdmbr=True):
proc = subprocess.Popen(["sync"])
proc.wait()

logging.debug("Probing device via 'blockdev --rereadpt %s'", device)
proc = subprocess.Popen(["blockdev", "--rereadpt", device])
proc.wait()
if proc.returncode != 0:
raise Exception(
"Couldn't execute blockdev on '%s' (install util-linux?)", device
)

set_rw(device)


Expand Down

0 comments on commit fe662d8

Please sign in to comment.