6 Jun 2023 |
oddlama | In reply to @elvishjerricco:matrix.org oddlama: Something else kinda weird is that on my system that has networkd enabled in both stage 1 and stage 2, I don't see the same messages from the socket unit about "Incoming traffic" Maybe it's also a red herring and just coincidence | 14:45:15 |
@elvishjerricco:matrix.org | possibly | 14:45:22 |
oddlama | In reply to @elvishjerricco:matrix.org your default.target is multi-user.target , right? :P I didn't change anything in that regard, so I hope so :D | 14:45:31 |
@elvishjerricco:matrix.org | (please double check, because it is possible to change) | 14:45:59 |
@elvishjerricco:matrix.org | (like, it shouldn't, but systemctl status default.target is easy enough :P) | 14:46:34 |
oddlama | Already on it | 14:46:46 |
oddlama | Yep, multi-user.target on both systems. | 14:46:59 |
@elvishjerricco:matrix.org | oddlama: As a sanity check, what's systemctl show -p WantedBy systemd-networkd.service say? | 14:48:24 |
oddlama | Just did a sanity check on the systemd issues | 14:49:39 |
oddlama | https://github.com/systemd/systemd/issues/27718 | 14:49:40 |
oddlama | In reply to @elvishjerricco:matrix.org oddlama: As a sanity check, what's systemctl show -p WantedBy systemd-networkd.service say? WantedBy=multi-user.target on both | 14:50:32 |
@elvishjerricco:matrix.org | Interesting tidbit from that issue that I'd like to revisit later:
networkd.service removes some (not all) IP addresses, routes, and friends on stop. Hence, restarting networkd during switching root may disconnect network. So, if the rootfs is backed by a network filesystem, system may fail to boot.
It was my understanding that this is explicitly not the case
| 14:53:49 |
@elvishjerricco:matrix.org | huh, ok apparently that's only true because we're not actually stopping systemd-networkd.service correctly before switch-root | 14:56:00 |
@elvishjerricco:matrix.org | Ok, looks like we just need Before and Conflicts on initrd-switch-root.target , and that will not only fix the bug, but also change how we need to implement flushBeforeStage2 | 14:58:18 |
@elvishjerricco:matrix.org | because apparently if it's stopped properly, it will flush | 14:58:35 |
@elvishjerricco:matrix.org | meaning with the current implementation, we won't have a way to do flushBeforeStage2 = false | 14:59:16 |
@elvishjerricco:matrix.org | I'm going to cook up a nixpkgs patch | 15:00:50 |
@elvishjerricco:matrix.org | oddlama: Can you try this in your config and see if it fixes your issue?
boot.initrd.network.flushBeforeStage2 = false;
boot.initrd.systemd = {
services.systemd-networkd = {
before = ["initrd-switch-root.target"];
conflicts = ["initrd-switch-root.target"];
};
sockets.systemd-networkd = {
before = ["initrd-switch-root.target"];
conflicts = ["initrd-switch-root.target"];
};
};
| 15:34:38 |
oddlama | Will try | 15:47:33 |
oddlama | In reply to @elvishjerricco:matrix.org meaning with the current implementation, we won't have a way to do flushBeforeStage2 = false What would be the benefit of not flushing? | 15:48:17 |
oddlama | In reply to @elvishjerricco:matrix.org
oddlama: Can you try this in your config and see if it fixes your issue?
boot.initrd.network.flushBeforeStage2 = false;
boot.initrd.systemd = {
services.systemd-networkd = {
before = ["initrd-switch-root.target"];
conflicts = ["initrd-switch-root.target"];
};
sockets.systemd-networkd = {
before = ["initrd-switch-root.target"];
conflicts = ["initrd-switch-root.target"];
};
};
Yep this works :) | 15:50:16 |
oddlama | Do you have an idea why it doesn't happen on your system? | 15:52:42 |
@elvishjerricco:matrix.org | In reply to @oddlama:matrix.org What would be the benefit of not flushing? If your rootfs is on a network fs for instance, you need to avoid flushing. | 15:53:17 |
@janne.hess:helsinki-systems.de | In reply to @oddlama:matrix.org What would be the benefit of not flushing? Network mounts | 15:53:27 |
@janne.hess:helsinki-systems.de | Ah yes :D | 15:53:34 |
@elvishjerricco:matrix.org | it appears that the person on the systemd issue is wrong that systemd-networkd flushes these things by default. But I'm having trouble parsing through all the documentation and code in systemd on the matter | 15:53:59 |
@elvishjerricco:matrix.org | If we can get rid of that stupid custom service and just use network config files to control flushBeforeStage2 , that would be great | 15:54:26 |
@elvishjerricco:matrix.org | * If we can get rid of that stupid custom service and just use network config files to implement flushBeforeStage2 , that would be great | 15:54:42 |
@elvishjerricco:matrix.org | In reply to @oddlama:matrix.org Do you have an idea why it doesn't happen on your system? No idea at all | 15:55:54 |
oddlama | I frequently think I need a systemd deep dive to grasp any of that properly :D | 15:56:59 |