[Bug 2077572] Re: Latest in main branch creates too small images for UC

Paul Mars 2077572 at bugs.launchpad.net
Mon Sep 30 10:19:40 UTC 2024


In ubuntu-image 1.X, once every partition was prepared (in separate
files) the resulting "farthest_offset" was raised with the following
line

calculated = ceil(farthest_offset / 1024 + 17) * 1024

According to some comments in tests it looks like this was to
accommodate the 34 sectors needed for the GPT backup header.


During the Go rewrite, this behavior was replicated in the `handleContentSizes` function. The line became:

calculated := quantity.Size((farthestOffset/quantity.OffsetMiB + 17) *
quantity.OffsetMiB)

But quantity.OffsetMiB is not 1024 but 1024*1024.

So instead of adding 34 sectors of 512 bytes, we were adding 34*1024
sectors of 512 bytes.

During a recent rework of the partition handling, this code was removed
to properly calculate and add the needed sectors for the partitions
tables. Consequently the image is now smaller.

So, unless I am missing something (the whole thing is a bit confusing) I
understand snapd needs a bit of unused room on the disk to dynamically
create the partitions declared in the gadget but not created during the
image build.

I know would like to understand how to properly determine the room
needed for snapd to properly setup additional partition during first
boot.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to Ubuntu Image.
https://bugs.launchpad.net/bugs/2077572

Title:
  Latest in main branch creates too small images for UC

Status in Ubuntu Image:
  New

Bug description:
  When building from https://github.com/canonical/ubuntu-
  image/commit/43771d1c02c35c2f78da1022274f8d7c2e47e4cc , I get this
  when creating an image with simple command:

  $ ubuntu-image snap <model>

  when running it:

  Aug 21 18:28:08 qemuname snapd[1675]: Device     Start     End Sectors  Size Type
  Aug 21 18:28:08 qemuname snapd[1675]: /dev/vda1   2048    4095    2048    1M BIOS boot
  Aug 21 18:28:08 qemuname snapd[1675]: /dev/vda2   4096 2461695 2457600  1.2G EFI System
  Aug 21 18:28:08 qemuname snapd[1675]: /dev/vda3: Created a new partition 3 of type 'Linux filesystem' and of size 750 MiB.
  Aug 21 18:28:08 qemuname snapd[1675]: /dev/vda4: Created a new partition 4 of type 'Linux filesystem' and of size 32 MiB.
  Aug 21 18:28:08 qemuname snapd[1675]: /dev/vda5: The last usable GPT sector is 6127649, but 6160383 is requested.
  Aug 21 18:28:08 qemuname snapd[1675]: Failed to add #5 partition: Invalid argument
  Aug 21 18:28:08 qemuname snapd[1675]: Leaving.
  Aug 21 18:28:08 qemuname snapd[1675]: -----

  so it seems that created images are slightly smaller than they should
  to be able to run normally.

  Furthermore, I see this warning when running the tool:

  WARNING: No mkfs configuration found for this series: 16.04. Will
  fallback on the default one.

  while I am actually running on 22.04. I wonder if the "series" of the
  model (that is always 16) is being taken as the distro version, which
  should be deducted from the model base instead.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu-image/+bug/2077572/+subscriptions




More information about the foundations-bugs mailing list