Muối Nhạt's site

Make notes and share experiences

Make notes and share experiences

Problem with Amazon EC2 Ubuntu instance after installing whereami

This post, I had copied from this article – it’s very useful, not only for the problem with whereami package installation, but for some other mess situation.

Issue
I installed whereami on an Amazon EC2 Debian/Ubuntu Linux instance and can no longer connect to the instance.

Short Description
The Debian version of whereami is designed to provide multiple network connectivity options for laptops or other portable devices capable of running Debian/Ubuntu Linux. The functionality of whereami for Debian-based Linux distributions is completely different from the functionality of whereami provided for Enterprise versions of Linux such as Red Hat Enterprise Linux, Amazon Linux, and enterprise versions of SuSe or Centos Linux. Attempted installation of the whereami package on an Amazon EC2 Debian/Ubuntu Linux instance will terminate any existing connection to the instance and cause all future connection attempts to fail.

Note
Attempts to install whereami on an Amazon EC2 Debian/Ubuntu Linux instance encounter problems running dpkg-reconfigure, causing the installation to hang and eventually fail.

Resolution
Follow these steps to restore network connectivity to an Amazon EC2 Debian/Ubuntu Linux instance after attempting installation of the whereami package:

Start an Amazon EC2 Linux ‘rescue’ instance with chroot installed.
Stop the Debian/Ubuntu EC2 instance.
Detach the root volume of the Debian/Ubuntu EC2 instance.
Attach the root volume of the Debian/Ubuntu EC2 instance to the Amazon EC2 ‘rescue’ instance.
Start the ‘rescue’ instance if it is not already started, and open a terminal session.
Run the following command to mount the root volume from the Debian/Ubuntu instance to /mnt.

     sudo mount /dev/xvdf /mnt

Run the following command to chroot into the root volume of the Debian/Ubuntu instance.

     chroot /mnt /bin/bash

Run the following command to remove the whereami package from the Debian/Ubuntu instance.

     apt-get remove –purge whereami

Run the following command to unmount the root volume of the Debian/Ubuntu instance and remove from the rescue instance.

     exit; umount /mnt;

After the disk is unmounted, detach the root volume of the Debian/Ubuntu EC2 instance from the ‘rescue’ instance.
Reattach the root volume of the Debian/Ubuntu EC2 instance.
Start the Debian/Ubuntu EC2 instance. Network connectivity should be restored and connections to the instance should be successful.

Keywords
Amazon EC2, Linux, Debian, Ubuntu, whereami, networking, lost connection, restore connectivity, chroot, mnt

Related Forums
“lost connectivity ubuntu whereami” in the Amazon EC2 Discussion Forums

RELATED POSTS

Kubernetes

Kubernetes is a container orchestration platform that automates the deployment, scaling, and management of containerized applications. Its architecture comprises several components, each with specific functionality: These components work together to provide a robust and scalable platform for deploying and managing

Read More »
Share the Post: