sfdisk crash when pc-boot.img is too big
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Ubuntu Image |
Fix Released
|
High
|
Barry Warsaw |
Bug Description
In response to LP: #1666173 the real problem is caused when pc-boot.img is too big for the mbr.
Steps to reproduce (from repo or deb, adjust to not use /tmp for snaps):
$ mkdir /tmp/uiwork
$ ubuntu-image -w /tmp/uiwork -d -t load_gadget_yaml pc-amd64-
$ truncate -s 512 /tmp/uiwork/
$ ubuntu-image -w /tmp/uiwork -d -r
DEBUG:ubuntu-
DEBUG:ubuntu-
DEBUG:ubuntu-
DEBUG:ubuntu-
DEBUG:ubuntu-
DEBUG:ubuntu-
DEBUG:ubuntu-
ERROR:ubuntu-
ERROR:ubuntu-image:
ERROR:ubuntu-
ERROR:ubuntu-
Traceback (most recent call last):
File "/home/
step()
File "/home/
self.
File "/home/
image.
File "/home/
str(partnum), str(typecode)])
File "/home/
proc.
File "/usr/lib/
self.stderr)
subprocess.
ERROR:ubuntu-
Traceback (most recent call last):
File "/home/
list(
File "/home/
step()
File "/home/
self.
File "/home/
image.
File "/home/
str(partnum), str(typecode)])
File "/home/
proc.
File "/usr/lib/
self.stderr)
subprocess.
Note that pc-boot.img is properly 440 before the truncate call (that's why LP: #1666173 is invalid).
To investigate:
1) We did early on get this warning:
WARNING:
Is that warning about the size:440 of the mbr structure? That would be wrong. Since the other sizes/offsets (not offset-write) are in units of MiB, I'm not sure what else could be triggering that. The warning should include a message about which structure it's complaining about.
2) Why did we not get a warning that pc-boot.img is too big for the mbr?
3) Instead of blinding making the partition fit the image, we should probably stop with an error if the contents of the mbr is bigger than 440 bytes. Clearly that's a fatal error condition.
Changed in ubuntu-image: | |
milestone: | none → 1.0 |
assignee: | nobody → Barry Warsaw (barry) |
importance: | Undecided → High |
status: | New → Confirmed |
Changed in ubuntu-image: | |
status: | Confirmed → In Progress |
Changed in ubuntu-image: | |
status: | In Progress → Fix Committed |
Changed in ubuntu-image: | |
status: | Fix Committed → Fix Released |
So yes, the sector size/offset warning is issued for the mbr partition. That at least seems wrong since the mbr must be <= 446 bytes.