2019-12-20

<clever> coco: allow port 5000 udp?
<clever> ocharles: looks like the children survived, systemd will likely -9 them
<clever> ocharles: id reboot then
<clever> ocharles: -9 to the head then, lol
<clever> ocharles: upgrade to -term ?
<clever> kill -int 22414 27332
<clever> id just kill (-int) both of those nix-daemons (not their children)
<clever> as-is 27319
<clever> except 22401 is missing
<clever> ocharles: pid 22401 and 27319 are doing something with those nix daemons
<clever> the filesystem shouldnt allow that
<clever> sounds like fs corruption?
<clever> ocharles: can you pastebin `ps -eH x` ?
<clever> evanjs: thats easy enough, it has its own nixos config
<clever> ah
<clever> evanjs: thatll do it
<clever> evanjs: i think path-info doesnt show closure? but maybe it does now
<clever> evanjs: oops, yeah, -qR
<clever> ocharles: and check what generic-builder.nix did with .env
<clever> ocharles: what about ghcWithPackages?
<clever> evanjs: that will tell you how big everything it depends on is, and sort by size
<clever> evanjs: `du -hc --max=0 $(nix-store THATPATH) | sort -h`
<clever> evanjs: yep, now `nix-store -r /nix/store/8fz04l5n1zrjm2b5bflvraf8w1zn3754-nixos-system-nixos-19.09.1647.2e73f72c87e.drv` to find its output
<clever> there should be one that looks like a nixos build, with a channel name or something
<clever> evanjs: nix-store -qR /nix/store/gq9y41i9zkradkfv294bgh8y80dsa1qz-initrd.drv | grep system
<clever> evanjs: nix-store -q --deriver /nix/store/jxj92yj8xjb773dq5afm79aq7sq2gwvc-initrd
<clever> evanjs: what is the storepath for your initrd?
<clever> not sure why yours is bigger
<clever> -r--r--r-- 1 root root 286M Dec 31 1969 rescue-initrd
<clever> Filesystem Size Used Avail Use% Mounted on
<clever> /dev/sda2 488M 422M 32M 94% /boot
<clever> evanjs: boot.loader.grub.extraFiles is what copied things to /boot for you
<clever> bbl
<clever> evanjs: need nodev there to keep it happy
<clever> boot.loader.grub.efiSupport = true;
<clever> evanjs: boot.loader.grub.devices = [ "nodev" ]; to make it shut up
<clever> evanjs: grub.devices is only if your not using efi
<clever> evanjs: just `nixos-rebuild switch --install-bootloader` and your done
<clever> evanjs: just switch to grub, youll thank me for it :P
<clever> the memtest86 support is specialy coded directly into systemd-boot-builder.py
<clever> i dont think systemd-boot has an option at all to add custom configs
<clever> ah, its using a new memtest86-efi package
<clever> thats new...
<clever> evanjs: memtest doesnt work under systemd-boot, it doesnt support efi
<clever> brnzz: then wrap the program with a shell script, that will copy from $out to the \$HOME, if the files are missing
<clever> evanjs: currently only tested on grub, but if you figure out how to add extra entries to systemd-boot, you can fix that
<clever> evanjs: one min
<clever> brnzz: it should read $HOME at runtime, not build time
<clever> just pass imports plain paths, nothing more
<clever> without any fuss
<clever> pie_: if you use imports, the merging happens automatically
<clever> brnzz: configure it to use $HOME for the state
<clever> pie_: you can also just define more nixos options
<clever> pie_: i think you want to just stop trying to call extra and nop_fun, just insert raw paths, and use _module.args
<clever> decoding...
<clever> the outer config takes a module, which can optionally have a config key
<clever> pie_: i think you want containers.retiolum.config.config then?
<clever> so you want imports = [...]; config = mkMerge [];
<clever> imports isnt a child of config, its a sibling
<clever> the errors get nasty if you dont
<clever> pie_: imports can accept sets or functions, or paths, its best to just always give it a path
<clever> pie_: just call mkMerge with a list? or use imports?
<clever> but it was computing the closure before running nix-build
<clever> the snack project has something similar
<clever> ocharles: the nix expr can probably run storePath for you, after you --argstr
<clever> that might work?
<clever> its now referencing the original, but its not tagged as a drv
<clever> "inputSrcs": [
<clever> "/nix/store/yhzvzdq82lzk0kvrp3i79yhjnhps6qpk-hello-2.10"
<clever> :q
<clever> «derivation /nix/store/j0naavgvinx348daarkqwpzhnsfxmbkp-name.drv»
<clever> nix-repl> builtins.derivation { name = "name"; foo = builtins.storePath /nix/store/yhzvzdq82lzk0kvrp3i79yhjnhps6qpk-hello-2.10; builder = "bar"; system = "x86_64-linux"; }
<clever> "string"
<clever> nix-repl> builtins.typeOf (builtins.storePath /nix/store/yhzvzdq82lzk0kvrp3i79yhjnhps6qpk-hello-2.10)
<clever> but you need an existing string with the context you want
<clever> and string appends spread it like a plague :P
<clever> LnL: note that even a single character of a string, has all of the strings context
<clever> correct
<clever> it treats it identically to `src = ./.`
<clever> "inputSrcs": [
<clever> "/nix/store/yz7398ad4nwarp502pzhl6s56s1kii6n-yhzvzdq82lzk0kvrp3i79yhjnhps6qpk-hello-2.10"
<clever> $ nix show-derivation /nix/store/3alg0nw6p214ah0w31mnd6mw27z6hgk1-name.drv
<clever> «derivation /nix/store/3alg0nw6p214ah0w31mnd6mw27z6hgk1-name.drv»
<clever> nix-repl> builtins.derivation { name = "name"; foo = /nix/store/yhzvzdq82lzk0kvrp3i79yhjnhps6qpk-hello-2.10; builder = "bar"; system = "x86_64-linux"; }
<clever> nix-repl> "${toString /nix/store/yhzvzdq82lzk0kvrp3i79yhjnhps6qpk-hello-2.10}"
<clever> "/nix/store/yhzvzdq82lzk0kvrp3i79yhjnhps6qpk-hello-2.10"
<clever> LnL: toString bypasses the copy
<clever> why did i see otherwise, elsewhere...
<clever> ack!
<clever> "/nix/store/yz7398ad4nwarp502pzhl6s56s1kii6n-yhzvzdq82lzk0kvrp3i79yhjnhps6qpk-hello-2.10"
<clever> nix-repl> "${/nix/store/yhzvzdq82lzk0kvrp3i79yhjnhps6qpk-hello-2.10}"
<clever> ive only seen it copy when using a symlink to the store
<clever> since its already immutable
<clever> if the item is already in the store, it wont copy it
<clever> ocharles: and no toString on that value?
<clever> ocharles: the key is --arg, not --argstr
<clever> ocharles: if the ghc is already in the nix store, it will just use it, and it already has deps
<clever> ocharles: you could just pass it the path to a ghc, --arg ghc $(which ghc)
<clever> only something that nix-build is building can have deps
<clever> ocharles: nix-store --add cant deal with any dependencies
<clever> ocharles: sounds like you just want to run `nix-build ghc.nix --arg file ./file.hs` basically
<clever> ocharles: if you call builtins.derivation with the right args, it should create that
<clever> that just tells it how to pretty-print the object
<clever> yeah
<clever> the other attrs are just misc data, that let you do other things with the object
<clever> > let foo = { outPath = "bar"; }; in "${foo}"
<clever> ocharles: if a set has an outPath and you try to treat it as a string, it just uses whatever the outPath is
<clever> if you know which nixpkgs it came from, its much simpler
<clever> ocharles: and then incrementally recreate the nix expression
<clever> ocharles: you can use nix-diff to compare 2 .drv files
<clever> siers: then generates a shell script that takes over the old binary name
<clever> siers: it renames the binary to .binary-wrapped
<clever> pie_: dig +trace, will explain it
<clever> pie_: dig will obey /etc/resolv.conf by default, but it bypasses nscd
<clever> pie_: dig
<clever> your welcome
<clever> i prefer having it in a $HOME, so i dont have to cd as far
<clever> user preference again
<clever> but its mostly user preference at that point
<clever> pie_: thats why i keep it in /root/ instead
<clever> inferencerules: then you dont need any symlinks, and that might have also fixed it
<clever> inferencerules: what i would instead do, is create a /etc/nixos/configuration.nix, that has just 1 line: { imports = [ /home/clever/nixcfg/configuration.nix ]; }
<clever> inferencerules: was it setup the exact same way before the upgrade failed?
<clever> could be interesting to try and reproduce it
<clever> inferencerules: any symlinks happen to be involved in that file?
<clever> id expect builtins.genericClosure to detect that, but maybe symlinks are breaking it
<clever> inferencerules: https://github.com/inferencerules/dotfiles/blob/master/nixos-configs/configuration.nix#L13 configuration.nix is loading configuration.nix
<clever> inferencerules: and there are no local differences?
<clever> inferencerules: can you pastebin the configuration.nix file?
<clever> inferencerules: re-run it with `nixos-rebuild build -vv` and see what it says
<clever> inferencerules: that definitely sounds like it could be infinite recursion
<clever> inferencerules: start by doing `strace -p 4520 -f`, does it output anything?
<clever> inferencerules: so i can give directions for the next steps
<clever> inferencerules: which pid is consuming 100% cpu?
<clever> inferencerules: how fast is the cpu, how long has it been running?
<clever> inferencerules: that sounds like decompression on the tar file for channels
<clever> matthuszagh: phases="unpackPhase patchPhase configurePhase buildPhase" genericBuild
<clever> juxiemaotu: are there any errors at the tail end of dmesg?
<clever> juxiemaotu: just run `dmesg` in the terminal
<clever> juxiemaotu: did you check dmesg?
<clever> juxiemaotu: anything interesting in dmesg?

2019-12-19

<clever> tobiasBora: yeah, the -env- in the middle is a sign of it likely just being a bash script that changes env vars to make weechat find plugins
<clever> pie_: and EnvironmentFile says to load that, based on the %i (the name after the @)
<clever> pie_: nixos creates a /etc/containers/foo.conf file, that contains the HOST_ADDRESS=
<clever> tobiasBora: typically config files dont have version numbers in the names
<clever> tobiasBora: half memorizing the name and purpose of every single package, half looking for version numbers
<clever> pie_: you could also read some of those attrs
<clever> pie_: .environment on all of the services, is set to a set from a let block
<clever> getting link...
<clever> pie_: hydra already does that
<clever> tobiasBora: and a quick skim over it says that the "biggest" thing your building is a single perl package, the rest are just configs
<clever> tobiasBora: i dont see any kernel in that pastebin, only linux-modules (a buildEnv) and modules-shrunk (the closure used by the initrd)
<clever> and due to hydra pre-building things, it wont have to compile anything
<clever> tobiasBora: and only if that build is green, will i know that nixos-rebuild switch can pass without errors
<clever> tobiasBora: personally, i have my own hydra setup, to build my entire nixos config, against the latest version of a channel
<clever> pie_: ive played a bit with namespacing, and read over how nix creates a namespace with only lo, but i havent seen the code yet to create a linked pair of ve- IF's in seperate namespaces
<clever> pie_: probably
<clever> and you have no way to know if an override has been applied to that drv
<clever> but, dry-run shows drv files, not attrs
<clever> pie_: enless you look up the build graphs for an attr overall
<clever> pie_: i think so, but you need to know which eval its in, which means knowing the nixpkgs rev
<clever> tobiasBora: and if it hangs for more then a minute on a certain job, look at the job names
<clever> tobiasBora: one thing that i find helps, is `nixos-rebuild -Q` to hide the build logs, then you can see what it is building
<clever> tobiasBora: not much you can do for that, you just have to learn what package names are cheap and what are expensive, and skim over the list
<clever> keithy[m]: https://github.com/cleverca22/nixos-configs/blob/master/router.nat.nix#L96 and the zone file is in the same repo
<clever> keithy[m]: i just use proper bind when i want a dns server, ive never messed with dnsmasq
<clever> keithy[m]: the entire 127.*.*.* is loopback
<clever> tobiasBora: nixos-rebuild dry-run
<clever> tobiasBora: nix-build --dry-run
<clever> keithy[m]: thats localhost, the loopback ip
<clever> keithy[m]: i believe its based on your hostname
<clever> ocharles: i'm not sure if it accepts both or not, and didnt think it kept logs for failures
<clever> ocharles: there is also `nix-store -l /nix/store/foo`
<clever> /home/clever/apps/nixpkgs/pkgs/development/compilers/kotlin/default.nix: wrapProgram $out/bin/$p --prefix PATH ":" ${jre}/bin ;
<clever> /home/clever/apps/nixpkgs/pkgs/development/tools/gometalinter/default.nix: wrapProgram $bin/bin/gometalinter --prefix PATH : "${makeBinPath runtimeDeps}"
<clever> siers: the wrapProgram function will generate that script for you
<clever> inferencerules: usually when things get that corrupt, your only option is to delete the entire /nix and re-run nixos-install from a livecd

2019-12-18

<clever> pie_: not that i know of
<clever> siers: yeah
<clever> siers: its much simpler to have a default.nix that imports nixpkgs, and uses callPackage for you
<clever> siers: only if you use -E and callPackage yourself
<clever> siers: yes, but it will be a lot simpler to make a default.nix and then `nix-env -f . -iA foo`
<clever> rizary_: correct
<clever> rizary_: so for configurePhase and onwards, the current directory is the writable copy of the src
<clever> rizary_: the stdenv will also cd into the copy after unpackPhase has run
<clever> rizary_: its $NIX_BUILD_TOP, which would be something like /tmp/nix-build-name-0/
<clever> DigitalKiwi: callCabal2nix is IFD, which isnt allowed within nixpkgs
<clever> rizary_: yeah, the sandbox stops you from doing anything thats completely unsafe
<clever> rizary_: you need to `chmod +w -R $out` to fix those permissions, and let you modify $out further
<clever> rizary_: if you use `cp $src $out`, then cp will preserve the fact that the contents of $src where read-only
<clever> and the buildInputs will only be available at build time
<clever> since $src is still read-only, you cant add things under $out/foo
<clever> siers: if $out is a symlink to $src, there is no way to persist those buildInputs at runtime
<clever> siers: you can just use ./. instead
<clever> siers: yes, but at that point, your derivation is pointless
<clever> thats an error saying you cant reach 10.243.77.2
<clever> thats not a valid reply
<clever> and then tcpdump the container side of the host<->container link, does that also show the replies
<clever> pie_: then tcpdump the container, is it sending pings out the vpn? are they coming back?
<clever> pie_: tcpdump on the far end, is it receiving the packets?
<clever> buildPhase should build things
<clever> generally, installPhase should be what writes to $out
<clever> pie_: it exists, but it would be simpler to just use buildPhase or installPhase
<clever> you need to chmod +w -R, to make it writable
<clever> rizary_: the default unpackPhase fixes the permissions for you
<clever> rizary_: the $src you copied is read-only, and cp preserves that
<clever> siers: nix-daemon will flag it all as read-only, after your builder exits
<clever> siers: buildCommand stops unpackPhase from running, so you may want to switch to installPhase instead
<clever> siers: and id recomend you then copy the files you want to keep to somewhere under $out, along with the scripts themselves
<clever> siers: the unpackPhase will copy it to $NIX_BUILD_TOP/name, and cd into it
<clever> siers: `src = ./.;` will copy ./. to /nix/store/hash-name, and set $src to that at build time
<clever> nd
<clever> siers: you can also just do cp ${./foo.txt} foo.txt in the buildComma
<clever> siers: if you do `src = ./.;` then the default unpackPhase will copy the entire directory, and cd into it
<clever> do i even want to know what your network is doing? lol
<clever> pie_: that could be done
<clever> duairc: that works
<clever> correct
<clever> which will un-nat things, as it forwards it back to the host
<clever> when packets come back over the vpn, they will enter the network stack for the container
<clever> think of the container as its own machine
<clever> pie_: the "internal" ip is the one from the virtual link between host&guest
<clever> pie_: nat is trivial to setup with nixos
<clever> or use NAT in the container, to claim everything came from the containers vpn addr
<clever> either setup the routing tables on the far end, to be be able to route packets back to you
<clever> thats your problem
<clever> pie_: does the far end know how to route 10.0.2.2 backwards?
<clever> pie_: it needs to know about 10.0.0.0, and to route it back to the vpn addr of that container
<clever> pie_: the remote node, at the other end of the vpn tunnel
<clever> pie_: realpath $(which tcpdump)
<clever> pie_: you may need to setup channels first, simpler to just run tcpdump by absolute path
<clever> pie_: so if you know the path to tcpdump, you can just run it by absolute path
<clever> pie_: also, the container has access to the entire /nix/store of the host
<clever> pie_: nix-env and nix-shell still work in the container
<clever> pie_: check tcpdump in the container, is it receiving the packets from the host? is it sending them out the vpn?
<clever> nixooosaaaa: if you keep the replacement string the exact same length as the original, sed could work on a compiled binary
<clever> pie_: the kernel still keeps up with the lie and uses the ip to know if something is for itself or another machine
<clever> nixooosaaaa: you dont have to fork the repo, thats what the patchPhase is for, to modify the source at build time
<clever> nixooosaaaa: and your not able to modify the source before it got compiled?
<clever> ,xy nixooosaaaa
<clever> pie_: sounds like it, and they decided to upgrade a node 100's of people where in the middle of using
<clever> patchelf is operating mainly on the structured part of the file, and leaving the .data untouched
<clever> nixooosaaaa: its usually not safe to edit binaries with sed, since it uses relative offsets within itself a lot
<clever> which is also why its so bad :P
<clever> its a single central node
<clever> gchristensen: id call that a DoS, not a DDoS
<clever> pie_: for extra confusion, the kernel has both drm (digital rights management) and drm (direct rendering manager)
<clever> if you do nat, your forced to keep the reply coming down the same path
<clever> more, that if you dont do nat, your able to have different paths
<clever> and send traffic out one, but replies down the other
<clever> you could have 2 different containers, each with its own vpn link
<clever> pie_: this shows 2 src/dst pairs
<clever> ipv4 2 tcp 6 105 SYN_SENT src=192.168.2.11 dst=80.250.4.14 sport=48130 dport=52233 [UNREPLIED] src=80.250.4.14 dst=108.175.80.208 sport=52233 dport=48130 mark=0 use=2
<clever> [root@router:~]# cat /proc/net/nf_conntrack | head
<clever> the conntrack table handles that
<clever> if your not doing NAT, then the reply could come down a different path
<clever> so the router has to un-fudge it
<clever> but, when the reply comes back, it will have the "wrong" destination
<clever> so the router will fudge the source ip
<clever> and in the case of 10.0.2.2 going to the web, you cant claim ownership of 10.0.0.0/8
<clever> for the responce to make it back to you, the source ip you claim must also be in the routing tables
<clever> each hop notices that the dest ip is "wrong", looks it up in its own routing tables, and relays it via the next gateway in the chain
<clever> yeah
<clever> the router also had NAT setup, so it will mutate the src ip along the way
<clever> and forwards it in the right direction
<clever> and because forwarding is enabled, the router looks that dest up, in its own routing tables
<clever> the OS within the router, then notices the dest ip is "wrong"
<clever> the dest mac is what triggers the remote NIC (in the router, in this case) to respond to the packet
<clever> when your default route says `via 10.0.2.2`, then you lookup the mac of 10.0.2.2, then send things to the public ip (say 8.8.8.8) but the mac of 10.0.2.2
<clever> you must use ARP to lookup the mac behind an ip
<clever> on typical ethernet based networks (wifi and ethernet), you can only ever send packets to a mac, never an ip
<clever> its likely showing up on lo
<clever> pie_: its the same as sending to 127.0.0.1
<clever> pie_: nope, linux will notice that that is its own ip, and not even shove it out the interface
<clever> then it will route it to the guest, via whatever device the guest ip shows up on (routing tables again)
<clever> it must point to the guest ip
<clever> via points to 10.250.0.1, the host
<clever> oh wait, theres the problem
<clever> yep, that looks fine
<clever> /12 is 8 + 4
<clever> 243 0xf3
<clever> 240 0xf0
<clever> checking the numbers...
<clever> pie_: what does `ip route` on the host say?
<clever> pie_: what IP are you trying to ping?
<clever> pie_: check the main interface of the host, do you see the ping there?
<clever> pie_: there should be a virtual if between the host and container, and tcpdump should see it on both ends of that if
<clever> pie_: and does the container see the ping on its internal IF?
<clever> pie_: what are the IP's on the host and container side?
<clever> pie_: so if your pings appear to come from 192.168.2.100, the remote machine will either send a responce out onto the lan (for nobody to hear) or out the main router (onto the general internet, for nobody to hear)
<clever> pie_: the source ip matters
<clever> `tcpdump -i IFACE -p -n icmp`
<clever> tcpdump on every link, and a ping, will show you how far things are getting
<clever> pie_: and setup a either NAT in the container, or a reverse route so the far end knows how to send replies back
<clever> pie_: and enable forwarding within the container