Forums » Linux

Unable to install in NixOS

Sep 13, 2023 SIGTERM link
Long story short, NixOS does not follow Filesystem Hierarchy Standard. So, it is pretty much impossible to run a binary with a simple chmod +x binary.

I tried packaging the binary as outlined by the NixOS Wiki but it does not work either.

Here is the flake.nix I used to package the installer.
<code>
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
};

outputs = { self, nixpkgs }: {
defaultPackage.x86_64-linux =
with import nixpkgs { system = "x86_64-linux"; };

stdenv.mkDerivation rec {
name = "vendetta";

src = pkgs.fetchurl {
url = "http://download.guildsoftware.com/vendetta-linux-amd64-installer.sh";
sha256 = "CA4D7BD26FEC832D8180DE050B8F40F4D6490ECAAEEA5A4C63466E1D6B74AF8E";
};

dontUnpack = true;
dontConfigure = true;
dontBuild = true;

nativeBuildInputs = [
autoPatchelfHook
];

sourceRoot = ".";

installPhase = ''
install -m755 -D $src $out/bin/vendetta-online
'';

meta = with lib; {
homepage = "https://vendetta-online.com/";
description = "Vendetta Online is a graphically intensive 3D MMORPG set in space.";
};
};
};
}
</code>

Running the installer (result/bin/vendetta-online) extracts the files in ~/.vendetta, places the launcher in ~/bin/ but those executables still do not run because of the apparently missing libraries.

/bin/rm not being found is pretty much a non-issue and can be fixed by replacing it with rm.


I guess the issue arises due to the required libraries not being linked. Theoretically, autoPatchelfHook in flake.nix should have done all the heavy lifting but the installer presents itself as a script file and not an elf. So, it does not work.

I recorded the logs by running
```
strace --trace=file,process --follow-forks --string-limit=200 \
./result/bin/vendetta-online 2>strace.log
```
and dug them up with
```
cat strace.log | grep -e 'No such file' -e 'execve("' \
| grep -v -E -e '(open|stat|access)(at)?\(.*"/nix/store/' \
-e resumed -e '/etc/ld-nix.so.preload'
```

Here is what got recorded:
execve("./result/bin/vendetta-online", ["./result/bin/vendetta-online"], 0x7ffffffef988 /* 167 vars */) = 0
[pid 11195] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/tty", ["tty", "-s"], 0x577010 /* 167 vars */) = 0
[pid 11196] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/mkdir", ["mkdir", "/tmp/nix-shell.Z6yYvN/selfgz1119410532"], 0x577010 /* 167 vars */) = 0
[pid 11198] newfstatat(AT_FDCWD, "/home/user/.local/bin/which", 0x7ffffffed660, 0) = -1 ENOENT (No such file or directory)
[pid 11198] newfstatat(AT_FDCWD, "/home/user/bin/which", 0x7ffffffed660, 0) = -1 ENOENT (No such file or directory)
[pid 11198] newfstatat(AT_FDCWD, "/run/wrappers/bin/which", 0x7ffffffed660, 0) = -1 ENOENT (No such file or directory)
[pid 11198] newfstatat(AT_FDCWD, "/home/user/.nix-profile/bin/which", 0x7ffffffed660, 0) = -1 ENOENT (No such file or directory)
[pid 11198] newfstatat(AT_FDCWD, "/etc/profiles/per-user/user/bin/which", 0x7ffffffed660, 0) = -1 ENOENT (No such file or directory)
[pid 11198] newfstatat(AT_FDCWD, "/nix/var/nix/profiles/default/bin/which", 0x7ffffffed660, 0) = -1 ENOENT (No such file or directory)
[pid 11199] execve("/run/current-system/sw/bin/which", ["which", "md5sum"], 0x577010 /* 167 vars */) = 0
[pid 11201] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/head", ["head", "-n", "401", "./result/bin/vendetta-online"], 0x577010 /* 167 vars */ <unfinished ...>
[pid 11202] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/wc", ["wc", "-c"], 0x577010 /* 167 vars */ <unfinished ...>
[pid 11203] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/tr", ["tr", "-d", " "], 0x577010 /* 167 vars */ <unfinished ...>
[pid 11206] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/cut", ["cut", "-d ", "-f1"], 0x577010 /* 167 vars */) = 0
[pid 11207] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/basename", ["basename", "/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/md5sum"], 0x577010 /* 167 vars */) = 0
[pid 11210] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/cut", ["cut", "-d ", "-f1"], 0x577010 /* 167 vars */) = 0
[pid 11214] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/cut", ["cut", "-b-32"], 0x577010 /* 167 vars */ <unfinished ...>
[pid 11216] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/md5sum", ["/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/md5sum"], 0x577010 /* 167 vars */ <unfinished ...>
[pid 11215] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/expr", ["expr", "358546660", "/", "1024"], 0x577010 /* 167 vars */ <unfinished ...>
[pid 11217] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/expr", ["expr", "358546660", "%", "1024"], 0x577010 /* 167 vars */) = 0
[pid 11218] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/dd", ["dd", "if=./result/bin/vendetta-online", "ibs=9490", "skip=1", "obs=1024", "conv=sync"], 0x577010 /* 167 vars */ <unfinished ...>
[pid 11220] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/dd", ["dd", "ibs=1024", "obs=1024", "count=350143"], 0x577010 /* 167 vars */ <unfinished ...>
[pid 11221] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/dd", ["dd", "ibs=1", "obs=1024", "count=228"], 0x577010 /* 167 vars */) = 0
[pid 11222] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/expr", ["expr", "1", "+", "1"], 0x577010 /* 167 vars */) = 0
[pid 11223] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/expr", ["expr", "9490", "+", "358546660"], 0x577010 /* 167 vars */) = 0
[pid 11225] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/head", ["head", "-n", "401", "./result/bin/vendetta-online"], 0x577010 /* 167 vars */ <unfinished ...>
[pid 11226] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/wc", ["wc", "-c"], 0x577010 /* 167 vars */ <unfinished ...>
[pid 11227] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/tr", ["tr", "-d", " "], 0x577010 /* 167 vars */ <unfinished ...>
[pid 11229] newfstatat(AT_FDCWD, "/usr/xpg4/bin", 0x7ffffffee740, 0) = -1 ENOENT (No such file or directory)
[pid 11230] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/df", ["df", "-kP", "/tmp/nix-shell.Z6yYvN/selfgz1119410532"], 0x577010 /* 167 vars */ <unfinished ...>
[pid 11231] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/tail", ["tail", "-1"], 0x577010 /* 167 vars */ <unfinished ...>
[pid 11232] execve("/nix/store/l69xigsqwjhlfl45h59ih69r1ni44xli-gawk-5.2.2/bin/awk", ["awk", "{print $4}"], 0x577010 /* 167 vars */ <unfinished ...>
[pid 11236] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/expr", ["expr", "358546660", "/", "1024"], 0x577010 /* 167 vars */ <unfinished ...>
[pid 11238] execve("/nix/store/zh1g9lzd8wpgcjxcvm3y4a6dwjy50dym-gzip-1.12/bin/gzip", ["gzip", "-cd"], 0x577010 /* 167 vars */ <unfinished ...>
[pid 11239] execve("/nix/store/61fb45v0p9rgpg8k4bmkd7wz187454f9-gnutar-1.34/bin/tar", ["tar", "xvf", "-"], 0x577010 /* 167 vars */ <unfinished ...>
[pid 11240] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/expr", ["expr", "358546660", "%", "1024"], 0x577010 /* 167 vars */) = 0
[pid 11238] execve("/nix/store/zh1g9lzd8wpgcjxcvm3y4a6dwjy50dym-gzip-1.12/bin/.gzip-wrapped", ["/nix/store/zh1g9lzd8wpgcjxcvm3y4a6dwjy50dym-gzip-1.12/bin/gzip", "-cd"], 0x577010 /* 167 vars */ <unfinished ...>
[pid 11241] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/dd", ["dd", "if=./result/bin/vendetta-online", "ibs=9490", "skip=1", "obs=1024", "conv=sync"], 0x577010 /* 167 vars */ <unfinished ...>
[pid 11243] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/dd", ["dd", "ibs=1024", "obs=1024", "count=350143"], 0x577010 /* 167 vars */ <unfinished ...>
[pid 11250] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/dd", ["dd", "ibs=1", "obs=1024", "count=228"], 0x577010 /* 167 vars */) = 0
[pid 11252] newfstatat(AT_FDCWD, "/usr/xpg4/bin/id", 0x7ffffffee350, 0) = -1 ENOENT (No such file or directory)
[pid 11252] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/id", ["id", "-u"], 0x577010 /* 167 vars */) = 0
[pid 11251] newfstatat(AT_FDCWD, "/usr/xpg4/bin/chown", 0x7ffffffee910, 0) = -1 ENOENT (No such file or directory)
[pid 11253] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/chown", ["chown", "-R", "1000", "."], 0x577010 /* 167 vars */) = 0
[pid 11254] newfstatat(AT_FDCWD, "/usr/xpg4/bin/id", 0x7ffffffee4e0, 0) = -1 ENOENT (No such file or directory)
[pid 11254] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/id", ["id", "-g"], 0x577010 /* 167 vars */) = 0
[pid 11251] newfstatat(AT_FDCWD, "/usr/xpg4/bin/chgrp", 0x7ffffffeeaa0, 0) = -1 ENOENT (No such file or directory)
[pid 11251] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/chgrp", ["chgrp", "-R", "100", "."], 0x577010 /* 167 vars */) = 0
[pid 11255] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/expr", ["expr", "9490", "+", "358546660"], 0x577010 /* 167 vars */) = 0
[pid 11256] execve("./setup.sh", ["./setup.sh"], 0x577010 /* 167 vars */) = 0
[pid 11258] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/whoami", ["whoami"], 0x58c010 /* 167 vars */) = 0
[pid 11259] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/whoami", ["whoami"], 0x58c010 /* 167 vars */) = 0
[pid 11257] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/cat", ["cat"], 0x58c010 /* 167 vars */) = 0
[pid 11260] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/whoami", ["whoami"], 0x58c010 /* 167 vars */) = 0
[pid 11261] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/cp", ["cp", "-rf", "install/demos.rlb", "install/drivers", "install/first_run", "install/manual", "install/manual.html", "install/media6.rlb", "install/media.rlb", "install/update.rlb", "install/vendetta", "install/vendetta.lfv", "/home/user/.vendetta/"], 0x58c010 /* 167 vars */) = 0
[pid 11262] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/cp", ["cp", "-f", "vendetta", "/home/user/bin"], 0x58c010 /* 167 vars */) = 0
[pid 11263] execve("/nix/store/c2bq8xsayc90s33fd5xbm1vh5lrmwcfq-coreutils-9.3/bin/cat", ["cat"], 0x58c010 /* 167 vars */) = 0
[pid 11264] execve("/bin/rm", ["/bin/rm", "-rf", "/tmp/nix-shell.Z6yYvN/selfgz1119410532"], 0x577010 /* 167 vars */) = -1 ENOENT (No such file or directory)
[pid 11264] newfstatat(AT_FDCWD, "/bin/rm", 0x7ffffffef0c0, 0) = -1 ENOENT (No such file or directory)
[pid 11264] newfstatat(AT_FDCWD, "/bin/rm", 0x7ffffffef0a0, 0) = -1 ENOENT (No such file or directory)
./result/bin/vendetta-online: line 399: /bin/rm: No such file or directory

References:
https://nixos.wiki/wiki/Packaging/Binaries
Sep 13, 2023 incarnate link
Long story short, NixOS does not follow Filesystem Hierarchy Standard. So, it is pretty much impossible to run a binary with a simple chmod +x binary.

So, I have zilch for knowledge of NixOS, but the binary is mostly statically linked, and any major dynamic libraries should only be impacted by LD_LIBRARY_PATH (locations are not baked into the binary, but searched from that path). So, I'm not sure how much the filesystem hierarchy even matters that much to the game?

If I recall, the install script is kind of a wrapped self-extracting archive. Something pretty standard, like tar.gz? I forget, it's been a really long time, but I think you can use gzip and such to extract the binaries directly?

(Also, maybe zsh isn't an ideal case for running the script, try bash?)

As long as you can get the game launcher to start up in a directory, it should function, although if it can't find the rest of the game files in expected places, it may (slowly) re-download them all.

The game launcher is very robust, although it does need gtk2.

And, of course, try to stick to the architecture you have natively (64bit or 32bit). I think one of the biggest challenges raised recently stemmed from him trying to run 32bit game on a 64bit system with no 32bit libraries. Once he stopped trying to use the 32bit version, things got a lot easier.

That's all I can think of, off the top of my head, late at night. But, Linux is Linux, we try to make it work okay out of the box with the most vanilla distros (Ubuntu); but as platforms go, we can never really be sure it'll be easy to run on all the other distros out there. People have to be willing to "tinker" on their side, that's part of the uhh.. "joy"? Or, to co-opt the ancient "If operating systems were airlines" joke..

Linux: Passengers bring a piece of the airplane and a box of tools with them to the airport. They gather on the tarmac, arguing about what kind of plane they want to build. The passengers split into groups and build several different aircraft but give them all the same name. Only some passengers reach their destinations, but all of them believe they arrived.
Sep 13, 2023 SIGTERM link
>any major dynamic libraries should only be impacted by LD_LIBRARY_PATH

That might be where the problem lies. Running echo $LD_LIBRARY_PATH in the build environment prints nothing. Now I have to figure out how to do that.

>but I think you can use gzip and such to extract the binaries directly?

Yes it is gzipped.
Sep 13, 2023 SIGTERM link
>That might be where the problem lies. Running echo $LD_LIBRARY_PATH in the build environment prints nothing. Now I have to figure out how to do that.

That...might not be the case. I am not extracting the files in /nix/store. For packages to work under nix, they must be placed under /nix/store. Then nix symlinks the required libraries. That is how the other packages worked, at least. When I put them in home directory, nix has no idea what to do with them. I mean, the entire idea of packaging in nix is to put it in nix store. I am not doing that so it does not work. I put the installer in nix store so the installer is the only thing that works. The installer then places the game files in home directory.
Sep 13, 2023 SIGTERM link
>the entire idea of packaging in nix is to put it in nix store

I kind of feel stupid for not being able to figure this out earlier. Anyways, I managed to hunt the dependencies and run the launcher. For that you need to run setup.sh first or the launcher will just crash.

Here is the updated flake.nix:
<code>
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
};

outputs = { self, nixpkgs }: {
defaultPackage.x86_64-linux =
with import nixpkgs { system = "x86_64-linux"; };

stdenv.mkDerivation rec {
name = "vendetta";

src = pkgs.fetchurl {
url = "http://download.guildsoftware.com/vendetta-linux-amd64-installer.sh";
sha256 = "CA4D7BD26FEC832D8180DE050B8F40F4D6490ECAAEEA5A4C63466E1D6B74AF8E";
};

dontUnpack = true;
dontConfigure = false;
dontBuild = false;

nativeBuildInputs = [
autoPatchelfHook
pkgs.glib
pkgs.pulseaudio
pkgs.alsa-lib
pkgs.libGLU
pkgs.gtk2
pkgs.xorg.libXxf86vm
];

sourceRoot = ".";

buildPhase = ''
xargs -n 1 cp -v $src <<<"vendetta-linux-amd64-installer.sh vendetta-linux-amd64-installer.tar.gz"
# delete lines starting from line 402 to EOF, which is the compressed package
sed -i '402,$d' vendetta-linux-amd64-installer.sh
# delete lines starting from 1 to 401, which is the bootstrapping script
sed -i '1,401d' vendetta-linux-amd64-installer.tar.gz

'';

installPhase = ''
mkdir -p $out/bin
tar xf vendetta-linux-amd64-installer.tar.gz --directory $out/bin
'';

meta = with lib; {
homepage = "https://vendetta-online.com/";
description = "Vendetta Online is a graphically intensive 3D MMORPG set in space.";
};
};
};
}
</code>



Now the launcher works, but the update fails with error code -99. I guess it tries to write in nix store which is supposed to be immutable. But I also have reasons to not be very sure of that idea. Is there any way to run the launcher in verbose or debug mode where I can see what it is doing?
Sep 13, 2023 incarnate link
Now the launcher works, but the update fails with error code -99. I guess it tries to write in nix store which is supposed to be immutable. But I also have reasons to not be very sure of that idea. Is there any way to run the launcher in verbose or debug mode where I can see what it is doing?

I think the launcher is going to try and write where-ever it is. I believe it's expecting to be run in a locale like ".vendetta", where it can examine and write the game files.

As far as I can recollect, there's no verbose or debug mode. Ray has some kind of weird predilection for Windows-style "error codes", which I find incredibly unhelpful, and even after all these years I'm still slowly forcing him to purge that all out in favor of some kind of explanatory text strings.

Anyway, my suggestion would be running it through strace or truss or something that will give you a read on what it's trying to do. That's far more detailed than "verbose flag" type data you'd get anyway.

However, if you know it's being run in an area where it can't write anything.. that's a pretty likely problem.

FYI that I'm eventually going to move this thread to the Linux forum, as this doesn't represent a "bug" in VO at all, and is more appropriate to that location. But, I'll make sure you're aware before I do that.
Sep 13, 2023 SIGTERM link
>FYI that I'm eventually going to move this thread to the Linux forum, as this doesn't represent a "bug" in VO at all, and is more appropriate to that location. But, I'll make sure you're aware before I do that.

Alright.