Safe shutdown

File under: “What WERE they thinking?!!”

I tried that, and it appeared to shutdown the system - including a power-off. However, when I turn the thing back on, there is a warning message in the webmin page saying that power was lost and it’s doing a consistency check of the filesystem. Therefore my understanding of what happened is that the filesystem is NOT cleanly unmounted prior to powering off the system, leaving the filesystem in a potentially un-defined state. :skull_crossbones::skull_crossbones::skull_crossbones::skull_crossbones:

Ergo, I am forced to believe that someone, somewhere, made a serious balls-up of the 2.n firmware.

BTW, the WD Access software does not, repeat NOT include a “shutdown” option for this item.

I totally get what people say when they mention that a device like this is designed to be on 24/7. However, I don’t care - even gazillion-dollar-each servers rated for “six nines” uptime still have a blankety-blank-blank power switch!

Seriously folks, there will be times when you need to turn it off in a safe manner.

If I wasn’t being shipped overseas in 48 hours-or-so, I’d seriously consider wiping the device, returning it, and look for a device with the 4.n firmware in it.

This isn’t just crazy, it’s stupid. More than that, it’s carelessly stupid.

(Shaking head in wonder)

Jim “JR”

(insert picture of head with top blowing off and steam coming out of both ears)

File this one under “Give 'em a SMACK!
(Subcategory: We’ve been making this WAY too hard. . . .)

A bit of research has discovered two things:

First:
There is a very, very, useful utility called WinSCP that will allow you to securely move files from - and to - your My Cloud device using your existing SSH credentials.

Having used this utility to poke around and download a few files, I discovered a hidden gem.

Second:
The My Cloud, with the 2.n firmware, has a cleverly hidden command named, (Doh!) “halt”.

This command, (which is a binary), when run from the SSH command-line does a full, formal, and complete shutdown of the device, including un-mounting all the filesystems in a sane manner.

Strangely enough, this appears to be totally un-documented - that is until right now.

So, go fire up those SSH clients and have fun shutting down your My Cloud boxes!

Jim “JR”

Yes WinSCP is a useful utility. It is one often mentioned in this subforum as an alternative to Putty for Windows users and can be used to move/copy/delete and more importantly edit files in the My Cloud OS.

What is the full path to the Halt command on the v2.x? Users may need to know the full path to Halt in order to program a batch file to use a SSH program like Plink, included with Putty, to issue commands without opening a command line terminal window or when using certain apps or software.

Next, when issuing the Halt command is it doing a full shutdown or just terminating the processor? And post Halt are the LED’s on the NIC still active? With the first gen My Cloud’s there is still power going to the NIC port post shutdown as the LED lights are still active. Before anyone asks the first gen My Clouds apparently do not have Wake-on-LAN capability which has been mentioned in several other prior discussions.

WD made some compromises and frankly a stupid programming mistake that has so far gone unfixed with both versions of the single bay My Cloud units. The lack of a physical on/off button is one. The lack of a method to power on the unit though Wake-on-LAN or similar action once a shutdown has been performed (at least on the first gen My Cloud) is two. Right now one has to physically power cycle the My Cloud. And the lack of a shutdown button in the v2.x firmware second gen My Cloud units even though its mentioned in the manual twice is three.

@Bennor

First:
At least on MY single-drive My Cloud with the 2,n firmware, the “halt” command fully shuts down the device. Period. No lights. No network lights. No apparent disk activity.

The clincher:
When you use the “shutdown.sh” script, it appears to shut the system down, but does not formally un-mount the drives, completely turn off power, etc. The result is that when you restart and log into the Dashboard, (what I cal the webmin page), you get a red alert claiming that “power was lost” and that it is “checking the file-system’s consistency”.

When you use the HALT command, the lights flash, the system goes to a totally power-off state, (the network lights are not running), and the filesystems are formally unmounted. This is shown by the fact that - when the system is re-started and you then login to the Dashboard - you do NOT get a “Power Failure” message, you get a “The system is booting. Please wait” message, and there is no alert in the alerts page for a power failure.

I suspect that the “shutdown” script does not really shut down the device, but rather puts it to sleep with the network and a basic level of functionality active so that it can “wake on lan”. By comparison, the “halt” command appears to completely shut the device down to a completely powered off state.

Second:
I do not remember where the actual path to the “halt” binary is. However it is in the system’s path, so that it will run regardless of where you might be in a SSH session. I do remember it is somewhere around the " /usr/local/modules/" area in the filesystem. Regrettably, I may not have the time to go find it for you.

I have not tried using something like Plink, but if Plink can send commands to a SSH-like session, it should work automagically as it is in the path. YMMV.

My investigations within the " /usr/local/modules/" path disclosed that there IS programmatic support for Wake On Lan, it just appears to not be implemented properly. Again, like the (hidden) halt command, I suspect it is just a matter of finding out how to use it. (Note that my investigations are being done with a single-drive, version 2.n My Cloud.)

It’s stuff like this that makes me wonder if the Dev team from WD were hired away from M$, or went to the “M$ School of Programming Excellence”. Likewise the QA department.

In all the SQA assignments I have had in the past, releasing with what are obvious high-severity bugs like these would have gotten me tossed out the door on the tip of the manager’s #9, steel-tipped boot!

The ray of sunshine in these clouds is the existence of fora like these, and people like us who are willing to take the time and research these issues with a view toward solving - or mitigating - them.

For which I am gratefully and humbly thankful.

Jim “JR”

Note that on my v4.x My Cloud the halt command (halt or halt -p) does not completely shut down the device either. Like with the shutdown - h command the NIC port remains powered.

Further I do not get an error message about a power failure post restart when using shutdown -h, I get a system restarted message with v4.x firmware.

There are slight differences between the two My Cloud firmwares which is why I asked where the halt command was located on the v2.x My Cloud since I do not have access to a v2.x My Cloud to find out the differences in file structure. The v4.x firmware is Debian (Weezy I believe). And the typical way from the command line interface of Debian to shut the system down is to use one of the following: shutdown -h now, halt, or poweroff.

I have also found this error and noticed where the problem is: the CSS is hiding the button.
The following screenshots prove it.
Meanwhile I’m ssh’ing and “shutdown.sh -h now”.
Hope this helps both the users and the devs!


1 Like


3 Likes

Muchos Gracias!

Well I’ll be. . . . . dipped!

It looks like they deliberately quashed that functionality - or - they hid it during testing for some God Forsaken reason, and forgot to re-enable it.

Hot Dawg! I’m going to have to go play with that and report results.

Huge, HUGE kudos for the excellent find!

Jim “JR”

Nice find. Now only time will tell if WD thinks this is a serious issue that should be fixed. The missing shutdown button in v2.x has been known for a couple of months now and was not fixed in the recent firmware release for the v2.x My Clouds.

Of course if one is enterprising they could edit the firmware files/code themselves to correct the Dashboard shutdown error.

What are the actual path(s) and filename(s) you edited? I’d like to try that myself.

Is this on a single-bay My Cloud, is it a 2.n firmware version?

Thanks hugely!

Jim “JR”

Well, If you like DIY Projects you may try this :grinning: -

you can find all the details at this link -

Hi Arquimaes. I have tried your step and it works. But how do I save it? Everytime when I wanna turn off the hard drive (My CLoud 4TB), I have to manually follow your steps. Is there a way to permanently save the “Inspect Element” file/log? Thanks.

@Bennor

I finally had time to do some searching, and this is what I found on my 2nd Gen, single drive, version of the My Cloud:

halt:

root@Storage2 /usr # find -name "halt"
./sbin/halt
./local/modules/usrsbin/halt'

shutdown.sh

root@Storage2 /usr # find -name "shutdown.sh"
./sbin/shutdown.sh
./local/modules/script/shutdown.sh

Likewise, the only instances of “id_shutdown_td” or “dev_shutdown()” are in /usr/local/modules.
Viz.:

root@Storage2 / # grep -rnsl '/usr' -e "dev_shutdown"
/usr/local/modules/web/pages/function/function.js
/usr/local/modules/web/pages/home.php
root@Storage2 / # grep -rnsl '/usr' -e "id_shutdown_td"
/usr/local/modules/web/pages/setting/diagnostics.html

The icing on the cake is that the /usr/local/modules portion of the filesystem is a loop-mounted squashfs filesystem. Viz.:

/dev/loop0 on /usr/local/modules type squashfs (loop)

Translation:

  1. It’s a “virtual” filesystem segment loaded from a squashfs file located somewhere on the system.
  2. It’s not writable, so even if you COULD edit the file, you can’t save it to see if it works!

The only way to play with this would be to find the actual squashfs filesystem file, copy it, un-pack it with 7Zip, edit it, and (somehow or other), put it back where you found it.

I haven’t figured this out yet.

BTW, on MY My Cloud device, the “style.css” file I have doesn’t even bear a remote resemblance to the one @Arquimaes found. I don’t know what his system is, or whatever, but it does not resemble my system at all. . . .

I’m going to keep plugging at this, and I will report more when I know more.

Jim “JR”

Same problem here with my new Mycloud device, Firmware V2.

If you have a Mac or Linux box, there is a simple script solution. Just make sure that you can login with ssh. My script uses “expect”-shell, which is standard available on Mac and Linux. No idea about Windows.

OK, it comes here:

#!/usr/bin/expect
spawn  ssh root@mycloud "halt -p"
expect "password:"
send "PASSWORD\n“;
interact

Just edit this script with the correct password and server name (IP address).
Make it executable with chmod 755.

This will shutdown the device cleanly.

To restart the device, you must power off/on. Why is there no switch??? :rage:

1 Like

Because the My Cloud is designed (apparently) to be left on 24/7.

Is that stupid? In some respects yes. But that’s how WD designed the single bay My Clouds. Wake on Lan would be nice too but that also is not available, at least in the v4.x My Cloud’s.

Hi there Bennor,
I just discovered this “feature” in the new firmware yesterday, having bought a MyCloud 4TB single bay, and then mistakenly thinking I should upgrade the firmware first.

Dumb question: how do I turn the unit back on, after I use the Shutdown and Power Off command, since (after all) there is no power on switch? Assuming I wait till the light goes out, etc., does a simple unplug of the AC power, then plug it back in, do the trick?

Thanks!

Hi Bennor,
I’d like to explore this further with you. Yes, 24/7 on cloud products are nice, but the underlying assumption is that your electrical power is also 24/7. And that lightning storms, etc., in your surroundings don’t cause you to want to safely shut down everything before you lose it.

Yes, I can (and am going to) find an UPS to help me out. But still… shut down, and turn it back on. Not having those fundamental features seems bizarre. How do we call WD’s attention to this?

Thanks!

Because there is no physical power button and no apparent way (that anyone’s found so far) to turn the My Cloud on after being shut down, the standard way is simply to remove power then reapply power to the My Cloud.

Thanks! Brute force cybernetics rules!

Hi all.
I was bored last night and somehow ended preparing a little browser extension to enable the buttons with one clic. It needs to be applied everytime you open the webpage, but is easier than inspecting the element and changing the css by hand.
I’ve only tested on Opera with a dummy page with the bare required elements to show the change.

The zip contains the compressed extension ready to use and the source code. GitHub page

extension.zip (54.3 KB)