read

I hope this will be my last post about Synology for a while.

After dealing for a few weeks with an unstable environment, then hacking a serial console to troubleshoot, then cracking the secret recovery telnet password just for fun, and finally solving the weird mistery of SSH not accepting /bin/bash as default shell, I thought I finally had a stable environment. Wrong.

But this time I was the one to blame.

After solving the conflict with bash, I changed /etc/passwd user shell to /bin/bash. The only problem is that Synology wipes the system partition during firmware upgrades, so when I upgraded to DSM 4.1.2668, my custom /bin/bash was gone. Of course this locked me out of the system. No SSH, SCP or FTP. Great.

After a few moments of panic, I remembered I still had the serial console. So I could put Linux in single user mode, and drop into recovery mode.

So if you're ever in a similar situation, here's how to fix it:

1. First, you need a serial console.

2. During U-Boot, press any key to cancel the automatic kernel boot (Hit any key to stop autoboot).

3. Enter printenv to check the environment variables. Search for bootargs and bootm variables (they will be different on your system, so do NOT copy and paste from mine, unless you have a Synology DS212+ with the same DSM).

4. Append reboot=cold,hard emergency init=/bin/sh to the end of bootargs variable. In my case, this is what I used:

setenv bootargs 'console=ttyS0,115200 ip=off initrd=0x00800040,4M root=/dev/md0 rw syno_hw_version=DS212pv20 ihd_num=2 netif_num=1 esata_7042=1 reboot=cold,hard emergency init=/bin/sh'

(again, your parameters will likely be different, so don't copy and paste)

5. Boot your kernel, with

bootm F8080000 F8280000

Now your Synology should be happily botting in single user mode, ignoring /etc/passwd and dropping you to a plain /bin/sh. Do what you have to do to fix the system, and reboot.

You can also use these steps to recover your system partition from a crash or other problem.

comments powered by Disqus
Blog Logo

Gui Ambros

Maker, developer, ad:tech executive. Incurable optimist. Head of Operations & Technology @ WPP/Wunderman. I was there when the web was born. @GuiAmbros


Published

-->
Image

wrgms.com

/dev/random rants about technology, electronics, startups.

Back to Overview