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

lokinet: init at 0.8.1 // loki-mq: init at 1.2.2 #69175

Closed
wants to merge 3 commits into from

Conversation

Chiiruno
Copy link
Contributor

Motivation for this change

Cool p2p thingy.
This is WIP for the moment however, having issues with libcap and this, and can't find any documentation related to this for nix. It does build and execute, just permission issues.

[100%] Built target testAll
Install the project...
-- Install configuration: "Release"
-- Installing: /nix/store/6ad8i69sygqwsqi2yfyk8im0v3qmyij2-lokinet-0.5.2/bin/lokinet
-- Installing: /nix/store/6ad8i69sygqwsqi2yfyk8im0v3qmyij2-lokinet-0.5.2/bin/lokinet-rcutil
-- Installing: /nix/store/6ad8i69sygqwsqi2yfyk8im0v3qmyij2-lokinet-0.5.2/bin/lokinet-bootstrap
unable to set CAP_SETFCAP effective capability: Operation not permitted
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/6ad8i69sygqwsqi2yfyk8im0v3qmyij2-lokinet-0.5.2
shrinking /nix/store/6ad8i69sygqwsqi2yfyk8im0v3qmyij2-lokinet-0.5.2/bin/lokinet
shrinking /nix/store/6ad8i69sygqwsqi2yfyk8im0v3qmyij2-lokinet-0.5.2/bin/lokinet-rcutil
strip is /nix/store/cl1i6bfqnx48ipakj4px7pb1babzs23j-binutils-2.31.1/bin/strip
stripping (with command strip and flags -S) in /nix/store/6ad8i69sygqwsqi2yfyk8im0v3qmyij2-lokinet-0.5.2/bin
patching script interpreter paths in /nix/store/6ad8i69sygqwsqi2yfyk8im0v3qmyij2-lokinet-0.5.2
/nix/store/6ad8i69sygqwsqi2yfyk8im0v3qmyij2-lokinet-0.5.2/bin/lokinet-bootstrap: interpreter directive changed from "/usr/bin/env bash" to "/nix/store/l6h4ya0wzb4b8mr0y58k2gh2nhfql4sn-bash-4.4-p23/bin/bash"
checking for references to /build/ in /nix/store/6ad8i69sygqwsqi2yfyk8im0v3qmyij2-lokinet-0.5.2...
/nix/store/6ad8i69sygqwsqi2yfyk8im0v3qmyij2-lokinet-0.5.2

unable to set CAP_SETFCAP effective capability: Operation not permitted

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@Chiiruno
Copy link
Contributor Author

Chiiruno commented Sep 20, 2019

Ah, I think the makefile is trying to set capabilities in the nix store directory.
That's exactly it. https://github.com/loki-project/loki-network/blob/master/CMakeLists.txt#L305

@Chiiruno
Copy link
Contributor Author

Nope, can't set those capabilities no matter what it seems.
If anyone has any ideas, I'd appreciate it.

@aanderse
Copy link
Member

Presumably you want to run this as a systemd service. Modify the Makefile to get rid of that line and then add the capabilities to the systemd service in a NixOS module.

@aanderse
Copy link
Member

After a quick scan of the Makefile you may want to review some of the options available. For example:

https://github.com/loki-project/loki-network/blob/47109c4191d9230f7a9a9472a23101694bb215da/CMakeLists.txt#L31

@Chiiruno
Copy link
Contributor Author

I did want to make this as a systemd service, but from what I could tell from the readme, it's to not be run as root, and I think it's meant to be run as the user.

@Chiiruno
Copy link
Contributor Author

Also no need to get rid of the line in the makefile or cmakelists, just remove libcap and it doesn't show up.

@aanderse
Copy link
Member

If the program allows running as a dedicated non root user you can use something like serviceConfig.AmbientCapabilities = [ "cap_net_admin" ...

I'm not familiar with the program though, so I'm not sure what they intend.

@Chiiruno
Copy link
Contributor Author

Also this does not build with WARNINGS_AS_ERRORS=ON, since there's some shadowed variables, so I don't think I should enable that.

@Chiiruno
Copy link
Contributor Author

The service has some issues building in a vm, not sure what's wrong.
value is a boolean while a set was expected, at /mnt/hdd1/home/okina/Documents/Development/nixpkgs/lib/modules.nix:219:25
Seems to be only for the bool and int options, I have no idea what I'm missing.

Copy link
Member

@aanderse aanderse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't tested this at all, and it isn't 100% complete... but I thought these are some changes I might suggest to this PR: Chiiruno@d6dfb02

nixos/modules/services/networking/lokinet.nix Outdated Show resolved Hide resolved
nixos/modules/misc/ids.nix Outdated Show resolved Hide resolved
nixos/modules/services/networking/lokinet.nix Outdated Show resolved Hide resolved
nixos/modules/services/networking/lokinet.nix Outdated Show resolved Hide resolved
pkgs/applications/networking/p2p/lokinet/default.nix Outdated Show resolved Hide resolved
nixos/modules/services/networking/lokinet.nix Outdated Show resolved Hide resolved
nixos/modules/services/networking/lokinet.nix Outdated Show resolved Hide resolved
nixos/modules/services/networking/lokinet.nix Outdated Show resolved Hide resolved
nixos/modules/services/networking/lokinet.nix Outdated Show resolved Hide resolved
nixos/modules/services/networking/lokinet.nix Outdated Show resolved Hide resolved
@Chiiruno
Copy link
Contributor Author

Okay, some new problems.
This is relatively new territory for me.

building Nix...
building the system configuration...
error: evaluation aborted with the following error message: 'generators.mkValueStringDefault: attrsets not supported: { "_type" = "if"; "condition" = false; "content" = "/var/lib/lokinet/log"; }'
(use '--show-trace' to show detailed location information)

@Chiiruno
Copy link
Contributor Author

Chiiruno commented Oct 3, 2019

Fixed that problem, but now the lokinet service just doesn't want to start, something about a logic error, that seems to indicate an issue with the code?

@aanderse
Copy link
Member

aanderse commented Oct 3, 2019

Sorry I've been swamped with a few things lately. I'll try to checkout your branch and look through when I get a chance but in the meantime can you possibly attach the output log including the error? Maybe something will jump out at me.

@Chiiruno
Copy link
Contributor Author

Chiiruno commented Oct 3, 2019

No problem at all, no rush here. ^^
I would, but the error was so ambiguous anyway it wouldn't have mattered, and it was also in a virtual machine.
Maybe in a few hours when I have time, I'll take a screenshot of it.

@Chiiruno
Copy link
Contributor Author

Chiiruno commented Oct 4, 2019

It's a bit late, sorry about that. Image was clean and newly generated, of course.
Screenshot_20191004_035945
Screenshot_20191004_040155

Copy link
Member

@aanderse aanderse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm apologize that this took me much longer to get back to than I expected.

nixos/modules/services/networking/lokinet.nix Outdated Show resolved Hide resolved
nixos/modules/services/networking/lokinet.nix Outdated Show resolved Hide resolved
@Chiiruno
Copy link
Contributor Author

Got all that fixed, but there's yet another issue.
Lokinet cannot use /dev/net/tun unless it's as the root user, regardless of combinations of capabilities and other things.
I'm at a loss, not sure what to do.

@aanderse
Copy link
Member

https://github.com/loki-project/loki-network/blob/master/readme.md#running-on-linux

DO NOT RUN AS ROOT, run as normal user. This requires the binary to have the proper setcaps set by make install on the binary.

If following upstream instructions isn't working (I also had an error when I tried) I bet if you file an issue or use any support mediums they have upstream can probably help you out. If you open an issue link here and we can all work through the problem together.

@mehlon
Copy link
Contributor

mehlon commented Apr 17, 2020

Is there a way to run this in its current form? Perhaps manually, without the systemd service?

@majestrate
Copy link

you may want to bump the version for lokinet to 0.8.0 when that is tagged as the 0.5.x and 0.6.x do not work on the network currently, only 0.7.x function at the moment and we are pretty close to tagging 0.8.0.

@Chiiruno Chiiruno changed the title lokinet: init at 0.5.2 lokinet: init at 0.8.1 // loki-mq: init at 1.2.2 Nov 19, 2020
@Chiiruno
Copy link
Contributor Author

Only problems left are the [ exitAuth blacklistSnode upstream addNode ] options, because they don't support lists or something.

@Chiiruno
Copy link
Contributor Author

cc @aanderse

@aanderse
Copy link
Member

@Chiiruno I'm sorry but due to some RL obligations I've been very busy lately and I'm having trouble finding the time to sit down and familiarize myself with this PR again, because of the size. If @infinisil is not able to review it at this time maybe we could ping the marvin bot to find a capable reviewer.

@stale
Copy link

stale bot commented Jun 3, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 3, 2021
@Lassulus Lassulus self-requested a review May 10, 2022 08:03
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label May 10, 2022
@wyndon wyndon mentioned this pull request May 29, 2022
13 tasks
@wyndon
Copy link
Contributor

wyndon commented Jun 1, 2022

#175335

@wyndon wyndon closed this Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants