Ticket #1011 (closed defect: fixed)

Opened 10 years ago

Last modified 9 years ago

Give up on kexec for auto-upgrades

Reported by: jdreed Owned by: jrjarvis
Priority: normal Milestone: Precise Beta
Component: -- Keywords: hackathon
Cc: Fixed in version:
Upstream bug:

Description

Unattended kexec is mostly unusable on modern systems (or at least with the natty kernel). If things don't improve, we should download the kernel and initrd and sketch on grub and reboot that way. Note that this requires changing /etc/default/grub to use GRUB_DEFAULT=saved

Change History

comment:1 Changed 10 years ago by geofft

I don't think you want GRUB_DEFAULT=saved, actually. That risks people booting into some other kernel (recovery kernel, old kernel, memtest) and the machine always booting into that kernel; see #968 and  LP:436936 for issues we've run into with this.

You only need GRUB_DEFAULT=saved for grub-reboot, and we can just add the kernel we want to boot to a fixed position, e.g., the first one and avoid grub-reboot entirely.

comment:2 Changed 10 years ago by jdreed

  • Keywords hackathon added

comment:3 Changed 10 years ago by jrjarvis

  • Status changed from new to assigned
  • Owner set to jrjarvis

comment:4 follow-up: ↓ 5 Changed 10 years ago by jrjarvis

/mit/jrjarvis/Public/athena-auto-upgrade

Went with the grub-reboot approach and put the kernel/initrd on athena-root.

Creates a new entry in grub.d for "auto-upgrade", modifies /etc/default/grub, grub-reboots into auto-upgrade to kick off the installer.

$ athena-auto-upgrade -d

mkdir -p /auto-upgrade
wget http://debathena.mit.edu/net-install/oneiric/i386/initrd.gz -O /auto-upgrade/initrd.gz
wget http://debathena.mit.edu/net-install/oneiric/i386/linux -O /auto-upgrade/linux
DEBUG: USING kargs=netcfg/get_hostname=helicon             netcfg/disable_dhcp=true             netcfg/get_domain=mit.edu             netcfg/get_nameservers="18.72.0.3 18.70.0.160"            netcfg/get_ipaddress=18.18.3.99             netcfg/get_netmask=255.255.0.0             netcfg/get_gateway=18.18.0.1             netcfg/confirm_static=true locale=en_US keyboard-configuration/layoutcode=us        interface=auto        url=http://18.9.60.73/installer/oneiric/debathena.preseed        debathena/pxetype=cluster --
cp /tmp/athena-auto-upgrade.27840.tmp /etc/grub.d/49_auto-upgrade
chmod 755 /etc/grub.d/49_auto-upgrade
perl -i.bak -pe s/^GRUB_DEFAULT=.*$/GRUB_DEFAULT=saved/ /etc/default/grub
perl -i.bak -pe s/^GRUB_CMDLINE_LINUX_DEFAULT=.*$/GRUB_CMDLINE="quiet panic=5"/ /etc/default/grub
/usr/sbin/grub-set-default 0
/usr/sbin/grub-reboot auto-upgrade
/usr/sbin/update-grub
/sbin/reboot

Note if something does fail during upgrade /etc/default/grub will be tainted.

comment:5 in reply to: ↑ 4 Changed 10 years ago by kaduk

Replying to jrjarvis:

$ athena-auto-upgrade -d

mkdir -p /auto-upgrade
wget http://debathena.mit.edu/net-install/oneiric/i386/initrd.gz -O /auto-upgrade/initrd.gz
wget http://debathena.mit.edu/net-install/oneiric/i386/linux -O /auto-upgrade/linux
DEBUG: USING kargs=netcfg/get_hostname=helicon             netcfg/disable_dhcp=true             netcfg/get_domain=mit.edu             netcfg/get_nameservers="18.72.0.3 18.70.0.160"            netcfg/get_ipaddress=18.18.3.99             netcfg/get_netmask=255.255.0.0             netcfg/get_gateway=18.18.0.1             netcfg/confirm_static=true locale=en_US keyboard-configuration/layoutcode=us        interface=auto        url=http://18.9.60.73/installer/oneiric/debathena.preseed        debathena/pxetype=cluster --
cp /tmp/athena-auto-upgrade.27840.tmp /etc/grub.d/49_auto-upgrade
chmod 755 /etc/grub.d/49_auto-upgrade
perl -i.bak -pe s/^GRUB_DEFAULT=.*$/GRUB_DEFAULT=saved/ /etc/default/grub
perl -i.bak -pe s/^GRUB_CMDLINE_LINUX_DEFAULT=.*$/GRUB_CMDLINE="quiet panic=5"/ /etc/default/grub
/usr/sbin/grub-set-default 0
/usr/sbin/grub-reboot auto-upgrade
/usr/sbin/update-grub
/sbin/reboot

Hmm, two successive perl -i.bak -pe s/foo/bar/ on /etc/default/grub may not be the greatest plan.

Note if something does fail during upgrade /etc/default/grub will be tainted.

tained as in have GRUB_DEFAULT=saved and/or GRUB_CMDLINE set, or something else?

comment:6 Changed 10 years ago by jdreed

Keep in mind that athena-auto-upgrade should only ever be run on -cluster, so we should feel free to clobber /etc/default/grub in any way we like.

comment:7 Changed 10 years ago by jrjarvis

  • Status changed from assigned to closed
  • Resolution set to fixed

comment:8 Changed 10 years ago by jdreed

  • Status changed from closed to reopened
  • Resolution fixed deleted

comment:9 Changed 10 years ago by jdreed

  • Status changed from reopened to committed

comment:10 Changed 9 years ago by jdreed

OK, code tested now that we have a testing entry for Precise on alpha. Awaiting a build.

comment:11 Changed 9 years ago by jdreed

  • Status changed from committed to development

auto-update 1.35 is in -dev.

comment:12 Changed 9 years ago by jdreed

  • Status changed from development to proposed

comment:13 Changed 9 years ago by jdreed

  • Status changed from proposed to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.