If you’re googling this and are eager to have a chroot running on your x86 Synology box, please scroll down.
These instructions worked for me on my DS416play.
Should work for you too.
So here’s what happened
I’ve been a happy user of a Synology disk station for quite a while now, it mostly just works. I’ve observed some issues with the Plex server that I have running on it, but that’s hardly Synologie’s fault.
Today however I did experience something new, the disk station was very slow to respond and it took ages even to do the simplest of operations.
Luckily, underneath all the fancy UI, it’s just a Linux box, surely I could debug it, I thought.
I have had the SSH account enabled on it since the beginning, but I have not ever actually used it for anything.
Now that I experienced the slowness, I finally had a good use case for logging in and troubleshooting, but I was surprised to discover that it lacks any observability tools beyond
What I needed was
iostat et al.
Installing debug tools
Quick googling revealed that there is a set of debug tools that you can install using the command:
sudo synogear install
Once you have them you can do
synogear list to see what’s available to you.
So far so good, and this should give enough tools to start with.
If you need fancier tools, you can use ipkg or Entware
Of course this does come with added downside of running random binaries off the internet. So think a bit about the implications.
Initially I seem to have overlooked another option.It turns out there is Synocommunity, and you can quite easily add their packages by changing one setting in Package manager settings by setting it to use packages by “Synology Inc. and trusted publishers”.
But what if there was a better way
It is a Linux box after all. I noticed that the
chroot command is available. So why not to try to debootstrap a nice Debian chroot…
There’s always a way. This might not be the most elegant one, but that’s how I did it.
First things first, we’ll need chroot package. You can take it from any Debian mirror. Luckily it is mostly just bunch of scripts. One dependency it has is Perl. You can install Perl via the Synology package manager.
Once you have both the chroot package and Perl, it’s just a standard Debian debootsrapping procedure.
Deploy a Debian chroot on your Synology box
Make sure you have Perl installed (see above).Get latest debootstrap package and unpack it.
wget http://ftp.debian.org/debian/pool/main/d/debootstrap/debootstrap_1.0.109.tar.gz tar xvzf debootstrap_1.0.109.tar.gz # debootstrap assumes some file locations, you could fix that or just move it to where it expects to be mv debootstrap-1.0.109 /usr/share/debootstrap
You should now be able to invoke debootstrap command using the full path
Now, pick a nice place to keep your chroots and run the debootstrap command to create a fresh new Debian chroot for you.
CHROOT=/volume1/chroots/debian mkdir -p $CHROOT /usr/share/debootstrap/debootstrap stable $CHROOT http://deb.debian.org/debian/
If everything went well, then congrats, you should be all set, feel free to chroot into your new Debian as usual
echo "proc $CHROOT/proc proc defaults 0 0" >> /etc/fstab mount proc $CHROOT/proc -t proc echo "sysfs $CHROOT/sys sysfs defaults 0 0" >> /etc/fstab mount sysfs $CHROOT/sys -t sysfs cp /etc/hosts $CHROOT/etc/hosts cp /proc/mounts $CHROOT/etc/mtab chroot $CHROOT /bin/bash
If anyone asks, you’re sort of running a container on your Synology now, an you can now install whatever tools you need.
See this for more complete instructions on building a chroot.
And all that, without messing up your Synology with any 3rd party packages.
Update from doing the same on Synology 920+
I recently followed the same procedure on a Synology 920+ and the
debootstrap was failing with errors about archive format.
dpkg-deb: error: archive './/var/cache/apt/archives/libacl1_2.2.53-4_amd64.deb' contains not understood data member control.tar.xz, giving up tar: This does not look like a tar archive tar: Exiting with failure status due to previous errors
After looking at
debootstrap log and help options, turns out there is a way to switch extractor.
ar did the trick and the debootstrap succeeded (you can get
synogear, see above).
sudo /usr/share/debootstrap/debootstrap --extractor=ar stable $CHROOT http://deb.debian.org/debian/