boot: ifup eth0 and/or alsa-mixer-restore sometimes fail on first attempt
I was asked by ncoppa to file a single bug for both issues, as he suspects they’re related.
On both cases where first attempt fails, waiting 1s and retrying seem to always succeed. See my workaround patch below. It can happen that both fail or only one fails or both succeed (on first attempt).
This is inside Virtualbox, without guest-additions or other vbox modules. Host is Windows 8.1 64, i7-4500U, 8G ram, guest is 64 bits, 2G ram, “normal” alpine disk install, currently on edge. In vbox - Both VT-X and enable-nested-paging are enabled (I believe by default).
Ethernet adapter exposed to the guest is PCnet-FAST III (am79c973). I also tried others and they also randomly fail.
Audio controller exposed to the guest is ICH-AC97 (the only one I could get to work with Alpine’s alsa/oss).
Using eudev in alpine.
The error for `ifup eth0` failure is always “ip: ioctl 0x8913 failed: No such device”
The error for the alsa restore failure is always that /proc/asound/cards contains “—- no soundcards —-”, which is followed by incorrect sed parsing and argument for alsactl restore.
These patches have so far worked around the issue 100% of the time:
diff --git a/main/alsa-utils/alsa.initd b/main/alsa-utils/alsa.initd
index e0a1215cf2..f5882094b2 100644
--- a/main/alsa-utils/alsa.initd
+++ b/main/alsa-utils/alsa.initd
@@ -25,6 +25,7 @@ restore() {
return 0
fi
+ grep -q "no soundcards" /proc/asound/cards && ewarn " No cards found, retrying ..." && sleep 1
local cards="$(sed -n -e 's/ *\([[:digit:]]*\) .*/\1/p' /proc/asound/cards)"
local CARDNUM
for cardnum in ${cards}; do
diff --git a/main/openrc/networking.initd b/main/openrc/networking.initd
index 7d653b0149..a3d720b913 100644
--- a/main/openrc/networking.initd
+++ b/main/openrc/networking.initd
@@ -43,6 +43,8 @@ start() {
for iface in $(find_ifaces); do
local r=0
ebegin "$iface"
+ ifup $iface >/dev/null && eend $r && ret=0 && continue
+ ewarn " Cannot ifup $iface. Retrying ..." && sleep 1
if ! ifup $iface >/dev/null; then
ifdown $iface >/dev/null 2>&1
r=1
(from redmine: issue id 6826, created on 2017-02-07)