Boot up from cold boot no network

Steve Litt slitt at troubleshooters.com
Fri Sep 23 15:54:55 MST 2022


On Fri, 2022-09-23 at 12:04 -0700, T Zack Crawford via PLUG-discuss wrote:
> I am very interested in the answer because my desktop does the same thing if I
> tell it to hibernate, boot into my windows dual boot, and reboot back into linux.
> I can regain network access again by hibernating again and booting back into linux
> directly (no windows). Pretty annoying because it takes a solid 2-5 minutes to
> shut down when hibernating. At least it still does the job, just with delay.

2 to 5 minutes to shut down isn't unusual with systemd. Also, Ubuntu is ultra
friendly and hardware tolerant, but there's a cost: Layers upon layers upon layers
of abstraction, making troubleshooting a needle in a haystack. Also, NetworkManager
is kind of twitchy and overly dependent on dbus.

If you no longer need the training wheels Ubuntu provides, I suggest you switch to
Devuan, or if you're comfortable with a close to the metal Linux with an excellent
rolling release packaging system, Void Linux. Both of these get rid of systemd.

I suggest you use runit as your init system: It's much better than sysvinit. Devuan
has a package for it and Void comes with runit straight from the factory. If you use
Devuan, you might want to use sysvinit as your PID1, and then supervise your daemons
with runit.

If your computer has a fixed IP address, you can set it with the upnet.sh
shellscript performed as the last thing in the boot (put it in rc.local). For the
long version of upnet.sh that's good to use with Qemu virtual machines, see
http://troubleshooters.com/linux/qemu/nobs.htm#hostnetworking . For a short and to
the point upnet.sh, see the following and modify as necessary:


=======================================
#!/bin/sh

# MAKE SURE IP FORWARDING IS ENABLED
echo 1 > /proc/sys/net/ipv4/ip_forward

# DEAL WITH HOSTNAME AND LOCALHOST
hostname=`grep -v "^\s*#"  /etc/hostname | head -n1`
ip link set dev lo up

# UNDO ANY POSSIBLE STUFF FROM PREVIOUS UPNET.SH
ip link set dev tap0 down
brctl delif br0 tap0
ip link del tap0
ip link set dev br0 down
ip addr del 192.168.0.102/24 dev br0
ip addr del 192.168.0.2/24 dev br0
brctl delbr br0
ip link set dev enp40s0 down
ip addr del 192.168.0.102/24 dev enp40s0
ip addr del 192.168.0.2/24 dev enp40s0

# BRING UP enp40s0
#ip addr add 192.168.0.2/24 dev enp40s0
#ip addr add 192.168.0.102/24 dev enp40s0
ip link set dev enp40s0 up
#ip route add default via 192.168.0.1

### GET br0 UP AND RUNNING WITH RIGHT IP ADDRESSES
ip link add name br0 type bridge
ip link set dev enp40s0 master br0
ip addr add 192.168.0.2/24 dev br0
ip addr add 192.168.0.102/24 dev br0
ip link set dev br0 up
ip route add default via 192.168.0.1

### DO THE TUN/TAP STUFF
ip tuntap add tap0 mode tap
brctl addif br0 tap0
#ip addr add 192.168.0.66/24 dev tap0
ip link set dev tap0 up
==================================

The nice thing about the preceding is it's portable between distros. You can even
use it in Ubuntu to restore your static network connectivity if if vanishes. Note
that if you're not using taps or bridges you can eliminate a lot of it, but you'll
need to uncomment a couple things. Obviously, you'll need to change IP addresses to
your desired network device name, static IP and default route.

HTH,

SteveT






More information about the PLUG-discuss mailing list