ubuntu-image created vfat eats itself after a while (mcopy creates wrong subdirs)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Snappy |
Fix Released
|
Critical
|
Unassigned | ||
Ubuntu Image |
Fix Released
|
Critical
|
Unassigned | ||
mtools (Ubuntu) |
Fix Released
|
Critical
|
Steve Langasek | ||
Xenial |
Fix Released
|
Critical
|
Steve Langasek | ||
ubuntu-image (Ubuntu) |
Fix Released
|
Critical
|
Unassigned |
Bug Description
[SRU Justification]
Since trusty, using mcopy to create directories will result in corrupted FAT entries due to uninitialized memory. This leads to data loss when an fsck is run on the filesystem.
[Test case]
1. Install dosfstools and mtools from xenial.
2. Run the script from https:/
3. Observe that you are prompted to fix corrupted filesystem entries
4. Install mtools from xenial-proposed
5. Run the reproducer.sh script again
6. Observe that the newly-created filesystem passes fsck with no errors.
[Regresion potential]
This is a one-line fix to correct uninitialized memory. The only regression potential is that associated with rebuilding the tools with a new toolchain (the last rebuild of these binary packages was in vivid, with gcc-4.9).
[Original bug description]
on arm images the vfat used for the boot partition corrupts itself after a few reboots (it is noteworthy that on uboot/arm installations we write a lot more to the vfat. i would actually expect this to happen on x86 systems as well, just a lot later, i.e. after a few kernel updates)
there seem to be various differences in how ubuntu-image creates the vfat ...
in ubuntu-device-flash we use:
mkfs.vfat -F 32 -S 512 -n ... against a loop mounted partition, the -S 512 value gets actually matched against blockdev --getss (and adjusted accordingly if needed)
ubuntu-image currently only calls:
"mkfs.vfat" without any options against an img file that represents the vfat content.
u-d-f also just uses cp against the loop mounted partition while ubuntu-image uses mtools' mcopy to put the files in place ...
the result is that at random boots fsck suddenly starts to rename files in an 8+3 scheme like:
http://
i spent the whole day trying to tweak the mkfs options but to no avail, the corruption always happens at some point, so my suspicion goes more towards mtools/mcopy now
http://
Changed in snappy: | |
importance: | Undecided → Critical |
Changed in ubuntu-image: | |
importance: | Undecided → Critical |
Changed in mtools (Ubuntu): | |
status: | New → In Progress |
Changed in mtools (Ubuntu Xenial): | |
status: | New → In Progress |
Changed in mtools (Ubuntu): | |
importance: | Undecided → Critical |
Changed in mtools (Ubuntu Xenial): | |
importance: | Undecided → Critical |
Changed in mtools (Ubuntu): | |
assignee: | nobody → Steve Langasek (vorlon) |
Changed in mtools (Ubuntu Xenial): | |
assignee: | nobody → Steve Langasek (vorlon) |
Changed in mtools (Ubuntu): | |
status: | In Progress → Fix Committed |
description: | updated |
Changed in ubuntu-image: | |
status: | New → Invalid |
Changed in ubuntu-image (Ubuntu Xenial): | |
status: | New → Invalid |
Changed in ubuntu-image (Ubuntu): | |
status: | New → Fix Committed |
Changed in snappy: | |
status: | New → Fix Released |
Changed in ubuntu-image: | |
status: | Invalid → Fix Released |
no longer affects: | ubuntu-image (Ubuntu Xenial) |
Changed in ubuntu-image (Ubuntu): | |
importance: | Undecided → Critical |
Fwiw, I suspect mtools (or the way its used) is broken. If I run: go/src/ launchpad. net/goget- ubuntu- touch/ubuntu- device- flash/canonical -pi2.model -o pi2.img i/.images/ part0.img 11.snap/ DTBS
$ sudo ./ubuntu-image --workdir /tmp/u-i --channel edge ~/devel/
$ sudo fsck.vfat /tmp/u-
fsck.fat 3.0.28 (2015-05-16)
/pi2-kernel_
Has a large number of bad entries. (2/5)
Drop directory ? (y/n) y
Reclaimed 88 unused clusters (45056 bytes).
Free cluster summary wrong (223996 vs. really 224084)
1) Correct
2) Don't correct
...