I have a headless raspberry pi 5 that only needs an ethernet connection with a static IP address. I don't need wifi, dhcp, NetworkManager, systemd-networkd, systemd-resolvd, netplan, etc.
It's amazing that you can't use the Raspberry Pi Imager to just create a debian lite install without all of that crap.
The following provides a simpler, saner, and leaner default IMO.
- Install the
ifupdownpackage:
sudo apt update && sudo apt install ifupdownsudo nano /etc/network/interfacesand modify as desired. For example:
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source /etc/network/interfaces.d/*
auto lo
iface lo inet loopback
auto eth0
allow-hotplug eth0
#iface eth0 inet6 auto
iface eth0 inet static
address 10.1.1.53/24
gateway 10.1.1.1sudo nano /etc/resolv.confand modify as desired. For example:
# or 8.8.8.8 or whatever:
nameserver 10.1.1.1- Enable the
networking.service:
sudo systemctl enable networking.service- Stop/Disable the bloat:
bloat_actions=('stop' 'disable')
bloat_services=('system-networkd.socket' 'system-networkd' 'systemd-networkd-wait-online')
bloat_services+=('systemd-resolved' 'networkd-dispatcher')
bloat_services+=('NetworkManager-wait-online' 'NetworkManager')
for bloat_service in "${bloat_services[@]}"; do for action in "${bloat_actions[@]}"; do sudo systemctl "$action" "$bloat_service" || true; done; done
unset bloat_services bloat_actions
sudo systemctl daemon-reload- Reboot:
sudo reboot- Remove cloud-init and netplan:
sudo apt update
# remove cloud-init:
sudo rm -rf /etc/cloud/cloud-init.disabled
sudo apt purge -y cloud-init
sudo rm -rf /etc/cloud
sudo rm -rf /var/lib/cloud
# remove netplan:
sudo apt purge -y netplan.io
sudo rm -rf /usr/share/netplan
sudo rm -rf /etc/netplan
# cleanup:
sudo apt autoremove --purge
sudo apt clean