How to Handle Modified /boot/grub/menu.lst During Ubuntu Upgrade on AWS EC2 Instances


1 views

When upgrading Ubuntu on AWS EC2 instances, particularly from older versions like 13.10 to 14.04, you might encounter this common GRUB configuration file conflict. The system detects that your current /boot/grub/menu.lst differs from the maintainer's version, even if you personally haven't modified it.

AWS EC2 instances typically come with pre-configured GRUB settings that:

  • Optimize boot parameters for virtualized environments
  • Include AWS-specific kernel parameters
  • May contain custom console settings for EC2's Xen hypervisor

The safest option is to keep the local version during the upgrade prompt. Here's why:

# Example of AWS-specific GRUB parameters you might find:
kernel /boot/vmlinuz-3.11.0-15-generic root=UUID=ebs-vol-123 ro 
console=hvc0 xen_emul_unplug=unnecessary

After completing the upgrade, verify your GRUB configuration:

sudo diff /boot/grub/menu.lst /usr/share/grub/menu.lst~
# Check for AWS-specific parameters
grep -E 'xen|console|root=' /boot/grub/menu.lst

Only choose "install the package maintainer's version" if:

  • You're moving to a new instance type
  • Experiencing boot issues
  • Upgrading across multiple LTS versions

For scripted upgrades, use this non-interactive approach:

sudo DEBIAN_FRONTEND=noninteractive do-release-upgrade -f DistUpgradeViewNonInteractive
sudo apt-mark hold grub-common grub-pc

If you encounter problems after upgrade:

# Recover using AWS Systems Manager
aws ssm send-command --instance-id i-1234567890abcdef0 \
--document-name "AWS-RunShellScript" \
--parameters 'commands=["sudo update-grub"]'

When upgrading Ubuntu on AWS EC2 instances (especially older versions like 13.10 to 14.04), you might encounter this prompt about /boot/grub/menu.lst modifications. This typically occurs because:

  • AWS modifies GRUB configuration during instance provisioning
  • The cloud-init process makes adjustments for virtualization
  • Previous unattended upgrades may have altered the file

The upgrade process presents several choices for handling the conflict:

1. install the package maintainer's version
2. keep the local version currently installed
3. show differences between versions
4. side-by-side difference view
5. 3-way difference comparison
6. 3-way merge (experimental)
7. start a shell to examine

For AWS EC2 instances, the safest choice is to:

# Select option 2: keep the local version
# This preserves AWS-specific configurations

After completing the upgrade, verify GRUB configuration:

sudo update-grub
sudo grub-install /dev/xvda  # For older EC2 instances

If you're curious about the modifications:

# Use option 3 or 4 to view differences
# Sample output might show AWS-specific entries:
# - console=hvc0
# - xen_blkfront.sda_is_xvda=1
# - root=LABEL=cloudimg-rootfs

After upgrade completion:

# Check boot configuration
ls -l /boot/grub/menu.lst
cat /proc/cmdline

# Verify instance connectivity
ping -c 3 google.com
ssh your-instance.amazonaws.com

Only select option 1 if:

  • You're migrating to a non-virtualized environment
  • You need new GRUB features not in AWS's version
  • You've confirmed backup of current configuration