> Failed to connect to wpa_supplicant - wpa_ctrl_open: Read-only file system

Since Upstart does not have native state, wait-for-state is going to need to be used for this. I have attached a modified network-interface job and another helper job that should fix this.
# network-interface - configure network device
#
# This service causes network devices to be brought up or down as a result
# of hardware being added or removed, including that which isn't ordinarily
# removable.

description     "configure network device"

emits net-device-up
emits net-device-down
emits static-network-up

start on net-device-added
stop on net-device-removed INTERFACE=$INTERFACE

instance $INTERFACE
export INTERFACE

pre-start script
    # Make sure the filesystem is mounted rw before we try to bring up the if
    start wait-for-state WAITER=network-interface-$INTERFACE WAIT_FOR=ifupdown 
WAIT_STATE=running
    
    if [ "$INTERFACE" = lo ]; then
        # bring this up even if /etc/network/interfaces is broken
        ifconfig lo 127.0.0.1 up || true
        initctl emit -n net-device-up \
            IFACE=lo LOGICAL=lo ADDRFAM=inet METHOD=loopback || true
    fi
    mkdir -p /run/network
    exec ifup --allow auto $INTERFACE
end script

post-stop exec ifdown --allow auto $INTERFACE
description "ifupdown - network-interface job needs a rw filesystem, but \
                        that does not work too well with a pure event system"

start on filesystem

pre-start script
    # wait-for-state likes to push people to do stuff they do not want to
    # do, like start when the filesystem is not really up
    [ -n "$UPSTART_EVENTS" ] || { stop; exit 0; }
end script

Reply via email to