Merge lp:~rbalint/livecd-rootfs/minimize-fix-grub into lp:~ubuntu-core-dev/livecd-rootfs/xenial-proposed

Proposed by Balint Reczey
Status: Merged
Merged at revision: 1434
Proposed branch: lp:~rbalint/livecd-rootfs/minimize-fix-grub
Merge into: lp:~ubuntu-core-dev/livecd-rootfs/xenial-proposed
Diff against target: 121 lines (+45/-8)
5 files modified
debian/changelog (+5/-0)
live-build/ubuntu-cpc/functions (+32/-2)
live-build/ubuntu-cpc/hooks/032-disk-image.binary (+3/-1)
live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary (+3/-3)
live-build/ubuntu-cpc/hooks/034-disk-image-ppc64el.binary (+2/-2)
To merge this branch: bzr merge lp:~rbalint/livecd-rootfs/minimize-fix-grub
Reviewer Review Type Date Requested Status
Steve Langasek Approve
Review via email: mp+331872@code.launchpad.net

Description of the change

Fix grub config before releasing 2.408.19

To post a comment you must log in.
Revision history for this message
Balint Reczey (rbalint) wrote :

I'm boot-testing the fix, hence the WIP.

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

A grep for suspicious strings also turns up this entry in live-build/ubuntu-cpc/hooks/030-root-tarball.binary (xenial only):

chroot binary/boot/filesystem.dir dpkg-divert --local --rename /usr/sbin/grub-probe

However this is being done while /removing/ kernel packages + grub, so I think this can be ignored.

+1, this all looks correct, just awaiting the results of your boot test.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2017-10-04 18:43:52 +0000
+++ debian/changelog 2017-10-05 14:40:41 +0000
@@ -32,6 +32,11 @@
32 - If we're using SUBPROJECT=minimized, and tzdata is not installed,32 - If we're using SUBPROJECT=minimized, and tzdata is not installed,
33 remove files that have been left behind. This is a workaround for a33 remove files that have been left behind. This is a workaround for a
34 bug that should be fixed in tzdata.34 bug that should be fixed in tzdata.
35 * Factor out grub-related diversions and use them consistently, so we
36 don't end up with wrong os-probe output in our grub.cfg.
37 * Fix the force-partuuid handling to create the file under
38 /etc/default/grub.d/ with a .cfg extension as grub expects; it's unclear
39 how this ever worked without.
3540
36 [ Balint Reczey ]41 [ Balint Reczey ]
37 * Mount using --make-rslave to ensure safe unmounts for rbind mounts42 * Mount using --make-rslave to ensure safe unmounts for rbind mounts
3843
=== modified file 'live-build/ubuntu-cpc/functions'
--- live-build/ubuntu-cpc/functions 2017-09-28 13:38:23 +0000
+++ live-build/ubuntu-cpc/functions 2017-10-05 14:40:41 +0000
@@ -274,10 +274,40 @@
274 CHROOT_ROOT="$1"274 CHROOT_ROOT="$1"
275275
276 # If boot by partuuid has been requested, don't override.276 # If boot by partuuid has been requested, don't override.
277 if [ -f $CHROOT_ROOT/etc/default/grub.d/40-partuuid ] && \277 if [ -f $CHROOT_ROOT/etc/default/grub.d/40-force-partuuid.cfg ] && \
278 grep -q ^GRUB_FORCE_PARTUUID= $CHROOT_ROOT/etc/default/grub.d/40-partuuid; then278 grep -q ^GRUB_FORCE_PARTUUID= $CHROOT_ROOT/etc/default/grub.d/40-force-partuuid.cfg
279 then
279 return 0280 return 0
280 fi281 fi
281 sed -i -e "s,root=[^ ]\+,root=LABEL=cloudimg-rootfs," \282 sed -i -e "s,root=[^ ]\+,root=LABEL=cloudimg-rootfs," \
282 "$CHROOT_ROOT/boot/grub/grub.cfg"283 "$CHROOT_ROOT/boot/grub/grub.cfg"
283}284}
285
286
287# When running update-grub in a chroot on a build host, we don't want it to
288# probe for disks or probe for other installed OSes. Extract common
289# diversion wrappers, so this isn't reinvented differently for each image.
290divert_grub() {
291 CHROOT_ROOT="$1"
292
293 chroot "$CHROOT_ROOT" dpkg-divert --local \
294 --rename /usr/sbin/grub-probe
295 chroot "$CHROOT_ROOT" touch /usr/sbin/grub-probe
296 chroot "$CHROOT_ROOT" chmod +x /usr/sbin/grub-probe
297
298 chroot "$CHROOT_ROOT" dpkg-divert --local \
299 --divert /etc/grub.d/30_os-prober.dpkg-divert \
300 --rename /etc/grub.d/30_os-prober
301}
302
303undivert_grub() {
304 CHROOT_ROOT="$1"
305
306 chroot "$CHROOT_ROOT" rm /usr/sbin/grub-probe
307 chroot "$CHROOT_ROOT" dpkg-divert --remove --local \
308 --rename /usr/sbin/grub-probe
309
310 chroot "$CHROOT_ROOT" dpkg-divert --remove --local \
311 --divert /etc/grub.d/30_os-prober.dpkg-divert \
312 --rename /etc/grub.d/30_os-prober
313}
284314
=== modified file 'live-build/ubuntu-cpc/hooks/032-disk-image.binary'
--- live-build/ubuntu-cpc/hooks/032-disk-image.binary 2017-10-03 15:31:27 +0000
+++ live-build/ubuntu-cpc/hooks/032-disk-image.binary 2017-10-05 14:40:41 +0000
@@ -119,8 +119,10 @@
119 if [ "${SUBPROJECT:-}" = minimized ] && [ -n "$partuuid" ]; then119 if [ "${SUBPROJECT:-}" = minimized ] && [ -n "$partuuid" ]; then
120 echo "partuuid found for root device; forcing it in Grub"120 echo "partuuid found for root device; forcing it in Grub"
121 mkdir -p mountpoint/etc/default/grub.d121 mkdir -p mountpoint/etc/default/grub.d
122 echo "GRUB_FORCE_PARTUUID=$partuuid" >> mountpoint/etc/default/grub.d/40-force-partuuid122 echo "GRUB_FORCE_PARTUUID=$partuuid" >> mountpoint/etc/default/grub.d/40-force-partuuid.cfg
123 divert_grub mountpoint
123 chroot mountpoint update-grub124 chroot mountpoint update-grub
125 undivert_grub mountpoint
124 fi126 fi
125fi127fi
126128
127129
=== modified file 'live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary'
--- live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary 2017-10-03 15:31:26 +0000
+++ live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary 2017-10-05 14:40:41 +0000
@@ -66,7 +66,7 @@
66 # and 033-disk-image-uefi.binary. We want to fix this to not66 # and 033-disk-image-uefi.binary. We want to fix this to not
67 # have initramfs-tools installed at all on these images.67 # have initramfs-tools installed at all on these images.
68 echo "partuuid found for root device; omitting initrd"68 echo "partuuid found for root device; omitting initrd"
69 echo "GRUB_FORCE_PARTUUID=$partuuid" >> mountpoint/etc/default/grub.d/40-force-partuuid69 echo "GRUB_FORCE_PARTUUID=$partuuid" >> mountpoint/etc/default/grub.d/40-force-partuuid.cfg
70 fi70 fi
7171
72 chroot mountpoint apt-get -y update72 chroot mountpoint apt-get -y update
@@ -119,10 +119,10 @@
119 chroot mountpoint grub-install --target=i386-pc "${loop_device}"119 chroot mountpoint grub-install --target=i386-pc "${loop_device}"
120 fi120 fi
121121
122 chroot mountpoint dpkg-divert --local --rename /etc/grub.d/30_os-prober122 divert_grub mountpoint
123 chroot mountpoint update-grub123 chroot mountpoint update-grub
124 replace_grub_root_with_label mountpoint124 replace_grub_root_with_label mountpoint
125 chroot mountpoint dpkg-divert --remove --local --rename /etc/grub.d/30_os-prober125 undivert_grub mountpoint
126126
127 chroot mountpoint apt-get -y clean127 chroot mountpoint apt-get -y clean
128128
129129
=== modified file 'live-build/ubuntu-cpc/hooks/034-disk-image-ppc64el.binary'
--- live-build/ubuntu-cpc/hooks/034-disk-image-ppc64el.binary 2017-05-12 19:20:22 +0000
+++ live-build/ubuntu-cpc/hooks/034-disk-image-ppc64el.binary 2017-10-05 14:40:41 +0000
@@ -50,10 +50,10 @@
50 --boot-directory=/boot \50 --boot-directory=/boot \
51 --target=powerpc-ieee127551 --target=powerpc-ieee1275
5252
53 chroot mountpoint dpkg-divert --local --rename /etc/grub.d/30_os-prober53 divert_grub mountpoint
54 chroot mountpoint update-grub54 chroot mountpoint update-grub
55 replace_grub_root_with_label mountpoint55 replace_grub_root_with_label mountpoint
56 chroot mountpoint dpkg-divert --remove --local --rename /etc/grub.d/30_os-prober56 undivert_grub mountpoint
5757
58 umount_partition mountpoint58 umount_partition mountpoint
59 rmdir mountpoint59 rmdir mountpoint

Subscribers

People subscribed via source and target branches