[Merge] ~xnox/grub:initrdless-docs into ~ubuntu-core-dev/grub/+git/ubuntu:ubuntu

Dimitri John Ledkov dimitri.ledkov+lp at canonical.com
Wed Nov 18 13:19:01 UTC 2020



Diff comments:

> diff --git a/debian/grub-common.service b/debian/grub-common.service
> new file mode 100644
> index 0000000..1395ad9
> --- /dev/null
> +++ b/debian/grub-common.service
> @@ -0,0 +1,14 @@
> +[Unit]
> +Description=Record successful boot for GRUB
> +
> +[Service]
> +Type=simple
> +Restart=no
> +RemainAfterExit=yes
> +ExecStartPre=/bin/sh -c '[ -s /boot/grub/grubenv ] || rm -f /boot/grub/grubenv; mkdir -p /boot/grub'

yes, that is correct. Since an empty grubenv file is not a valid grub environment file. Note this is direct reimplementation of the init.d script that grub already ships.

> +ExecStart=grub-editenv /boot/grub/grubenv unset recordfail
> +ExecStartPost=/bin/sh -c 'if grub-editenv /boot/grub/grubenv list | grep -q initrdless_boot_fallback_triggered=1; then echo "<3>grub: GRUB_FORCE_PARTUUID set, initrdless boot paniced, fallback triggered."; fi'

this is a lot shorter than the existing init.d script. putting logic somewhere where it can be reused by both systemd & initd script might be useful.

> +StandardOutput=kmsg
> +
> +[Install]
> +WantedBy=multi-user.target
> \ No newline at end of file
> diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
> index 49e6272..47daf51 100644
> --- a/util/grub.d/10_linux.in
> +++ b/util/grub.d/10_linux.in

Yes i did mean to include this. This is how one must commit things for git-dpm managed grub source tree.

> @@ -160,6 +160,12 @@ if [ "$vt_handoff" = 1 ]; then
>  fi
>  
>  if [ x"$GRUB_FORCE_PARTUUID" != x ]; then
> +    gettext_printf "GRUB_FORCE_PARTUUID is set, will attempt initrdless boot\n" >&2
> +    cat << EOF
> +#
> +# GRUB_FORCE_PARTUUID is set, will attempt initrdless boot
> +# Upon panic fallback to booting with initrd
> +EOF
>     echo "set partuuid=${GRUB_FORCE_PARTUUID}"
>  fi
>  
> @@ -245,6 +251,8 @@ EOF
>          linux_root_device_thisversion="PARTUUID=${GRUB_FORCE_PARTUUID}"
>      fi
>      message="$(gettext_printf "Loading initial ramdisk ...")"
> +    initrdlessfail_msg="$(gettext_printf "GRUB_FORCE_PARTUUID set, initrdless boot failed. Attempting with initrd.")"
> +    initrdlesstry_msg="$(gettext_printf "GRUB_FORCE_PARTUUID set, attempting initrdless boot.")"
>      initrd_path=
>      for i in ${initrd}; do
>          initrd_path="${initrd_path} ${rel_dirname}/${i}"
> @@ -256,6 +264,7 @@ EOF
>      if test -n "${initrd}" && [ x"$GRUB_FORCE_PARTUUID" != x ]; then
>          sed "s/^/$submenu_indentation/" << EOF
>  	if [ "\${initrdfail}" = 1 ]; then
> +	  echo	'$(echo "$initrdlessfail_msg" | grub_quote)'
>  	  linux	${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
>  EOF
>          if [ x"$quiet_boot" = x0 ] || [ x"$type" != xsimple ]; then
> @@ -266,6 +275,7 @@ EOF
>          sed "s/^/$submenu_indentation/" << EOF
>  	  initrd	$(echo $initrd_path)
>  	else
> +	  echo	'$(echo "$initrdlesstry_msg" | grub_quote)'
>  	  linux	${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args} panic=-1
>  EOF
>          if [ -n "$initrd_path_only_early" ]; then


-- 
https://code.launchpad.net/~xnox/grub/+git/grub/+merge/392866
Your team Ubuntu Core Development Team is requested to review the proposed merge of ~xnox/grub:initrdless-docs into ~ubuntu-core-dev/grub/+git/ubuntu:ubuntu.



More information about the Ubuntu-reviews mailing list