<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Ubuntu 18.04 Cloud-Init Networking Problem]]></title><description><![CDATA[<p dir="auto">I've been trying to create an Ubuntu 18.04 cloud ready template. After much trial and error I've mostly gotten it working. But the networking won't come up.</p>
<p dir="auto">I created the template from scratch and after some reading I found that it's important to remove any previous netplan configurations. So the template has an empty <code>/etc/netplan</code> directory.</p>
<p dir="auto">I added the following to my "Network config" box when creating the VM:</p>
<pre><code>version: 2
renderer: networkd
ethernets:
  eth0:
    addresses:
      - 172.27.19.65/24
    gateway4: 172.27.19.1
    nameservers:
      addresses:
        - 192.168.1.15
        - 192.168.2.15
</code></pre>
<p dir="auto">And after the first boot of the template I can see that the following is indeed created in <code>/etc/netplan/50-cloud-init.yaml</code>:</p>
<pre><code>network:
    ethernets:
        eth0:
            addresses:
            - 172.27.19.65/24
            gateway4: 172.27.19.1
            nameservers:
                addresses:
                - 192.168.1.15
                - 192.168.2.15
    renderer: networkd
    version: 2

</code></pre>
<p dir="auto">But the network is never brought up. In the cloud-init log I see the following:</p>
<pre><code>2021-04-02 01:12:09,262 - stages.py[DEBUG]: applying net config names for {'version': 2, 'renderer': 'networkd', 'ethernets': {'eth0': {'addresses': ['172.27.19.65/24'], 'gateway4': '172.27.19.1', 'nameservers': {'addresses': ['192.168.1.15', '192.168.2.15']}}}}
2021-04-02 01:12:09,263 - __init__.py[DEBUG]: no interfaces to rename
2021-04-02 01:12:09,263 - stages.py[INFO]: Applying network configuration from ds bringup=False: {'version': 2, 'renderer': 'networkd', 'ethernets': {'eth0': {'addresses': ['172.27.19.65/24'], 'gateway4': '172.27.19.1', 'nameservers': {'addresses': ['192.168.1.15', '192.168.2.15']}}}}
2021-04-02 01:12:09,265 - __init__.py[DEBUG]: Selected renderer 'netplan' from priority list: None
2021-04-02 01:12:09,265 - network_state.py[DEBUG]: NetworkState Version2: missing "macaddress" info in config entry: eth0: {'addresses': ['172.27.19.65/24'], 'gateway4': '172.27.19.1', 'nameservers': {'addresses': ['192.168.1.15', '192.168.2.15']}}
2021-04-02 01:12:09,265 - network_state.py[DEBUG]: v2(ethernets) -&gt; v1(physical):
{'type': 'physical', 'name': 'eth0', 'mac_address': None, 'subnets': [{'type': 'static', 'address': '172.27.19.65/24', 'gateway': '172.27.19.1', 'dns_nameservers': ['192.168.1.15', '192.168.2.15']}]}
2021-04-02 01:12:09,268 - network_state.py[DEBUG]: v2_common: handling config:
{'eth0': {'addresses': ['172.27.19.65/24'], 'gateway4': '172.27.19.1', 'nameservers': {'addresses': ['192.168.1.15', '192.168.2.15']}}}
2021-04-02 01:12:09,269 - netplan.py[DEBUG]: V2 to V2 passthrough
2021-04-02 01:12:09,270 - util.py[DEBUG]: Writing to /etc/netplan/50-cloud-init.yaml - wb: [644] 649 bytes
2021-04-02 01:12:09,282 - subp.py[DEBUG]: Running command ['netplan', 'generate'] with allowed return codes [0] (shell=False, capture=True)
2021-04-02 01:12:09,455 - subp.py[DEBUG]: Running command ['udevadm', 'test-builtin', 'net_setup_link', '/sys/class/net/eth0'] with allowed return codes [0] (shell=False, capture=True)
2021-04-02 01:12:09,460 - subp.py[DEBUG]: Running command ['udevadm', 'test-builtin', 'net_setup_link', '/sys/class/net/lo'] with allowed return codes [0] (shell=False, capture=True)
2021-04-02 01:12:09,463 - main.py[DEBUG]: [local] Exiting. datasource DataSourceNoCloud [seed=/dev/xvdb][dsmode=net] not in local mode.
</code></pre>
<p dir="auto">You can see that it runs <code>netplan generate</code> but never <code>netplan apply</code>. From the logs it looks like the problem might be that the datasource isn't in "local" mode. But I thought I took care of that because I have the following in my <code>/etc/cloud/cloud.cfg</code>:</p>
<pre><code>datasource_list: [ NoCloud, None ]
datasource:
  NoCloud:
    dsmode: local
</code></pre>
<p dir="auto">I'm also wondering if there's an issue related to the line in the logs <code>NetworkState Version2: missing "macaddress" info in config entry: eth0:</code>.</p>
<p dir="auto">In any case I've been banging my head against the wall with this for too long... So I'd appreciate any guidance.</p>
]]></description><link>https://xcp-ng.org/forum/topic/4426/ubuntu-18-04-cloud-init-networking-problem</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Apr 2026 16:28:06 GMT</lastBuildDate><atom:link href="https://xcp-ng.org/forum/topic/4426.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 02 Apr 2021 01:33:39 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Ubuntu 18.04 Cloud-Init Networking Problem on Thu, 22 Apr 2021 01:25:08 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/slynch" aria-label="Profile: slynch">@<bdi>slynch</bdi></a> OK, that's very good news then! Debian was still having issues where any configuration applied via cloud-init would just be <em>added</em> to the existing default DHCP config, unless you took care to build the VM without the default <code>interfaces</code> config beforehand.</p>
]]></description><link>https://xcp-ng.org/forum/post/38808</link><guid isPermaLink="true">https://xcp-ng.org/forum/post/38808</guid><dc:creator><![CDATA[fohdeesha]]></dc:creator><pubDate>Thu, 22 Apr 2021 01:25:08 GMT</pubDate></item><item><title><![CDATA[Reply to Ubuntu 18.04 Cloud-Init Networking Problem on Fri, 16 Apr 2021 19:47:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/fohdeesha" aria-label="Profile: fohdeesha">@<bdi>fohdeesha</bdi></a> The VM has both of the netplan configurations in <code>/etc/netplan</code> - the original DHCP and CloudInit config.</p>
<pre><code>&gt; ls -la /etc/netplan/
total 16
drwxr-xr-x   2 root root 4096 Apr 15 12:44 .
drwxr-xr-x 104 root root 4096 Apr 15 17:59 ..
-rw-r--r--   1 root root  193 Apr  9 16:27 01-netcfg.yaml
-rw-r--r--   1 root root  648 Apr 15 12:44 50-cloud-init.yaml
</code></pre>
<p dir="auto">But the DHCP address is <strong>replaced</strong> by the new config. So yes, it successfully reads the new networking config, generates the config for Netplan, and applies it so the VM gets the correct address.</p>
]]></description><link>https://xcp-ng.org/forum/post/38611</link><guid isPermaLink="true">https://xcp-ng.org/forum/post/38611</guid><dc:creator><![CDATA[slynch]]></dc:creator><pubDate>Fri, 16 Apr 2021 19:47:45 GMT</pubDate></item><item><title><![CDATA[Reply to Ubuntu 18.04 Cloud-Init Networking Problem on Fri, 16 Apr 2021 09:57:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/slynch" aria-label="Profile: slynch">@<bdi>slynch</bdi></a> Interesting! since you left the default DHCP netplan, does the VM also have a DHCP config and grab a DHCP address in addition to your cloud-init config?</p>
<p dir="auto">Also, you mean when there is netplan content, cloud-init <em>does</em> finally apply <code>netplan apply</code> like it's supposed to? interesting</p>
]]></description><link>https://xcp-ng.org/forum/post/38603</link><guid isPermaLink="true">https://xcp-ng.org/forum/post/38603</guid><dc:creator><![CDATA[fohdeesha]]></dc:creator><pubDate>Fri, 16 Apr 2021 09:57:34 GMT</pubDate></item><item><title><![CDATA[Reply to Ubuntu 18.04 Cloud-Init Networking Problem on Mon, 12 Apr 2021 20:18:50 GMT]]></title><description><![CDATA[<p dir="auto">I was able to get this working!</p>
<p dir="auto">I had read that it's important to delete anything existing in <code>/etc/netplan</code> otherwise it won't be overwritten by the new networking setup. But, first of all, that's not true in my case. And second, when there's nothing existing in that directory to start with, cloud-init doesn't run <code>netplan apply</code> for the new network setup (not sure why this is but I guess it's just a bug). So I just left the default Netplan DHCP setup in the template and now it works.</p>
<p dir="auto">I'd be happy to give this to others to test, and then if it looks good, contribute it to the Hub. If anyone is interested let me know a place to upload the template.</p>
]]></description><link>https://xcp-ng.org/forum/post/38496</link><guid isPermaLink="true">https://xcp-ng.org/forum/post/38496</guid><dc:creator><![CDATA[slynch]]></dc:creator><pubDate>Mon, 12 Apr 2021 20:18:50 GMT</pubDate></item><item><title><![CDATA[Reply to Ubuntu 18.04 Cloud-Init Networking Problem on Tue, 06 Apr 2021 00:39:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/slynch" aria-label="Profile: slynch">@<bdi>slynch</bdi></a> that end of the issue sounds like a cloud-init bug/issue, which doesn't surprise me (I've been fighting with them since I started here at Vates). I suppose you could manually work around it, somewhere in the cloud-init options/parameters is optional commands to pass and run in the VM on first run, I suppose you could pass "netplan apply" there.</p>
]]></description><link>https://xcp-ng.org/forum/post/38247</link><guid isPermaLink="true">https://xcp-ng.org/forum/post/38247</guid><dc:creator><![CDATA[fohdeesha]]></dc:creator><pubDate>Tue, 06 Apr 2021 00:39:10 GMT</pubDate></item><item><title><![CDATA[Reply to Ubuntu 18.04 Cloud-Init Networking Problem on Mon, 05 Apr 2021 22:44:40 GMT]]></title><description><![CDATA[<p dir="auto">I made the change in<br />
<a href="https://github.com/lynchs61/xen-orchestra/blob/16ad1ad41f48230f6c27ef0e6c2a73ea7884d794/packages/xo-server/src/xapi/index.js#L2026" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/lynchs61/xen-orchestra/blob/16ad1ad41f48230f6c27ef0e6c2a73ea7884d794/packages/xo-server/src/xapi/index.js#L2026</a></p>
<p dir="auto">And I confirmed with my XO that it does in fact work to populate the metadata and set the NoCloud datasource mode to local. But unfortunately it still never runs <code>netplan apply</code> after it runs <code>netplan generate</code>. If I go into the VM after creation and run <code>netplan apply</code> everything is fine but it won't run it during the first boot.</p>
]]></description><link>https://xcp-ng.org/forum/post/38244</link><guid isPermaLink="true">https://xcp-ng.org/forum/post/38244</guid><dc:creator><![CDATA[slynch]]></dc:creator><pubDate>Mon, 05 Apr 2021 22:44:40 GMT</pubDate></item><item><title><![CDATA[Reply to Ubuntu 18.04 Cloud-Init Networking Problem on Mon, 05 Apr 2021 20:30:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/fohdeesha" aria-label="Profile: fohdeesha">@<bdi>fohdeesha</bdi></a> I did see that gist. And I also found that part in code in XO that sets the metadata for the config drive. Would it be possible to put in another metadata line in addition to the instance-id to specify the dsmode?</p>
]]></description><link>https://xcp-ng.org/forum/post/38240</link><guid isPermaLink="true">https://xcp-ng.org/forum/post/38240</guid><dc:creator><![CDATA[slynch]]></dc:creator><pubDate>Mon, 05 Apr 2021 20:30:44 GMT</pubDate></item><item><title><![CDATA[Reply to Ubuntu 18.04 Cloud-Init Networking Problem on Mon, 05 Apr 2021 19:43:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/slynch" aria-label="Profile: slynch">@<bdi>slynch</bdi></a> Indeed this needs to be passed in the meta-data file, and there's currently no way in XOA in the GUI to pass anything into this file. This thread has some more info and sums up my feelings on cloud-inits documentation state: <a href="https://gist.github.com/Informatic/0b6b24374b54d09c77b9d25595cdbd47" target="_blank" rel="noopener noreferrer nofollow ugc">https://gist.github.com/Informatic/0b6b24374b54d09c77b9d25595cdbd47</a></p>
<p dir="auto">We do write out a meta-data file, but as of now there's no way to pass custom contents into it, it is just used to pass the VM UUID into cloud-init:  <a href="https://github.com/vatesfr/xen-orchestra/blob/master/packages/xo-server/src/xapi/index.js#L2019" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/vatesfr/xen-orchestra/blob/master/packages/xo-server/src/xapi/index.js#L2019</a></p>
]]></description><link>https://xcp-ng.org/forum/post/38235</link><guid isPermaLink="true">https://xcp-ng.org/forum/post/38235</guid><dc:creator><![CDATA[fohdeesha]]></dc:creator><pubDate>Mon, 05 Apr 2021 19:43:44 GMT</pubDate></item><item><title><![CDATA[Reply to Ubuntu 18.04 Cloud-Init Networking Problem on Mon, 05 Apr 2021 16:45:19 GMT]]></title><description><![CDATA[<p dir="auto">Nevermind. I thought I had it, but it was a false positive because I had an old networking config laying around in <code>/etc/netplan</code> that was providing the networking. It wasn't actually getting the networking from cloud-init running on first boot.</p>
<p dir="auto">From what I can gather, I need to add <code>dsmode: local</code> to the metadata that is given to cloud-init. How do I do that from XO? Does that need to be added to the XO CloudConfigDrive?</p>
]]></description><link>https://xcp-ng.org/forum/post/38223</link><guid isPermaLink="true">https://xcp-ng.org/forum/post/38223</guid><dc:creator><![CDATA[slynch]]></dc:creator><pubDate>Mon, 05 Apr 2021 16:45:19 GMT</pubDate></item><item><title><![CDATA[Reply to Ubuntu 18.04 Cloud-Init Networking Problem on Sat, 03 Apr 2021 17:14:45 GMT]]></title><description><![CDATA[<p dir="auto">Well I never figured out how to create this from scratch, but I did get it working.</p>
<p dir="auto">I took the VM that was created from the original template (with the networking that wouldn't come up) and changed <code>/var/lib/cloud/instance/datasource</code> from</p>
<pre><code>DataSourceNoCloud: DataSourceNoCloud [seed=/dev/xvdb][dsmode=net]
</code></pre>
<p dir="auto">to</p>
<pre><code>DataSourceNoCloud: DataSourceNoCloud [seed=/dev/xvdb][dsmode=local]
</code></pre>
<p dir="auto">Then since this VM had already done it's first boot, I needed to run <code>cloud-init clean</code> to remove the cache.</p>
<p dir="auto"><img src="https://xcp-ng.org/forum/assets/plugins/nodebb-plugin-emoji/emoji/android/1f44d.png?v=a78c449d9ac" class="not-responsive emoji emoji-android emoji--+1" style="height:23px;width:auto;vertical-align:middle" title=":+1:" alt="👍" /></p>
]]></description><link>https://xcp-ng.org/forum/post/38170</link><guid isPermaLink="true">https://xcp-ng.org/forum/post/38170</guid><dc:creator><![CDATA[slynch]]></dc:creator><pubDate>Sat, 03 Apr 2021 17:14:45 GMT</pubDate></item><item><title><![CDATA[Reply to Ubuntu 18.04 Cloud-Init Networking Problem on Fri, 02 Apr 2021 14:34:33 GMT]]></title><description><![CDATA[<p dir="auto">Hmmm. I see in <code>/var/lib/cloud/instance/datasource</code> for the created VM, that is seems to still be in "net" mode</p>
<pre><code>slynch@misc05:~$ cat /var/lib/cloud/instance/datasource 
DataSourceNoCloud: DataSourceNoCloud [seed=/dev/xvdb][dsmode=net]
</code></pre>
<p dir="auto">So it looks like setting the <code>dsmode</code> in <code>/etc/cloud/cloud.cfg</code> doesn't work. Any idea how to set it properly?</p>
]]></description><link>https://xcp-ng.org/forum/post/38115</link><guid isPermaLink="true">https://xcp-ng.org/forum/post/38115</guid><dc:creator><![CDATA[slynch]]></dc:creator><pubDate>Fri, 02 Apr 2021 14:34:33 GMT</pubDate></item><item><title><![CDATA[Reply to Ubuntu 18.04 Cloud-Init Networking Problem on Fri, 02 Apr 2021 07:57:15 GMT]]></title><description><![CDATA[<p dir="auto">Maybe <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/fohdeesha" aria-label="Profile: fohdeesha">@<bdi>fohdeesha</bdi></a> would have some insight on this</p>
]]></description><link>https://xcp-ng.org/forum/post/38101</link><guid isPermaLink="true">https://xcp-ng.org/forum/post/38101</guid><dc:creator><![CDATA[olivierlambert]]></dc:creator><pubDate>Fri, 02 Apr 2021 07:57:15 GMT</pubDate></item></channel></rss>