Okay, following up on my old thread, I’ve got my configuration migrated successfully into my new setup.
So if you, like me, would like to have an always on, always accessible centralized Syncthing server without leaving your desktop computer running 24/7, follow this quicky guide!
This setup is mostly automated by the
/root/post_update file, posted to the bottom of this post. What this means is that everything will get set-up again and again from scratch, every time you update the Neon OS software. Cool, eh?
Maybe you want to just keep the files in your
/home/neon folder. In that case, take all the drive mounting-stuff, labelled “1.x” out of the
/root/post_update script below, and jump to Step Two. Just bear in mind that those files won’t be readable if you unplug your SSD and plug it into your desktop or laptop. The new Neon 2.0 configuration doesn’t expose the filesystem anymore.
So if you want to make a new partition which will be readable directly from the drive, or are going to use a different USB storage device as your storage spot, then keep reading Step One.
Once you’ve flashed the
recommended_mark_2.img.xz image to your SSD drive and booted it for the first time, the setup will have expanded the
root partition to fill the entire drive.
If you want to use a new partition on that drive, then use a partition manager like
gparted on your desktop to shrink the
root back down again to something realistic. Then make yourself a permanent storage partition in the excess space.
Plug the drive back into your Mycroft, boot it up, ssh in. If you’re using a second dedicated storage device, plug that in too. Use
lsblk -o NAME,UUID,FSTYPE,SIZE -T=NAME to get the UUID of your storage partition. For instance, my results look like this:
(venv) neon@neon:~$ lsblk -o NAME,UUID,FSTYPE,SIZE -T=NAME NAME UUID FSTYPE SIZE loop0 squashfs 2G sda 465.8G ├─sda1 B7A9-F5DB vfat 255M ├─sda2 2f5ace11-ba68-44a6-a80f-33c94a58ecdb ext4 12.1G └─sda3 1dde9e90-bf69-462c-ae90-59551ac67be9 ext4 453.4G zram0
/dev/sda3 is my storage partition. so I’ve put the UUID (1dde9…) into the script to mount it into my filesystem at
/mnt/storage. Modify the UUID and filesystem type for your own partition, based on the results above.
Once you know where you’re storing your files, you can run the post_update script once from SSH on the Neon and it will set up everything else! Easiest way might be to just
sudo nano /root/post_upgrade over ssh and copy/paste it into the terminal session. Then be sure to
sudo chmod +x /root/post_update, so that the script is executable. Finally, just
- set up that
/mnt/storagemountpoint, enter that into
/etc/fstabfor reboots, and set the permissions to allow you to read/write from it. (assuming you didn’t delete those lines).
- add the keys and repos to install the latest stable Syncthing.
Now, one final setup step is necessary: usually Syncthing only allows local addresses to connect to the web interface. So you’ll need to edit
/home/neon/.config/syncthing/config.xml to allow you to connect from your desktop or laptop. You can just use
nano over ssh.
You might also want to configure your router to always assign your Mycroft the same static IP address, so that things stay consistent. Remember that wireless and wired connections are different, and will require reconfiguration should you change between them.
config.xml file, find the
<gui> section. Change the loopback address 127.0.0.1 in the
<address> tags to your devices’ permanent IP address. Also add the
<insecureAdminAccess>true</insecureAdminAccess>. That way, any machine on your local network can connect. Mind you, this means you trust anything that connects to your LAN. You will need to harden this once you get everything set up! Check the syncthing docs for that.
You’ll be able to access the Syncthing web-based control panel thereafter at [neon’s ip]:6364. Create new shares to new folders—remember to use the
/mnt/storage location if you followed Step One—and then you’re good to go! You can now leave all your computers off, yet rely on a stable, always-on central server so-long as your Mycroft is plugged in.
/root/post_update file. Remember to modify the UUID and filesystem if you’re not using ext4!
#!/bin/bash # 1.1 setup and mount storage partition for immediate usage mkdir /mnt/storage mount UUID=1dde9e90-bf69-462c-ae90-59551ac67be9 /mnt/storage # 1.2 add storage partition to fstab for permanent usage after reboots cat << EOF >> /etc/fstab UUID=1dde9e90-bf69-462c-ae90-59551ac67be9 /mnt/storage ext4 defaults 0 0 EOF # 1.3 allow read/write permissions! chown -R neon:neon /mnt/storage # 2.1 Install Syncthing sudo curl -o /usr/share/keyrings/syncthing-archive-keyring.gpg https://syncthing.net/release-key.gpg echo "deb [signed-by=/usr/share/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list apt update apt -y install syncthing # 2.2 Enable syncthing to start on bootup and also start it now. The @ means that it will use the neon user's config folder to allow configuration preservation across upgrades. systemctl enable firstname.lastname@example.org systemctl start email@example.com