Shutdown MyCloud 2.Gen via SSH halt command - device still working?

I know it has been discussed a lot here in the forum. I use to shutdown my MyCloud via SSH and the halt command. I was actually satisfied with this. But yesterday after I shut down the device I put my ear next to it and was bad surpriced to hear that the hard drive inside was still working. All of the lights infront and LAN lights behind were off, but the drive was still making noise. After I pulled out the plugin the hard drive went silent.
Recently I made an upgrade to 2.31.xxx after one year earlier I did not use the device because of vulnabilieties. SO I compare my expirience now with the time of about 1 year back when I did setup the shutdown procedure via SSH and using the old firmware version. I am not sure but earlier after I did execute the SSH command I had never hear this noise of working hard drive.
So is it possible that WD changed something the recent new last firmware upgrades and thats why the hard drive doesnt turn-off completely after executing SSH halt command?

Last I looked at a gen2’s shutdown script, it just unmounts the volumes and goes into system halt status after terminating all its daemons.

It might be sensible to issue a few commands to the drive with hdparm to write out its internal cache, and then spin-down in power save state before going to halt. (I would also have it put the front LED state to solid green or some other unused color to indicate “safe to yank power” status.)

Sadly, the folks in charge of the MyCloud firmwares seriously overlooked shutting the device down in their quality control process, and have consistently ignored feature requests to implement more sane and sanitary shutdown processes.

Lately, I have been thinking more and more about making a community patch, since these devices are now offically End of Life (and any warranty period they might maybe have is quickly running out, making voided warranties a non-issue to contemplate.) If CSS was one of the features in my skillset, I would be all over it like stink on ■■■■, but sadly it is not. :frowning: Many of the security issues are with the Web GUI baked into the thing not properly sanitizing its inputs before firing off CGI calls, as well as the infamous lack of shutdown and pals. Those things are sadly outside my skillset.

Try poweroff. It will shutdown the gen2. Only thing is it leaves the front led blue.

@Wierd_w
So with other words can confirm the same behaviour after shut down via SSH command halt?

@rac8006
I will try it. Are the noises from the drive and the back lights gone when using poweroff command? Earlier is was proven that poweroff does not completely shut down the device, and halt had not more success

After poweroff the led in front is blue. The led in the back are green and blinking green. The disk
is powered off.

Hm, than it is not completely off if the LEDs are blinking:frowning_face:

The disk is completely off. Yes there is power to the to the main board.

As RAC points out, the system stays powered. (This is because WD was too cheap to implement a flipflop driven by a GPIO pin to cut the main power lead. Apparently some transistors and a resistor were too costly to include.)

It is however, “shut down.” It has written all its data to its disk, terminated all its daemons, and halted all processing on the CPU.

The rear activity lights are driven by the ethernet port asic’s firmware. It’s a result of it still being powered. Again, the lack of any ability to disable its own power input to turn itself off causes things like this to still happen, even though it is “shut down.”

but then what is the difference between the halt and poweroff commands? Halt causes the opposite of the poweroff command - lights are off but the drive is noisy.
Can someone check what happens after executing halt ? I mean in the logs or elsewhere, and not what is visible/audible.

halt causes the kernel to halt. It issues a sigterm system message, which theoretically commands all running processes to stop what they are doing, and then the system halts.

shutdown is a script that politely terminates all the system’s daemons, flushes the disk cache, and THEN halts.

a little confused… you are talking ablout shutdown. But Rac8006 mensioned poweroff. SO with halt there are 3 possible commands :thinking: Whats the difference?
@Bennor
what is your opinion? I know you use shutdown -h -P

I have a first gen v4.x My Cloud so the commands I use may be different than the second gen.

There are lots of articles explaining the difference between shutdown, halt, poweroff and reboot. Here is one such article: https://www.tecmint.com/shutdown-poweroff-halt-and-reboot-commands-in-linux/

I generally use the shutdown -h -P now command to shut down the several Linux devices including the My Cloud that I use. Much like the second gen, the first gen My Cloud doesn’t actually power all the way off after issuing the shutdown or halt command. This is indicated by the My Cloud’s Ethernet port LED indicators still remain lit after shutting the unit down either via SSH or via the My Cloud Dashboard.

thanks Bennor.
So basicly after executing poweroff or shutdown it “includes” the system to halt. And with the command shutdown -h -P now the device will be first halted and then powered off, right?
Does upper and lower case matter, because in the link from Bennor it is -H and -p, in the Bennors command is the opposite -h and -P @Bennor?

Please note that I do not have a second gen v2.x My Cloud. As such I do not know if the command /sbin/shutdown -h -P now I use to shutdown a first gen will work on the second gen. If I remember right it doesn’t because the second gen uses different firmware structure than the first gen.

There are numerous online explanations of what the Linux shutdown command is and the various switches one can use with it. Here is one general explanation: https://www.computerhope.com/unix/ushutdow.htm

Per that link:
-h Instructs the system to shut down and then halt.
-H If -h is also specified, this option instructs the system to drop into boot monitor on systems that support it.
-P Instructs the system to shut down and then power down.
time Also, the word now is the same as specifying +0 ; it shuts the system down immediately.

Yes, i know are are using the 1.Gen device.
I have to test with the commands and see exactly how the Mycloud behaves. As my wife just told me the command i use in the moment is only halt. :face_with_raised_eyebrow: So it is at that point clear why I heard noises, it was just halting the device - it is my fault, dont know what i messed up while setting up SSH command line.
@Bennor
But i noticed that in your command line field you have entered /sbin/ in front of the command. I just write the command…is that important and what makes difference?

The /sbin/ may or may not be needed depending on one’s Linux configuration and the program used to call the SSH command. The /sbin/ is simply the folder location (from the root location) where the shutdown file/command is located on the first gen v4.x My Cloud.

There’s no power control in the MyCloud devices. So it cannot turn off the power supply (unlike a PC PSU).

^ Correct.

The system will not be able to power off. It will stay powered. However, it will be inactive. You can yank the power cord without consequence. I wish WD would give some visual indicator that it is in this state; I noted that the shutdown script does not properly execute if you have “nonstandard” (ahem) things running. (In my case, additional raid devices mounted, iscsi running, etc, since it does not shut those down. It will just silently fail! I consider this poor quality control in action.)

To get around it, I rename the shutdown script, drop a symlink to a pre-shutdown handler that disables all the fancy addons I cobbled on, then executes normal shutdown script. With the other stuff turned off first, it shuts down properly. You wouldn’t know it had improperly executed without being on the remote console though; The shutdown script is what gets envoked by the GUI menu (via a cgi call). The fact that it terminates incorrectly when other things are running is worrisome.

what means it can not power off and stay powered? It will make working noises from the harddrive? Or the back green LEDs will be on fire? Or both? I dont have other deiveces mounted or other apps running on the MyCloud
And which command are you talking about now?

@Bennor
How can I know if the 2.Gen. needs /sbin/ ?

Because the second gen v2.x firmware is different chances are good the folder structure isn’t the same as the first gen. As previously indicated if you can run the shutdown command without using it’s full directory path then you don’t need to use the full directory path.

It seems like a dead horse is being repeatedly beaten to death here. :laughing: The single bay My Cloud devices (both generations) do not have the power control module needed to physically turn off power to the device. Best one can do is issue the halt or shutdown command via SSH on the second gen. On the first gen there is a shutdown menu option in the My Cloud Dashboard. This Dashboard shutdown option was removed from the v2.x single bay/single drive My Cloud My Cloud firmware when they released the second gen single bay/single drive My Cloud. When shut down the My Cloud motherboard still receives power even though the internal My Cloud hard drive is in a powered down/powered off state. If you want to 100% shut down and power off a My Cloud, pull the power cord on the My Cloud after issuing the halt or shutdown command. You’ll have to pull the cord anyway to reboot the device.

There are a number of links above that explain the differences between halt and shutdown as well as what each of the optional switches do.

It appears WD designed these devices to be left on 24/7 since they didn’t feel the need to include a physical power module capable of shutting off power or even a physical on/off switch.