Skip to content

Instantly share code, notes, and snippets.

@cogneato
Created December 18, 2018 21:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cogneato/87581a1c84a7567e0751bd2f4e84d5a9 to your computer and use it in GitHub Desktop.
Save cogneato/87581a1c84a7567e0751bd2f4e84d5a9 to your computer and use it in GitHub Desktop.

Alternate method for Wifi on HassOS

If you are having problems creating a working network keyfile or importing the keyfile, this alternate method might work for you. It could also be that you have some other problem so this is not a "cure-all" for your wifi/network issues.

Set up access over ssh to the host.

This is not the same access as using the ssh addon. The connection to the host happens on port 22222 and requires that you import an authorized_keys file to your system as described here: https://developers.home-assistant.io/docs/en/hassio_debugging.html

Or, you could connect a keyboard and monitor to your device running HassOS and connect to the host that way.

Login to the host

Once connected, login as 'root'. (Hit enter if you have connected directly to your device to interrupt the output you see.) You will arrive at the Hass.io custom command line interface (cli). You need to use 'login' here to continue on to the host system.

You should be sitting at a # prompt.

Reset network

You will now reset your network back to default, to clear out any other attempts and profiles you have made.

The following commands

  • Clear the system-connections directory (where your keyfiles are imported to).
  • Copies the default profile to the same directory.
  • Reloads the network manager.
$ rm /etc/NetworkManager/system-connections/*
$ cp /usr/share/system-connections/* /etc/NetworkManager/system-connections/
$ nmcli con reload

Check your current state

  • nmcli - shows you your connections and ip and dns info
  • nmcli con show - shows your connections. Green = connected (but not neccesarrily reachable)
  • nmcli d - shows you your network devices

You can search for other nmcli commands on the internet. There's a lot of cool stuff, but the important one is next...

Connect to wifi using nmcli instead of making your own profile

nmcli device wifi connect YOUR_SSID password YOUR_WIFI_PASSWORD

This will try to connect to your SSID and will generate a network profile for you, which you can then check on using the previously provided nmcli commands.

If you use ls /etc/NetworkManager/system-connections you should see at least two network profiles. One for default and another for your wifi connection. You can use cat YOUR_WIFI_PROFILE to check the contents of your file.

And that's it. Hopefully you have your wifi connection now (but...why? Why are you using wifi for a server?!) and you also know how to reset and locate the files that are in play here. Have fun!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment