Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.

tplink-monitor-linux install?

Western Digital Drives - The Preferred Drives of FreeNAS and TrueNAS CORE

fixit9660

Member
Joined
Jan 14, 2018
Messages
33
Has anyone tried using the TPLink Monitor installing in on FreeNAS 11.1U-7 please? This is NOT software to monitor an ethernet interface. It's software to monitor the TP-Link HS110 Smart Plug. It pulls back and stores Energy consumption as monitored by the plug. Basically acting the same way as an SNMP server might work on network equipment. It then provides a web interface to diaply the collected data.
 

Attachments

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
2,801
Looks like a straight-forward installation inside a Linux VM. It won't work natively on FreeNAS 11. The last time you could create a Linux jail was in 9.2.
 

fixit9660

Member
Joined
Jan 14, 2018
Messages
33
Thanks for the prompt and helpful response, much appreciated.
 

fixit9660

Member
Joined
Jan 14, 2018
Messages
33
I take it that it won't just install on the FreeBSD NAS and run alongside it, rather than trying to run it in a Jail?
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
2,801
No, sorry. Like I said, the last time you could run a Linux application natively on FreeNAS was in FreeNAS 9.2, and that was only a 32-bit application inside a Linux jail.
 

Fredda

Neophyte Sage
Joined
Jul 9, 2019
Messages
608
That is not true. For example: I am running a nagios instance inside a FreeNAS jail (11.3) and in order to do FlexLM licence checks I needed a
binary, which is only available for Linux.
Code:
[root@jail] ~# file /usr/local/bin/lmutil
/usr/local/bin/lmutil: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-lsb-x86-64.so.3, for GNU/Linux 2.6.9, stripped
[root@jail] ~# /usr/local/bin/lmutil
lmutil - Copyright (c) 1989-2012 Flexera Software LLC. All Rights Reserved.
usage:     lmutil lmborrow -status
    lmutil lmborrow -clear
    lmutil lmborrow {all|vendor} dd-mmm-yyyy:[time]
....

Of course you should not expect to run too complicated Linux binaries, which require a lot of different libraries.
Take a look here: https://www.freebsd.org/doc/handbook/linuxemu-lbc-install.html
The Linux kernel module has to be loaded in FreeNAS directly (I do it with a post bootup script), the rest is installed in a jail.
 

fixit9660

Member
Joined
Jan 14, 2018
Messages
33
I've read your response and the links, and I'm keen to try, but the problem I have is that I have done very little directly with Linux or FreeBSD. I have "dabbled" with both, and am quite at home with scripts, but I've never done anything of this complexity before.
Can you recommend somewhere that I might be able to get some step-by-step "handholding" as I try to do this please?
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
2,801
  1. First, install your preferred 64-bit Linux distro in a VM, using the procedure from the Guide, Section 18.1. It's recommended to use VirtIO for your VM's boot zvol and NIC. Boot via UEFI. (Note, this only works if your CPU supports VT-x extended page tables.) For a very lightweight distro, you could use Porteus, which will happily run in 1 GiB RAM, and 1 GiB disk. For VNC, it's best to stick to the default port of 5900, if this will be your only VM, and a resolution of 1024x768.
  2. Once you're got the VM booted and installed, install Docker. For Porteus, which is based on Slackware, see https://slackbuilds.org/repository/14.2/system/docker/. Note, this may increase the RAM needed for your VM.
  3. Once Docker is running, install the jamesbarnett91/tp-link-energy-monitor container, using the directions listed in the Github readme.
 

Fredda

Neophyte Sage
Joined
Jul 9, 2019
Messages
608
Perhaps you should have linked to the homepage of the tool you intend to run in a jail instead of dumping the zip file here.
So its: https://github.com/jamesbarnett91/tplink-energy-monitor/ right?

This is a javascript application, which needs node.js to run, which is available for FreeBSD.
Install node.js for your jail and then simply follow the install instructions on the homepage.
 

fixit9660

Member
Joined
Jan 14, 2018
Messages
33
Perhaps you should have linked to the homepage of the tool you intend to run in a jail instead of dumping the zip file here.
So its: https://github.com/jamesbarnett91/tplink-energy-monitor/ right?

This is a javascript application, which needs node.js to run, which is available for FreeBSD.
Install node.js for your jail and then simply follow the install instructions on the homepage.
So very sorry for not responding sooner, I've had some family affairs taking precedent.

Samuel Tai thank you for the prompt and helpful response, I did start reading and investigating it.
Fredda your are correct, it is the github article. I'm not familiar with identifying javascript applications, hence my focus on running the linux. I try to avoid dumping a huge amount of info and then "asking people to sort it out for me", without trying to understand it first. Apologies.
I've also never built a jail and installed node.js, so I might need a little help.
 

fixit9660

Member
Joined
Jan 14, 2018
Messages
33
OK that was a battle! I've built a Jail called TPLink_Devices, I hope I've done it correctly. I'm running 11v1-U7 so followed https://www.ixsystems.com/documentation/freenas/11.1/freenas.html. I used the wizard to create the jail. After I'd enabled SSH and created user "andrew", I ran the command to install the packages and got this:
root@TPLink_Devices:/home/andrew # whoami
root
root@TPLink_Devices:/home/andrew # pkg install npm git
Updating FreeBSD repository catalogue...
pkg: Repository FreeBSD has a wrong packagesite, need to re-create database
[TPLink_Devices] Fetching meta.txz: 100% 916 B 0.9kB/s 00:01
pkg: repository meta /var/db/pkg/FreeBSD.meta has wrong version 2
repository FreeBSD has no meta file, using default settings
[TPLink_Devices] Fetching packagesite.txz: 100% 6 MiB 1.6MB/s 00:04
pkg: repository meta /var/db/pkg/FreeBSD.meta has wrong version 2
pkg: Repository FreeBSD load error: meta cannot be loaded No error: 0
Unable to open created repository FreeBSD
Unable to update repository FreeBSD
Error updating repositories!
root@TPLink_Devices:/home/andrew #
 

sretalla

Wizened Sage
Joined
Jan 1, 2016
Messages
4,768
Perhaps you could start with pkg update?

But it looks like that will fail too...

Maybe try this one from @Yorick 's post.


pkg-static install -f pkg
 

fixit9660

Member
Joined
Jan 14, 2018
Messages
33
Well I tried.....

root@TPLink_Devices:/usr/local/etc/pkg/repos # pkg-static install -f pkg
Updating FreeBSD repository catalogue...
pkg-static: repository meta /var/db/pkg/FreeBSD.meta has wrong version 2
pkg-static: Repository FreeBSD load error: meta cannot be loaded No error: 0
[TPLink_Devices] Fetching meta.txz: 100% 916 B 0.9kB/s 00:01
pkg-static: repository meta /var/db/pkg/FreeBSD.meta has wrong version 2
repository FreeBSD has no meta file, using default settings
[TPLink_Devices] Fetching packagesite.txz: 100% 6 MiB 1.6MB/s 00:04
pkg-static: repository meta /var/db/pkg/FreeBSD.meta has wrong version 2
pkg-static: Repository FreeBSD load error: meta cannot be loaded No error: 0
Unable to open created repository FreeBSD
Unable to update repository FreeBSD
Error updating repositories!
root@TPLink_Devices:/usr/local/etc/pkg/repos #

Someone has suggested that it's because this version is too old (EOL) and all the online repositories to update from are gone.
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
2,801
Since the jail route isn't working out, how about the Docker route?
 

ornias

Neophyte Sage
Joined
Mar 6, 2020
Messages
1,461
Since the jail route isn't working out, how about the Docker route?
The jail route not working has nothing to do with what he wants to run...
All he wants to run is a basic node.js application, which is perfectly compatible with FreeBSD/FreeNAS, so why are you pushing docker?

Someone has suggested that it's because this version is too old (EOL) and all the online repositories to update from are gone.
Yes, you are running an insecure EOL version. 11.1-11.3U4 should be not much of a problem in many cases.
In which case you are also ensured jails would be working.

Considering you already seem to have some trouble with basic CLI troubleshooting and keeping operating systems up-to-date (no offense intended, just stating what I understand from your posts), I doubt it's a smart move to add a second CLI-heavy operatingsystem (which is required for docker).

Once you get a jail and do pkg install npm, you could be fine just following the github for the software you linked:
 

fixit9660

Member
Joined
Jan 14, 2018
Messages
33
no offense intended, just stating what I understand from your posts
...none taken; I am fully happy with CLI but just not experienced with FreeBSD, and Unix in general. Added to the fact that the last time I tried to perform a major version upgrade I lost my entire NAS and contents, you'll understand my reticence do that.
I created the jail using the FreeNAS 11v1-U7 wizard. I can SSH to it and have a user created, so the jail would seem, to my untrained eye, to be working correctly. I can't "do pkg install npm" though:

root@TPLink_Devices:/home/andrew # pkg install npm
Updating FreeBSD repository catalogue...
pkg: repository meta /var/db/pkg/FreeBSD.meta has wrong version 2
pkg: Repository FreeBSD load error: meta cannot be loaded No error: 0
[TPLink_Devices] Fetching meta.txz: 100% 916 B 0.9kB/s 00:01
pkg: repository meta /var/db/pkg/FreeBSD.meta has wrong version 2
repository FreeBSD has no meta file, using default settings
[TPLink_Devices] Fetching packagesite.txz: 100% 6 MiB 1.6MB/s 00:04
pkg: repository meta /var/db/pkg/FreeBSD.meta has wrong version 2
pkg: Repository FreeBSD load error: meta cannot be loaded No error: 0
Unable to open created repository FreeBSD
Unable to update repository FreeBSD
Error updating repositories!
root@TPLink_Devices:/home/andrew #

I'm puzzled as to why the jail even built itself? It downloaded and installed well over 500Mb when it ran, so it can get that data from somewhere but not these repositories?
 

Fredda

Neophyte Sage
Joined
Jul 9, 2019
Messages
608
The point is, the base jail is downloaded directly from an IX-Systems server. But if you continue with pkg to install, update etc. it will pull these packages directly from the official FreeBSD repositories. As the 11.1 release of FreeBSD is now EOL it no longer works, the repos might have moved to another (archived) location.

The update from 11.1 FreeNAS to 11.2 worked for my server pretty unproblematic. But I understand your concern not to update. I'm also pretty conservative in that regard. My production servers are still running on 11.2.

But I'm not sure, if there might currently be a server problem at FreeBSD, as it looks I can't browse any of the FreeBSD repositories located at https://pkg.freebsd.org/
 
Last edited:

fixit9660

Member
Joined
Jan 14, 2018
Messages
33
the base jail is downloaded directly from an IX-Systems server. But ... pkg .. install, update etc. .. will pull these packages directly from the official FreeBSD repositories
AHHH I understand, thank you! I wasn't aware of the different sources!

I also didn't realise you could browse these repositories. This one works: http://pkg0.jinx.freebsd.org/
...but the rest give me a 403 error.
Could I amend the file that points to https://pkg.freebsd.org/ to point to http://pkg0.jinx.freebsd.org/ instead?
 
Last edited:

Fredda

Neophyte Sage
Joined
Jul 9, 2019
Messages
608
OK. That's easy. In the jail edit the file /etc/pkg/FreeBSD.conf and change the URL to
"pkg+http://pkg0.jinx.freebsd.org/${ABI}/release_1". That should do the trick.

EDIT: it looks https://pkg.freebsd.org/ only does not allow browsing anymore. If you try the URL of a
file on a known location it still works.

But you should consider updating.
 
Last edited:
Top