- Newest
- Most votes
- Most comments
Try this:
- Stop the Instance and Create a Backup
-
Stop the Instance: Go to the AWS Management Console, navigate to the EC2 dashboard, and stop the affected instance.
-
Create a Snapshot: Take a snapshot of the root volume to ensure you have a backup before making any changes.
- Detach and Attach the Root Volume
-
Detach the Root Volume:
-
In the EC2 dashboard, select the instance and detach the root volume.
-
Attach the Volume to Another Instance:
-
Attach the root volume to a temporary EC2 instance as a secondary volume.
- Repair the /etc Folder
-
Mount the Volume:
-
SSH into the temporary instance.
-
Mount the attached volume (e.g., /dev/xvdf) to a directory:
sudo mkdir /mnt/temp
sudo mount /dev/xvdf1 /mnt/temp
- Restore the /etc Folder:
Copy the /etc folder from the temporary instance to the mounted volume:
sudo cp -r /etc /mnt/temp/
- Ensure permissions are correct:
sudo chmod -R 755 /mnt/temp/etc
- Reattach the Volume
-
Detach the repaired volume from the temporary instance.
-
Reattach it as the root volume to the original instance.
- Start the Original Instance
-
Start the original instance and check if it boots correctly.
-
Test SSH access to ensure the issue is resolved.
- Prevent Future Issues
-
Regularly back up critical system files using snapshots or AMIs.
-
Use IAM roles and policies to restrict access to sensitive directories.
Relevant content
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago