The writable partition is corrupted using the latest ubuntu-image (0.8)

Bug #1634557 reported by Liming Wang
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu Image
Fix Released
Medium
Steve Langasek

Bug Description

I installed the latest ubuntu-image from git version, and the issue can be reproduced through following steps:

$ ubuntu-image --version
ubuntu-image 0.8+17.04ubuntu1
$ more pi3.model
type: model
authority-id: 9anEFsr3zJAqJ3zq2Rv2IdLys8p6353z
series: 16
brand-id: 9anEFsr3zJAqJ3zq2Rv2IdLys8p6353z
model: pi3
architecture: armhf
gadget: pi3
kernel: pi2-kernel
timestamp: 2016-09-24T16:16:24+00:00
sign-key-sha3-384: RfSxuO7R8OT_22IQMEOVHCFHrg68AZ4vPJgCqTZbkX8h9pZktEVbK2fVYQ6lf1P5

AcLBXAQAAQoABgUCV+anHwAKCRD8jF0bWIvfelLeEACUmSaNsP1HvKFVuhlQbrS4xSyENy5HsyzR
7rv04iR7JZ8mATvnx8QtQEHFFG3re/F8pPcK/RmUjSwQ3v0ZvbHQovfg4rxmYGQeb71pYON6+Qdw
z/eZphyhDscesDOyW84zZ6eVkvrLmVhH5nP+l6T4/H8mPXiacUBwjcUHT7VqTrwFG8w7abTZxj+/
HXSfYYAzWr2ONwwBXP0PCUcQuq3AEhwXEralURW79PvHmXUUi464htirzFSgdjHiwTNNWFwHgvti
usnwA1qBa8VH61gadOaiSYy8Bhhq0yhpjrqvZs0398M2LI9c/8xb1CaTuTFTcFdYNZJ/EHsWds05
VjSqcRRvBPHoP/51oxeaonrDlhev1OWAmblGpVq7HQeu7AUOrjSrcH+BuB08Td/vc5F27myw2NMO
FBvocHR5SvTfjfZEPzFiD6WHJfpq8RRmBAo74xzQhpOjdjRaED0e22nQipLi2437iR+MtYCDwMnd
IXYCmUuIeUW2bQu+RQ1PA4oOcCetTAF+vhp0A7cMzyuL8uThRDRo2AQ041DIJzGaTD+NXYFtoo6j
0fYIdlRFYny7w5eTHyMb603tzeiI3NTqJr3yAXfanLBL0qalEpHy5tB3CVv2nkI9LqsTu1y9X+X4
FMtVmp4bXe7jU2nPYn4xARf/y3NfCCuJ8UPFMVLDIA==

$ sudo ubuntu-image -c beta -o pi3-test-new.img pi3.model
[sudo] password for u:
5.83 MB / 5.83 MB [===============================================================================================================================] 100.00 % 714.42 KB/s
Fetching ubuntu-core
63.42 MB / 63.42 MB [=============================================================================================================================] 100.00 % 279.58 KB/s
Fetching pi2-kernel
85.44 MB / 85.44 MB [=============================================================================================================================] 100.00 % 514.58 KB/s
Fetching pi3
5.83 MB / 5.83 MB [=================================================================================================================================] 100.00 % 2.41 MB/s
$ sudo kpartx -av pi3-test-new.img
add map loop2p1 (252:0): 0 262144 linear 7:2 2048
add map loop2p2 (252:1): 0 948224 linear 7:2 264192
$sudo mount /dev/mapper/loop2p2 mnt/
mount: wrong fs type, bad option, bad superblock on /dev/mapper/loop2p2,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.
$ dmesg|tail -n 2
[82470.253410] EXT4-fs (loop2): mounted filesystem with ordered data mode. Opts: (null)
[82493.633046] EXT4-fs (dm-1): bad geometry: block count 118616 exceeds size of device (118528 blocks)

But if I use the snap version (0.5+mvo13), mounting the second partition is OK.

Revision history for this message
Anthony Wong (anthonywong) wrote :

Looks like the partition table is incorrect.

The partition table of the created image is:
Device Boot Start End Sectors Size Id Type
pi3-test.img1 * 2048 264191 262144 128M c W95 FAT32 (LBA)
pi3-test.img2 264192 1210367 946176 462M 83 Linux

After I re-create the 2nd partition to be like this, I can then mount it:
Device Boot Start End Sectors Size Id Type
pi3-test.img1 * 2048 264191 262144 128M c W95 FAT32 (LBA)
pi3-test.img2 264192 1212171 947980 462.9M 83 Linux

Revision history for this message
Steve Langasek (vorlon) wrote :

This bug was introduced in ubuntu-image 0.7. It went unnoticed because if you boot an affected image, the initramfs will auto-resize the rootfs on first boot and you'll never know the partition was undersized.

It also is specific to MBR partition tables, because sfdisk unhelpfully rounds down partition sizes that aren't a multiple of 1MiB.

Changed in ubuntu-image:
assignee: nobody → Steve Langasek (vorlon)
status: New → In Progress
importance: Undecided → Medium
Revision history for this message
Liming Wang (wangliming) wrote :

I confirmed that the commint in the branch lp.1634557 fixes the bug

Barry Warsaw (barry)
Changed in ubuntu-image:
milestone: none → 0.9
Barry Warsaw (barry)
Changed in ubuntu-image:
status: In Progress → Fix Committed
Barry Warsaw (barry)
Changed in ubuntu-image:
status: Fix Committed → Fix Released
summary: - The writable partition is corrupted using the latest ubuntu-image(0.8 )
+ The writable partition is corrupted using the latest ubuntu-image (0.8)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.