1
0
Fork 0
mirror of https://github.com/pikvm/pikvm.git synced 2026-03-02 18:16:56 -05:00

tailscale requires readwrite filesystem #119

Closed
opened 2026-02-20 13:20:34 -05:00 by deekerman · 9 comments
Owner

Originally created by @moodoki on GitHub (Jan 8, 2021).

Originally assigned to: @mdevaev on GitHub.

Describe the bug
tailscale seems to keep an open handle on some files.
Also, tailscale will not start if filesystem is readonly (i.e. after reboot)

To Reproduce
Steps to reproduce the behavior, like:

  1. Install and setup tailscale as per documentation
  2. After the steps, ro command will fail. Showing mount: /: mount point is busy.
  3. After reboot, tailscale will fail to start with these messages in journalctl
Sep 04 15:45:30 pikvm systemd[1]: Starting Tailscale node agent...
Sep 04 15:45:31 pikvm tailscaled[330]: 2020/09/04 15:45:31 --state is required
Sep 04 15:45:31 pikvm systemd[1]: tailscaled.service: Control process exited, code=exited, status=1/FAILURE
Sep 04 15:45:31 pikvm tailscaled[347]: 2020/09/04 15:45:31 --state is required
Sep 04 15:45:31 pikvm systemd[1]: tailscaled.service: Control process exited, code=exited, status=1/FAILURE
Sep 04 15:45:31 pikvm systemd[1]: tailscaled.service: Failed with result 'exit-code'.
Sep 04 15:45:31 pikvm systemd[1]: Failed to start Tailscale node agent.
Sep 04 15:45:31 pikvm systemd[1]: tailscaled.service: Scheduled restart job, restart counter is at 1.
Sep 04 15:45:31 pikvm systemd[1]: Stopped Tailscale node agent.
Sep 04 15:45:31 pikvm systemd[1]: Starting Tailscale node agent...
Sep 04 15:45:31 pikvm tailscaled[353]: 2020/09/04 15:45:31 --state is required
Sep 04 15:45:31 pikvm systemd[1]: tailscaled.service: Control process exited, code=exited, status=1/FAILURE
Sep 04 15:45:31 pikvm tailscaled[360]: 2020/09/04 15:45:31 --state is required
Sep 04 15:45:31 pikvm systemd[1]: tailscaled.service: Control process exited, code=exited, status=1/FAILURE
Sep 04 15:45:31 pikvm systemd[1]: tailscaled.service: Failed with result 'exit-code'.
...

tailscaled service would start successfully if file system is set to rw

Expected behavior
ro command should succeed.
tailscaled should start after reboot
rw should not be required to start tailscaled

Pi-KVM info:

  • Raspberry Pi board version - RPi 4
  • Pi-KVM platform: v2-hdmi
  • Video capture type: CSI bridge
  • KVMD version: kvmd 1.100-1 kvmd-platform-v2-hdmi-rpi4 1.100-1 kvmd-webterm 0.34-1
  • uStreamer version: ustreamer 1.25-1
  • Linux kernel: Linux pikvm 5.4.61-2-ARCH #1 SMP PREEMPT Fri Sep 4 12:46:16 UTC 2020 armv7l GNU/Linux

Additional context
Add any other context about the problem here.

Originally created by @moodoki on GitHub (Jan 8, 2021). Originally assigned to: @mdevaev on GitHub. **Describe the bug** tailscale seems to keep an open handle on some files. Also, tailscale will not start if filesystem is readonly (i.e. after reboot) **To Reproduce** Steps to reproduce the behavior, like: 1. Install and setup tailscale as per [documentation](https://github.com/pikvm/pikvm/blob/master/pages/tailscale.md) 2. After the steps, `ro` command will fail. Showing `mount: /: mount point is busy.` 3. After `reboot`, tailscale will fail to start with these messages in `journalctl` ``` Sep 04 15:45:30 pikvm systemd[1]: Starting Tailscale node agent... Sep 04 15:45:31 pikvm tailscaled[330]: 2020/09/04 15:45:31 --state is required Sep 04 15:45:31 pikvm systemd[1]: tailscaled.service: Control process exited, code=exited, status=1/FAILURE Sep 04 15:45:31 pikvm tailscaled[347]: 2020/09/04 15:45:31 --state is required Sep 04 15:45:31 pikvm systemd[1]: tailscaled.service: Control process exited, code=exited, status=1/FAILURE Sep 04 15:45:31 pikvm systemd[1]: tailscaled.service: Failed with result 'exit-code'. Sep 04 15:45:31 pikvm systemd[1]: Failed to start Tailscale node agent. Sep 04 15:45:31 pikvm systemd[1]: tailscaled.service: Scheduled restart job, restart counter is at 1. Sep 04 15:45:31 pikvm systemd[1]: Stopped Tailscale node agent. Sep 04 15:45:31 pikvm systemd[1]: Starting Tailscale node agent... Sep 04 15:45:31 pikvm tailscaled[353]: 2020/09/04 15:45:31 --state is required Sep 04 15:45:31 pikvm systemd[1]: tailscaled.service: Control process exited, code=exited, status=1/FAILURE Sep 04 15:45:31 pikvm tailscaled[360]: 2020/09/04 15:45:31 --state is required Sep 04 15:45:31 pikvm systemd[1]: tailscaled.service: Control process exited, code=exited, status=1/FAILURE Sep 04 15:45:31 pikvm systemd[1]: tailscaled.service: Failed with result 'exit-code'. ... ``` `tailscaled` service would start successfully if file system is set to rw **Expected behavior** `ro` command should succeed. `tailscaled` should start after reboot `rw` should not be required to start `tailscaled` **Pi-KVM info:** - Raspberry Pi board version - RPi 4 - Pi-KVM platform: v2-hdmi - Video capture type: CSI bridge - KVMD version: `kvmd 1.100-1 kvmd-platform-v2-hdmi-rpi4 1.100-1 kvmd-webterm 0.34-1 ` - uStreamer version: `ustreamer 1.25-1` - Linux kernel: Linux pikvm 5.4.61-2-ARCH #1 SMP PREEMPT Fri Sep 4 12:46:16 UTC 2020 armv7l GNU/Linux **Additional context** Add any other context about the problem here.
deekerman 2026-02-20 13:20:34 -05:00
Author
Owner

@mdevaev commented on GitHub (Jan 8, 2021):

Update the whole system using rw; pacman -Syu; reboot and try again.

@mdevaev commented on GitHub (Jan 8, 2021): Update the whole system using `rw; pacman -Syu; reboot` and try again.
Author
Owner

@moodoki commented on GitHub (Jan 8, 2021):

Updating the whole system doesn't help. The error still remains.

@moodoki commented on GitHub (Jan 8, 2021): Updating the whole system doesn't help. The error still remains.
Author
Owner

@moodoki commented on GitHub (Jan 8, 2021):

It looks like tailscaled has open handles on /var/lib/tailscale/tailscaled.log1.txt and /var/lib/tailscale/tailscaled.log2.txt.
I don't see a way to change the path of these files. Any ideas?

@moodoki commented on GitHub (Jan 8, 2021): It looks like `tailscaled` has open handles on `/var/lib/tailscale/tailscaled.log1.txt` and `/var/lib/tailscale/tailscaled.log2.txt`. I don't see a way to change the path of these files. Any ideas?
Author
Owner

@mdevaev commented on GitHub (Jan 8, 2021):

I don't really understand where this problem came from at all because I haven't updated the package in the last couple of months, and all this time it worked fine. I'll figure it out, just today I had a higher priority issue in the form of a broken csi bridge driver.

@mdevaev commented on GitHub (Jan 8, 2021): I don't really understand where this problem came from at all because I haven't updated the package in the last couple of months, and all this time it worked fine. I'll figure it out, just today I had a higher priority issue in the form of a broken csi bridge driver.
Author
Owner

@moodoki commented on GitHub (Jan 9, 2021):

@mdevaev No worries, I'll try to debug as well.

Looks like from a recent version of tailscale, they've decided that it was a good idea to write to 2 files in /var/lib/tailscale. github.com/tailscale/tailscale@f9659323df/logpolicy/logpolicy.go (L111)

I'm not sure why they've decided to do so instead of using LOGS_DIRECTORY. STATE_DIRECTORY doesn't seem to be used anywhere else in tailscale.

I've verified that I can get it to start using a writable overlay, with something like this:

#!/bin/bash

mkdir -p /var/log/tailscale.overlay/upper
mkdir -p /var/log/tailscale.overlay/workdir
mount -t overlay -o lowerdir=/var/lib/tailscale.ro,upperdir=/var/log/tailscale.overlay/upper,workdir=/var/log/tailscale.overlay/workdir overlay /var/lib/tailscale
@moodoki commented on GitHub (Jan 9, 2021): @mdevaev No worries, I'll try to debug as well. Looks like from a recent version of tailscale, they've decided that it was a good idea to write to 2 files in `/var/lib/tailscale`. https://github.com/tailscale/tailscale/blob/f9659323df677a35dc1c53bcb6c55d708933571b/logpolicy/logpolicy.go#L111 I'm not sure why they've decided to do so instead of using LOGS_DIRECTORY. STATE_DIRECTORY doesn't seem to be used anywhere else in tailscale. I've verified that I can get it to start using a writable overlay, with something like this: ``` #!/bin/bash mkdir -p /var/log/tailscale.overlay/upper mkdir -p /var/log/tailscale.overlay/workdir mount -t overlay -o lowerdir=/var/lib/tailscale.ro,upperdir=/var/log/tailscale.overlay/upper,workdir=/var/log/tailscale.overlay/workdir overlay /var/lib/tailscale ```
Author
Owner

@mdevaev commented on GitHub (Jan 9, 2021):

The problems are related to the fact that tailscale was accepted into the official arch repository. Systemd service is not patched there, as it was with me. As a workaround, do the following:

  1. mkdir -p /etc/systemd/system/tailscaled.service.d
  2. Create file /etc/systemd/system/tailscaled.service.d/override.conf:
    [Service]
    ExecStartPre=
    ExecStartPre=/usr/sbin/tailscaled --cleanup --state=/var/lib/tailscale/tailscaled.state
    ExecStopPost=
    ExecStopPost=/usr/sbin/tailscaled --cleanup --state=/var/lib/tailscale/tailscaled.state
    StateDirectory=
    StateDirectoryMode=
    
@mdevaev commented on GitHub (Jan 9, 2021): The problems are related to the fact that tailscale was accepted into the official arch repository. Systemd service is not patched there, as it was with me. As a workaround, do the following: 1. `mkdir -p /etc/systemd/system/tailscaled.service.d` 2. Create file `/etc/systemd/system/tailscaled.service.d/override.conf`: ``` [Service] ExecStartPre= ExecStartPre=/usr/sbin/tailscaled --cleanup --state=/var/lib/tailscale/tailscaled.state ExecStopPost= ExecStopPost=/usr/sbin/tailscaled --cleanup --state=/var/lib/tailscale/tailscaled.state StateDirectory= StateDirectoryMode= ```
Author
Owner

@mdevaev commented on GitHub (Jan 9, 2021):

Alternative: pacman -S tailscale-pikvm

@mdevaev commented on GitHub (Jan 9, 2021): Alternative: `pacman -S tailscale-pikvm`
Author
Owner

@mdevaev commented on GitHub (Jan 9, 2021):

I've fixed doc. Problem solved.

@mdevaev commented on GitHub (Jan 9, 2021): I've fixed doc. Problem solved.
Author
Owner

@moodoki commented on GitHub (Jan 9, 2021):

Awesome. Verified that it works! Thanks.

@moodoki commented on GitHub (Jan 9, 2021): Awesome. Verified that it works! Thanks.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/pikvm-pikvm#119
No description provided.