Network Manager Strikes Again

At work NetworkManager (NM) has been a pebble in our shoe with respect to our migration efforts. We had issues with:

The NM saga continues.

We wanted to find a way to organize NM system-connection files.

We have two use cases. With the normal use case we have about a half dozen regular connections. With another use case we have about two dozen infrequently used connections, all unique to that work flow. Within the second use case we do not use any of the regular connections.

In the nm-applet menu we prefer not to clutter our normal list of connections with these additional two dozen infrequently used connections.

A simple nm-applet submenu optionwould be a great way to distinguish the two connection lists. There is a submenu for VPN connections but that seems to be hard-coded.

I manually created a submenu under /etc/NetworkManager/system-connections but nm-applet does not display the connections. Something like /etc/NetworkManager/system-connections.d would be a great idea. Or any submenu in /etc/NetworkManager/system-connections gets its own submenu in nm-applet. No clutter and easy organization.

Adding all of the infrequently used connections clutters the nm-applet menu. On a limited laptop display, this means using the cumbersome GTK scroll tools. Worse, the default sorting order for the menu is based on last access time. We are using a naming scheme that should at least support alphanumeric sorting, but there is no such sorting option. Even when stopping NM and deleting the last access time in all connection files results in a nm-applet menu list that is not alphanumerically sorted.

That left us once again considering some kind of kludge work-around.

Option 1: Create two /etc/NetworkManager/system-connections folders: frequent and infrequent. Use a script to 1) stop NM, 2) sym link the desired system-connections folder, and 3) start NM.

Option 2: Tag the infrequently used connections chmod 660. NM will only list connections that are chmod 600. Use a script to 1) Temporarily reverse the permissions of all connection files so nm-applet lists only the infrequently used connections and 2) restart NM.

Both options require something in the boot process to ensure the normal system-connections folder is always selected or the infrequently used connections are chmod 660. Either script idea needs elevated privileges, which is a nuisance although possible with a polkit file. Using sudo and a password prompt is doable but is inconvenient with respect to normal NM usage.

Option 3: Create a script that creates a temporary one-off system-connections configuration. This would not require any elevated privileges, but needs to be robust because everything would be configured through nmcli rather than nm-applet.

That is the solution I accepted and pursued.

The script is basically a wrapper to nmcli commands.

    nmcli con add type $CONNECTION_TYPE con-name $CONNECTION_NAME ifname eth0 ip4 $CONNECTION_IP_ADDRESS/8 gw4 $CUSTOMER_IP_ADDRESS
    .....
    nmcli con mod $CONNECTION_NAME ipv6.method ignore connection.autoconnect no

The script includes sanity checks, such as NetworkManager, et.al. are installed and running. I added a *.desktop file so the script would be available in the MATE menu. The desktop file automatically opens a mate-terminal session, but users can manually open any terminal window and manually run the script.

I provided a nominal training session. After the first need for the script in the field the technicians returned and said “everything just worked.”

That’s a fine compliment.

Posted: Category: Usability Tagged: Migrate, Ubuntu

Next: Replacing Windows Network Scripts

Previous: MATE Loses Color Background Support