Problems with Arch Live-USB after pacman -Syu?

Discuss development on Bubba
Post Reply
sakaki
Posts: 172
Joined: 15 Aug 2014, 11:20

Problems with Arch Live-USB after pacman -Syu?

Post by sakaki » 24 Dec 2016, 09:16

Hi,

I've had a few Arch live-USB users email me recently, noting that they had issues logging in after performing a full system update via pacman -Syu, and then rebooting.

Having looked into this, the issue appears to be that systemd-networkd-wait-online's behaviour has recently changed (specifically, it now no longer reliably returns a success exit code when the target is a bridge, even one which has come up correctly and has an IP address...), which in turn is preventing the dnsmasq service from starting up correctly. This in turn means there is no DHCP service provided on eth1 or wlan0, which causes the login issue.

To address this, I have just released v1.3.0 of the Arch live-USB (here), which is up-to-date against the archlinuxarm.org tree as of 22 Dec 2016 (and which contains a fix for this issue), and new users should simply use that. However, if you have an existing Arch system that you need to recover, please read on.

Recovering an existing Arch B3

First, since dnsmasq is not running, you'll need (on your PC) to configure a manual IP address to be able to connect. Specify your PC to have address (e.g.) 192.168.50.100, netmask 255.255.255.0, gateway 192.168.50.1 for its Ethernet interface, then connect via a cable to the B3's LAN port (you can use the same manual IP settings for the b3 SSID on WiFi also, if you have a WiFi enabled B3). You should then be able to log in as root (using the command ssh root@192.168.50.1).

Once ssh'd into your B3, we can begin by creating a script that will allow the dnsmasq service to wait for the br0 bridge to come up, much in the way that systemd-networkd-wait-online used to. Issue:

Code: Select all

[root@archb3 ~]# nano -w /usr/local/bin/wait-for-br0.sh
and place the following text in that file:

Code: Select all

#!/bin/bash
# Wait up to 30 seconds for br0 to become available
# Needed as systemd-networkd-wait-online on bridge interfaces now
# appears to hang
declare -i TIMEOUT=30

while ((SECONDS<TIMEOUT)); do
	if grep -q "inet " <(ip addr show br0 2>/dev/null); then
		echo "br0 is up and has an ip address"
		exit 0
	fi
	sleep 1
done
# error, no valid br0 bridge
>&2 echo "br0 is down, or has no allocated address"
exit 1
Save, and exit nano. Then issue:

Code: Select all

[root@archb3 ~]# chmod +x /usr/local/bin/wait-for-br0.sh
Next, we need to modify the dnsmasq service to use this. Issue

Code: Select all

[root@archb3 ~]# nano -w /etc/systemd/system/dnsmasq.service
and modify that file so it reads:

Code: Select all

[Unit]
Description=A lightweight DHCP and caching DNS server
After=network.target
Documentation=man:dnsmasq(8)

[Service]
Type=dbus
BusName=uk.org.thekelleys.dnsmasq
ExecStartPre=/usr/bin/dnsmasq --test
ExecStartPre=/usr/local/bin/wait-for-br0.sh
ExecStart=/usr/bin/dnsmasq -k --enable-dbus --user=dnsmasq --pid-file
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target
(this should only involve modifying replacing the ExecStart line citing systemd-networkd-wait-online with our new wait-for-br0.sh, as shown). Save, and exit nano.

Finally, for safety, there is one additional change that needs to be made before rebooting. Issue:

Code: Select all

[root@archb3 ~]# nano -w /etc/shorewall/masq
and ensure that the file reads as follows:

Code: Select all

#
# Shorewall - Sample Masq file for two-interface configuration.
# Copyright (C) 2006-2015 by the Shorewall Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# See the file README.txt for further details.
#------------------------------------------------------------------------------
# For information about entries in this file, type "man shorewall-masq"
################################################################################################################
#INTERFACE:DEST		SOURCE		ADDRESS		PROTO	PORT(S)	IPSEC	MARK	USER/	SWITCH	ORIGINAL
#										GROUP		DEST
eth0			192.168.50.0/24
Save, and exit nano.

You can now reboot your B3, and everything should be working normally again.

Apologies for any inconvenience caused ><

sakaki

Post Reply