Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EC2 AMI built from Ubuntu 18.04 with ubuntu-desktop installed is unreachable

I am trying to create a custom AMI with some software installed including the package called ubuntu-desktop. However, installing this package makes the resulting AMI unusable.

Exact steps for a minimal repro:

  1. Create EC2 instance from AMI ami-0f65671a86f061fcd (this is Canonical's Ubuntu Server 18.04 LTS (HVM), SSD Volume Type)
  2. SSH into the box and run two commands:
    • sudo apt-get -y update
    • sudo apt-get -y install ubuntu-desktop
  3. From EC2 console, right click the instance, and hit Image > Create Image
    • Fill in name/description, but make sure to not to check "No Reboot"
  4. Create a new instance from that AMI that you just created

Expected result:

  • New instance is created, passes all status checks, and you can SSH into it.

Actual result:

  • New instance is created, does not pass the reachability check, and times out upon trying to SSH.

The system log in the instance launched from the AMI shows:

[ 12.125396] cloud-init[691]: Cloud-init v. 18.3-9-g2e62cb8a-0ubuntu1~18.04.2 running 'init' at Fri, 09 Nov 2018 02:15:09 +0000. Up 11.47 seconds. [ 12.145064] cloud-init[691]: ci-info: +++++++++++++++++++++++++++Net device info++++++++++++++++++++++++++++ [ 12.161038] cloud-init[691]: ci-info: +--------+-------+-----------+-----------+-------+-------------------+ [ 12.180149] cloud-init[691]: ci-info: | Device | Up | Address | Mask | Scope | Hw-Address | [ 12.192161] cloud-init[691]: ci-info: +--------+-------+-----------+-----------+-------+-------------------+ [ 12.209635] cloud-init[691]: ci-info: | eth0 | False | . | . | . | 0a:6a:25:9c:47:cc |[[0;32m OK [0m] Started Initial cloud-init job (metadata service crawler). [ 12.223002] cloud-init[691]: ci-info: | lo | True | 127.0.0.1 | 255.0.0.0 | host | . |

SO formatting makes that unreadable but the interesting part is that eth0 is not Up

like image 738
Lev Dubinets Avatar asked Nov 09 '18 02:11

Lev Dubinets


People also ask

Why is my EC2 instance refused to connect?

Error message: "ssh: connect to host ec2-X-X-X-X.compute-1.amazonaws.com port 22: Connection refused". This message comes from a host remotely. The following are common causes for this error: The host reached the instance but there was no service listening on the SSH port.


2 Answers

I also had this exact same problem with Ubuntu 18.04 on AWS. This answer resolved it for me:

The correct way to do it is to use an empty /etc/NetworkManager/conf.d/10-globally-managed-devices.conf that will overshadow/overwrite the one in /usr/lib – solsTiCe Jan 2 '17 at 13:41

This answer is from this Ask Ubuntu question: https://askubuntu.com/questions/838865/network-manager-refusing-to-manage-wired-interfaces

like image 98
rcprcp Avatar answered Sep 25 '22 07:09

rcprcp


I wanted to post this as a comment (because the other answer is correct) but I can't because I don't have enough reputation.

Anyway the exact command I entered was:

touch /etc/NetworkManager/conf.d/10-globally-managed-devices.conf

And I was then able to SSH in.

This was taken from this comment 6 on this issue: https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1638842/comments/6

like image 41
vab2048 Avatar answered Sep 22 '22 07:09

vab2048