openzfs / openzfs-docs

OpenZFS Documentation
https://openzfs.github.io/openzfs-docs/
135 stars 194 forks source link

NixOS: add option for more than 3 udhcpc retries when ssh unlocking boot #419

Closed mariaa144 closed 1 year ago

mariaa144 commented 1 year ago

I tried to setup sshUnlock using the guide but I couldn't figure out how to connect using ssh. Specifically, I couldn't ping the host and ssh would return sh: connect to host 192.168.99.47 port 22: No route to host. I am using DHCP and I believe the IP is correct.

Is it possible to get some logging for initrd? How should I go about troubleshooting the issue? How can I verify DHCP is setup correctly for initrd. I do have NetworkManager enabled.

I tried again with NetworkManager disable and I got the errors:

udhcpc: broadcasting discover
udhcpc: broadcasting discover
udhcpc: broadcasting discover
udhcpc: no lease, failing

When I boot completely in NixOS with NetworkManager or without NetworkManager enable I get a IP with no problem.

mariaa144 commented 1 year ago

To get udhcpc to have enough time to get an IP I had to increase the number of tries to 10. Usually on the forth try it succeeds. All works fine after that.

See: https://nixos.org/manual/nixos/stable/options.html#opt-boot.initrd.network.udhcpc.extraArgs

I added:

boot.initrd.network.udhcpc.extraArgs = [ "--retries=10" ];

Perhaps an options to allow for more retires should be added or the default should be increased a little. Right now the default is 3 retries.

ghost commented 1 year ago

It seems that your DHCP server is not working as it should be. I can not help with that.

For changing the defaults or adding options: it is your job to customize the template further to suit your needs.

We are not going to change the defaults just to suit your needs.

gmelikov commented 1 year ago

To get udhcpc to have enough time to get an IP I had to increase the number of tries to 10. Usually on the forth try it succeeds.

@mariaa144 it strongly indicates that you have local problems with network or dhcp server, I agree with @ne9z here.

mariaa144 commented 1 year ago

Maybe it is a problem with my dhcp but my dhcp is running on an off the shelf pfsense device and it has never been a source of problem for me. Perhaps my NIC is still initializing when the for the first three attempts. That's what this guy suggests is happening for him. https://unix.stackexchange.com/a/617821/55139

mariaa144 commented 1 year ago

I noticed I can create an issue on the flake repo so I'm going to close the issue here.