[SOLVED] Tailscale causes boot to hang

Started by benniekiss, January 20, 2025, 08:48:56 PM

Previous topic - Next topic
January 20, 2025, 08:48:56 PM Last Edit: January 22, 2025, 02:01:57 PM by benniekiss
OPNsense version: 24.7.12
Tailscale plugin version: 1.1

When rebooting my opnsense vm instance, the boot hangs at this point in the process:

Warning: Subnet routing and exit nodes only work with additional manual configuration on freebsd, and is not currently officially supported.
setup vtnet0 [egress only]
setup vtnet2
setup vtnet1

I believe this is because my tailscale vpn is connected to a self-hosted headscale instance that is behind the opnsense vm. When opnsense boots, it cannot reach the control server, so it hangs trying to bring the interface up.

I tested this by disabling tailscale and rebooting, and the boot completes without any issue. I also tested by configuring a connection to the main tailscale control server, and the boot also completed without issue. Here are the logs when connecting to the tailscale control server:

Warning: Subnet routing and exit nodes only work with additional manual configuration on freebsd, and is not currently officially supported.
tun0: changing name to 'tailscale0'
tun0: link state changed to UP
setup vtnet0 [egress only]
setup vtnet2
setup vtnet1

Is there a way to manually bypass this check so the boot can complete? This only recently became an issue with my setup.

Switch to the tailscale plugin, it allows configuring the headscale server.

I am using the tailscale plugin. My issue is not with connecting to the headscale server.

I don't use a custom headscale server but I think I was able to reproduce the problem of bootup stalling by just trying a fake headscale URL.  I found a crude workaround, you could see if it works for you, if you're comfortable checking code from a random stranger on the Internet is safe to use - it's a very small change: https://github.com/bensmithurst/opnsense-plugins/commit/0cbcf2d54412e2899348083ee46dd3d198e6ea3c

curl https://github.com/bensmithurst/opnsense-plugins/commit/0cbcf2d54412e2899348083ee46dd3d198e6ea3c.patch > tailscale-timeout.patch
patch -d /usr/local -p4 < tailscale-timeout.patch

Go to tailscale > settings in the UI and press apply to make it re-generate the config.  You should see the change in /etc/rc.conf.d/tailscaled

tailscaled_up_args="--timeout=10s .....

Then reboot and see if it works as expected.  This should make 'tailscale up' give up after 10 seconds during bootup and not stall completely.  If that works, it at least gives an idea of what a proper fix for the plugin might be (e.g. maybe something like I've done but made into a config option).

This resolved the problem for me, and is vastly better then my solution which was to get a shell on the box, and restart tailscale :)



Looks like your patch was merged and is in 25.1, but I haven't tried upgrading yet (I'm nervous after a kernel bug a month or two ago).  Thanks for doing that work!