the-internet-vagabond-dot-com/2022/07/04/steam_deck_syncthing.html

296 lines
15 KiB
HTML
Raw Normal View History

2024-06-18 23:26:12 +00:00
<!DOCTYPE html>
<html>
<head>
<title>The Internet Vagabond :: Syncthing on the Steam Deck</title>
<link type="application/atom+xml" rel="alternate" href="https://www.theinternetvagabond.com/feed.xml" title="The Internet Vagabond" />
<meta name="description"
content="Rants of a wandering techy, in search of truth, knowledge, and a decent ping." />
<meta name="author" content="Bill Niblock" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="canonical" href="https://www.theinternetvagabond.com/2022/07/04/steam_deck_syncthing.html" />
<link rel="stylesheet" type="text/css"
href="https://www.theinternetvagabond.com/src/styles/corrupt_layout.css" />
<link rel="stylesheet" type="text/css"
href="https://www.theinternetvagabond.com/src/styles/corrupt_typog.css" />
<link rel="icon" type="image/x-icon"
href="https://www.theinternetvagabond.com/src/images/favicon.ico" />
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/fork-awesome@1.2.0/css/fork-awesome.min.css"
integrity="sha256-XoaMnoYC5TH6/+ihMEnospgm0J1PM/nioxbOUdnM8HY="
crossorigin="anonymous">
<script data-goatcounter="https://theinternetvagabond.goatcounter.com/count"
async src="https://www.theinternetvagabond.com/src/scripts/goatcounter.js"></script>
</head>
<body>
<div class="cor_page">
<header>
<a href="/">
<div>
<span class="first">T</span>he
<span class="first">I</span>nternet
<span class="first">V</span>agabond
</div>
</a>
</header>
<main>
<article>
<h1 id="syncthing-on-the-steam-deck-updated">Syncthing on the Steam Deck (Updated!)</h1>
<h2 id="update">Update</h2>
<p>Turns out, when you update the SteamOS, it completely over-writes the operating
system. All of the setup I had originally written was great, if I never update,
which is unacceptable. Not all is lost; the quest simply gets harder. If I cant
rely on system-wide services, then I rely on user services.</p>
<h3 id="the-wrong-way-system-wide-services">The Wrong Way: System-Wide Services</h3>
<p>My first attempt was to setup Syncthing as a system-wide service managed by
<code class="language-plaintext highlighter-rouge">systemd</code>, installed via <code class="language-plaintext highlighter-rouge">pacman</code>. There are several problems with this. First,
it requires disabling the read-only file-system. Next, <code class="language-plaintext highlighter-rouge">pacman</code> is not setup nor
reliable, since every SteamOS update will over-write any changes I make to any
of the read-only file-system, including the directories that <code class="language-plaintext highlighter-rouge">pacman</code> relies on.
Related, the update will also erase the Syncthing package. This means I either
never update (inadvisable, and unacceptable), or I setup Syncthing not in the
read-only file-system.</p>
<h3 id="the-right-way-user-services">The Right Way: User Services</h3>
<p>systemd allows for non-root-based services, called user services. The Arch Wiki
<a href="https://wiki.archlinux.org/title/Systemd/User">systemd/User</a> article describes
this functionality much more than I will. Here are the relevant details:</p>
<ul>
<li>User services can be enabled to start when a user logs in</li>
<li>Service files are stored in the users home directory (specifically
<code class="language-plaintext highlighter-rouge">~/.config/systemd/user</code>)</li>
<li>No root privileges are required. No modifying the read-only file-system</li>
</ul>
<h2 id="syncthing">Syncthing</h2>
<p>Syncthing is incredible. Ive <a href="2020/07/19/syncthing-part-1.html">written about it
before</a>, but the setup here is a bit more
involved. The Steam Deck runs Arch Linux (and have I told you yet today that I
do too?), so the Arch Wiki <a href="https://wiki.archlinux.org/title/Syncthing">article on
Syncthing</a> gives some good insight.
When I initially started this process, I installed the SyncthingGTK application
from the Discover Store. This means it is a Flatpak application, and so doesnt
require elevated user privileges. I also tried the Syncthingy application, which
explicitly calls out Steam Deck users. However, both require running the Flatpak
in the background (like some users do for Discord or Spotify). I dont like
this, it feels off, and thus I sought a different approach.</p>
<h2 id="sshd-still-incredibly-useful">SSHD: Still Incredibly Useful</h2>
<p>I got real tired real quick of using the on-screen keyboard. After
complaining, a friend recommended I enable <code class="language-plaintext highlighter-rouge">sshd</code> and just remote in to the
device. Doing so was a breeze, and I recommend to others who dont have a
physical keyboard they can plug into their device. Drop to desktop mode
(hold the power button for a few seconds, and select the option), and start a
terminal (default is Konsole). Before remotely accessing the device, or using
elevated privileges via <code class="language-plaintext highlighter-rouge">sudo</code>, I need to set a password for the default user,
<em>deck</em>. In the terminal, type <code class="language-plaintext highlighter-rouge">passwd</code> and set it (and then put it in your
password vault so you dont forget. You <em>do</em> have a password vault, right?).
Start the service, <code class="language-plaintext highlighter-rouge">sudo systemctl start sshd</code>, and optionally enable it to have
<code class="language-plaintext highlighter-rouge">sshd</code> automatically started on each boot (<code class="language-plaintext highlighter-rouge">sudo systemctl enable sshd</code>). Get
the device IP with <code class="language-plaintext highlighter-rouge">ip addr list</code>, from my desktop run <code class="language-plaintext highlighter-rouge">ssh deck@ip-address</code>,
type in the password, and now Im a grade-A Hackermans.</p>
<p>This setting is not reset on SteamOS updates, that I can tell. Once enabled,
this will always start at boot, and always be on until explicitly turned off. Be
mindful of that if you decide to wander away from your home network; maybe turn
it off in public if you dont need it.</p>
<h2 id="setup">Setup</h2>
<p>There are 2 things required: a systemd service file, and the <code class="language-plaintext highlighter-rouge">syncthing</code>
binary. Syncthing is written in Go, and a compiled binary can be downloaded that
has no dependencies or installation requirements. It can be downloaded from
the <a href="https://github.com/syncthing/syncthing/releases/tag/v1.20.3">Syncthing
Releases</a> page for
many platforms and architectures. The Steam Deck is a Linux platform, using the
AMD64 architecture (or x86_64), so I grab that one. Ill note here, since I have
SSH access, I do all the editing and downloading on my desktop, and then
transfer the files using <code class="language-plaintext highlighter-rouge">scp</code> to the Deck. All of these steps can be done on
the Deck itself, without SSH access. Once the proper tarball has been
downloaded, extract it, and within will be the <code class="language-plaintext highlighter-rouge">syncthing</code> binary, ready to
rock. I copy/move the binary to <code class="language-plaintext highlighter-rouge">~/.local/bin/syncthing</code> on the Deck. The exact
location is less important than ensuring the binary is within my home directory
on the Deck.</p>
<p>The systemd serivce file can also be taken from the extracted tarball, but
requires modification. In the tarball, it is
<code class="language-plaintext highlighter-rouge">etc/linux-systemd/user/syncthing.service</code>. Copy this file to
<code class="language-plaintext highlighter-rouge">~/.config/systemd/user</code> on the Deck, and edit the “ExecStart” line in the
“[Service]” section from</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>...
[Service]
ExecStart=/usr/bin/syncthing serve --no-browser --no-restart --logflags=0
...
</code></pre></div></div>
<p>to</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>...
[Service]
ExecStart=/home/deck/.local/bin/syncthing serve --no-browser --no-restart --logflags=0
...
</code></pre></div></div>
<p>(or wherever you decided to put the local <code class="language-plaintext highlighter-rouge">syncthing</code> binary)</p>
<p>With everything in place, I can now enable and start the Syncthing user service:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>systemctl --user enable syncthing.service
systemctl --user start syncthing.service
</code></pre></div></div>
<p>Since I dont have a physical keyboard plugged in, I modify my SSH command
slightly to forward the Syncthing web-UI from the Deck to my local machine:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ssh -L 31337:deck-ip-goes-here:8384 deck@deck-ip-goes-here
</code></pre></div></div>
<p>Now, on my local machine I can open one tab to <code class="language-plaintext highlighter-rouge">localhost:8384</code>, to show
Syncthing on my local machine, and another tab to <code class="language-plaintext highlighter-rouge">localhost:31337</code> to show
Syncthing on my Deck. From here, I add my local machine as a device on my Deck,
and begin sharing folders.</p>
<h2 id="closing-thoughts">Closing Thoughts</h2>
<p>Ive been using this setup for about a week now. Ive synced almost 20GB of
files, including configurations and saves for Retroarch. It works after
restarts, OS and client upgrades, and waking the device from sleep. It sits
quietly in the background, without having to start up applications. The biggest
problem is that it doesnt automatically update to the newest version of
Syncthing. Its also a bit involved to setup. To that end, Ive written a tool
to help with setup: <a href="https://codeberg.org/VagabondAzulien/steam-deck-syncthing">Steam Deck Syncthing
Setup</a>. Im still
finishing it up, but I intend to make use of it to keep my version of Syncthing
up-to-date. If you use it, let me know!</p>
<div class="author_info">
Bill Niblock
<a href="https://unlicense.org/"
aria-label="Code dedicated to the public domain under Unlicense">
<span class="fa fa-cc-pd" aria-hidden="true"
title="Code dedicated to the public domain under Unlicense"</span>
</a>
<a href="https://creativecommons.org/publicdomain/zero/1.0/"
aria-label="Published to the public domain under CC0">
<span class="fa fa-cc-zero" aria-hidden="true"
title="Content dedicated to the public domain under CC0"</span>
</a>
2022-07-12
<br />
[
<a href="/topics/gaming">gaming</a>
<a href="/topics/technology">technology</a>
]
</div>
</article>
</main>
<footer>
<nav>
<div><a href="/">home</a></div>
<div><a href="/topics/all">all</a></div>
<div><a href="/topics/gaming">gaming</a></div>
<div><a href="/topics/other">other</a></div>
<div><a href="/topics/philosophy">philosophy</a></div>
<div><a href="/topics/technology">technology</a></div>
<div><a href="/topics/writing">writing</a></div>
</nav>
<hr />
<section class="h-card">
<section class="footer_about" id="about">
<div>The Site</div>
<div>
2024-06-20 19:38:41 +00:00
<a href="https://www.theinternetvagabond.com/feed.xml"
2024-06-18 23:26:12 +00:00
aria-label="RSS feed for the site">
<span class="fa fa-rss" aria-hidden="true"
title="RSS Feed"</span>
</a> |
2024-06-20 19:38:41 +00:00
<a href="https://theinternetvagabond.goatcounter.com/"
2024-06-18 23:26:12 +00:00
aria-label="GoatCounter statistics for the site">
<span class="fa fa-bar-chart" aria-hidden="true"
title="GoatCounter Statistics"</span>
</a> |
2024-06-20 19:38:41 +00:00
<a href="https://codeberg.org/VagabondAzulien/the-internet-vagabond-dot-com"
2024-06-18 23:26:12 +00:00
aria-label="Source code repository for the site">
<span class="fa fa-code" aria-hidden="true"
title="Site Source Code"</span>
</a>
</div>
<a class="u-url u-uid" href="https://theinternetvagabond.com"></a>
<p>
This site is a small slice of internet real-estate that I use for
occasional writing. Nothing I say is visionary or profound. I
focus on technology, gaming, and philosophy. All opinions my
own.
</p>
<div>The Vagabond</div>
<div>
2024-06-20 19:38:41 +00:00
<a rel="me"
2024-06-18 23:26:12 +00:00
href="mailto:bill@theinternetvagabond.com"
aria-label="Email Bill at The Internet Vagabond dot com">
<span class="fa fa-envelope-o" aria-hidden="true"
title="Email bill at theinternetvagabond.com"</span>
</a> |
<a class="u-url" rel="me"
href="https://matrix.to/#/@vagabondazulien:matrix.org"
aria-label="Speak with me on Matrix">
<span class="fa fa-matrix-org" aria-hidden="true"
title="Speak with me on Matrix"</span>
</a> |
<a class="u-url" rel="me"
href="https://mastodon.social/@azulien"
aria-label="Find me on the Fediverse">
<span class="fa fa-mastodon" aria-hidden="true"
title="Find me on the Fediverse"</span>
</a> |
<a class="u-url" rel="me" href="https://www.twitch.tv/vagabondazulien/profile"
aria-label="Link to my Twitch channel">
<span class="fa fa-twitch " aria-hidden="true"
title="My Twitch channel"</span>
</a>
</div>
<p>
My name is <span class="p-name">Bill Niblock</span>. <span
class="p-note">I'm a computer scientist by education, a technologist
by trade, a gamer by hobby, and a philosopher by accident. I
live in <span class="p-locality">Buffalo</span>, <span class="p-region">
2024-06-20 19:38:41 +00:00
New York</span>, <span class="p-country-name">USA</span>.<br />
<br />
My PGP Key is <span class="u-key" id="key">CCE7 3682 331B 5614 9FAB
7383 7359 80B2 6381 C91E</span>.
2024-06-18 23:26:12 +00:00
</p>
</section>
<section style="display: none;">
<span class="p-category">Gaming</span>
<span class="p-category">Technology</span>
<span class="p-category">Philosophy</span>
<span class="p-category">Open Source Software</span>
<span class="p-category">Self-Hosting</span>
<span class="p-category">Coffee</span>
2024-06-20 19:38:41 +00:00
<span class="u-email">bill@theinternetvagabond.com</span>
2024-06-18 23:26:12 +00:00
</section>
</section>
</footer>
</div>
</body>
</html>