Switch from NetworkManager to dhclient
basementhud/pipeline/head This commit looks good Details

NetworkManager is a memory hog.  We don't need it to do anything except
renew the DHCP lease when it's time, so let's switch to a more
lightweight alternative.  Unfortunately, Fedora does not include any
systemd units for `dhclient`, so we have to provide our own.
pull/1/head
Dustin 2022-04-05 16:31:45 -05:00
parent 919b578ebc
commit d6139d4884
4 changed files with 26 additions and 2 deletions

View File

@ -18,6 +18,7 @@ echo install_weak_deps=False >> "${destdir}"/etc/dnf/dnf.conf
dnf --installroot "${destdir}" install -y \ dnf --installroot "${destdir}" install -y \
bcm2711-firmware \ bcm2711-firmware \
dhcp-client \
dracut-network \ dracut-network \
firefox \ firefox \
hostname \ hostname \
@ -28,7 +29,6 @@ dnf --installroot "${destdir}" install -y \
openssh-server \ openssh-server \
rsyslog \ rsyslog \
systemd \ systemd \
systemd-resolved \
xinit \ xinit \
xorg-x11-server-Xorg \ xorg-x11-server-Xorg \
xset \ xset \
@ -59,12 +59,14 @@ if ! grep -qE '^video:.*:.+:.*,?user' "${destdir}"/etc/group; then
chroot "${destdir}" gpasswd -a user video chroot "${destdir}" gpasswd -a user video
fi fi
chroot "${destdir}" systemctl enable \ chroot "${destdir}" systemctl enable \
dhclient@eth0 \
systemd-time-wait-sync \ systemd-time-wait-sync \
systemd-timesyncd \ systemd-timesyncd \
xinit@user xinit@user
chroot "${destdir}" systemctl disable \ chroot "${destdir}" systemctl disable \
systemd-homed \ systemd-homed \
systemd-userdbd systemd-userdbd
ln -sf /run/resolv.conf "${destdir}"/etc/resolv.conf
umask 0022 umask 0022
mksquashfs "${destdir}" "${destdir}/boot/${dest}" \ mksquashfs "${destdir}" "${destdir}/boot/${dest}" \

View File

@ -0,0 +1,10 @@
option classless-static-routes code 121 = array of unsigned integer 8;
send dhcp-client-identifier = hardware;
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, domain-search, host-name,
root-path, interface-mtu, classless-static-routes,
netbios-name-servers, netbios-scope, ntp-servers,
dhcp6.domain-search, dhcp6.fqdn,
dhcp6.name-servers, dhcp6.sntp-servers;

View File

@ -1,7 +1,6 @@
tmpfs /var/lib/rsyslog tmpfs defaults 0 0 tmpfs /var/lib/rsyslog tmpfs defaults 0 0
tmpfs /var/log tmpfs defaults 0 0 tmpfs /var/log tmpfs defaults 0 0
tmpfs /var/lib/systemd tmpfs defaults 0 0 tmpfs /var/lib/systemd tmpfs defaults 0 0
tmpfs /var/lib/NetworkManager tmpfs defaults 0 0
/dev/mmcblk0 /run/storage ext4 ro,noexec,nosuid,nodev,x-systemd.makefs 0 2 /dev/mmcblk0 /run/storage ext4 ro,noexec,nosuid,nodev,x-systemd.makefs 0 2
overlay /etc/ssh overlay ro,lowerdir=/etc/ssh:/run/storage/ssh,noexec,nodev,nosuid,x-systemd.requires-mounts-for=/run/storage 0 0 overlay /etc/ssh overlay ro,lowerdir=/etc/ssh:/run/storage/ssh,noexec,nodev,nosuid,x-systemd.requires-mounts-for=/run/storage 0 0
/dev/nbd1 swap swap noauto,x-systemd.makefs 0 0 /dev/nbd1 swap swap noauto,x-systemd.makefs 0 0

View File

@ -0,0 +1,13 @@
[Unit]
Description=DHCPv4 client for %I
Before=network-online.target
Before=network.target
[Service]
Type=forking
RuntimeDirectory=dhclient
ExecStart=/usr/sbin/dhclient -4 -1 -lf /run/dhclient/%I.lease -pf /run/dhclient/%I.pid
PIDFile=/run/dhclient/%I.pid
[Install]
WantedBy=multi-user.target