chilcote / outset

Automatically process packages, profiles, and scripts during boot, login, or on demand.
572 stars 58 forks source link

Network not up #84

Closed marmalodak closed 2 years ago

marmalodak commented 3 years ago

Is there something wrong with my plist? What should I do to get outset to run?

# ls -l /usr/local/outset/share/com.chilcote.outset.plist 
-rw-r--r--  1 root  wheel  355 Apr 12 17:26 /usr/local/outset/share/com.chilcote.outset.plist
# plutil -p /usr/local/outset/share/com.chilcote.outset.plist 
{
  "ignored_users" => [
  ]
  "network_timeout" => 180
  "override_login_once" => {
  }
  "wait_for_network" => 1
}

My plist settings seem to be ignored. I get the same output from outset every time:

+ . /etc/rc.common
++ set -u
++ PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec:/System/Library/CoreServices
++ export PATH
++ alias ConsoleMessage=echo
+ CheckForNetwork
+ local test
+ '[' -z '' ']'
++ ifconfig -a inet
++ sed -n -e /127.0.0.1/d -e /0.0.0.0/d -e /inet/p
++ wc -l
+ test='       0'
+ '[' '       0' -gt 0 ']'
+ NETWORKUP=-NO-
+ '[' -NO- '!=' -YES- ']'
+ echo 'network not up, exiting.'
+ exit

I don't know if this help, but:

# plutil -convert xml1 /usr/local/outset/share/com.chilcote.outset.plist
# cat /usr/local/outset/share/com.chilcote.outset.plist 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>ignored_users</key>
        <array/>
        <key>network_timeout</key>
        <integer>180</integer>
        <key>override_login_once</key>
        <dict/>
        <key>wait_for_network</key>
        <true/>
</dict>
</plist>
# ls -l /usr/local/outset/share/com.chilcote.outset.plist
-rw-r--r--  1 root  wheel  355 Apr 15 14:42 /usr/local/outset/share/com.chilcote.outset.plist

Big Sur 11.2.1

chilcote commented 3 years ago

If you don't want it to wait for network you can set the wait_for_network value to false. https://github.com/chilcote/outset/wiki/NetworkTimeout#removing-the-network-timeout-requirement

Also if you are on an ipv6 network that check may not be valid anymore 😕

marmalodak commented 3 years ago

I'm sorry, I was obviously unclear.

I want outset to wait until the network is ready. The problem I'm having is that outset aborts because the network is not up yet.

chilcote commented 3 years ago

Ah I see. Sorry. The plist you are referencing is the default setting, I think. Is this a ipv6 only network? For whatever reason it doesn't think you're getting an IP.

You may want to turn this to false and then add your own logic for this as a boot-every script and name it such that it runs first alphanumerically (AAA_towing.sh or something) which does its own network wait that is more relevant to the network you're on.

arubdesu commented 3 years ago

I reviewed that code (and its predecessor, the place we all crib notes when writing python in the macadmin world, munki) and I was surprised that the check doesn't ignore link-local when considering if the network is up (because if an interface that can't route/doesn't have DHCP I don't consider that 'up', in 2021 at least), but we should look at the timeout and confirm the sleep(10) behavior is still firing properly.

arubdesu commented 3 years ago

I think I figured it out - this only kicks in (as documented on the wiki) for boot-once, not items in boot-every. I'm not sure why this was decided on in particular with the original design? We can get it changed, I agree it's unintuitive why you'd only want boot-timed actions to have network connectivity when you're running one-and-done actions.

marmalodak commented 2 years ago

I'm going to close this since outset seems to be doing the right thing for my case and I haven't encountered any more problems like this.