ethernet interface lost or couldn't find eth0


Turns out the root cause was no ifup or ifdown, which were both scripts required by /etc/init.d/networking to bring up networking

[email protected]:/etc/init.d$ ifup eth0
-bash: ifup: command not found
[email protected]:/etc/init.d$ ifdown eth0
-bash: ifdown: command not found

Nor I could find networking

[email protected]:/etc/init.d$ cat /etc/init.d/networking
cat: /etc/init.d/networking: No such file or directory

Also netplan is missing, but interfaces were replaced

[email protected]:/etc/init.d$ cat /etc/network/interfaces 
# ifupdown has been replaced by netplan(5) on this system.  See
# /etc/netplan for current configuration.
# To re-enable ifupdown on this system, you can run:
#    sudo apt install ifupdown


Temp fix to get back onto the internet to actually install networkd/netplan:

[email protected]:~$ ifconfig eth0 up
# xx.xx.xx.xx/24 is your static IP
[email protected]:~$ ip addr add xx.xx.xx.xx/24 dev eth0
# xx.xx.xx.1 is your gateway
[email protected]:~$ ip route add default via xx.xx.xx.1 dev eth0

long-term fix, install netplan, configure it to manage networkd:

[email protected]:~$ apt-get install

We configure netplan(/etc/netplan/01-netcfg.yaml):

  version: 2
  renderer: networkd
      dhcp4: no
      dhcp6: no
      addresses: [xx.xx.xx.xx/24]
      gateway4: xx.xx.xx.1
        addresses: [,]
        macaddress: 00:00:00:00:00:00

To prevent "A start job is running for wait for network to be configured"

      optional: true

generate, try, apply and reboot

[email protected]:~$ netplan generate --debug
[email protected]:~$ netplan --debug generate
DEBUG:command generate: running ['/lib/netplan/generate']
** (generate:31842): DEBUG: 03:52:00.167: Processing input file /etc/netplan/01-netcfg.yaml..
** (generate:31842): DEBUG: 03:52:00.167: starting new processing pass
** (generate:31842): DEBUG: 03:52:00.167: Processing input file /etc/netplan/50-cloud-init.yaml..
** (generate:31842): DEBUG: 03:52:00.167: starting new processing pass
** (generate:31842): DEBUG: 03:52:00.168: We have some netdefs, pass them through a final round of validation
** (generate:31842): DEBUG: 03:52:00.168: eth0: setting default backend to 1
** (generate:31842): DEBUG: 03:52:00.168: Configuration is valid
** (generate:31842): DEBUG: 03:52:00.168: Generating output files..
** (generate:31842): DEBUG: 03:52:00.169: NetworkManager: definition eth0 is not for us (backend 1)
[email protected]:~$ netplan try
Do you want to keep these settings?

Press ENTER before the timeout to accept the new configuration

Changes will revert in 119 seconds
Configuration accepted.
[email protected]:~$ netplan apply
[email protected]:~$ reboot
Last modification:May 22, 2021