LXC container - Ubuntu22.04 and UP no longer have LAN connetion

First of First hello.
I am not very active user here as i am not very good with linux and i stumble across problem that i cannot find online.
I am user of Turris Omnia 2GB with USB3 drive for LXC that was running Pihole filter on Ubuntu 20.
Yesterday Turris start to “lag” on loading websites so i turn it off and scan USB3 drive for wear and find that flashdrive had many dead sectors so i replaced it.
Sadly the volume image from USB that i have as “backup” did not work i must start over again configure LXC Ubuntu with PI hole

First i noticed Ubuntu20 is no longer option for LXC container only u22.04-u23.04-u23.10.
I did install 22.04 (supported by pi-hole) and even 23.10 but both have same problem…
Upon “lxc-attach -n ubuntu1” and trying “nslookup github.com” the container have no connection.

;; communications error to ::1#53: connection refused
;; communications error to connection refused
;; no servers could be reached

“ip a” tell me i have none IPv4 address on eth0.

Without connection i cannot install PI-hole.
Very little info from web that tell me something about not generated/created “netplan” and also that Ubuntu 22+ have problem with “legacy iptables” like = “# Warning: iptables-legacy tables present”

So i am stuck with Ubuntu as Pi hole install script support this OS and i did not find LXC Debian (armv7l) for my Turris

Yes i also did search this forum, and i did not find this problem.
Thank you for any reply

Remove package cloud-init and restart container

If you want Debian use this repo:

Thank you for reply
By removing cloud-init package and container restart = Turris no longer see and index LXC container with IP in client list.
nslookup command run inside Ubuntu LXC container bring 4 lines of comunication error instead of 3.
This give me feels that cloud package was doing something and by removing it render Ubuntu total invisible to Turris…

Looks like Ubuntu is no longer useable…
Thank you for mirror link i try to run different OS

You didnt provide any error message nor logs so I based on this that worked in the past:

Maybe you didnt wait long enough for the container to get IP or you could force it with dhclient. Just guesses here

Thank you for reply
Well removing that package Turris totally lost all LAN connection with LXC container.
I am open to any suggestion that can point me to right direction.

I did same command setup as i done with LXC Ubuntu 20 long ago and after USB flash fail i reverted my changes to default (before i install Pi-Hole) as if not revert some settings i will have no connection.

I have feel my problem resides inside that more recent Ubuntu 22 as if i got hands on that “older version” (Ubuntu 20) it will work out of box.
Yes i also find some not clear topics about Ubuntu 22 “netplan failure” and i must create some YAML file and reset some manager.
Sadly none of those things work that is why i search more skilled people that maybe had same problem with LXC container using Ubuntu 22+
It is quite frustrating that i just install the U22 LXC container and it is broken while i done same setup like with Ubuntu20. I know 20----22 is major leap but something has changed that render it broken.

I reinstall the new container with u22 and Turris give it IP address.
Doing “lxc-attach -n ubuntu2” and “nslookup github.com” just give me 3 errors as my 1 post.
sending “ip a” tell me LXC ubuntu22 have no ip4 address while Turris see the LXC container and assign IP as like new PC.


Trying that alternate repo you suggest and i install (debian sid) (default) (armv7l) to new LXC container.
Upon “lxc-attach -n debsid” and trying apt-get install htop the LAN is working fine and installation success
Turris see the debsid LXC container and LXC container upon “ip a” show same IP as Turris assign.
I can install packages and install pi hole.
The problem is Ubuntu22+

The problem is probably the official Turris LXC container repository. The network was not configured for any container that I tried in the official repository. The containers in the alternative repo that I tried all had the network configured.

You might want to read the thread referenced above.

Thanky you for reply.
While i solved my problem by using different OS (Debian) and using different LXC repository, i am still curious why U22+ just not work.

—For future failures when even U22-24 OR that second repository no longer exist.

I did read referenced topic and while it say that by removing cloud-init from the container fix the problem, it did not fix it in my scenario.

My search say very little something about

  1. netplan failure
  2. legacy iptables problem

Again thank you for reply and helpfull information :slight_smile:


personally I am using Arch container (with Adguard Home) and no problems here, network works “out-of-the-box” but I will look closer to the Ubuntu, because, when I tested I got the same issue as you mentioned above.
We are using official containers from Ubuntu repo → Ubuntu Cloud Images

As workaround for Ubuntu I can only recommend for now this simple script:

ip link set eth0 up
ip addr add IP_ADDR_OF_CONT dev eth0
ip route add IP_OF_DNS/GATEWAY dev eth0
ip route add IP_ADDR_SPACE/24 via IP_OF_DNS/GATEWAY
ip route add default via IP_OF_DNS/GATEWAY
resolvectl dns eth0 IP_OF_DNS/GATEWAY

And add it into cron after restart with some delay. (10 - 15 sec.)

for example:
container ip -
Main router ip -

ip link set eth0 up
ip addr add dev eth0
ip route add dev eth0
ip route add via
ip route add default via
resolvectl dns eth0

No the best solution, but it should work.

So, after short discussion with @miska, one of the good way how to run ubuntu container with functional network is to use systemd network.

Here is the guidline:

Short manual:

Assume, that name of ethernet adapter is eth0 (usual case).

  1. Create file, for example: “05-eth0.network” under: /etc/systemd/network/
  2. Then add this as “the minimum”:


Save it and call command: “systemctl restart systemd-networkd”

In few seconds your container should have an connection.
After the restart of container, the connection is established again after few seconds.

I tried it for all Ubuntu distros what we offer in LXC and it should be functional.

Reason why this is necessary under “Ubuntu” distros is, that we moved from linuxcontainers (where ubuntu images are not available anymore) to official site from Ubuntu.

Hope this help. :slight_smile:


Thank you for reply and guide for non very linux people. I was curious how to solve this in future USB drive failures.
Thank you

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.