I’m trying to write a derivation for ProgrammingDinosaur/autoortho4xplane.
Attempt with buildFHSEnv - Fails due to SUID wrappers
Currently, I have managed to get the program running with the following derivation:
{ lib
, stdenv
, fetchzip
, buildFHSEnv
, fuse3
, glib
, zlib
, mesa
, libGL
, libGLU
, libxkbcommon
, wayland
, xorg
, fontconfig
, freetype
, zstd
, dbus
}:
let
baseDrv = stdenv.mkDerivation rec {
pname = "auto-ortho-base";
version = "1.3.3";
src = fetchzip {
url = "https://github.com/ProgrammingDinosaur/autoortho4xplane/releases/download/${version}/autoortho_linux_${version}.tar.gz";
sha256 = "sha256-slH7Po9LYS1JjObKvMrRTmpI0RjnbbkI1Lik0yCUCr0=";
stripRoot = false;
};
buildInputs = [ fuse3 ];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp autoortho_lin_${version}.bin $out/bin/auto-ortho
runHook postInstall
'';
dontFixup = true;
meta = with lib; {
homepage = "https://github.com/ProgrammingDinosaur/autoortho4xplane";
description = "AutoOrtho for X-Plane — automatic orthophoto streaming";
platforms = platforms.linux;
};
};
in
buildFHSEnv {
name = "auto-ortho";
targetPkgs = pkgs: with pkgs; [
baseDrv
fuse3
glib
zlib
mesa
libGL
libGLU
libxkbcommon
wayland
xorg.libX11
xorg.libXext
xorg.libXrender
xorg.libXtst
xorg.libXi
xorg.libXrandr
fontconfig
freetype
zstd
dbus
];
extraBwrapArgs = [ "--bind-try /etc/fuse.conf /etc/fuse.conf" ];
runScript = "${baseDrv}/bin/auto-ortho";
}
However, when trying to use the main function of the program you get an error when fusermount is called.
INFO:config_ui_qt:Mounting sceneries...
INFO:autoortho:Running in single-threaded mode.
INFO:autoortho:Running mounts in non-blocking mode.
INFO:autoortho:Running in FUSE mode.
INFO:autoortho:AutoOrtho: root: .../Steam/steamapps/common/X-Plane 12/Custom Scenery/z_autoortho/scenery/z_ao_eur mountpoint: .../Steam/steamapps/common/X-Plane 12/Custom Scenery/z_ao_eur
Linux detected
INFO:getortho:chunk_getter: <getortho.ChunkGetter object at 0x7f3115cc4440>
INFO:autoortho_fuse:ROOT: .../Steam/steamapps/common/X-Plane 12/Custom Scenery/z_autoortho/scenery/z_ao_eur
INFO:getortho:Maptype override set to BI
INFO:getortho:Will use Compressor: ISPC
INFO:getortho:Cache dir: /home/matth/.autoortho-data/cache
INFO:getortho:Target zoom level set to ZL16
INFO:getortho:Started tile clean thread. Mem limit 4294967296.0
INFO:autoortho_fuse:MOUNT: .../Steam/steamapps/common/X-Plane 12/Custom Scenery/z_ao_eur
INFO:autoortho_fuse:Starting FUSE mount
INFO:autoortho_fuse:Loading FUSE with options: allow_other, foreground, nothreads
DEBUG:fuse:Set libFUSE callback for 'getattr' to wrapped <bound compiled_method FUSE.getattr_fuse_3 of <mfusepy.FUSE object at 0x7f3115ce44d0>> wrapping <bound method AutoOrtho.getattr of <autoortho_fuse.AutoOrtho object at 0x7f3134476870>>
DEBUG:fuse:Set libFUSE callback for 'readlink' to wrapped <bound compiled_method FUSE.readlink of <mfusepy.FUSE object at 0x7f3115ce44d0>> wrapping <bound compiled_method AutoOrtho.readlink of <autoortho_fuse.AutoOrtho object at 0x7f3134476870>>
DEBUG:fuse:Set libFUSE callback for 'mknod' to wrapped <bound compiled_method FUSE.mknod of <mfusepy.FUSE object at 0x7f3115ce44d0>> wrapping <bound compiled_method AutoOrtho.mknod of <autoortho_fuse.AutoOrtho object at 0x7f3134476870>>
DEBUG:fuse:Set libFUSE callback for 'mkdir' to wrapped <bound compiled_method FUSE.mkdir of <mfusepy.FUSE object at 0x7f3115ce44d0>> wrapping <bound compiled_method AutoOrtho.mkdir of <autoortho_fuse.AutoOrtho object at 0x7f3134476870>>
DEBUG:fuse:Set libFUSE callback for 'unlink' to wrapped <bound compiled_method FUSE.unlink of <mfusepy.FUSE object at 0x7f3115ce44d0>> wrapping <bound compiled_method AutoOrtho.unlink of <autoortho_fuse.AutoOrtho object at 0x7f3134476870>>
DEBUG:fuse:Set libFUSE callback for 'rmdir' to wrapped <bound compiled_method FUSE.rmdir of <mfusepy.FUSE object at 0x7f3115ce44d0>> wrapping <bound compiled_method AutoOrtho.rmdir of <autoortho_fuse.AutoOrtho object at 0x7f3134476870>>
DEBUG:fuse:Set libFUSE callback for 'symlink' to wrapped <bound compiled_method FUSE.symlink of <mfusepy.FUSE object at 0x7f3115ce44d0>> wrapping <bound compiled_method AutoOrtho.symlink of <autoortho_fuse.AutoOrtho object at 0x7f3134476870>>
DEBUG:fuse:Set libFUSE callback for 'rename' to wrapped <bound compiled_method FUSE.rename_fuse_3 of <mfusepy.FUSE object at 0x7f3115ce44d0>> wrapping <bound compiled_method AutoOrtho.rename of <autoortho_fuse.AutoOrtho object at 0x7f3134476870>>
DEBUG:fuse:Set libFUSE callback for 'link' to wrapped <bound compiled_method FUSE.link of <mfusepy.FUSE object at 0x7f3115ce44d0>> wrapping <bound compiled_method AutoOrtho.link of <autoortho_fuse.AutoOrtho object at 0x7f3134476870>>
DEBUG:fuse:Set libFUSE callback for 'chmod' to wrapped <bound compiled_method FUSE.chmod_fuse_3 of <mfusepy.FUSE object at 0x7f3115ce44d0>> wrapping <bound compiled_method AutoOrtho.chmod of <autoortho_fuse.AutoOrtho object at 0x7f3134476870>>
DEBUG:fuse:Set libFUSE callback for 'chown' to wrapped <bound compiled_method FUSE.chown_fuse_3 of <mfusepy.FUSE object at 0x7f3115ce44d0>> wrapping <bound compiled_method AutoOrtho.chown of <autoortho_fuse.AutoOrtho object at 0x7f3134476870>>
DEBUG:fuse:Set libFUSE callback for 'truncate' to wrapped <bound compiled_method FUSE.truncate_fuse_3 of <mfusepy.FUSE object at 0x7f3115ce44d0>> wrapping <bound compiled_method AutoOrtho.truncate of <autoortho_fuse.AutoOrtho object at 0x7f3134476870>>
DEBUG:fuse:Set libFUSE callback for 'open' to wrapped <bound compiled_method FUSE.open of <mfusepy.FUSE object at 0x7f3115ce44d0>> wrapping <bound compiled_method AutoOrtho.open of <autoortho_fuse.AutoOrtho object at 0x7f3134476870>>
DEBUG:fuse:Set libFUSE callback for 'read' to wrapped <bound compiled_method FUSE.read of <mfusepy.FUSE object at 0x7f3115ce44d0>> wrapping <bound compiled_method AutoOrtho.read of <autoortho_fuse.AutoOrtho object at 0x7f3134476870>>
DEBUG:fuse:Leave libFUSE callback for 'write' uninitialized.
DEBUG:fuse:Set libFUSE callback for 'statfs' to wrapped <bound compiled_method FUSE.statfs of <mfusepy.FUSE object at 0x7f3115ce44d0>> wrapping <bound method AutoOrtho.statfs of <autoortho_fuse.AutoOrtho object at 0x7f3134476870>>
DEBUG:fuse:Set libFUSE callback for 'flush' to wrapped <bound compiled_method FUSE.flush of <mfusepy.FUSE object at 0x7f3115ce44d0>> wrapping <bound compiled_method AutoOrtho.flush of <autoortho_fuse.AutoOrtho object at 0x7f3134476870>>
DEBUG:fuse:Set libFUSE callback for 'release' to wrapped <bound compiled_method FUSE.release of <mfusepy.FUSE object at 0x7f3115ce44d0>> wrapping <bound compiled_method AutoOrtho.release of <autoortho_fuse.AutoOrtho object at 0x7f3134476870>>
DEBUG:fuse:Set libFUSE callback for 'fsync' to wrapped <bound compiled_method FUSE.fsync of <mfusepy.FUSE object at 0x7f3115ce44d0>> wrapping <bound compiled_method AutoOrtho.fsync of <autoortho_fuse.AutoOrtho object at 0x7f3134476870>>
DEBUG:fuse:Leave libFUSE callback for 'setxattr' uninitialized.
DEBUG:fuse:Leave libFUSE callback for 'getxattr' uninitialized.
DEBUG:fuse:Leave libFUSE callback for 'listxattr' uninitialized.
DEBUG:fuse:Leave libFUSE callback for 'removexattr' uninitialized.
DEBUG:fuse:Set libFUSE callback for 'opendir' to wrapped <bound compiled_method FUSE.opendir of <mfusepy.FUSE object at 0x7f3115ce44d0>> wrapping <bound compiled_method AutoOrtho.opendir of <autoortho_fuse.AutoOrtho object at 0x7f3134476870>>
DEBUG:fuse:Set libFUSE callback for 'readdir' to wrapped <bound compiled_method FUSE.readdir_fuse_3 of <mfusepy.FUSE object at 0x7f3115ce44d0>> wrapping <bound method AutoOrtho.readdir of <autoortho_fuse.AutoOrtho object at 0x7f3134476870>>
DEBUG:fuse:Set libFUSE callback for 'releasedir' to wrapped <bound compiled_method FUSE.releasedir of <mfusepy.FUSE object at 0x7f3115ce44d0>> wrapping <bound compiled_method AutoOrtho.releasedir of <autoortho_fuse.AutoOrtho object at 0x7f3134476870>>
DEBUG:fuse:Leave libFUSE callback for 'fsyncdir' uninitialized.
DEBUG:fuse:Set libFUSE callback for 'init' to wrapped <bound compiled_method FUSE.init_fuse_3 of <mfusepy.FUSE object at 0x7f3115ce44d0>> wrapping <bound compiled_method Operations.init of <autoortho_fuse.AutoOrtho object at 0x7f3134476870>>
DEBUG:fuse:Leave libFUSE callback for 'destroy' uninitialized.
DEBUG:fuse:Leave libFUSE callback for 'access' uninitialized.
DEBUG:fuse:Leave libFUSE callback for 'create' uninitialized.
DEBUG:fuse:Leave libFUSE callback for 'lock' uninitialized.
DEBUG:fuse:Set libFUSE callback for 'utimens' to wrapped <bound compiled_method FUSE.utimens_fuse_3 of <mfusepy.FUSE object at 0x7f3115ce44d0>> wrapping <bound compiled_method AutoOrtho.utimens of <autoortho_fuse.AutoOrtho object at 0x7f3134476870>>
DEBUG:fuse:Leave libFUSE callback for 'bmap' uninitialized.
DEBUG:fuse:Leave libFUSE callback for 'ioctl' uninitialized.
DEBUG:fuse:Leave libFUSE callback for 'poll' uninitialized.
DEBUG:fuse:Leave libFUSE callback for 'write_buf' uninitialized.
DEBUG:fuse:Leave libFUSE callback for 'read_buf' uninitialized.
DEBUG:fuse:Leave libFUSE callback for 'flock' uninitialized.
DEBUG:fuse:Leave libFUSE callback for 'fallocate' uninitialized.
DEBUG:fuse:Leave libFUSE callback for 'copy_file_range' uninitialized.
DEBUG:fuse:Leave libFUSE callback for 'lseek' uninitialized.
/nix/store/hia0d0lpnkzcjgizrd4y2x681gqpm3mz-fuse-3.17.4-bin/bin/fusermount3: mount failed: Operation not permitted
ERROR:autoortho_fuse:FUSE mount failed with non-negotiable error: 4
INFO:utils.mount_utils:Cleaning up mountpoint: .../Steam/steamapps/common/X-Plane 12/Custom Scenery/z_ao_eur
ERROR:autoortho:Exception in FUSE mount: 4
Traceback (most recent call last):
File "/tmp/onefile_66002_1761770772_151601/autoortho.py", line 782, in domount
File "/tmp/onefile_66002_1761770772_151601/autoortho_fuse.py", line 602, in run
File "/tmp/onefile_66002_1761770772_151601/mfusepy.py", line 1237, in __init__
RuntimeError: 4
In my configuration programs.fuse.userAllowOther = true; is set, and I can confirm it works correctly by checking /etc/fuse.conf
I stumbled upon this file and Issue on GitHub and this, which indicates what the problem is
Attempt with autoPatchelfHook - Unsure why this fails
I have tried to rewrite derivation to patch the file directly, but I’m running into issues that go a little above my knowledge.
Currently, I have this
{ lib
, stdenv
, fetchzip
, autoPatchelfHook
, patchelf
, fuse3
, glib
, zlib
, mesa
, libGL
, libGLU
, libxkbcommon
, wayland
, xorg
, fontconfig
, freetype
, zstd
, dbus
}:
let
pname = "auto-ortho";
version = "1.3.3";
src = fetchzip {
url = "https://github.com/ProgrammingDinosaur/autoortho4xplane/releases/download/${version}/autoortho_linux_${version}.tar.gz";
sha256 = "sha256-slH7Po9LYS1JjObKvMrRTmpI0RjnbbkI1Lik0yCUCr0=";
stripRoot = false;
};
in
stdenv.mkDerivation {
inherit pname version src;
nativeBuildInputs = [
autoPatchelfHook
];
buildInputs = [
fuse3
glib
zlib
mesa
libGL
libGLU
libxkbcommon
wayland
xorg.libX11
xorg.libXext
xorg.libXrender
xorg.libXtst
xorg.libXi
xorg.libXrandr
fontconfig
freetype
zstd
dbus
];
installPhase = ''
mkdir -p $out/bin
cp autoortho_lin_${version}.bin $out/bin/auto-ortho
'';
meta = with lib; {
homepage = "https://github.com/ProgrammingDinosaur/autoortho4xplane";
description = "AutoOrtho for X-Plane — automatic orthophoto streaming";
platforms = platforms.linux;
};
}
Which returns the following:
$ strace -e openat ./result/bin/auto-ortho
openat(AT_FDCWD, "/nix/store/pfn887ygmab6jmwcwj57phzljspgqnpn-libdbusmenu-glib-16.04.0/lib/glibc-hwcaps/x86-64-v3/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/nix/store/pfn887ygmab6jmwcwj57phzljspgqnpn-libdbusmenu-glib-16.04.0/lib/glibc-hwcaps/x86-64-v2/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/nix/store/pfn887ygmab6jmwcwj57phzljspgqnpn-libdbusmenu-glib-16.04.0/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/nix/store/daamdpmaz2vjvna55ccrc30qw3qb8h6d-glibc-2.40-66/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/nix/store/daamdpmaz2vjvna55ccrc30qw3qb8h6d-glibc-2.40-66/lib/glibc-hwcaps/x86-64-v3/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/nix/store/daamdpmaz2vjvna55ccrc30qw3qb8h6d-glibc-2.40-66/lib/glibc-hwcaps/x86-64-v2/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/nix/store/daamdpmaz2vjvna55ccrc30qw3qb8h6d-glibc-2.40-66/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/nix/store/xvshk5x5p4vin4pnnxqivjgfjpd0p0yh-auto-ortho-1.3.3/bin/auto-ortho", O_RDONLY) = 3
Error, couldn't find attached data header.
+++ exited with 2 +++
I’ve checked the glibc files with the directory linked in the logs, but the glibc-hwcaps/ directory does not seem to exist. Anyone have a clue? This was already quite the search for me, but by this point I’m unsure how to continue.
Thanks in advance!

