Pages

Tuesday, April 4, 2017

How to reboot Synology NAS from terminal when GUI is unresponsive

I own a Synology NAS (it's a Ds213j) that every now and then get unresponsive.
The web GUI doesn't works, the network share doesn't works.
But the NAS does still respond to ping, so the network is working.

When my NAS get unresponsive my first solution has always been to power-cycle it, by unplugging the power cable.
But this isn't very nice for a NAS, so I found another solution:  reboot the NAS from SSH terminal.

So here is a little guide about how to reboot the NAS via the SSH terminal.
This guide works on my Synology DS213j. On different model YMMV.

Disclaimer: with the instructions in this guide you can mess up your NAS, you can loose your data, and do a lot of bad things. So, be responsible of your actions, and do something only when you clearly uderstand the full consequence of your actions.
A NAS can contains a lot of data, and form a terminal console with administrative right is very easy to mess things up, lose data, or do bad things.


First thing: you need to enable SSH/Telnet access to your NAS.

Access the NAS GUI, click  "Control Panel", scroll to and click "Terminal & SNMP", Enalbe Telnet and SSH Services, Click Apply.
Important: Always use strong password for any account that can access your NAS.

Even more important: If your NAS is accessible from outside your LAN, take care about the security of any new service that you enable: are they going to be accessible form the internet? Do you need to protect the in some way? (firewall?)

Now you can access the terminal of your NAS. So, the next time you need to reboot your NAS you will be able to try to force a reboot by using the terminal.

How do you access the terminal of your NAS? There are many software that can do that, I use Putty, that is a free ssh/telnet client for windows. You can download Putty there.

After installing Putty, fire it up, and insert your NAS IP/host name.

 Click the "open" button, and this will take you there:
 
Now enter the username, and then the password.
The user must be part of the administrators group of your NAS.

Then You are logged in the terminal

Now you must type the command "sudo su", press enter, and then re-type the user password.
This will give your command prompt the administrative right.

Now we are ready to type the command that will reset/reboot the NAS.

There are 4 different command that you can use:

1) reboot
2) echo C >/dev/ttyS1
3) echo 1 >/dev/ttyS1
4) echo 0 >/dev/ttyS1

The "reboot" command should gracefully reboot your Synology NAS... but for me it doesn't works.
It just stop some NAS services, get me disconnected from the terminal, but the NAS doesn't reboot.

The "echo C >/dev/ttyS1" command is my favorite one: this will instantly hard-reset the NAS, like when you press the reset button on your computer. This is not nice for a NAS, but it's still better than unplugging the power when the NAS get unresponsive.

The  command "echo 1 >/dev/ttyS1" will instantly power off your NAS, like unplugging the power cable.

The  command "echo 0 >/dev/ttyS1" should be like pressing the NAS power button, I never tried that one.

So when my NAS get unresponsive, I usually go for the "echo C >/dev/ttyS1" command.
Press Enter, and the NAS get a forced reset!


Saturday, May 16, 2015

Dismantle Asus SonicMaster SubWoofer

Lately the external subwoofer of our Asus notebook started to malfunction.



I thought it probably was due to the number of times it has fallen on the floor... :-)
So I decided to take a look inside.

In theory, you should be able to dismantle it by simply turning the subwoofer base in the right direction... but during the assembly process of our subwoofer someone spilled too much glue...

So I forced my way in with some pieces of plastics cut from an old badge...

Well... many pieces of plastics...

And a screwdriver to finish the job...

Anda Ta-Daaaaa, here is the mini-subwoofer!



To dismantle it, I fundamentally broke it's 4 clips
And here is the spilled glue that forbid me to open the subwoofer by simply turning it's base

The subwoofer it it's resonant box


But I noticed that, interestingly, the resonant box is not just a simple plastic cylinder, but it's composed by 2 concentric cylinders, with a bit of air in between.

So, let's dismantle them! (There are just 2 screw that keep them together)

Here is the internal cylinder.

And here is the external one.


All the parts:

The jack, it's a 2.5mm one.


And here is the cable connection schematics I found after doing some test.

Black and Red wire are connected to a 200k ohm resistor (a 5 band one: Red, black, black, orange, brown) This is probably used by the notebook to detect when the subwoofer is connected.
White and Yellow cable are connected to the speaker. My tester measure a 4 ohm impedance.


And the vertict?
The subwoofer, the cable and the jack are ok.
It's the female jack on the notebook that isn't working properly.
Facepalm!

But now, at least, we know how to properly dismantle it... :-)

Update: there is a possible fix!
Here is a comment, posted by Alex At, that explain how the female jack works and how to try to fix it!
Alex At also draw a nice diagram.

Image by Alex At
 Here is an excerpt of Alex At comment that accompained this useful diagram:

Basically from what I managed to understand after studying the board holding the tiny 2.5mm female is that the signal connectors (for white and yellow) are naturally in contact when there is no jack insterted. They are springed and stay together until you plug the male jack. When the subwoofer stops working the issue most likely comes from these two pins. The cone shape of the male jack tip serves as a threshold for the separation of these two connectors upon insertion, that is why if you don't insert the jack fully the subwoofer won't work, that is why if the jack doesn't have the precise size it won't work... the connectors will not detach from each other, thus sending a scrambled signal to the subwoofer, causing it to make crackle sounds or get no sounds whatsoever. Forget about checking the connectors for the ground and red wire, those work ok, the issue is at the tip where white and yellow have a common spot. My suggestion for you is to apply a bit of solder onto the tip of your jack, laterally just behind the area with the largest diameter; insert the jack and spin it slowly, at some point it might touch the right spot and get the signal. And again, use some contact spray cleaner, this system is all about passing the right current values.
 That's some very useful information, thanks Alex At!



Update: added a short dismantle video


Wednesday, February 4, 2015

Single click conversion form any format to MOBI using Calibre

Two year ago I developed a simple script to convert any document (PDF, RTF, TXT,...) to EPUB format, using Calibre.
The script was very simple to use, just put the script in the Calibre folder, and then drag and drop the file you want to convert on the script.

Last year I added some more feature to the script.

Today a reader asked for a script that convert in MOBI format, so I created a  new version of the script that convert to MOBI.
Click here to Download the 'anything to MOBI' conversion script.
You need to place this script in the same folder where you have the Calibre executable.

Then you can drag and drop the file you want to convert on the script:

After the conversion, you'll find the new converted EPUB file in the same folder as the original file.

Check the original articles for more information about this script, and how to use it.

Thursday, August 28, 2014

Adding a switch to the battery hungry Roomba Lighthouse/Virtualwall

I'm the proud owner of an iRobots Roomba 780. Included in the package there are 2 Lighthouse/Virtualwall used to put some limits to the Roomba willingness to clean the whole house (falling down the stair in the process...).

The Roomba's Lighthouse get the job done, but they have a defect: the battery last only 2 months.

And why do they last so little? It's easy: because  there is no switch, the Roomba's lighthouse are always on.

Let me think... my Roomba works about 6 hours/week... and it's Lighthouse receive and emit signal for 168 hours/week (24*7=168).
This doesn't make sense to me...

So I hacked a Lighthouse and added a switch to it.

The rest of this post is divided in 3 sections:
1) How to dismantle an iRobots Roomba Lighthouse/Virtualwall
2) How to NOT glue a switch with hot glue
3) How to CORRECTLY glue a switch with hot glue, to a Roomba Lighthouse


So, first things first:
1 - How to dismantle an iRobots Roomba Lighthouse/Virtualwall


Here is the Roomba Lighthouse

The top piece of plastic is hooked to the lower part with 4 plastic clip, in the 4 corner.


 
 
You can then remove all the 5 screws.

Then you can lift up the top part.


 And you are left with this:






 The Roomba Lighthouse dismantled:



2 - How to NOT glue a switch with hot glue

The hack to add a switch seemed ridiculously easy: cut  the red wire, and put a switch in between.
But when you think a job is dead easy, the mistake is waiting to happen...

So, here is the switch, salvaged from a broken ADSL router:

After some cutting/desoldering, I have a usable switch:

 I tough I would place the switch there:

Something like that, but with a hole for the switch:

So I made the hole, and I glued the switch with with hot glue... and when I pushed the switch on it's new hot-glue bed... the hot glue happily entered INSIDE the switch trough the switch venting hole... :-|

Here is the top of the switch, with the (now glue-filled) venting hole.

And this is the inside of the switch: a total loss.
 


3 - How to CORRECTLY glue a switch with hot glue, to a Roomba Lighthouse

So, let's go on with the Plan B: use  another switch I had lying around, and glue it in the correct way.

Here is the new switch connected to the Lighthouse.

This switch is bigger, it wont fit inside the lighthouse, so I created a plane spot (with some hot glue) on the external side of the Lighthouse.



Now, after the previous failure, I covered any hole in the switch BEFORE gluing it. :-)

And here is the glued switch in my brand new Roomba Franken -Lighthouse




 Now, some black tape to make it look a little better:

And I'm done!
My Roomba Lighthouse finally finished eating my batteries.
Now it's an Eco-friendly Lighthouse :-)