Connecting to your network on Centos 8 minimal (maybe trickier than you'd expect)
Tags: linux, tutorial, devops, opensource
Published: 2019-10-23 16:07:25

If you like linux as well as playing with the latest and greatest tools than the recent release of Centos 8 may have been on your radar. 

In my free time I like to experiment with various devops tools and technologies, all of which I've provisioned on Centos 7. I also like to write a fair bit of automation for them. So when the new release came out I figured that this would be a perfect opportunity to tear everything down and start from scratch to see if I could get things back to the same state. I think this is a great practice to test the robustness of your infrastructure and find areas that could use improvement. It's probably a bad idea to do something this extreme in production, but if it's out of your house for fun... who really cares what breaks, right?

The installation process is pretty much the same as it was in past versions. Not really much to say, but here's a [decent guide](https://linoxide.com/how-tos/centos-7-step-by-step-screenshots/) if you want to know more. 

For the installation I chose `minimal server` as I only `ssh` into this machine so a GUI is just a waste of resources. To connect to my network I generally use `NetworkManager` and the included cli tool `nmcli` as this is the recommended tool. 


The standard command used to connect to your network via wifi...

```
$nmcli connection add con-name <your-network> type wifi ssid <your-ssid> ifname <your-device-name>`- registers a connection for your network
$nmcli con modify <your-new-connection> wifi-sec.key-mgmt wpa-psk
$nmcli con modify <your-new-connection> wifi-sec.psk <password>
```

If your network is not password protected the last two commands are not necessary. 

Normally this would just work, but this time around I got back an error instead...

```
Error: Connection activation failed: No suitable device found for this connection (device lo not available because device is strictly unmanaged).
``` 

After a little investigation... a.k.a checking the logs I noticed that there's a missing plugin.
```
$journalctl -u NetworkManager
...
Oct 17 20:41:21 localhost.localdomain NetworkManager[960]: <info> [1571359281.1533] manager: (wlp0s20f3): 'wifi' plugin not available; creating generic device
```
There was a lot more here, but I took it out for simplicity. The real thing to note here, if you have this problem is `'wifi' plugin not available;`. Specifically this means you are missing the plugin `NetworkManager-wifi`. To verify you can run the following and not that it does not appear. 
```
$sudo dnf list | grep NetworkManager

NetworkManager.x86_6 1:1.14.0-14.e18
NetworkManager-libnm.x86_6 1:1.14.0-14.e18
NetworkManager-team.x86_6 1:1.14.0-14.e18
NetworkManager-tui.x86_6 1:1.14.0-14.e18
```

Ethernet here will not work either as there more additional missing plugins. So how does when install network plugins without any internet? The only way I've managed to do so is by pulling it from the iso used to install. In my case installed via usb, but whichever way you used you should be able to mount the iso as a device to pull it from. This will require root privileges.

```
$ sudo mkdir /media/CentOS
$ mount -o loopback,rw /dev/sdb2 /media/CentOS
```
Making the `/media/CentOS` directory and mounting the device at this location is necessary as `dnf` has this location preset as a repo to install base OS packages from. This may be used as part of the initial installation process but idk. You will have to verify which device your iso is registered as. In my case it was `/dev/sdb` but this will not always be the case. The first partition for the CentOS install seems to be the boot device and the second is actual packages and such.

After doing this we can enable the necessary repos and just install. 

```
dnf --enablerepo=c8-media-BaseOS,c8-media-AppStream install NetworkManager-wifi
```
You should see the usual `dnf` output and the package plus dependancies should be added just fine.

Try bringing up your connection again and you should see the following.
```
$nmcli con up <your-connection>
Connection successfully activated (D-Bus active path: /org/freedesktopon/1
```
If you see this or something close you should be all set. Now you can install whatever!!