Make Tails Installer's isohybrid detection code robust
From #8860 (comment 80916):
I’m a tiny bit worried about the new isohybrid detection code (b7dcb936a58bb0016981645c9224caee4493112a): I’ve seen very weird stuff happening when the kernel detects these devices, kinda lacking determinism (sometimes it would be recognized in a way, sometimes in the other) which is not surprising given such devices are really two different things at the same time. Let’s not bother for now but keep it in mind if we get related bug reports.
From #8860 (comment 80948):
I think I’ve found a bug:
- dd a Tails ISO to a USB stick
- leave that USB stick plugged
- start Tails Installer
- /dev/sdc1 is automatically selected
- the “Upgrade” button is visible (weird) but disabled (OK)
- the “Reinstall (delete all data)” button is enabled, which is inconsistent wrt. the “Upgrade” button (but if I click on it I’m told “No ISO image selected” as expected); that’s another bug, please handle it separately
- once I select an ISO image the “Upgrade” button is enabled
- clicking “Upgrade” fails with “Unknown GLib exception while trying to mount device: udisks-error-quark: GDBus.Error:org.freedesktop.UDisks2.Error.Failed: Error mounting /dev/sdb1 at /media/intrigeri/Tails2: Wrong fs type, /dev/sdb1 has an invalid superblock or missing helper program. (0)”
- unplug / re-plug the USB stick => I see an “Install” button, which works.
That’s a regression because in 4.4.18+dfsg-1 when clicking “Upgrade” I was told:
It is impossible to upgrade the device TOSHIBA TransMemory (7.8 GB) - /dev/sdb1 because it was not created using Tails Installer. You should instead use "Install from ISO" to upgrade Tails on this device.
… and when clicking “Install” the correct device (
Granted, it’s a corner case and thankfully our doc does not instructs anyone to do that. But it makes the developer experience a bit painful, and (worse) confusing when working on the code that handles isohybrid’ed devices. Also, I had doubts wrt. the robustness of some changes made in our isohybrid detection code on this ticket, and this experience decreases a bit my level of confidence.
And here is the response to the above from #8860 (comment 80952):
So this is exactly what we do in the
Writing a Tails isohybrid to a USB drive [...] scenario, except that the
dd:ing doesn’t happen during
the same session we start
tails-installer. I’m hypothesizing that the
flakiness you’ve seen re: “isohybrid detection” only occurs during the
session the isohybrid is
dd:ed to the disk, due to a race between the
writing of the partition table to the disk, and the scanning of said
partition table, possibly in an intermediate state of the write.
Parent Task: #9005 (closed)