Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webui not working on FreeNAS 9.3 #95

Closed
thesymbol opened this issue Aug 29, 2015 · 113 comments
Closed

Webui not working on FreeNAS 9.3 #95

thesymbol opened this issue Aug 29, 2015 · 113 comments
Assignees
Labels

Comments

@thesymbol
Copy link
Contributor

The webgui is not applying the cron tasks to the crontab on FreeBSD
crontab -e returns an empty crontab, while the cron.config in the server folder does contain the information for the cron task.

@hexparrot hexparrot added the bug label Aug 29, 2015
@hexparrot hexparrot self-assigned this Aug 29, 2015
@hexparrot
Copy link
Owner

MIneOS doesn't actually add real crontabs to the underlying system, the crontabs are managed and interpreted through the cron npm module, which should be platform agnostic. If scheduled tasks aren't working though, I'll take a look.

@hexparrot
Copy link
Owner

I haven't been able to reproduce this issue. Cron works as expected for the simple crons I've been entering in so far.

If this is still an issue, please let me know the following:

  1. what is the cron expression you're typing in the webui
  2. what is the command that expression is doing?
  3. what commit are you on?

@thesymbol
Copy link
Contributor Author

i was going to look into this now, but when i try and update mineos-node to node v4 i get errors compiling node_modules userid and posix (complains that -std=gnu++0x is an unrecognized option).
i have tried to update gcc and gmake but still getting the same error.

@hexparrot
Copy link
Owner

It's still hard to diagnose without knowing what commit you're on. There's a point when userid and posix get updated to nodev4-compatible versions, but I can't tell if your npm is trying to use it or the older ones.

Successfully npm installed commit 99c2d68 without error on FreeBSD 10.2-RELEASE r286666.

posix@4.0.0 install /usr/games/minecraft/node_modules/posix
node-gyp rebuild

gmake: Entering directory '/usr/games/minecraft/node_modules/posix/build'
CXX(target) Release/obj.target/posix/src/posix.o
SOLINK_MODULE(target) Release/obj.target/posix.node
COPY Release/posix.node
gmake: Leaving directory '/usr/games/minecraft/node_modules/posix/build'

userid@0.2.0 install /usr/games/minecraft/node_modules/userid
node-gyp rebuild

gmake: Entering directory '/usr/games/minecraft/node_modules/userid/build'
CXX(target) Release/obj.target/userid/src/userid.o
SOLINK_MODULE(target) Release/obj.target/userid.node
COPY Release/userid.node
gmake: Leaving directory '/usr/games/minecraft/node_modules/userid/build'

@thesymbol
Copy link
Contributor Author

MineOS-node commit: 99c2d68
Posix version 4.0.0 (this should work since it just updated to node v4)
userid version is 0.2.0.
here is an output of what im getting when i try to do npm install (with the npm-debug.log): https://gist.github.com/thesymbol/2ff73e541490cbddb63a

@hexparrot
Copy link
Owner

I continue to test the MineOS webui under FreeBSD, though admittedly I don't use the FreeNAS distro at all. Almost all of my testing has been under FreeBSD 10, which I've found has worked okay with pre-stable node as well as 4.0+.

Right now what you're experiencing is limited solely to the realm of Node/NPM and the build environment. My build environment under FreeBSD 10 (and youre 9.3) shouldn't be too different...but perhaps they are very different--I'm just not very well versed in it. In 9.0, you're definitely using a CLANG compiler (or at least it's present by default) and I would think that's enough, but evidently not.

You might try stepping back a few commits and try checking out whether it builds.

cd /usr/local/games/minecraft
git fetch
git checkout tags/v1.0.1
rm -rf node_modules
npm install

Does it build?

(modify the above path for where the FreeNAS plugin puts it. again, not familiar with it's conventions, but it should be similar).

@thesymbol
Copy link
Contributor Author

Well, i have tried to use 1.0.1 but still getting complaints about the -std=gnu++0x.
will see if recreating the jail will help.

@hexparrot hexparrot changed the title Cron not working on FreeBSD Cron not working on FreeNAS Oct 15, 2015
@thesymbol
Copy link
Contributor Author

Sorry for the late update, but i have not had the time to look at this again, i have progressed through the error when installing with npm install, but now i get "unable to load the node-posix extension module" and nothing more when i try to login (with correct and incorrect password).
do you know any way to test this other than doing node and then try to require in the extension?

@hexparrot
Copy link
Owner

The posix module is how authentication happens.

I still don't look much at FreeNAS, but I know that MineOS works without issue on FreeBSD, so somewhere in there is a disconnect that is keeping you from properly building the modules that MineOS does really need.

You can also try showing us the error log and maybe we can work more with it.

@thesymbol
Copy link
Contributor Author

Here is the mineos.log and console output: https://gist.github.com/thesymbol/539f00d83951068dc0fa

P.S. to get rid of the gmake error i had to run: npm install -g gmake.

@hexparrot
Copy link
Owner

Hrm, so there's something telling in there, but I'm not sure what to make of it.

For example, you should be able to do this: (as you did)

npm install posix
node
var posix = require('posix')

This is the absolute bare minimum it takes to ensure that 'node-posix' is getting built and works. But if you get an error from this, we know it's not MineOS code--we have to find out why the posix module is inaccessible to node!

Thinking on it further...

@thesymbol
Copy link
Contributor Author

did a npm rebuild posix -dd to get build output (might help).
https://gist.github.com/thesymbol/080c87b9f022afbb427f

@hexparrot
Copy link
Owner

Have you recently tried removing the node_modules directory and re-installing via npm install?

I just installed nodev5 on Ubuntu and then I got an error similar to yours. While npm rebuild posix fixed the posix issue that arose from this update, it didn't fix other modules. In short, I think it's best to be liberal in rebuilding (e.g., npm rebuild rather than npm rebuild posix), or to clear it out entirely and start from scratch (rm -rf node_modules).

I apologize I haven't been with much time to get a FreeNAS instance up and running, but I still am able to get the most current commit running on FreeBSD, so I still have yet to determine the differences here.

@thesymbol
Copy link
Contributor Author

tried with rm -rf node_modules (and removed the gmake/posix from global so its completely clean) i did get build error that gmake was missing, after running npm install gmake i could re-run the npm install and it went through without errors this time but i still get unable to load the node-posix extension module when trying to run this:

node
var posix = require('posix');

if the module was not found it would error out of node with undef but it can see the module but it clearly isnt working correctly.

If you could get an instance up of FreeNAS it would simplify this a bit.
Are you running your mineos-node of off FreeBSD directly or inside a Warden Jail?
Since i cannot run anything outside of a Warden Jail in FreeNAS since plugins are heavily using this and the system paratition gets overwriten during updates on FreeNAS (hence the heavy use of jails in FreeNAS).

@hexparrot
Copy link
Owner

The problem here is we're not running into a MineOS issue. npm install may be installing packages required for MineOS, but the error you're getting is not reflecting anything that can be fixed with MineOS changes. So please verify this, preferably in a directory that has nothing to do with MineOS:

npm install posix
node
var posix = require('posix')

Does this give you an error?

@thesymbol
Copy link
Contributor Author

I know that its not related to mineos, and yes that gives me the same error as before (tried to do it in a empty directory and nothing installed in the global directory)

I will try and install a clean FreeNAS instance in virtual box to verify that its not my installation that is acting up.

@josh4trunks
Copy link
Contributor

I'm trying to update the freenas plugin to have node 4.X and running into issues with building this module on FreeBSD 9.3 (which is the OS of my build environment).
The plugin currently has node 0.10 so I gotta update this so mineos continues to work.

I'll post my build errors tonight and hopefully we can come up with a solution.

@hexparrot
Copy link
Owner

Also take note of this semi-recent release: https://github.com/hexparrot/mineos-node/releases/tag/v1.1.2

This is the last release before 4.0 became mandatory, due to some new usage of the path module, and builds on Linux with 0.10.x.

@josh4trunks
Copy link
Contributor

my goal with the plugin is that users can update it themselves to the latest commit. so while that's great info, won't make a difference in my case. thanks

@josh4trunks
Copy link
Contributor

Here's what I was hitting yesterday. I'm assuming my issue is because of dependencies that are not compatible with each other. My build environment isn't ideal and will be much cleaner once I can build plugins on FreeBSD10 (for FreeNAS 10).
I'll debug this further once I get some time, but any advice would be helpful.

root@freebsd-ports:/tmp/test # npm install posix
|
> posix@4.0.0 install /tmp/test/node_modules/posix
> node-gyp rebuild

gmake: Entering directory `/tmp/test/node_modules/posix/build'
  CXX(target) Release/obj.target/posix/src/posix.o
cc1plus: error: unrecognized command line option "-std=gnu++0x"
gmake: *** [Release/obj.target/posix/src/posix.o] Error 1
gmake: Leaving directory `/tmp/test/node_modules/posix/build'
gyp ERR! build error 
gyp ERR! stack Error: `gmake` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System FreeBSD 9.3-RELEASE
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /tmp/test/node_modules/posix
gyp ERR! node -v v4.2.1
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
npm ERR! FreeBSD 9.3-RELEASE
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "posix"
npm ERR! node v4.2.1
npm ERR! npm  v2.14.7
npm ERR! code ELIFECYCLE

npm ERR! posix@4.0.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the posix@4.0.0 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the posix package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls posix
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /tmp/test/npm-debug.log

@thesymbol
Copy link
Contributor Author

I got past that error by doing npm install -g gmake

@josh4trunks
Copy link
Contributor

hmm, nice. should that be added as a dependency then?

@thesymbol
Copy link
Contributor Author

Well maybe, atleast for FreeNAS systems its needed, altough you probably will end up with the same issue as @hexparrot and i have discussed that node-posix wont work, and it dosen't give any usable error messages.
node-posix is used for the login part of mineos, to handle users, would be happy if you could find a solution for it but for now im running mineos in a Ubuntu-VM on FreeNAS.

@josh4trunks
Copy link
Contributor

thanks for the insight. I'll see if I hit the same issue.

@josh4trunks
Copy link
Contributor

I'm also hitting the unable to load the node-posix extension module issue in my FreeBSD 9.3 VM. Gonna debug this further when I have time.

@josh4trunks
Copy link
Contributor

I was able to build the mineos plugin after first building the gmake dependency. I still can't load node-posix but wanted to see what would happen when I try starting mineos.

I'm hitting this upon running the init script.

root@customplugin_1:/usr/pbi/mineos-amd64/lib # service mineos start
Starting mineos.
/usr/lib/libstdc++.so.6: version GLIBCXX_3.4.11 required by /usr/pbi/mineos-amd64/bin/node not found
/usr/local/etc/rc.d/mineos: WARNING: failed to start mineos
root@customplugin_1:/usr/pbi/mineos-amd64/lib # strings /usr/lib/libstdc++.so.6 | grep GLIBC
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_FORCE_NEW

Maybe FreeBSD 9.3 doesn't support GLIBC 3.4.11 which is required because of some functions called by the node-posix module?

@hexparrot
Copy link
Owner

hexparrot commented Jul 7, 2016

Recently, I received a PR addressing FreeNAS posix auth: https://github.com/hexparrot/mineos-node/tree/Mithril7-master

@josh4trunks can you switch to this branch and see if it works? Currently, I'm testing this to make sure there's no unintended side-effects for all other systems (linux, freebsd). If this resolves the remaining issue on FreeNAS, I'd definitely get this into master.

EDIT: #206 has been pulled in. I tested it on Debian, Ubuntu, Arch, FreeBSD 10.2, and CentOS. All handle this auth update well, and FreeBSD actually is fixed (did it not work before?! and for how long?!).

I've merged it into master, so just update to the latest commit and ignore this alternate branch.

@josh4trunks
Copy link
Contributor

@thesymbol I'm not sure if my plugin jails are using the latest template. these are all new plugin installs so they likely clones of what I had. I'm not even sure if they updated the plugin jail template with the 9.10 update.

@hexparrot ok, I'll test again with the commit today/tonight, crossing my fingers.

With enough trying I was getting everything working accept for auth. But I was not able to actually compile a new enough version of node in my 9.3 build environment that works on the plugin jail.

@jsegaert
Copy link
Contributor

jsegaert commented Jul 7, 2016

@josh4trunks
I'm running FreeNAS 9.10 with the legacy 9.3 MineOS plugin. I created a new standardjail and installed MineOS from scratch (git commit 93d11a1), and I built from pkg instead of compiling from ports. In a newly created jail, pkg is using the FreeBSD 10 repository as per file /usr/local/etc/pkg/repos/FreeBSD.conf
FreeBSD: { url: "pkg+http://pkg.FreeBSD.org/freebsd:10:x86:64/latest", mirror_type: "srv", enabled: yes }
Anyway, webui worked fine but I also run into that same authentication issue, but I got passed that by installing the authenticate-pam module.
npm install authenticate-pam

@josh4trunks
Copy link
Contributor

josh4trunks commented Jul 7, 2016

I'm starting to think the (newly installed) plugin jails on FreeNAS 9.10 are FreeBSD10 based, with the compat9 package installed. If so, maybe I could successfully build PBIs for MineOS in a FreeBSD10 based system. Then I wouldn't have he issues with compiling/running newer versions of Node.

Only issue would be users of FreeNAS 9.3 couldn't run the new PBI, but this probably isn't the majority anymore.

@jsegaert
Thanks for the tip, maybe this should be a dependency. Gotta do some testing.

@hexparrot
Copy link
Owner

@jsegaert 7910864, right after the one youre set at, is the commit that addresses the authentication issue failing on FreeNAS. Including authenticate-pam also would do nicely, as an alternative.

@josh4trunks
Copy link
Contributor

josh4trunks commented Jul 10, 2016

I'm still having authentication issues, in a FreeNAS 9.10 plugin jail, with the latest commit and with authentication-pam installed.

@jsegaert
Copy link
Contributor

I can confirm that git commit 7910864 fixes that authorization error for me. Thank you!

@thesymbol
Copy link
Contributor Author

Can also confirm that it is working now on 7910864
at least it is working on FreeNAS 9.10.

@josh4trunks
Copy link
Contributor

for anyone that has it working are you using a plugin jail or standard jail?

@thesymbol
Copy link
Contributor Author

@josh4trunks i used a standard jail (as in template: --- ), and it comes up as a FreeBSD icon in the jails view (and it says standard in the jails list).
There are no plugin jails anymore in FreeNAS as far as i know, and i think they even stated in an update that standard jails is the only jails to be used (think it was the same update that removed ubuntu jails etc).

@josh4trunks
Copy link
Contributor

ok, I'm trying to modify a plugin jail by installing npm/node with pkg. this way the automounting of linprocfs still works and the configuration options are still available in the freenas webui.

but for some reason authentically still isn't working =\

@thesymbol
Copy link
Contributor Author

That is wierd, are you sure your instance of the plugin jail is 9.10? (FreeBSD 10) because it is not working on lower than that (tried to do it in an old standard 9.3 jail and it also failed).

@josh4trunks
Copy link
Contributor

yes, it is a plugin jail on FreeNAS9.10. I believe the jail is a FreeBSD10 userland because I tested installing node built for FreeBSD10 and it worked as expected.

I can post my steps and maybe you guys can see if I'm doing anything wrong.

@thesymbol
Copy link
Contributor Author

thesymbol commented Jul 11, 2016

ye or at least we can try and reproduce the issue :)

@josh4trunks
Copy link
Contributor

josh4trunks commented Jul 11, 2016

OK, thanks. Here's what I'm trying...

  • install the plugin from the repo, v9.3.5
  • pkg install npm gcc
  • edit /usr/local/etc/rc.d/mineos
    • command="/usr/local/bin/node"
    • start_precmd="export PATH=$PATH:/usr/local/bin:/usr/pbi/mineos-amd64/bin" - needed to see g++ for compiling posix
    • replace /usr/pbi/mineos-amd64/bin/npm with /usr/local/bin/npm
  • service mineos oneupdate
  • start mineos from FreeNAS Plugins > Installed tab (so linprocfs is mounted)
  • try logging in with username & password = "mcserver"

@thesymbol
Copy link
Contributor Author

thesymbol commented Jul 11, 2016

do you have all the other packages needed already installed (like gmake, git, etc...)?

Because when compiling it manually (the whole node_modules directory) you have to use "CXX=c++ npm install", atleast that fixed the compiling of the posix plugin for me (as we hexparrot found out earlier i think, this issue is getting big).

instructions: https://minecraft.codeemo.com/mineoswiki/index.php?title=MineOS-node_(pkg_add)

It must be that you are still compiling the posix plugin with something else than gmake and that might be why its causing issues.

@josh4trunks
Copy link
Contributor

yes, those are available in the pbi directory. the issue with node is i can't find a way to compile it on FreeBSD 9 VM that will run on these FreeBSD 10 based jails =/

hmm, forgot about setting CXX in my recent round of testing, that would probably drop the need for gcc earlier, and authentication might work.

@josh4trunks
Copy link
Contributor

josh4trunks commented Jul 11, 2016

unrelated, but @hexparrot I had some questions/comments about the wiki entry

  • I'd remove refrences of pkg_add, I believe that system is no longer supported
  • why are you using py-supervisor, is this really a dependency? What's wrong with using a FreeBSD init script like https://github.com/josh4trunks/freenas-plugins/blob/master/ports/games/mineos/files/mineos.in
  • I don't think you need to chmod +x anything. 'service.js mineos_console.js webui.js' will be executed just fine, since they are scripts being executed by node.
    for generate-ssl.sh you can just run /bin/sh generate-sslcert.sh

@josh4trunks
Copy link
Contributor

josh4trunks commented Jul 11, 2016

EDIT
Actually got it working, needed to set the path so c++ could be seen. If only I could get node working well in the plugin, but I might find a hack around that.
=]

@thesymbol
Copy link
Contributor Author

Yes i think that might actually be the only solution at this time at least, cant you use a standard jail for a plugin at all? (might be unrelated to this and is rather a FreeNAS issue to take care of)

@josh4trunks
Copy link
Contributor

nope, the PBI is installed to whatever jail freenas wants.
I might need to hack in installing node with pkg install -y npm and hope that actually works for people

@thesymbol
Copy link
Contributor Author

hm, isnt it pkg install -y www/npm? (just making sure you are not doing something different).

@josh4trunks
Copy link
Contributor

guess that would be more specified, but either would work the same unless there really was another npm port in another category.

@thesymbol
Copy link
Contributor Author

i think there was a different port before at least on 9.3 there was an older version and a newer (not the super old 0.10 or whatever it was but a recent version).

@josh4trunks
Copy link
Contributor

yeah, but those were in the same category with different naming like npm2. so as I said, category would not be needed

@josh4trunks
Copy link
Contributor

I think this bug can be closed. This is not a bug in mineos-node, just complications with the PBIs / the plugin system in FreeNAS 9.10

I have a manual workaround detailed here
https://forums.freenas.org/index.php?threads/freenas-9-plugin-mineos.20122/page-22#post-300032

@thesymbol
Copy link
Contributor Author

Yes, since the original issue is solved (or atleast the issue it turned into), will wait for hexparrot to close instead.

@hexparrot
Copy link
Owner

@josh4trunks

  1. I removed the pkg add documentation; thanks for helping me keep this up to date--I don't spend as much time going through the install processes anymore on any given non Turnkey distro so I had no idea this went obsolete!
  2. I'm using py-supervisor because it seems to be the most consistent way to protect against node-level crashes by restarting the webui automatically. There's tons of different init-methods out there, and at one point I created one for systemd, upstart, (even requests for snappy)--but none of them guaranteed both a) webui process restarted on crash or b) that the $HOME var was set (essential for bukkit git clone/compiling)
  3. Definitely it's not necessary for the chmod +x to be on there; all the init scripts invoke it as arguments to bash/sh/etc. I've just gotten in the habit of wanting the shorthand (which I enjoy for dev). It's definitely something you can leave out, if you choose.

Thank you everybody for your continued work in this thread to try to hone in on why auth wasn't working on FreeBSD/FreeNAS! Upon your recommendation, I'll close this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants