question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

google-adress-manager is broken on Ubuntu Xenial 16.04

See original GitHub issue

address-manager fails on the current image of 16.04 server because the network interfaces have been renamed:

 google-address-manager[7151]: WARNING Non-zero exit status from: "/sbin/ip route ls table local type local dev eth0 scope host proto 66"
                    STDOUT:

             STDERR:
          Cannot find device "eth0"

I am getting such an error every 5 seconds. See also https://bugs.launchpad.net/juju-vagrant-images/+bug/1547110 or https://github.com/geerlingguy/packer-ubuntu-1604/issues/1 for (some) of the other manifestations of this change.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
sbadiacommented, Apr 29, 2016

For the record…

# zcat /usr/share/doc/gce-daemon/changelog.Debian.gz|head -20
gce-utils (1.3.3-0ubuntu4~16.04.0) xenial; urgency=medium

  * Backport to 16.04

 -- Daniel Watkins <daniel.watkins@canonical.com>  Tue, 26 Apr 2016 11:01:13 +0100

gce-utils (1.3.3-0ubuntu4) yakkety; urgency=medium

  * Don't assume (in address manager) that the network interface will be eth0.

 -- Daniel Watkins <daniel.watkins@canonical.com>  Mon, 25 Apr 2016 17:54:22 +0100
# diff -u address_manager.py /usr/share/google/google_daemon/address_manager.py
--- /usr/share/google/google_daemon/address_manager.py  2016-04-29 17:13:34.584521685 +0000
+++ /usr/share/google/google_daemon/address_manager.py  2016-04-26 20:03:08.000000000 +0000
@@ -15,7 +15,7 @@
 """Manage extra network interface addresses on a GCE instance.

 Fetch a list of public endpoint IPs from the metadata server, compare it with
-what's configured on eth0, and add/remove addresses from ens4 to make them
+what's configured on eth0, and add/remove addresses from eth0 to make them
 match.  Only remove those which match our proto code.

 This must be run by root. If it reads any malformed data, it will take no
@@ -42,6 +42,13 @@
 class InputError(Exception):
   pass

+
+def get_first_ens_interface():
+    candidates = [iface for iface in os.listdir('/sys/class/net/')
+                  if iface.startswith('ens')]
+    return candidates[0]
+
+
 class AddressManager(object):
   """Manage public endpoint IPs."""

@@ -52,6 +59,7 @@
     self.ip_path = '/sbin/ip'
     if not os.path.exists(self.ip_path):
         self.ip_path = '/bin/ip'
+    self.interface = get_first_ens_interface()

     # etag header value is hex, so this is guaranteed to not match.
     self.default_last_etag = 'NONE'
@@ -107,8 +115,8 @@

   def ReadLocalConfiguredAddrs(self):
     """Fetch list of addresses we've configured on eth0 already."""
-    cmd = ('{0} route ls table local type local dev eth0 scope host ' +
-           'proto {1:d}').format(self.ip_path, GOOGLE_PROTO_ID)
+    cmd = ('{0} route ls table local type local dev {2} scope host ' +
+           'proto {1:d}').format(self.ip_path, GOOGLE_PROTO_ID, self.interface)
     result = self.system.RunCommand(cmd.split())
     if self.IPCommandFailed(result, cmd):
       raise InputError('Can''t check local addresses')
@@ -141,8 +149,8 @@

   def AddOneAddress(self, addr):
     """Configure one address on eth0."""
-    cmd = '%s route add to local %s/32 dev eth0 proto %d' % (
-        self.ip_path, addr, GOOGLE_PROTO_ID)
+    cmd = '%s route add to local %s/32 dev %s proto %d' % (
+        self.ip_path, addr, self.interface, GOOGLE_PROTO_ID)
     result = self.system.RunCommand(cmd.split())
     self.IPCommandFailed(result, cmd)  # Ignore return code

@@ -155,8 +163,8 @@
     """Delete one address from eth0."""
     # This will fail if it doesn't match exactly the specs listed.
     # That'll help ensure we don't remove one added by someone else.
-    cmd = '%s route delete to local %s/32 dev eth0 proto %d' % (
-        self.ip_path, addr, GOOGLE_PROTO_ID)
+    cmd = '%s route delete to local %s/32 dev %s proto %d' % (
+        self.ip_path, addr, self.interface, GOOGLE_PROTO_ID)
     result = self.system.RunCommand(cmd.split())
     self.IPCommandFailed(result, cmd)  # Ignore return code

0reactions
zmaranocommented, Dec 5, 2017

@maksymov What specifically are you having problems with? 16.04+ introduced predictable network interface names. The Ubuntu software for GCE has been updated to reflect these changes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ubuntu 16.04.7 LTS (Xenial Xerus)
Name Last modified Size Parent Directory ‑ MD5SUMS 2019‑02‑28 16:54 264 MD5SUMS‑metalink 2019‑02‑28 16:54 284
Read more >
Ubuntu 16.04 broken packages after fresh install - apt
16.04 is new and all packages are not ready to use in all servers. Using Main Server to download packages solve my problem....
Read more >
Ubuntu 16.04 LTS Is Now Available to Download
Ubuntu 16.04 LTS ('Xenial Xerus') is a long-term support release of ... New app spread shortcut: Super + Ctrl + W; Window management...
Read more >
How to Upgrade Ubuntu 16.04 to Ubuntu 18.04 - Liquid Web
If you are still using Ubuntu version 16.04, you may want to consider ... Hit:1 http://us.archive.ubuntu.com/ubuntu xenial InRelease
Read more >
Install Ubuntu 16.04 From Scratch - CSCI 353, Fall 2022 - Merlot
To download the right 32-bit Ubuntu 16.04, you need to go to the Ubuntu 16.04 (Xenial Xerus) web site and download the desktop...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found