From: Thierry Parmentelat Date: Fri, 8 Jul 2016 09:41:58 +0000 (+0200) Subject: when resolv.conf is empty, always add 8.8.8.8 X-Git-Tag: bootcd-5.4-1~3 X-Git-Url: http://git.onelab.eu/?p=bootcd.git;a=commitdiff_plain;h=ed5ce94453595611f867aa26801094938cc690bd when resolv.conf is empty, always add 8.8.8.8 on top of DNS1 and DNS2 --- diff --git a/fedoras.md b/fedoras.md new file mode 100644 index 0000000..2cdf712 --- /dev/null +++ b/fedoras.md @@ -0,0 +1,4 @@ +A few notes on the status wrt recent fedoras + +# `/etc/resolv.conf` + diff --git a/initscripts/pl_functions b/initscripts/pl_functions index 72878d6..30b035d 100644 --- a/initscripts/pl_functions +++ b/initscripts/pl_functions @@ -40,6 +40,8 @@ function verbose-forensics () { verbose-run lsmod verbose-run lspci + # XXX : need to check for a running udev + for file in /etc/resolv.conf /run/resolvconf/resolv.conf /etc/sysconfig/network-scripts/ifcfg-eth*; do verbose-file $file done diff --git a/initscripts/pl_netinit b/initscripts/pl_netinit index 2363cea..ae9dbea 100755 --- a/initscripts/pl_netinit +++ b/initscripts/pl_netinit @@ -283,7 +283,7 @@ fi # tmp: Thierry June 2015 # on fedora 21 nodes we see this running in a context where eth0 is not known to the system # could be related to a dependency that we poorly describe to systemd -# I am increasing this timeout to 2 minutes in order to check that conjecture +# I am increasing this timeout to 1 minute in order to check that conjecture ALLOW=60 COUNTER=0 while true; do @@ -321,30 +321,36 @@ verbose-message "pl_netinit: attempting to start networking" verbose-message "pl_netinit: network online" -# patch for f22 - if /etc/resolv.conf is empty in static mode +# patch for f22 and above - if /etc/resolv.conf is empty or missing function pl-netinit-patch-resolv-conf () { - file=/etc/resolv.conf + file="$1"; shift needed="" # missing file : patch needed if ! [ -f $file ]; then needed=true # empty file : patch needed - elif cmp $file /dev/null; then - needed=true - fi - if [ -n "$needed" ]; then - verbose-message "pl_netinit: patching $file" - source /etc/sysconfig/network-scripts/ifcfg-${ETH_DEVICE} - # delete because it's a symlink to /run/systemd/resolve/resolv.conf - # which looks really weird (ls -lL /etc/resolv.conf does not show anything) - rm $file - ( [ -n "$DNS1" ] && echo nameserver $DNS1; \ - [ -n "$DNS2" ] && echo nameserver $DNS2 ) > $file else + contents=$(grep -v '^#' $file) + contents=$(echo $contents) + [ -z "$contents" ] && needed=true + fi + if [ -z "$needed" ]; then echo pl_netinit has no need to patch $file + return fi + + verbose-message "pl_netinit: patching $file" + source /etc/sysconfig/network-scripts/ifcfg-${ETH_DEVICE} + # delete because it may be a symlink to /run/systemd/resolve/resolv.conf + # which looks really weird (ls -lL /etc/resolv.conf does not show anything) + rm -f $file + # mention the DNS servers defined in the config - if any + [ -n "$DNS1" ] && echo nameserver $DNS1 >> $file + [ -n "$DNS2" ] && echo nameserver $DNS2 >> $file + # also add landmark for good measure + echo "nameserver 8.8.8.8" >> $file } -pl-netinit-patch-resolv-conf +pl-netinit-patch-resolv-conf /etc/resolv.conf verbose-forensics "pl_netinit epilogue" diff --git a/initscripts/pl_sysinit b/initscripts/pl_sysinit index 630b9f0..492cc73 100755 --- a/initscripts/pl_sysinit +++ b/initscripts/pl_sysinit @@ -15,11 +15,16 @@ verbose-message "pl_sysinit: bringing system online" verbose-message "pl_sysinit: mounting file systems" verbose-run /bin/mount -v -a +# on old systems that use init, we totally take control and replace +# /etc/inittab with just our stuff, so nothing is going to run udev +# for us and we need to start it ourselves if [ -x /sbin/start_udev ]; then verbose-message "pl_sysinit: starting udev daemon" verbose-run /sbin/start_udev else - verbose-message "pl_sysinit: WARNING cannot start udev daemon - /sbin/start_udev NOT FOUND" + # on systemd-based systems, udev is triggered by systemd + # but just in case we issue a warning + verbose-message "pl_sysinit: WARNING cannot start udev daemon (probably safe under systemd)" fi verbose-message "pl_sysinit: invoking hardware initialization script" diff --git a/outline.md b/outline.md new file mode 100644 index 0000000..31900e2 --- /dev/null +++ b/outline.md @@ -0,0 +1,24 @@ +# overall sequence (sysV init / systemd) + +* `pl_sysinit` +* `pl_boot` + +# `pl_sysinit` + +* udev +* **PY** `pl_hwinit` + * loads modules / blacklisted + * modprobe `sd_mod`, `usb_storage`, `floppy` + * wait 10' for USB subsystem to come up +* initrd +* block-devices +* device-mapper-node +* sysctl +* rsyslog +* **SH** `pl_netinit` + * locate network config + * IPMI + * determine interface name<> +* clock + +# `pl_boot`