Restarting or Stopping Incus Brings Down the Host Network

Whenever I stop incus, it brings the host network down, can’t ssh any more to my host network and I can’t interact with incus through the API as well.

Host: Debian 12.

There is a similar issue here with workaround: LXD brings network interfaces down on container stop · Issue #6884 · MichaIng/DietPi (github.com)

Also similar: Stoping/Restarting lxc containers disconnects machine from network · Issue #12482 · canonical/lxd (github.com)

Anybody experiencing this as well? and is there a better workaround?

Hello Devsrealm,

I bieleve you’re experiencing problems with LXD, wich is not part of Linuxcontainers any more :slight_smile:

More infos here

Incus is a “fork” of LXD :slight_smile:

If i understand the problem, using DietPi distrib, on Rpi4, when you bring down a container (how is network configured on CT ? Bridge ? Macvlan ? Routed ?), it also brings down host network ?

Could you print result of :

incus network list

incus info local:

incus info

I bieleve, reading the links you posted, that it’s about how DietPi configures network, as “allow-hotplug” and not “auto”. It’s a strange behavior :slight_smile:

Thanks for your response, no, I am not using lxd, I am using incus, and it is not related to DietPi network.

I only have a similar issue to the linked post.

Using only auto eth0 without allow-hotplug eth0 in /etc/network/interfaces fixed the issue, and restarting the host machine fixed the issue as well.

Editing /etc/network/interfaces requires jumping through several hops with my VPS server as I might need to disable some things first if I want it to stick.

Edit:

Related: Stopping a container brings down the host eth0 interface · Issue #146 · lxc/incus (github.com)

Edit 2:
Restarting the network also fixes the issue: service networking restart

This report was an interesting read. It’s a kernel issue, it has been fixed upstream, probably since Linux 6.7.

Yeah, it has been fixed upstream, I do not have the latest version, I am on: 6.7.9-x86_64 and it does not seem to apply to my version.

The alternative that works for me is using SystemD to automatically restart the network once it is down:

In case anyone is looking for a workaround:

Create a new service file: nano /etc/system/system/network-check.service

and paste the below in the file

[Unit]
Description=Network Connection Checker

[Service]
Type=simple
ExecStart=/usr/bin/bash -c 'ping -c1 8.8.8.8 || systemctl restart networking'
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target

save the file and reload, start and enable:

systemctl daemon-reload && systemctl start network-check && systemctl enable network-check
1 Like