# Finally a Network Manager for FreeBSD!



## sk8harddiefast (Mar 5, 2015)

Can someone port Networkmgr from GhostBSD?
https://github.com/GhostBSD/networkmgr
Some screenshots!


----------



## vermaden (Mar 6, 2015)

+1


----------



## gqgunhed (Mar 6, 2015)

Nice: +1


----------



## phoenix (Mar 6, 2015)

PC-BSD has one already, and it's available in the ports tree:  sysutils/pcbsd-utils-qt4


----------



## sk8harddiefast (Mar 7, 2015)

Yes but with this may I have bluetooth, network manager etc but also converts FreeBSD to a real PCBSD. Also the networkmgr is seems to have not a big list of dependencies. I tried this port for my Bluetooth and I had even update notification from PCBSD servers, pbi and a lot of tools that I don't need.


----------



## tobik@ (Mar 7, 2015)

I am sure PC-BSD's network manager can be extracted from the port and be made to work standalone with a little effort. Less effort than polishing GhostBSD's network manager anyway.


----------



## Chris_H (Mar 20, 2015)

Honestly; I'm not a big QT fan, which is why I've shied away from the PC-BSD version. I see the GHOST-BSD version uses GTK. I'll have a look. If it's not _too_ big a conversion, I'll port it. I think it's a nice "convenience" package. 

--Chris


----------



## Chris_H (Mar 20, 2015)

OK just had a look at the source. This should be a POC (piece of cake). I should have a PR listed for it, before the end of the day. 

--Chris


----------



## Chris_H (Mar 21, 2015)

For those who care, it's taking a little longer than anticipated to complete this.
The archive was corrupt, and I had to re-create the missing bits. I'll still be able to finish it today, just a little later than expected. I'll post back, when I'm done.

All the best.

--Chris


----------



## Chris_H (Mar 21, 2015)

It's DONE!
OK for those who would like to try it out before it has been committed;
simply go to the PR link above, and download the attached shar(1) file, to /ust/ports/net-mgmt/. Cd to that directory, if you're not already there, and do the following:
`sh ./network-manager.shar
rm ./network-manager.shar
cd ./network-manager/
make
make install clean`
While I developed, and tested this on x11-wm/xfce4, it is _currently_ better suited for the Gnome desktop. I'll need to add an Xfce4 plugin, so the controls show up in the Xfce4 taskbar. I would *greatly* appreciate your input on this. I would have implemented this port a bit differently, but decided to follow it's current implementation, and get user feedback, so I could see if everyone else ended up having the same thoughts as I.

Screenshots, anybody?




This screenshot is on Xfce4. But I'll do some testing in Gnome, and maybe post a shot, or 2.

All the best!

--Chris


----------



## protocelt (Mar 21, 2015)

Thanks a bunch for porting this over Chris_H! This should come in quite handy for a lot of people


----------



## Chris_H (Mar 21, 2015)

You're *most* welcomed, protocelt!

Please let me know how it works for you. It's still fairly early. So I expect the need to make changes, as the reviews come in. 

--Chris


----------



## protocelt (Mar 21, 2015)

Great  I'll give it a spin this later this weekend as soon as I get the chance.


----------



## jdakhayman (Mar 23, 2015)

Good day,

     I am very interested in this.
`uname -a`

```
FreeBSD ugmm-2.router 10.1-RELEASE-p6 FreeBSD 10.1-RELEASE-p6 #0: Tue Feb 24 19:00:21 UTC 2015  root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
```
I use XFCE as my DE as well. I have copied over the file from the PR link as you instructed. (I used root account as I did this.)
I placed the file in the directory:

/usr/ports/net-mgmt.

I then ran:

`sh ./network-manager.shar`

`rm ./network-manager.shar`

Then I cd into the network-manager directory that was created:

`cd ./network-manager`

and then ran:

`make`

This is the following output from the initial make command:


```
root@ugmm-2:/usr/ports/net-mgmt/network-manager # make
===>  License BSD3CLAUSE accepted by the user
===>  network-manager-0.9.0 depends on file: /usr/local/sbin/pkg - found
=> network-manager-0.9.0.tar.xz doesn't seem to exist in /usr/ports/distfiles/.
=> Attempting to fetch http://BSDforge.com/projects/source/net-mgmt/network-manager/network-manager-0.9.0.tar.xz
fetch: http://BSDforge.com/projects/source/net-mgmt/network-manager/network-manager-0.9.0.tar.xz: size mismatch: expected 21048, actual 21044
=> Attempting to fetch http://distcache.FreeBSD.org/ports-distfiles/network-manager-0.9.0.tar.xz
fetch: http://distcache.FreeBSD.org/ports-distfiles/network-manager-0.9.0.tar.xz: Not Found
=> Couldn't fetch it - please try to retrieve this
=> port manually into /usr/ports/distfiles/ and try again.
*** Error code 1
```

So, I  downloaded the distfile from your site http://BSDforge.com/projects/source/net-mgmt/network-manager/network-manager-0.9.0.tar.xz and manually placed it into the /usr/ports/distfiles/. Unfortunately, the distfile is not the same size as what is stated in the distinfo file in /usr/ports/net-mgmt/network-manager/
So I changed that from 21048 to 21044, and I ran:

`make`

and it reports


```
===>  Giving up on fetching files: network-manager-0.9.0.tar.xz
Make sure the Makefile and distinfo file (/usr/ports/net-mgmt/network-manager/distinfo)
are up to date.  If you are absolutely sure you want to override this
check, type "make NO_CHECKSUM=yes [other args]".
*** Error code 1
```

I did as instructed and ran:

`make NO_CHECKSUM=yes`


```
root@ugmm-2:/usr/ports/net-mgmt/network-manager # make NO_CHECKSUM=YES
===>  License BSD3CLAUSE accepted by the user
===>  network-manager-0.9.0 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by network-manager-0.9.0 for building
===>  Extracting for network-manager-0.9.0
===>  Patching for network-manager-0.9.0
===>  network-manager-0.9.0 depends on executable: sudo - found
===>  network-manager-0.9.0 depends on package: py27-setuptools27>0 - found
===>  network-manager-0.9.0 depends on file: /usr/local/bin/python2.7 - found
===>  network-manager-0.9.0 depends on package: py27-setuptools27>0 - found
===>  network-manager-0.9.0 depends on file: /usr/local/bin/python2.7 - found
===>  Configuring for network-manager-0.9.0
===>  Building for network-manager-0.9.0
===>  Staging for network-manager-0.9.0
===>  network-manager-0.9.0 depends on executable: sudo - found
===>  network-manager-0.9.0 depends on package: py27-setuptools27>0 - found
===>  network-manager-0.9.0 depends on file: /usr/local/bin/python2.7 - found
===>  Generating temporary packing list
(cd /usr/ports/net-mgmt/network-manager/work/network-manager-0.9.0/networkmgr && /bin/sh -c '(/usr/bin/find -d $0 $2 | /usr/bin/cpio -dumpl $1 >/dev/null  2>&1) &&  /usr/sbin/chown -Rh root:wheel $1 &&  /usr/bin/find -d $0 $2 -type d -exec chmod 755 $1/{} \; &&  /usr/bin/find -d $0 $2 -type f -exec chmod 444 $1/{} \;' -- . /usr/ports/net-mgmt/network-manager/work/stage/usr/local/share/networkmgr/)
(cd /usr/ports/net-mgmt/network-manager/work/network-manager-0.9.0/networkmgr/icons &&  /bin/sh -c '(/usr/bin/find -d $0 $2 | /usr/bin/cpio -dumpl $1 >/dev/null  2>&1) &&  /usr/sbin/chown -Rh root:wheel $1 &&  /usr/bin/find -d $0 $2 -type d -exec chmod 755 $1/{} \; &&  /usr/bin/find -d $0 $2 -type f -exec chmod 444 $1/{} \;' -- . /usr/ports/net-mgmt/network-manager/work/stage/usr/local/share/pixmaps/networkmgr/)
/bin/cp /usr/ports/net-mgmt/network-manager/work/network-manager-0.9.0/networkmgr.desktop /usr/ports/net-mgmt/network-manager/work/stage/usr/local/share/applications/
/bin/cp /usr/ports/net-mgmt/network-manager/work/network-manager-0.9.0/networkmgr.desktop /usr/ports/net-mgmt/network-manager/work/stage/usr/local/etc/xdg/autostart/
install  -o root -g wheel -m 555 /usr/ports/net-mgmt/network-manager/work/network-manager-0.9.0/networkmgr/detect-nics.sh /usr/ports/net-mgmt/network-manager/work/stage/usr/local/share/networkmgr/
install  -o root -g wheel -m 555 /usr/ports/net-mgmt/network-manager/work/network-manager-0.9.0/networkmgr/detect-wifi.sh /usr/ports/net-mgmt/network-manager/work/stage/usr/local/share/networkmgr/
install  -o root -g wheel -m 555 /usr/ports/net-mgmt/network-manager/work/network-manager-0.9.0/networkmgr/enable-net.sh /usr/ports/net-mgmt/network-manager/work/stage/usr/local/share/networkmgr/
install  -o root -g wheel -m 555 /usr/ports/net-mgmt/network-manager/work/network-manager-0.9.0/networkmgr/functions-networking.sh /usr/ports/net-mgmt/network-manager/work/stage/usr/local/share/networkmgr/
install  -o root -g wheel -m 555 /usr/ports/net-mgmt/network-manager/work/network-manager-0.9.0/networkmgr/test-netup.sh /usr/ports/net-mgmt/network-manager/work/stage/usr/local/share/networkmgr/
install  -o root -g wheel -m 555 /usr/ports/net-mgmt/network-manager/work/network-manager-0.9.0/networkmgr.py /usr/ports/net-mgmt/network-manager/work/stage/usr/local/bin/
====> Compressing man pages (compress-man)
if [ -d "/usr/ports/net-mgmt/network-manager/work/stage/usr/local/lib/python2.7/site-packages/network_manager-0.9.0-py2.7.egg-info" ]; then  /bin/ls /usr/ports/net-mgmt/network-manager/work/stage/usr/local/lib/python2.7/site-packages/network_manager-0.9.0-py2.7.egg-info | while read f; do  echo lib/python2.7/site-packages/network_manager-0.9.0-py2.7.egg-info/${f} >> /usr/ports/net-mgmt/network-manager/work/.PLIST.mktmp;  done;  fi;
```

it completed and then I ran:

`make install clean`


```
root@ugmm-2:/usr/ports/net-mgmt/network-manager # make install clean
===>  Installing for network-manager-0.9.0
===>  network-manager-0.9.0 depends on executable: sudo - found
===>  network-manager-0.9.0 depends on package: py27-setuptools27>0 - found
===>  network-manager-0.9.0 depends on file: /usr/local/bin/python2.7 - found
===>  Checking if network-manager already installed
===>  Registering installation for network-manager-0.9.0
Installing network-manager-0.9.0...
===>  Cleaning for sudo-1.8.13
===>  Cleaning for network-manager-0.9.0
```

and it built, the icon does appear in the settings menu after the install, although it isn't the same icon as in your screenshot, but when I run it from the menu, it throws an error:


```
Failed to execute command "networkmgr".
Failed to execute child process "networkmgr" (Permission denied).
```

Hope I left feedback on this in the proper way and that I didn't make any mistakes. I am not sure if I added to much info, or not. Thank you for the effort you have put into this.

jda


----------



## Chris_H (Mar 23, 2015)

jdakhayman said:


> Good day,
> 
> I am very interested in this.
> `uname -a`
> ...


Thank you *very* much, jdakhayman, for the "heads up".
I had a lot going on that day, and apparently left the original DISTFILE (before making last minute changes), instead of the FINAL version.
I've just updated the file on the server. So if you try again, you'll get the *correct* one this time.

*DO* let me know, if you should run into any more issues. The current file I just updated on the server, is the one I used, and am running from. So you should have no more issues. 

Thanks again, jdakhayman!

--Chris


----------



## grub3r (Apr 3, 2015)

Hi guys,

I cant seem to start the networkmgr:

```
# networkmgr
Traceback (most recent call last):
  File "./trayicon.py", line 3, in <module>
  import gtk
ImportError: No module named gtk
```

I understand that it has something to do with gtk, which cannot be started.

When I try to install it by pkg, it that says that newer version is already is installed.

```
# pkg install gtk2
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
Checking integrity... done (0 conflicting)
The most recent version of packages are already installed
```

Same happens with gtk3

Is it possible to install the networkmgr by pkg?


----------



## chrbr (Apr 3, 2015)

Dear grub3r, it is a shot in the dark, but please check if you have x11-toolkits/py27-gtk2 installed.

EDIT: I have had a look what is imported by trayicon.py. The next step might be to check devel/py-gobject.


----------



## grub3r (Apr 5, 2015)

chrbr said:


> Dear grub3r, it is a shot in the dark, but please check if you have x11-toolkits/py27-gtk2 installed.
> 
> EDIT: I have had a look what is imported by trayicon.py. The next step might be to check devel/py-gobject.



Hi chrgr,

And thanks for the pointers. There is no x11-toolkits/py27-gtk2 I installed py-gtk2 instead, maybe you meant that too 

But when starting `networkmgr` by root this message appears:

```
# networkmgr
/usr/local/lib/python2.7/site-packages/gtk-2.0/gtk/__init__.py:57: GtkWarning: could not open display
  warnings.warn(str(e), _gtk.Warning)
```

I'm running xfce 4.12 on:
`uname -a`

```
FreeBSD dmb-tech 10.1-RELEASE FreeBSD 10.1-RELEASE #0 r274401: Tue Nov 11 21:02:49 UTC 2014  root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
```

Thanks again


----------



## chrbr (Apr 5, 2015)

grub3r said:


> There is no x11-toolkits/py27-gtk2 I installed py-gtk2 instead, maybe you meant that too


Yes, sure, sorry. If you seek in /usr/ports/INDEX-10 there is no py-gtk2 but py27-gtk2. But the port name is py-gtk2.  This is strange but true.


grub3r said:


> When starting  networkmgr by root this message appears:


As far as I root is not allowed to open X11 applications because of security issues. Please try to start `networkmgr` as regular user.

By the way, I do not know the details of the software and which files it handles, may be you have to add the user to the group wheel to have all the functions. On the other hand this has been no topic in the posts above.


----------



## Dan1973 (Apr 6, 2015)

Nice, but IMO this is a hackish setup.  The Linux / BSD desktop is worst than Frankenstein's monster. It's bloated, stinking, hacked together, an abomination with missing limbs and no orthogonality.  Doing network management the proper way from GUI the proper way would require:

1. Restructuring parts as ifconfig(8) + wpa_supplicant(8) as a library, and use that.
2. Rethink the whole desktop paradigm in BSDs. All desktops I tried feel like Frankenstein's monster in Linux and BSDs.  You need to start with the base OS before even writing a single line of graphical code to address this.  This means:
  - Writing an asynchronous message passing and notification facility in the base OS, pretty much like notifyd in MacOSx.
  - Integrate said facility with devd(8) / autofs(5) / kevent(2).
  - Maybe add to kernel another one more IPC mechanism -- Solaris doors or Windows NT like ALPC would be prime candidates IMO.
3. Restructuring other important system utilities as libraries, and make the command line tools just a shim above those libs is also important IMO. Prime candidates beside networking are user control, GEOM control, audio control, sharing control (NFS at least.)
4. Pay utmost attention to power management code in kernel and profile the user mode base system for power hungry pathway, isolate them and vanquish them out of the code.
5. Too much freedom of choice is bad. BSDs should in future absorb Wayland or X in the base and enforce a unique GUI toolkit and common controls. There is no other way unfortunately to ensure look and feel orthogonality on the desktop.

This doesn't mean destroying the "Unix (superpower) user experience (TM)" and everything Unix stands for. It just means that the 70s passed like 35 years ago  BSDs should learn from Apple and MacOSX. IMO MacOSX is at the moment the best user experience one can have on desktop and laptops. Windows was easy and intuitive till Windows 8 when MS managed to ruin it somehow.


----------



## chrbr (Apr 6, 2015)

I am not sure if the networkmgr is already completely finished. Chris_H has ported it and provided a temporary solution which works for many users. I guess sooner or later it will appear in the ports and handle all dependencies well.

Regarding the FreeBSD concept I am really happy to have configuration files which are easy to be maintained, to be search through and to be backed up. Providing a GUI for everything with consitent look&feel seem to me only possible with huge effort and a strong management. Even most companies can not provide that. I have no idea how this should be possible in a world wide open software community.


----------



## Dan1973 (Apr 6, 2015)

chrbr said:


> I have no idea how this should be possible in a world wide open software community.



One big step ahead would would be Xorg and Wayland adopt a widget / com ctrl toolkit as part of their base source, stick with it, market it and groom it religiously. In fact, you can blame part of the lack of orthogonality and coherence on the desktop in the open source world to the very uninspired choice made by X developers many years ago to not enforce a toolkit on X user.

Another big step is to provide access to base OS function (GEOM, audio, user management, ifconfig(8), WPA, host management, time management and so on) as libraries, so front ends and frameworks can be easily written on top of that.

In fact, no CLI OS control utility in base should be anything but a shim over those libraries.  It would save you from Frankensteined fragile GUI utilities like those network managers. This is doable inside each OS, but yeah, its a lot of work, because it implies designing APIs and making a commitment to those APIs. 

And as much as I dislike the systemd way of doing things, as opposed to the MacOSX launchd or Solaris SMF  I think the world needs more Lennarts. The guy at least managed to see the future clearly, as opposed to many who seem stuck in the 70s.


----------



## Chris_H (Apr 9, 2015)

Greetings, All.
Sorry for the delay in responding to these posts. I'm doing some development work on cell phones. Which (UGH) required me to (temporarily) put Windows on my FreeBSD development box.
I _know_ there's some additional "tweaking" left to do, to polish up this port. But, if used as described, it does work. As to the "root error" mentioned above. If you followed the instructions, you would have known to preface the starting of the application with sudo(8). This will provide the ability to communicate with the necessary system level bits, to talk to the system at such a low level. Which is required to make these types of _system_ modification(s).

I also see lme@ (Lars) has proposed some changes. So I'll need to examine, and test those, as well.

Thanks for the feedback, and please take the time to read the messages, and docs provided, before calling this (work in progress) broken. Thanks!

--Chris


----------



## Crivens (Apr 10, 2015)

Looks like the dependencies are not all listed. I am running a mostly stock system here with no python installs besides what xfce4 and some tools want to have. When trying to run the networkmgr, it simply quits and does nothing. Now before I hit you with several hundred KB worth of ktrace output, I will see if something jumps out at me, but it is some reading I need to do.


----------



## Chris_H (Apr 11, 2015)

Dan1973 said:


> Nice, but IMO this is a hackish setup.  The Linux / BSD desktop is worst than Frankenstein's monster. It's bloated, stinking, hacked together, an abomination with missing limbs and no orthogonality.  Doing network management the proper way from GUI the proper way would require:
> 
> 1. Restructuring parts as ifconfig(8) + wpa_supplicant(8) as a library, and use that.
> 2. Rethink the whole desktop paradigm in BSDs. All desktops I tried feel like Frankenstein's monster in Linux and BSDs.  You need to start with the base OS before even writing a single line of graphical code to address this.  This means:
> ...


Frankenstein. Not hardly. But it seems you think BSD was/is not well suited for a "standard desktop" OS.
If so. I would agree. But, in fact; (Free)BSD was built (in the UNIX tradition) as a set of tools, to better accommodate nearly any need, and was mostly written with Server, in mind. As most of the contributions were made by Server administrators. And what good is a desktop, if there aren't/weren't Servers? Managing service(8)s on BSD platforms is quite trivial. There are a multitude of libraries; both for CLI, as well as GUI, to help leverage such things. In fact, the desktop (Xorg(1)) wouldn't even exist w/o them.
Frankly, I see little need, nor have any interest in seeing things change, or seeing any type of a massive restructuring, where any of the BSD's are concerned. Everything's already there. It's only a matter of getting to know where they are, and how they work, what they do.
To someone not fully immersed in the OS, (Free)BSD/Linux may well seem "Frankenstein-ish".


----------



## Chris_H (Apr 11, 2015)

Crivens said:


> Looks like the dependencies are not all listed. I am running a mostly stock system here with no python installs besides what xfce4 and some tools want to have. When trying to run the networkmgr, it simply quits and does nothing. Now before I hit you with several hundred KB worth of ktrace output, I will see if something jumps out at me, but it is some reading I need to do.


Indeed, network-manager (networkmgr) is a WIP. I simply made it in response to a request for it. It "works" just enough to say it does. To what degree, will (currently) vary from (user) system, to system. I requested feedback, right from the start (as seen in many of my previous posts) for just this/ese reasons.
But bashing/complaining without any (prior) initiation, isn't of any value to anyone. 
sudo(8) is a pre-req, as root has no place on the desktop (Xorg(1). So all of the commands (if not already provided by the scripts) need to be prefaced by sudo(8). In a future version, I will add the option to make(1) for su(1), as well. But let's try to get this running smoothly, rather than adding additional variables, first.


----------



## Crivens (Apr 11, 2015)

Chris_H said:


> Indeed, network-manager (networkmgr) is a WIP. I simply made it in response to a request for it. It "works" just enough to say it does. To what degree, will (currently) vary from (user) system, to system. I requested feedback, right from the start (as seen in many of my previous posts) for just this/ese reasons.
> But bashing/complaining without any (prior) initiation, isn't of any value to anyone.
> sudo(8) is a pre-req, as root has no place on the desktop (Xorg(1). So all of the commands (if not already provided by the scripts) need to be prefaced by sudo(8). In a future version, I will add the option to make(1) for su(1), as well. But let's try to get this running smoothly, rather than adding additional variables, first.


That is why I said I would look trough the dumps and see for myself if I can spot it. If there was a known dependency currently missing, "because everyone has that", it would have saved me the trouble to find that again. So that is why I gave that response. I made attempts to start the manager using sudo, starting it as root, ... no change.  But fear not, I will not complain without enough data attached to prove me wrong  (if I am), as any good scientist should do.


----------



## kpa (Apr 11, 2015)

You should try to compile the port in a clean jail, self fabricated clean jail or with ports-mgmt/poudriere. That would very quickly reveal the missing dependencies.


----------



## Chris_H (Apr 11, 2015)

Crivens said:


> That is why I said I would look trough the dumps and see for myself if I can spot it. If there was a known dependency currently missing, "because everyone has that", it would have saved me the trouble to find that again. So that is why I gave that response. I made attempts to start the manager using sudo, starting it as root, ... no change.  But fear not, I will not complain without enough data attached to prove me wrong  (is I am), as any good scientist should do.


Meant no disrespect, Crivens. Just "telling it, like it is".  and am greatful for any useful feedback, and further investigation you'd be willing to provide. 

Thanks!

--Chris


----------



## Chris_H (Apr 11, 2015)

kpa said:


> You should try to compile the port in a clean jail, self fabricated clean jail or with ports-mgmt/poudriere. That would very quickly reveal the missing dependencies.


Good advise, indeed, kpa!
But still doesn't provide as valuable information as actual usage feedback.
I'm pretty sure I know where the issue(s) lie. Mostly in the scripts call to the functions they (intend) to provide. I'm going to spend some time with them, today. In hopes of being able to overcome the current issue(s).

Thanks again, kpa.

--Chris


----------



## Crivens (Apr 11, 2015)

kpa said:


> You should try to compile the port in a clean jail, self fabricated clean jail or with ports-mgmt/poudriere. That would very quickly reveal the missing dependencies.


That might not tell me much-there are no error messages or unresolved symbols. It simply returns to the console, doing nothing. maybe I need to update my ports tree, maybe it is something else. Time will tell.


----------



## chrbr (Apr 11, 2015)

Dear Crivens,
I think most of the part is python code. It is quite likely that just some python stuff is missing. If you like to have an early look on the software I suggest to proceed as below:
`find ./ -name "*.py" | xargs grep import | sort | uniq` digs for the parts which python likes to import from external extensions. It gave me

```
./networkmgr.py:from subprocess import call
./networkmgr.py:from sys import path
./networkmgr.py:from trayicon import trayIcon
./networkmgr/authentication.py:from net_api import openinfo, bssidinfo, lockinfo, findRSN, enableWifi, findWPA
./networkmgr/authentication.py:import gtk
./networkmgr/net_api.py:# import os
./networkmgr/net_api.py:# import re
./networkmgr/net_api.py:from subprocess import Popen, PIPE, STDOUT, call
./networkmgr/net_api.py:from sys import path
./networkmgr/netcardmgr.py:from subprocess import Popen, PIPE, call
./networkmgr/trayicon.py:from authentication import Authentication, Open_Wpa_Supplicant
./networkmgr/trayicon.py:from net_api import ifWlanInRc, disableWifi, enableWifi
./networkmgr/trayicon.py:from net_api import netstate, ssidliste, barpercent, keyinfo, get_ssid
./networkmgr/trayicon.py:from net_api import startwirednetwork, wifidisconnection, ifWlan, ifStatue
./networkmgr/trayicon.py:from net_api import stopallnetwork, startallnetwork, connectToSsid
./networkmgr/trayicon.py:from net_api import wiredonlineinfo, wiredconnectedinfo, stopwirednetwork
./networkmgr/trayicon.py:from sys import path
./networkmgr/trayicon.py:from time import sleep
./networkmgr/trayicon.py:import gobject as GObject
./networkmgr/trayicon.py:import gtk
./networkmgr/trayicon.py:import locale
./networkmgr/trayicon.py:import threading
./setup.py:import os
./setup.py:import shutil
```
The `import xxx` and `from xxx import zzz` loads extensions of python. Please open a python shell by `python -i` and launch `import gtk` and so on. Errors should guide you which python extension might be missing. trayicon should be related to the software itself. I am just not sure about net_api. I think
Chris_H can tell which extension is related to that extension. It fails on my system. Regarding the shell scripts ./networkmgr/functions-networking.sh refers to kde4 as it tries to access run /usr/local/kde4/bin/pc-nettray. I am not sure if this can be a show stopper. I focused on python.


----------



## Chris_H (Apr 11, 2015)

chrbr said:


> Dear Crivens,
> ...
> Regarding the shell scripts ./networkmgr/functions-networking.sh refers to kde4 as it tries to access run /usr/local/kde4/bin/pc-nettray. I am not sure if this can be a show stopper. I focused on python.


The original (GhostBSD) version was based/ran on x11/kde4.
I'm pretty sure, it isn't a "show stopper", but only an additional option.


--Thanks

--Chris


----------



## Crivens (Apr 12, 2015)

chrbr said:


> Dear Crivens,
> I think most of the part is python code. It is quite likely that just some python stuff is missing. If you like to have an early look on the software I suggest to proceed as below:
> `find ./ -name "*.py" | xargs grep import | sort | uniq` digs for the parts which python likes to import from external extensions. It gave me ...


Running that command line gives me

```
/usr/local/share/networkmgr % find ./ -name "*.py" | xargs grep import | sort | uniq
./authentication.py:from net_api import openinfo, bssidinfo, lockinfo, findRSN, enableWifi, findWPA
./authentication.py:import gtk
./net_api.py:# import os
./net_api.py:# import re
./net_api.py:from subprocess import Popen, PIPE, STDOUT, call
./net_api.py:from sys import path
./netcardmgr.py:from subprocess import Popen, PIPE, call
./trayicon.py:from authentication import Authentication, Open_Wpa_Supplicant
./trayicon.py:from net_api import ifWlanInRc, disableWifi, enableWifi
./trayicon.py:from net_api import netstate, ssidliste, barpercent, keyinfo, get_ssid
./trayicon.py:from net_api import startwirednetwork, wifidisconnection, ifWlan, ifStatue
./trayicon.py:from net_api import stopallnetwork, startallnetwork, connectToSsid
./trayicon.py:from net_api import wiredonlineinfo, wiredconnectedinfo, stopwirednetwork
./trayicon.py:from sys import path
./trayicon.py:from time import sleep
./trayicon.py:import gobject as GObject
./trayicon.py:import gtk
./trayicon.py:import locale
./trayicon.py:import threading
```
This is very different from what you got. I have used the .shar file which was attached by Lars Engels to the report as my starting point, which was the newest one. I hope that was the correct to pick. The imports listed above work, no problem there.


----------



## chrbr (Apr 12, 2015)

I have used the tgz file, sorry I should have mentioned that. And I have overlooked the link to Bugzilla. Now I have used the shar file and run the installer. Checking the imput files (slightly different) gives

```
chris@esprimo:/usr/local/share/networkmgr $ find ./ -name "*.py" -exec grep import {} \; | sort | uniq
# import os
# import re
from authentication import Authentication, Open_Wpa_Supplicant
from net_api import ifWlanInRc, disableWifi, enableWifi
from net_api import netstate, ssidliste, barpercent, keyinfo, get_ssid
from net_api import openinfo, bssidinfo, lockinfo, findRSN, enableWifi, findWPA
from net_api import startwirednetwork, wifidisconnection, ifWlan, ifStatue
from net_api import stopallnetwork, startallnetwork, connectToSsid
from net_api import wiredonlineinfo, wiredconnectedinfo, stopwirednetwork
from subprocess import Popen, PIPE, STDOUT, call
from subprocess import Popen, PIPE, call
from sys import path
from time import sleep
import gobject as GObject
import gtk
import locale
import threading
```
Now `from net_api import xxx` relates to /usr/local/share/networkmgr/net_api.py and `from authentication import xxx` relates to /usr/local/share/networkmgr/authentication.py. The module gobject should be provided by installing devel/py-gobject and gtk should be handled by x11-toolkits/py-gtk2. The others as subprocess, sys, time, locale and threading should be provided by the standard python installation. On my system using x11-wm/i3 `sudo networkmgr.py` causes a small blue icon appear at the right lower part of the i3 bar. I have not noticed it in the first place.

I am just not sure about your setup. I now assume that the installation works. You have files as

```
chris@esprimo:/usr/local/share/networkmgr $ ls -altrG
total 136
-rw-r--r--  1 root  wheel  10073 14 Mär 04:56 trayicon.py.bak
-r-xr-xr-x  1 root  wheel  3976 14 Mär 04:56 authentication.py
-rw-r--r--  1 root  wheel  4355 20 Mär 22:06 netcardmgr.py.bak
-rw-r--r--  1 root  wheel  6892 12 Apr 18:59 net_api.py.bak
-r-xr-xr-x  1 root  wheel  4355 12 Apr 18:59 netcardmgr.py
-r-xr-xr-x  1 root  wheel  10073 12 Apr 18:59 trayicon.py
-r-xr-xr-x  1 root  wheel  6708 12 Apr 18:59 net_api.py
drwxr-xr-x  94 root  wheel  2560 12 Apr 18:59 ..
-r-xr-xr-x  1 root  wheel  400 12 Apr 18:59 detect-nics.sh
-r-xr-xr-x  1 root  wheel  119 12 Apr 18:59 detect-wifi.sh
-r-xr-xr-x  1 root  wheel  789 12 Apr 18:59 enable-net.sh
-r-xr-xr-x  1 root  wheel  12601 12 Apr 18:59 functions-networking.sh
-r-xr-xr-x  1 root  wheel  498 12 Apr 18:59 test-netup.sh
drwxr-xr-x  2 root  wheel  1536 12 Apr 18:59 icons
-r--r--r--  1 root  wheel  9001 12 Apr 19:00 net_api.pyc
-r--r--r--  1 root  wheel  4721 12 Apr 19:00 authentication.pyc
-r--r--r--  1 root  wheel  9590 12 Apr 19:07 trayicon.pyc
drwxr-xr-x  3 root  wheel  512 12 Apr 19:07 .
```
and in a python shell `import gtk` and `import gobject` give no error. Do I miss anything?
Regarding the version, does python27 appear as

```
chris@esprimo:/usr/local/share/networkmgr $ python
Python 2.7.9 (default, Apr  8 2015, 19:02:20)
[GCC 4.2.1 Compatible FreeBSD Clang 3.4.1 (tags/RELEASE_34/dot1-final 208032)] on freebsd10
Type "help", "copyright", "credits" or "license" for more information.
>>>
```
?
Now the post might be longer than it should be. I hope it is ok and I hope it helps.


----------



## fredvs (Aug 22, 2015)

Hello and congrats for that absolutely _must_ package.

Does it needs GTK or Qt to work or is it "pure" xorg ?

Does it work with JWM window manager ?

Thanks.

Fre;D


----------



## ericbsd (Dec 8, 2016)

Networkmgr need Operator to work, but since Operator might be the most unsecured peace of software I have written, I am writting gbsudo, this would act a bit like gksu, but for sudo only and it should alow us to save some software to be exempt of sudo password for the current session or permanently until the user  remove it from the list.


----------



## vermaden (Dec 13, 2016)

ericturgeon said:


> Networkmgr need Operator to work, but since Operator might be the most unsecured peace of software I have written, I am writting gbsudo, this would act a bit like gksu, but for sudo only and it should alow us to save some software to be exempt of sudo password for the current session or permanently until the user  remove it from the list.


Why not use BSD licensed 'doas' from Ports?


----------



## ericbsd (Dec 31, 2016)

Yea I was not really interested to 'doas' until I read this http://www.tedunangst.com/flak/post/doas-mastery.

I will implement doas in Networkmgr, and I'll probably work on  GUI for doas probably called gdoas.


----------



## ericbsd (Jan 1, 2017)

He I did an update to NetworkMgr I did replace operator with doas there is the installation process https://github.com/GhostBSD/networkmgr#installation. 

I will try to make setup.py to create doas.conf if it is missing and to add the config line in it that NetworkMgr need.

If there is any issue please file issue on the GitHub repos.

Thanks everyone, for help and subjection.


----------



## vermaden (Jan 4, 2017)

@ericturgeon

You could create a Port for it


----------



## 905mickeym (Jan 26, 2017)

I switched from PCBSD to FreeBSD after 2 years since it did not want to use z file system and an updater that messed up my boot manager. FreeBSD is a very good client and server.

I have 2 nics and found that PCBSD Network Mgr is not needed to switch between them as a simple script will do it.

Here is the steps in root or sudo wheel and followup each step with netstat and ifconfig ::

NOTE : Desktop is client not server.

TO SWITCH TO THE ALTERNATE NIC ::

1.) *ifconfig* _default-nic *down*_

2.) *route flush*

3.) *hostname* _alternate-nic-hostname_

4.) *ifconfig* _alternate-nic_ *inet* _alternate-nic-static-address_ *netmask* *255.255.255.0* *up*

5.)* route add* *default* _router-gateway-address _

DONE. Default nic is down and alternate nic is up. Routing table checks out OK.

TO SWITCH BACK TO THE DEFAULT NIC ::

1.) */etc/rc.d/netif stop*

2,) *route flush*

3.) *hostname* _default-hostname(in rc.conf)_

4.) */etc/netstart*

DONE. Default nic is up and alternate nic is down since netstart uses the default network specified in rc.conf. 
Routing table checks out OK.

Make sure that all of your *nic hostnames* appear in the user *.Xauthority file*. Check this file open with emacs.
If needed run *xauth* then *xauth add *to list it.

GUI NOTE  :  For all those who like X buttons , annunciators and control panels then a simple Gtk widget factory has simplicity. FreeBSD has it all.


----------



## ericbsd (Jan 28, 2017)

vermaden I have a ports ready for testing. I would appreciate if anyone would try it and even look at the port code.


```
git clone https://github.com/GhostBSD/ports.git
```


```
cd ports/net-mgmt/networkmgr
```


```
sudo make install clean
```

Basically what I am looking for is if there is any error when compiling the port and if NetworkMgr work well after the port installation.


----------



## lme@ (Jan 30, 2017)

Thanks for the port!

I think you should run `portlint -AC` in sysutils/networkmgr.

There are a lot of warnings.


----------



## lme@ (Jan 30, 2017)

Apart from the port issues, the networkmanager is working nice, so far.


----------



## ericbsd (Feb 3, 2017)

I did send a port request.

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216685


----------



## weyland-yutani (Feb 7, 2017)

First and foremost, thank you for your work. The question is whether to run networkmgr I need to have wifimgr. If you uninstall wifimgr networkmgr does not work.

Also can networkmgr save the keys of different networks?

thanks for everything


----------



## ericbsd (Feb 12, 2017)

NetworkMrg save all the key in /etc/wpa_supplicant.conf and It does not use Wifimgr.


----------



## Phishfry (Apr 30, 2017)

ericturgeon
I want to say good job on this program. I have had the wireless bug for a while.
I was previously using wifimgr which does work, but I do like your program much more.
I create multiple FreeBSD AP's and switching back and forth on your program works well. Been using it since it hit pkg on Xfce4.

Now what would it take to add cell modem connections for a mobile warrior?
I want auto switching between PPP/MPD5 and Wifi depending on Wifi availability.

Keep up the great work.


----------



## aimeec1995 (Oct 15, 2017)

Old thread, I realize. 
But how can I make this use dhclient for me?


----------



## gnath (Jan 28, 2018)

Chris_H said:


> It's DONE!


Chris_H!, Thanks a lot for very useful port for DE users. Free gift for all.
ericturgeon, Very good GUI program for multiple AP's. Just installed in my openbox. I had to run it in backgroud. Both wired & wireless interfaces were up. Put down wired one first & found that there is no default route. So had to run

```
/etc/rc.d/routing start
```
. May be I am in wrong foot.
This would be nice if this cleaning/rerouting is included. Great work in any way.


----------

