-
-
Save jaredallard/96da354c37afb2a000f61cc0c10c4e61 to your computer and use it in GitHub Desktop.
Tailscale setup for remarkable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Original: https://github.com/cceckman/homelab/blob/main/helpers/rm2-tailscale.sh | |
# I am the original author of this document and release it into the public domain. | |
# Go wild. | |
# | |
# 2025 Modified by @jaredallard to build release versions of Tailscale. | |
# | |
# This script enables [Tailscale] on a [reMarkable 2] tablet. | |
# | |
# Tailscale is run in [userspace networking] mode, so any outbound applications | |
# will need to be configured to proxy via tailscaled. | |
# | |
# The script assumes you've set up SSH to the tablet, as described in | |
# https://remarkablewiki.com/tech/ssh, and that it's locally connected | |
# (not just via Tailscale) during setup. | |
# | |
# [Tailscale]: https://tailscale.com | |
# [reMarkable 2]: https://remarkable.com/ | |
# [userspace networking]: https://tailscale.com/kb/1112/userspace-networking/ | |
# | |
set -eu | |
if ! test "$#" = "1"; then | |
echo >&2 "Requires a single argument: reMarkable address" | |
echo >&2 "(Typically 10.11.99.1)" | |
exit 1 | |
fi | |
TARGET="$1" | |
TSINSTALLPATH="~/tailscale" | |
# TAILSCALE_VERSION is the version of tailscale to build. | |
TAILSCALE_VERSION="1.80.3" | |
CONTENT="$(mktemp -d)/" | |
build_tailscale() { | |
# Build Tailscale: | |
TSPATH="$(mktemp -d)" | |
rmdir "$TSPATH" | |
echo >&2 "Downloading tailscale source..." | |
mkdir -p "$(dirname "$TSPATH")" | |
git clone -c advice.detachedHead=false --single-branch --branch "v$TAILSCALE_VERSION" \ | |
https://github.com/tailscale/tailscale.git "$TSPATH" | |
pushd "$TSPATH" >/dev/null | |
# Read build information | |
set -a | |
eval "$(./build_dist.sh shellvars)" | |
set +a | |
# We're building for a small device. We aren't trying to squeeze onto the root | |
# partition, but we still want to leave more space for docs if we can. | |
# | |
# Use https://tailscale.com/kb/1207/small-tailscale, | |
# and tags+flags pulled from build_dist. | |
echo >&2 "Building tailscale..." | |
GOOS=linux GOARCH=arm GOARM=7 \ | |
go build \ | |
-C "$TSPATH" \ | |
-o "$CONTENT"/tailscale.combined \ | |
-tags ts_include_cli,ts_omit_aws,ts_omit_bird,ts_omit_tap,ts_omit_kube,ts_omit_completion \ | |
-ldflags "-w -s -X tailscale.com/version.longStamp=${VERSION_LONG} -X tailscale.com/version.shortStamp=${VERSION_SHORT}" \ | |
./cmd/tailscaled | |
echo >&2 "Tailscale binary up-to-date in $CONTENT" | |
# Capture the service file too. | |
cp "$TSPATH"/cmd/tailscaled/tailscaled.service "$CONTENT" | |
popd >/dev/null | |
} | |
# Build in a subshell, so cd doesn't move us. | |
(build_tailscale) | |
cat <<EOF >"$CONTENT"/setup.sh | |
#!/usr/bin/env bash | |
set -eu | |
# Sometimes Remarkable's OS doesn't update resolv.conf ? | |
# https://www.reddit.com/r/RemarkableTablet/comments/miogzb/solution_cloud_service_connection_issue_when | |
# Turn ~ into the actual home path. | |
export TSINSTALLPATH=$(sed 's|~|'"\$HOME"'|' <<<"$TSINSTALLPATH") | |
# Install files to their proper locations: | |
ls -lah \$TSINSTALLPATH | |
chown -R root:root \$TSINSTALLPATH | |
echo >&2 "Installing binaries and service definitions..." | |
set -x | |
# Link from the /usr paths to our install location | |
ln -sf "\$TSINSTALLPATH/tailscale.combined" /usr/bin/tailscale | |
ln -sf "\$TSINSTALLPATH/tailscale.combined" /usr/sbin/tailscaled | |
sed 's|/usr/sbin/tailscaled|'"\$TSINSTALLPATH/tailscale.combined"'|' "\$TSINSTALLPATH/tailscaled.service" > /etc/systemd/system/tailscaled.service | |
set +x | |
# Tailscale expects some configuration in a drop-in unit or config files; | |
# the tailscale.service definition includes PORT and FLAGS variables. | |
# We oblige! | |
# The reMarkable kernel doesn't appear to have CONFIG_TUN (no /dev/net/tun), | |
# so we have to try userspace-networking: | |
# https://tailscale.com/kb/1112/userspace-networking/ | |
cat <<EOS >/etc/default/tailscaled | |
PORT=41641 | |
FLAGS="--tun userspace-networking --socks5-server=localhost:1055 --outbound-http-proxy-listen=localhost:1055" | |
EOS | |
echo >&2 "Reloading systemd..." | |
systemctl daemon-reload | |
echo >&2 "Starting tailscale..." | |
systemctl enable --now tailscaled | |
tailscale up | |
EOF | |
chmod +x "$CONTENT/setup.sh" | |
echo >&2 "Connecting and uploading..." | |
ssh -o ConnectTimeout=5 "$TARGET" \ | |
"echo >&2 'Connected to reMarkable!'; rm -rf $TSINSTALLPATH; mkdir -p $TSINSTALLPATH" >&2 | |
rsync -avz "$CONTENT" "$TARGET:$TSINSTALLPATH" | |
echo >&2 "Running setup..." | |
ssh "$TARGET" "$TSINSTALLPATH/setup.sh" |
It should!
…On Thu, Feb 20, 2025 at 10:09, akralovic ***@***.***(mailto:On Thu, Feb 20, 2025 at 10:09, akralovic <<a href=)> wrote:
@akralovic commented on this gist.
---------------------------------------------------------------
Does this work with version 3.17.0.72?
—
Reply to this email directly, [view it on GitHub](https://gist.github.com/jaredallard/96da354c37afb2a000f61cc0c10c4e61#gistcomment-5447411) or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AASH2NN7BSC54LPRZBJSQKD2QYK7BBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVEYTGNJWGY2TAOBYU52HE2LHM5SXFJTDOJSWC5DF).
You are receiving this email because you authored the thread.
Triage notifications on the go with GitHub Mobile for [iOS](https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675) or [Android](https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does this work with Remarkable2 version 3.17.0.72?