diskimage-builder/elements
Ian Wienand 2c32c7ae1a Handle modern sfdisk and correctly align image partition
As described in the comments, sfdisk was rewritten for util-linux 2.26
(as shipped in F22) and now interprets arguments a sectors, rather
than cylinders.

The current partitioning line is "1 - - *" (start/size/type/bootable)
which means you start getting:

---
/usr/sbin/grub2-install: warning: this msdos-style partition label has
no post-MBR gap; embedding won't be possible.

/usr/sbin/grub2-install: warning: Embedding is not possible.  GRUB can
only be installed in this setup by using blocklists.  However,
blocklists are UNRELIABLE and their use is discoura ged..

/usr/sbin/grub2-install: error: will not proceed with blocklists.
---

when building images, because the start is interpreted by the new
sfdisk as sector 1 and it crams the partition right next to the MBR.

Specifying "-" for the size is undefined in the man page; even reading
the source it's not totally clear what "-" for the size does [2].  In
any case, the alignment is wrong in sectors or cylinders; we want to
be a multiple of 4KiB for best performance.

The intent here is to create one single, Linux, bootable, partition
taking up the whole disk starting at 1MiB, so "2048 + L *" makes this
clear.

We use the -uS argument to ensure both versions treat this start-value
as a sector offset (newer sfdisk essentially ignores the argument).
As described in the comments, bugs in the older sfdisk necessitate
usage of "--force".

Although we could choose more or less, it seems most common to align
to a 1MiB boundary (i.e. starting at sector 2048).  libguestfs has
some disucssion around --alignment and where it sets it's default to
this [3].  The 2.26-era sfdisk also defaults to putting partitions
here.  1MiB should be enough for GPT schemes in the future as well.

[1] https://github.com/karelzak/util-linux/blob/master/libfdisk/src/script.c#L1050
[2] https://bugzilla.redhat.com/show_bug.cgi?id=1249893
[3] http://libguestfs.org/virt-resize.1.html

Change-Id: I2c2966f98d1d5ad4ebb433ea148b3b26c65dc1b5
2015-08-04 15:26:13 +10:00
..
apt-conf Standarise tracing for scripts 2015-02-12 10:41:32 +11:00
apt-preferences Merge "Fix unbound variables in apt-{preferences,sources}" 2015-03-04 02:49:34 +00:00
apt-sources Initial element tests 2015-05-17 02:07:40 +00:00
architecture-emulation-binaries Standarise tracing for scripts 2015-02-12 10:41:32 +11:00
baremetal Merge "Turn docs warnings into errors and fix issues" 2015-05-06 17:48:16 +00:00
base Merge "Make managing hosts entries optional" 2015-05-12 13:29:48 +00:00
cache-url Standarise tracing for scripts 2015-02-12 10:41:32 +11:00
centos CentOS-6 resize support 2015-06-03 09:13:00 -07:00
centos7 Merge "Use Centos 7 cloud image symlink" 2015-05-20 19:08:46 +00:00
centos-minimal Port centos-minimal to yum-minimal 2015-04-22 20:34:48 -04:00
cleanup-kernel-initrd Standarise tracing for scripts 2015-02-12 10:41:32 +11:00
cloud-init-datasources Simple-init should disable cloud-init 2015-05-11 16:55:02 +00:00
cloud-init-nocloud Standarise tracing for scripts 2015-02-12 10:41:32 +11:00
debian debian: install DHCP client and ifconfig packages 2015-07-09 14:01:13 +02:00
debian-minimal Use official mirror name for debian-minimal 2015-07-09 23:41:49 -04:00
debian-systemd Standarise tracing for scripts 2015-02-12 10:41:32 +11:00
debian-upstart Standarise tracing for scripts 2015-02-12 10:41:32 +11:00
debootstrap debootstrap: fix syntax issues 2015-05-05 11:00:10 +02:00
deploy Create docs site containing element READMEs 2015-02-10 11:45:35 -08:00
deploy-baremetal Create docs site containing element READMEs 2015-02-10 11:45:35 -08:00
deploy-ironic Wait longer for root device to become available 2015-06-17 11:53:57 -05:00
deploy-kexec Create docs site containing element READMEs 2015-02-10 11:45:35 -08:00
deploy-targetcli Optimize Python install in deploy-targetcli 2015-06-22 13:19:14 -05:00
deploy-tgtadm No markdown docs for elements 2015-04-02 23:55:19 +00:00
devuser Add generic devuser element 2015-04-08 07:01:24 +00:00
dhcp-all-interfaces Standarise tracing for scripts 2015-02-12 10:41:32 +11:00
dib-init-system Add init-scripts directory support 2015-07-16 17:59:05 +01:00
dib-run-parts/root.d Standarise tracing for scripts 2015-02-12 10:41:32 +11:00
disable-selinux/post-install.d Standarise tracing for scripts 2015-02-12 10:41:32 +11:00
dkms Standarise tracing for scripts 2015-02-12 10:41:32 +11:00
docker Add base element for using docker as image base 2015-07-19 10:23:34 +00:00
dpkg Download of translations not properly disabled in APT 2015-03-25 15:23:45 -04:00
dracut-network Standarise tracing for scripts 2015-02-12 10:41:32 +11:00
dracut-ramdisk Make troubleshoot work with dracut ramdisks 2015-04-08 12:54:32 -05:00
element-manifest Standarise tracing for scripts 2015-02-12 10:41:32 +11:00
enable-serial-console Standarise tracing for scripts 2015-02-12 10:41:32 +11:00
epel epel: support centos element 2015-05-06 15:49:59 +02:00
fedora Update default Fedora to 22 2015-07-20 09:08:06 +10:00
fedora-minimal Add a yum-minimal element that just uses yum 2015-04-14 13:39:18 -04:00
grub2 Add grub2 element 2015-06-02 05:35:03 +00:00
hwburnin Create docs site containing element READMEs 2015-02-10 11:45:35 -08:00
hwdiscovery Create docs site containing element READMEs 2015-02-10 11:45:35 -08:00
ilo Standarise tracing for scripts 2015-02-12 10:41:32 +11:00
install-static Standarise tracing for scripts 2015-02-12 10:41:32 +11:00
install-types Break install-types out of base 2015-04-14 13:39:18 -04:00
ironic-agent Removes hardcoded refrences for ethernet interface 2015-07-08 07:14:06 +05:30
ironic-discoverd-ramdisk Fix incorrect package name dmidecoded to dmidecode 2015-03-11 01:04:37 +00:00
iso Merge "Add grub2 element" 2015-06-03 10:48:18 +00:00
local-config Standarise tracing for scripts 2015-02-12 10:41:32 +11:00
manifests Standarise tracing for scripts 2015-02-12 10:41:32 +11:00
mellanox Standarise tracing for scripts 2015-02-12 10:41:32 +11:00
modprobe-blacklist Standarise tracing for scripts 2015-02-12 10:41:32 +11:00
oat-client Add oat-client element 2015-06-26 09:57:12 +08:00
opensuse opensuse: Update README 2015-07-01 22:03:50 +02:00
package-installs Merge "package-installs: fix error case for Python 2.6" 2015-05-07 17:25:54 +00:00
pip-cache Standarise tracing for scripts 2015-02-12 10:41:32 +11:00
pkg-map Turn docs warnings into errors and fix issues 2015-04-27 15:03:19 +00:00
pypi Merge "Allow setting DIB_PIP_RETRIES" 2015-04-23 03:51:57 +00:00
ramdisk Merge "Add element ubuntu-signed to provide signed kernel" 2015-04-28 11:02:44 +00:00
ramdisk-base Merge "Address comments on virtual media device label commit" 2015-05-11 19:36:26 +00:00
rax-nova-agent rax-nova-agent: switch to $DISTRO_NAME 2015-05-12 17:48:49 +02:00
redhat-common Cleanup yum downloading 2015-07-20 09:08:06 +10:00
rhel Use shorter temporary file names for kpartx 2015-04-21 10:36:33 +02:00
rhel7 force arch amd64 for EL7 elements 2015-05-04 14:18:51 +02:00
rhel-common rhel-common element should not use attach with activation key 2015-05-25 07:18:47 -04:00
rpm-distro Work around yum/dnf differences 2015-06-24 09:20:45 +10:00
select-boot-kernel-initrd Standarise tracing for scripts 2015-02-12 10:41:32 +11:00
selinux-permissive Standarise tracing for scripts 2015-02-12 10:41:32 +11:00
serial-console Standarise tracing for scripts 2015-02-12 10:41:32 +11:00
simple-init Use the init scripts from the glean package 2015-06-27 12:51:25 -04:00
source-repositories Allow source-repositories ref to be "*" 2015-06-24 20:50:06 +00:00
stable-interface-names Standarise tracing for scripts 2015-02-12 10:41:32 +11:00
svc-map Turn docs warnings into errors and fix issues 2015-04-27 15:03:19 +00:00
uboot Standarise tracing for scripts 2015-02-12 10:41:32 +11:00
ubuntu Set DIB_RELEASE in ubuntu element 2015-03-04 23:11:27 +00:00
ubuntu-core Use shorter temporary file names for kpartx 2015-04-21 10:36:33 +02:00
ubuntu-minimal Split the debootstrap functions into an element 2015-04-26 18:04:59 +00:00
ubuntu-signed Add element ubuntu-signed to provide signed kernel 2015-04-12 11:36:17 -07:00
vm Handle modern sfdisk and correctly align image partition 2015-08-04 15:26:13 +10:00
yum Cleanup yum downloading 2015-07-20 09:08:06 +10:00
yum-minimal Add a yum-minimal element that just uses yum 2015-04-14 13:39:18 -04:00
zypper Standarise tracing for scripts 2015-02-12 10:41:32 +11:00