0

I'm currently trying to "clone" a working Ubuntu 18 instance. Essentially I just want to make multiple instances from a single preconfigured Ubuntu 18.04 instance. The preconfigured Ubuntu instance is using Google's stock Ubuntu 18.04 LTS image and is fully functional and reachable.

I have attempted to clone it in two ways:

  • Creating an image from the bootdisk of the preconfigured Ubuntu instance to use while creating a new Ubuntu instance.
  • Creating a snapshot of the preconfigured Ubuntu instance to use when creating a new Ubuntu instance.

When deploying the new instance via either one of these methods, the new instance seems to have lost all means of connectivity. The deployment looks to be successful; I can see the internal IP being assigned to nic0 in GCE. It's internal IP, unlike the preconfigured Ubuntu instance, cannot be pinged and SSH doesn't work.

Upon connecting via Serial0 and running ifconfig I tell that there seems to be no networkinterface except for lo. This makes me think that when creating the new instance from an image or snapshot it does not create the networkinterface, even though I am assigning and internal IP and ephemeral IP.

The Serial0 logs also generates these logs in the following order:

[ 2.077602] virtio_net virtio1 ens4: renamed from eth0

[[0;32m  OK  [0m] Started Raise network interfaces.
[[0;32m  OK  [0m] Started Network Service.
         Starting Wait for Network to be Configured...
         Starting Network Name Resolution...
[[0;32m  OK  [0m] Started Wait for Network to be Configured.
         Starting Initial cloud-init job (metadata service crawler)...
[[0;32m  OK  [0m] Started Network Name Resolution.
[[0;32m  OK  [0m] Reached target Host and Network Name Lookups.
[   16.249051] cloud-init[1068]: Cloud-init v. 19.4-33-gbb4131a2-0ubuntu1~18.04.1 running 'init' at Sat, 23 May 2020 18:42:35 +0000. Up 16.12 seconds.
[   16.272622] cloud-init[1068]: ci-info: +++++++++++++++++++++++++++Net device info++++++++++++++++++++++++++++
[   16.292596] cloud-init[1068]: ci-info: +--------+-------+-----------+-----------+-------+-------------------+
[   16.312622] cloud-init[1068]: ci-info: | Device |   Up  |  Address  |    Mask   | Scope |     Hw-Address    |
[   16.332577] cloud-init[1068]: ci-info: +--------+-------+-----------+-----------+-------+-------------------+
[   16.352578] cloud-init[1068]: ci-info: |  ens4  | False |     .     |     .     |   .   | 42:01:0a:01:00:15 |
[   16.373422] cloud-init[1068]: ci-info: |   lo   |  True | 127.0.0.1 | 255.0.0.0 |  host |         .         |
[   16.392574] cloud-init[1068]: ci-info: |   lo   |  True |  ::1/128  |     .     |  host |         .         |
[   16.412605] cloud-init[1068]: ci-info: +--------+-------+-----------+-----------+-------+-------------------+

May 23 18:42:38 ubuntu-gui kernel: [ 2.077602] virtio_net virtio1 ens4: renamed from eth0

Ens4 seems down in Serial0, and eth0 is not present at all. Both ifup ens4 and ifup eth0 return "Uknown interface".

All other instances in the same network have connectivity and SSH, I'm quite sure it's not a firewall problem. Is there a way I can make sure all instances using the image will have working interfaces that actually get their IP-address from GCE?

Thanks in advance!

Edit 1:

While trying to troubleshoot, I found that somehow the new instance does detect the network interface. Although it looks like there is no way to enable them AFAIK.

ykoolhout@ubuntu-gui:~$ sudo ethtool ens4
Settings for ens4:
        Supported ports: [ ]
        Supported link modes:   Not reported
        Supported pause frame use: No
        Supports auto-negotiation: No
        Supported FEC modes: Not reported
        Advertised link modes:  Not reported
        Advertised pause frame use: No
        Advertised auto-negotiation: No
        Advertised FEC modes: Not reported
        Speed: Unknown!
        Duplex: Unknown! (255)
        Port: Other
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: off
        Link detected: no
ykoolhout@ubuntu-gui:~$ sudo ifup ens4
Unknown interface ens4

Edit 2:

It seems the way Google preconfigures it's VM's gets broken when installing the Ubuntu-GUI via apt-get install ubuntu-desktop. The VM still works, but when making a machine image of it and creating a new instance from that machine image will make the new instance break Google's guest environment. New followup question posted here.

Ykoolhout
  • 1
  • 2

1 Answers1

0

It is possible that the guest OS is not installed on your machine. I would suggest to first validate your guest environment and if it is not installed you can install the guest OS using one of these methods.

  • Use the import tool. For instructions for how to use the import tool, review Making an image bootable.
  • Connect to your instance using SSH or RDP and install the guest environment in-place
  • Clone your boot disk and install the guest environment using a startup script
Gustavo
  • 31
  • 4
  • You are right! Guest environment doesn't seem to be loading when checking Serial0! There doesn't seem to be a way for me to make it bootable though. I tried the import tool, which succesfully finishes after about 15 minutes and states the it is installing the GCE tools. Upon creating an instance from the image it still doesn't seem to load the Google daemons/agents. I also tried doing this via a machine from the original VM, which does have the daemons running...no luck. Any ideas? – Ykoolhout May 26 '20 at 14:01
  • I would recommend reviewing the image you are installing based on this documentation: https://cloud.google.com/compute/docs/images/guest-environment#when-to-install I created an instance based on a snapshot from a instance using the ubuntu 18.04 google pre-defined image and successfuly booted it up and was able to SSH. – Gustavo May 26 '20 at 18:02
  • Figured out the problem happened from the moment I installed "ubuntu-desktop". Made a new followup question here: https://serverfault.com/questions/1018785/gcp-cant-succesfully-clone-gcp-instance-after-installing-ubuntu-desktop-googl – Ykoolhout May 26 '20 at 18:12