- Newest
- Most votes
- Most comments
Hello,
Please try this solution it will be helpful for you.
If your Ubuntu server has lost connectivity and is showing an "Error: boot/grub/i386-pc/normal.mod not found," you can attempt to recover it without terminating the instance.
First stop the affected instance via the AWS Management Console.
Then detach the root EBS volume from this instance and attach it to a new temporary recovery instance in the same availability zone. SSH into the recovery instance, mount the detached volume, and chroot into it.
Once inside the chroot environment, reinstall the GRUB bootloader by running grub-install /dev/xvdf (replace with the correct device name) and update-grub. Exit the chroot environment, unmount the volume, and detach it from the recovery instance. Reattach the volume back to the original instance as /dev/sda1.
Finally start the affected instance again. If the issue persists, you might need to check the filesystem integrity using fsck or perform a complete reinstall of GRUB. This process should help you recover your server without losing your existing configurations.
Please look at Document Link you will get more information.
Step 1: Stop the Instance
Stop the Instance:
- Log in to the AWS Management Console.
- Go to the EC2 dashboard.
- Select your affected instance and stop it.
Step 2: Create a Snapshot of the Root Volume
Create a Snapshot:
- Go to the Elastic Block Store (EBS) section in the AWS Console.
- Find the root volume attached to your instance.
- Create a snapshot of this volume to ensure you have a backup before making any changes.
Step 3: Attach the Root Volume to Another Instance
Launch a New Temporary Instance:
- Launch a new temporary EC2 instance in the same availability zone as your affected instance. This instance will be used to repair the filesystem.
- Choose an instance type and operating system similar to your affected instance (preferably Ubuntu).
Detach the Root Volume:
- In the EC2 dashboard, select the stopped instance.
- Go to the Description tab and find the root volume (typically /dev/xvda or /dev/sda1).
- Detach the root volume from the affected instance.
Attach the Root Volume to the Temporary Instance:
- Attach the detached volume to the temporary instance as a secondary volume (e.g., /dev/sdf).
Step 4: Repair the Filesystem
Connect to the Temporary Instance:
- SSH into the temporary instance.
Mount the Attached Volume:
- Create a mount point:
sudo mkdir /mnt/recovery - Mount the volume:
sudo mount /dev/sdf1 /mnt/recovery - Note: Use /dev/sdf1 if it is the first partition; otherwise, use /dev/sdf.
Chroot into the Mounted Volume:
sudo chroot /mnt/recovery
Reinstall GRUB:
- Install GRUB:
grub-install /dev/xvdf(or /dev/nvme1n1 if using NVMe) - Update GRUB configuration:
update-grub
Exit the Chroot Environment and Unmount:
- Exit chroot:
exit - Unmount the volume:
sudo umount /mnt/recovery
Step 5: Reattach the Volume and Restart the Instance
Detach the Volume from the Temporary Instance:
- Go to the EBS section in the AWS Console.
- Detach the volume from the temporary instance.
Reattach the Volume to the Original Instance:
- Attach the volume back to the original instance as the root volume (e.g., /dev/xvda or /dev/sda1).
Start the Original Instance:
- Start the original instance and check if it boots correctly.
Step 6: Verify and Monitor
Connect to the Original Instance:
- SSH into your original instance once it is running.
Verify System Logs:
- Check the system logs to ensure there are no other issues:
dmesg,journalctl -xe, and/var/log/syslog.
Relevant content
- asked 2 years ago

please accept the answer if it was useful