Can't create servers / No Profiles downloaded - Arch


#1

I have an existing MineOS Install on a Kubuntu system working fine, but deploying a new server on my existing Arch server, but stuck on this issue of not being able to create servers, and seeing the no profiles downloaded error as well.

Searching, I’ve gone through and tried the fixes in these two posts:

https://discourse.codeemo.com/t/solved-web-ui-will-not-allow-creation-of-servers-and-web-ui-looks-broken/954

https://discourse.codeemo.com/t/unable-to-create-server-and-no-profiles-downloaded/2539

In my /var/log/mineos.log, I see the same common theme as the source of the issue as the above posts being:

“stack”:[“Error: Cannot find module ‘/usr/games/minecraft/node_modules/userid/build/Debug/userid.node’”," at Function.Module._resolveFilename (internal/modules/cjs/loader.js:649:15)"," at Function.Module._load (internal/modules/cjs/loader.js:575:25)"," at Module.require (internal/modules/cjs/loader.js:705:19)"," at require (internal/modules/cjs/helpers.js:14:16)"," at Object. (/usr/games/minecraft/node_modules/userid/lib/userid.js:5:19)","`

error","message":"uncaughtException: Cannot find module '/usr/games/minecraft/node_modules/userid/build/Debug/userid.node'

From the posts I went through, I’m set on NodeJS 4 and tried the various WebUI rebuilds, and the other fixes for UserID and Poisx node module re-installs, but still the same end result so far.

This interface is however rendering correctly, which was the first bug to fix that I solved from searching :slight_smile:

With those subsets pulled out, following what the Start Here post requests for troubleshooting after searching, I tried to paste the entire mineos.log file, but received a posting error for entity too large, but can provide any section needed.


#2

userid is an essential dependency for operation of the webui. If it hasn’t built correctly, we should assume the webui will fail, so let’s see if we can install the userid module with npm.

As root:

cd /usr/games/minecraft
rm -rf ./node_modules
npm install --unsafe-perm

Do you get further errors rebuilding all the npm modules? If so, what are the errors. If its the same, let’s try:

npm install --unsafe-perm userid

Provide us the output. userid isn’t written or maintained by MineOS, we just depend on it. Any which way that we can get it to build will be what we need to get the webui working again.

Lastly, can you confirm what version of NodeJS you’re using on Arch? Because the maintainer of userid might have made changes that make older versions of NodeJS not modern enough to successfully build.


#3

Thanks @hexparrot

I’m currently manually set to NodeJS 8.0.0, although also tried previously with the same results on NodeJS 4.0.

I tried both sets of commands, restarting the MineOS Service each time and checking the WebUI, and both with the same results. For both commands, they completed fine, no obvious error message. In the console the only other entries are:

/root/.node-gyp/8.0.0/include/node/v8.h:9814:53: warning: cast between incompatible function types from ‘v8::GCCallback’ {aka ‘void (*)(v8::GCType, v8::GCCallbackFlags)’} to ‘v8::Isolate::GCCallback’ {aka ‘void (*)(v8::Isolate*, v8::GCType, v8::GCCallbackFlags)’} [-Wcast-function-type]
       reinterpret_cast<Isolate::GCCallback>(callback));

The first command was good, and finished with ‘added 553 packages’.
The second command likewise had no errors, and ‘updated 1 package’.

I did also previous try with the latest arch version of NodeJS, v11.12.0, which encountered errors, and led me to the forum searching where NodeJS v8 seemed to be the most common fix.


#4

Can you provide the output that was produced here? Right now, knowing that userid is the problematic module, I don’t have much to go on.

Here’s what I need to know (as root):

  1. output from: npm install --unsafe-perm userid
  2. output from: /usr/bin/env node -v
  3. output from: which node

My guess is that you have multiple nodejs versions, but the one that root is invoking implicitly (from the hashbang of webui.js is different than the one you’re building userid for, hence a proper build but a failed runtime execution.


#5

No Problem, here we are:

npm install --unsafe-perm userid (as root)

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

make: Entering directory '/usr/games/minecraft/node_modules/userid/build'
  CXX(target) Release/obj.target/userid/src/userid.o
In file included from /root/.node-gyp/8.0.0/include/node/node.h:63,
                 from ../../nan/nan.h:53,
                 from ../src/userid.cc:11:
/root/.node-gyp/8.0.0/include/node/v8.h: In static member function ‘static void v8::V8::RemoveGCPrologueCallback(v8::GCCallback)’:
/root/.node-gyp/8.0.0/include/node/v8.h:9814:53: warning: cast between incompatible function types from ‘v8::GCCallback’ {aka ‘void (*)(v8::GCType, v8::GCCallbackFlags)’} to ‘v8::Isolate::GCCallback’ {aka ‘void (*)(v8::Isolate*, v8::GCType, v8::GCCallbackFlags)’} [-Wcast-function-type]
       reinterpret_cast<Isolate::GCCallback>(callback));
                                                     ^
/root/.node-gyp/8.0.0/include/node/v8.h: In static member function ‘static void v8::V8::RemoveGCEpilogueCallback(v8::GCCallback)’:
/root/.node-gyp/8.0.0/include/node/v8.h:9821:53: warning: cast between incompatible function types from ‘v8::GCCallback’ {aka ‘void (*)(v8::GCType, v8::GCCallbackFlags)’} to ‘v8::Isolate::GCCallback’ {aka ‘void (*)(v8::Isolate*, v8::GCType, v8::GCCallbackFlags)’} [-Wcast-function-type]
       reinterpret_cast<Isolate::GCCallback>(callback));
                                                     ^
In file included from ../src/userid.cc:11:
../../nan/nan.h: In function ‘void Nan::AsyncQueueWorker(Nan::AsyncWorker*)’:
../../nan/nan.h:2232:62: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
     , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
                                                              ^
In file included from ../../nan/nan.h:53,
                 from ../src/userid.cc:11:
../src/userid.cc: At global scope:
/root/.node-gyp/8.0.0/include/node/node.h:460:43: warning: cast between incompatible function types from ‘void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void (*)(v8::Local<v8::Object>)’} to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
       (node::addon_register_func) (regfunc),                          \
                                           ^
/root/.node-gyp/8.0.0/include/node/node.h:491:3: note: in expansion of macro ‘NODE_MODULE_X’
   NODE_MODULE_X(modname, regfunc, NULL, 0)
   ^~~~~~~~~~~~~
../src/userid.cc:174:1: note: in expansion of macro ‘NODE_MODULE’
 NODE_MODULE(userid, Init);
 ^~~~~~~~~~~
In file included from /root/.node-gyp/8.0.0/include/node/node.h:63,
                 from ../../nan/nan.h:53,
                 from ../src/userid.cc:11:
/root/.node-gyp/8.0.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)]’:
/root/.node-gyp/8.0.0/include/node/node_object_wrap.h:85:78:   required from here
/root/.node-gyp/8.0.0/include/node/v8.h:8793:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<node::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
                reinterpret_cast<Callback>(callback), type);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/.node-gyp/8.0.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]’:
../../nan/nan_object_wrap.h:65:61:   required from here
/root/.node-gyp/8.0.0/include/node/v8.h:8793:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
  SOLINK_MODULE(target) Release/obj.target/userid.node
  COPY Release/userid.node
make: Leaving directory '/usr/games/minecraft/node_modules/userid/build'
+ userid@0.3.1
updated 1 package and audited 1285 packages in 6.112s
found 0 vulnerabilities

/usr/bin/env node -v (as root)

v8.0.0

which node (as root)

/home/techzerker/.nvm/versions/node/v8.0.0/bin/node


#6

This is really bizarre. Are you still getting this error showing up in your /var/log/mineos.log? I’m worried that NVM is causing issues here in case environment variables are being set up for you from your login session (logging in at the console, or doing su - to root, etc.).

Of course, since it’s matching 8.0.0, I’m less inclined to think that’s really the problem; I’m just not certain.

That said, the error is pointing to userid/build/Debug/userid.node (emphasis on Debug) but the actual build you made when to userid/build' (lacking Debug). I’m not sure why it would be trying to load that in any circumstance.

Can you try npm install -g userid

This calls for a global installation of userid–My primary concern is why /Debug is in there at all. I’m further curious whether it can just be symlinked from the Debug to the Prod version, but that feels a bit hacky and I’m unsure whether to recommend it at this moment.

Just to make sure, make sure you’re restarting the webui process after each time you run npm. Sorry you’re running into these issues.


#7

No Problem! The joy of the open source community is the ability to actually get useful help, and learn something along the way :slight_smile:

I’m leaning towards this being a very Arch specific problem as far as trying to make progress on it, as running the npm install -g userid command mainly returns this error set:

gyp ERR! configure error gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/techzerker/.nvm/versions/node/v8.0.0/lib/node_modules/userid/build' gyp ERR! System Linux 5.0.4-arch1-1-ARCH gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "rebuild" gyp ERR! cwd /home/techzerker/.nvm/versions/node/v8.0.0/lib/node_modules/userid gyp ERR! node -v v11.12.0 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok npm ERR! code ELIFECYCLE npm ERR! errno 1

Despite following the Arch Wiki’s themselves for how to permanently force a specific version of NodeJS, in this case, trying 8.0.0, and yet you’ll see above, which wasn’t the case in my earlier attempts, if I build with the -g flag, then it goes back to the latest v11.12.0 build, where as without -g, then I get my forced v8.0.0 NodeJS.

The MineOS.log file has since changes to reflect that as well, where before it was v.8.0 and failing because it was looking at the /Debug path and their was no /Build path version, now it’s referring to v11.12 (and still looking at /Debug):

{"date":"Thu Mar 28 2019 12:03:19 GMT-0400 (Eastern Daylight Time)","process":{"pid":15340,"uid":0,"gid":0,"cwd":"/","execPath":"/usr/bin/node","version":"v11.12.0","argv":["/usr/bin/node","/usr/games/minecraft/webui.js","start"],"memoryUsage":{"rss":62562304,"heapTotal":18329600,"heapUsed":14801264,"external":1297574}},"os":{"loadavg":[0.1669921875,0.18994140625,0.08349609375],"uptime":142957},"trace":[{"column":15,"file":"internal/modules/cjs/loader.js","function":"Module._resolveFilename","line":649,"method":"_resolveFilename","native":false},{"column":25,"file":"internal/modules/cjs/loader.js","function":"Module._load","line":575,"method":"_load","native":false},{"column":19,"file":"internal/modules/cjs/loader.js","function":"Module.require","line":705,"method":"require","native":false},{"column":16,"file":"internal/modules/cjs/helpers.js","function":"require","line":14,"method":null,"native":false},{"column":19,"file":"/usr/games/minecraft/node_modules/userid/lib/userid.js","function":null,"line":5,"method":null,"native":false},{"column":30,"file":"internal/modules/cjs/loader.js","function":"Module._compile","line":799,"method":"_compile","native":false},{"column":10,"file":"internal/modules/cjs/loader.js","function":"Module._extensions..js","line":810,"method":".js","native":false},{"column":32,"file":"internal/modules/cjs/loader.js","function":"Module.load","line":666,"method":"load","native":false},{"column":12,"file":"internal/modules/cjs/loader.js","function":"tryModuleLoad","line":606,"method":null,"native":false},{"column":3,"file":"internal/modules/cjs/loader.js","function":"Module._load","line":598,"method":"_load","native":false}],"stack":["Error: Cannot find module '/usr/games/minecraft/node_modules/userid/build/Debug/userid.node'"," at Function.Module._resolveFilename (internal/modules/cjs/loader.js:649:15)"," at Function.Module._load (internal/modules/cjs/loader.js:575:25)"," at Module.require (internal/modules/cjs/loader.js:705:19)"," at require (internal/modules/cjs/helpers.js:14:16)"," at Object.<anonymous> (/usr/games/minecraft/node_modules/userid/lib/userid.js:5:19)"," at Module._compile (internal/modules/cjs/loader.js:799:30)"," at Object.Module._extensions..js (internal/modules/cjs/loader.js:810:10)"," at Module.load (internal/modules/cjs/loader.js:666:32)"," at tryModuleLoad (internal/modules/cjs/loader.js:606:12)"," at Function.Module._load (internal/modules/cjs/loader.js:598:3)"],"level":"error","message":"uncaughtException: Cannot find module '/usr/games/minecraft/node_modules/userid/build/Debug/userid.node'","timestamp":"2019-03-28T16:03:19.815Z"} {"level":"info","message":"Starting up server, using commit: b28c5be fw.ignore for all skip_dirs\n","timestamp":"2019-03-28T16:03:20.659Z"} {"level":"info","message":"Starting up server, using commit: b28c5be fw.ignore for all skip_dirs\n","timestamp":"2019-03-29T20:00:42.527Z"}

Note, that this isn’t critical to get working, I’m only running a single server at this point migrating to this VPS, and I can always run it like it currently is just straight from command line. If I do that, when I have time I’ll build an matching offline VM with Arch, and see if I can install with the same steps and replicate the problem the same way again.


#8

Ultimately I think the issue is that when the user root tries to run node, it’s doing so from a non-login session, which is another way of saying it doesn’t run a couple of critical variable-setting scripts we’re depending on.

So, like when you’re logging in as a user and expecting a terminal, some scripts are ‘sourced’ which introduces variables into the environment that would do things like allow your NPM-versioned node to take precedence over the system version.

Right now you have a system version of 11.12.0, and you have a version controlled by nvm that exists and gets detected/run instead of the 11.12.0. However, mineos doesn’t know that your 8.0.0 exists, because MineOS runs a non-login shell (where if you’re typing, you’re running a login shell).

You’re building userid correctly. It’s building and it’s working. The webui just doesn’t ever get to see it because 11.12.0 is what’s being invoked and 11.12.0 doesn’t care for your userid build.

Answer?

  1. [it is something]. Remove the system-installed version of NodeJS (11.12.0) if you don’t need it. Recreating a symlink where the old one existed to point to your 8.0.0 install.

  2. [better]. Update /etc/profile to source the NVM environment that your /root/.bashrc is already doing. You’d check the latter file for what the script is and then just have it exist in /etc/profile which MineOS would see.

  3. [another option]. (but requires git committing). Edit /usr/games/minecraft/webui.js–the very first line that says: #!/usr/bin/env node and update that to the path of your 8.0.0 installation. Make a commit of this change with git so that your change lives peacefully along with future updates (which won’t be coming very often).

Realistically, you can do just the edit and you’re likely to be AOK forever. Worst case scenario is that you ‘reset the webui to default/factory settings’ and then you remake this change.

Those are a few options. I think #2 might be best, #3 might be the actual easiest but if not fully done, could be … confusing shortly, down the line.