jsegaert / iocage-plugin-mineos

Artifact file(s) for MineOS iocage plugin
6 stars 5 forks source link

Plugin install failing on FreeNAS 11.3 #2

Closed tyler-vincent closed 3 years ago

tyler-vincent commented 3 years ago

I seem to be having the same issue as the poster here: https://www.ixsystems.com/community/threads/mineos-installation-error.87920/#post-609161

I've tried updating to the mainstream www/node port and that allows me to log in but my servers crash immediately with an error related to the userid npm package. Any ideas what is going on here?

jsegaert commented 3 years ago

Yes, I also managed to reproduce that issue, some dependency seems broken in the FreeBSD 11 branch. I don't have a workaround yet, but if I do I'll be sure to post it in the forum post you linked above.

tyler-vincent commented 3 years ago

This seems to point to the heart of the issue: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=220983

I tried running npm install with the latest www/node and www/npm and ran into this:

gmake: Entering directory '/usr/local/games/minecraft/node_modules/userid/build'
  CC(target) Release/obj.target/nothing/../node-addon-api/src/nothing.o
  AR(target) Release/obj.target/../node-addon-api/src/nothing.a
  COPY Release/nothing.a
  CXX(target) Release/obj.target/userid/src/Gid.o
  CXX(target) Release/obj.target/userid/src/Gids.o
../src/Gids.cc:122:19: error: use of undeclared identifier 'getgrouplist'
    foundGroups = getgrouplist(username, pw->pw_gid, groups, &ngroups);

There's a fork of userid that properly looks for the FreeBSD macro here: https://github.com/runesoeknudsen/node-userid/commit/b25975d259fb0f4e3afbcb9a4c328f4ea62242ea

Using this with npm install runesoeknudsen/node-userid seems to succeed and I'm running MineOS fine after that.

jsegaert commented 3 years ago

Many thanks for the feedback and pointers. I tried this out on FreeNAS 11.3; I changed the plugin to use the latest node and npm and run npm install runesoeknudsen/node-userid. That seems to install MineOS fine, but it something is still off...

You can try as follows:

fetch https://raw.githubusercontent.com/jsegaert/iocage-my-plugins/11.3-RELEASE/mineos.json
iocage fetch -P mineos.json -n mineos-test dhcp=1

Is this working properly for you? As soon as I create a new server or start a server, node crashes with the an error "RangeError [ERR_OUT_OF_RANGE]: The value of \"length\" is out of range. It must be >= 0 && <= 2. Received 6" in /var/log/mineos.log:

{
    "date":"Sun Oct 11 2020 20:03:57 GMT-0700 (Mountain Standard Time)",
    "process":{
        "pid":14163,
        "uid":0,
        "gid":0,
        "cwd":"/",
        "execPath":"/usr/local/bin/node",
        "version":"v14.13.0",
        "argv":[
            "/usr/local/bin/node",
            "/usr/local/games/minecraft/webui.js",
            "start"
        ],
        "memoryUsage":{
            "rss":70946816,
            "heapTotal":31768576,
            "heapUsed":18430544,
            "external":3189004,
            "arrayBuffers":1617578
        }
    },
    "os":{
        "loadavg":[
            0.25244140625,
            0.67138671875,
            0.6064453125
        ],
        "uptime":195213
    },
    "trace":[
        {
            "column":3,
            "file":"buffer.js",
            "function":"validateOffset",
            "line":103,
            "method":null,
            "native":false
        },
        {
            "column":7,
            "file":"buffer.js",
            "function":"Buffer.write",
            "line":1064,
            "method":"write",
            "native":false
        },
        {
            "column":13,
            "file":"/usr/local/games/minecraft/mineos.js",
            "function":null,
            "line":1608,
            "method":null,
            "native":false
        },
        {
            "column":22,
            "file":"events.js",
            "function":"Socket.emit",
            "line":326,
            "method":"emit",
            "native":false
        },
        {
            "column":10,
            "file":"net.js",
            "function":"TCPConnectWrap.afterConnect [as oncomplete]",
            "line":1131,
            "method":"afterConnect [as oncomplete]",
            "native":false
        }
    ],
    "stack":[
        "RangeError [ERR_OUT_OF_RANGE]: The value of \"length\" is out of range. It must be >= 0 && <= 2. Received 6",
        "    at validateOffset (buffer.js:103:3)",
        "    at Buffer.write (buffer.js:1064:7)",
        "    at Socket.<anonymous> (/usr/local/games/minecraft/mineos.js:1608:13)",
        "    at Socket.emit (events.js:326:22)",
        "    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1131:10)"
    ],
    "level":"error",
    "message":"uncaughtException: The value of \"length\" is out of range. It must be >= 0 && <= 2. Received 6",
    "timestamp":"2020-10-12T03:03:57.484Z"
}
tyler-vincent commented 3 years ago

I tried that branch of your plugin and it seemed to work fine. I was able to create a new server without issue. However I can't seem to get the profile list to populate after updating profiles. Uncertain if that's an issue with using the newer Node or just the latest commit of MineOS being flaky.

tyler-vincent commented 3 years ago

Ignore that last comment about the server profiles. MineOS eventually got them. I can't seem to get any servers to actually start on the test jail though. My existing MineOS jail is working fine after the node update however

tyler-vincent commented 3 years ago

Ugh, ignore that again MineOS was just being terribly unresponsive. I did eventually get a vanilla server running through the UI. Seems to work fine.

jsegaert commented 3 years ago

Yeah, I noticed the "server profiles" take some time to pull in, but that has been the case for a while.

So the patched version worked fine for you? Can you still get into the MineOS admin tool once the server is running? What minecraft profile did you use? Thank you for taking the time to test. I'll keep trying when I off work.

jsegaert commented 3 years ago

Update: I found why the UI was crashing and I submitted a patch to upstream via hexparrot/mineos-node#373

tyler-vincent commented 3 years ago

Can confirm I get the same error with my test jail but only when starting a server. Creating one works fine. Oddly my existing MineOS jail, which I had upgraded, has no issue starting an existing server.

I had thought I was getting one running before when posting above but hadn't realized the UI crashed in the process.

jsegaert commented 3 years ago

I also submitted a PR freenas/iocage-ix-plugins#253 to switch the official plugin to the latest version of node.js and npm, so hopefully the official plugin will be fixed soon.

The following manual install steps should work until the upstream projects merge these PRs

https://raw.githubusercontent.com/jsegaert/iocage-ix-plugins/NAS-107920/mineos.json
iocage fetch -P mineos.json -n mineos-test dhcp=1
jsegaert commented 3 years ago

All fixes have been merged upstream, so I'll close this. Happy mining! 😄