2 Small Projects for Linux & iMac Techie - Synology NAS

Jaybird180

Final Approach
Joined
Dec 28, 2010
Messages
9,034
Location
Near DC
Display Name

Display name:
Jaybird180
I have a troubleshooting issue and a functional change that I need to implement. I'm seeking help in terms of someone to walk me through step-step in resolving. I would agreeable to screen sharing sessions, so this is also somewhat a learning experience as well.

In order of priority:
The Functional Issue- I have a UPS connected to my NAS, (recently purchased) iMAC, and Verizon wireless router/4-port switch. The UPS only supports communications to one device. During power events, the NAS does it what its supposed to an monitors the battery level and determines when to shutdown. I have no communications to my iMAC to safely shut it down, but when not in use it's in sleep mode. I have read online that it's not 100% safe, but better than actively working during a power event. Nevertheless others have described enabling the NAS to command the iMAC to shutdown, but some of the discussion assumes a greater familiarity with Linux command shell than I have. I am also a Mac n00b.

The Troubleshooting Issue- For reasons of usefulness, I have WOL enabled on the NAS. Except that it wakes far too often. My suspicion is that the Verizon supplied switch is too noisy, sending packets to MAC address of the NAS unnecessarily. I tested this by unplugging the ethernet cable and it didn't wake as often. I read on the Synology forum about checking various scheduled tasks and services and so far everything seems to check out, but I'm not sure if I'm missing something. My box has no customization whatsoever. Then there's the possibility that my NAS has been hijacked. FWIW, the NAS has always been this "noisy" and to the best of my knowledge, it's not being advertised outside of my local LAN.

Hoping that one of you great Pilot/ Nerds would be willing and able to help. I'm thinking that it wouldn't take more than an hour to do both???
 
Since nobody has replied to you, here are a couple of points that may help:

Nevertheless others have described enabling the NAS to command the iMAC to shutdown, but some of the discussion assumes a greater familiarity with Linux command shell than I have. I am also a Mac n00b.
Make sure ssh is enabled on the iMac and set up the script that runs when the UPS power is low to ssh to the mac and run a 'shutdown -h now'. You may have to set up key'd authentication or be familiar with 'expect' to automate the ssh session.

Except that it wakes far too often. My suspicion is that the Verizon supplied switch is too noisy, sending packets to MAC address of the NAS unnecessarily.
A WoL requires what's called a 'magic packet' to be sent to the device. This is a broadcast that's specially crafted with the MAC address for the target device encoded. I highly doubt the Verizon device is going to brute force wake every possible MAC... but it's possible that the Disk Station NIC isn't behaving as expected.


I tested this by unplugging the ethernet cable and it didn't wake as often.
If it's waking at all with no network connectivity, it's something local. It's possible that a hardware state change is causing the waking... but I'm not familiar enough with the specific device to be of much help here.
 
A WoL requires what's called a 'magic packet' to be sent to the device. This is a broadcast that's specially crafted with the MAC address for the target device encoded. I highly doubt the Verizon device is going to brute force wake every possible MAC... but it's possible that the Disk Station NIC isn't behaving as expected.



If it's waking at all with no network connectivity, it's something local. It's possible that a hardware state change is causing the waking... but I'm not familiar enough with the specific device to be of much help here.

I could not detect any periods of waking while disconnected. But I'm also not as adept at poring through the logs to find the culprit either. I'm hoping that the problem is a chatty router as I notice brief periods of network slowdown (congestion). I don't know if this router has the ability to operate a port in promiscuous mode, but also to setup packet capturing would get me into time consumption that I hope would be unnecessary.
 
Fortunately, since they're broadcasts, a port needn't be a span/mirror. You could watch for magic packets on anything connected to the switch.
 
Man, the day I start sniffing my home network trying to fix a WoL issue must be about a month after I quit IT and decided to fly professionally and missed it.

The last thing I want to do at home is fix technology....

Anyways...

As mentioned above it'll be a broadcast -- you should be able to see it with WireShark but you'll have to apply some filters so you're not grabbing everything.

Do you lose power that often? Modern systems with journaled filesystems are pretty damn tolerant to an occasional power off. I personally wouldn't invest my time into making the NAS command the shutdown, given that I lose power about once every 7 years for about a minute.
 
Jesse- I don't expect to have power events often, but if one happens I'd rather the system do it's thing automagically. And if I learn something in the process, that's a cherry on top.

I would like to solve this WOL issue as the NAS waking all the time is pretty annoying and makes me paranoid that someone has hijacked it to mine Bitcoins or something like that.
 
I would like to solve this WOL issue as the NAS waking all the time is pretty annoying and makes me paranoid that someone has hijacked it to mine Bitcoins or something like that.

Have some kind of firewall upstream? Or can you ssh in to this device? If upstream firewall, block external ingress and egress there. If you can ssh to the device, you could also apply some kind of firewall there. I'm assuming this box is based on some flavor of *nix/bsd, so you have iptables or some other kernel filtering mechanism available to you.

You kill the ability for any external traffic to ingress/egress, then there's no way a bitcoin miner is getting his data even if previously compromised :wink2:
 
I see under Firewall & Traffic Control "Allow/Deny access to selected ports or services for specific IP addresses"

If you block traffic to everything but your local network (and I'd also block your router's IP in case they're source natting as well), then the NAS will have no external connectivity.

If it were me, I'd only allow connectivity to the hosts that need it.
 
I had a coworker who shut down her laptop by just holding the power button until it powers off, who did this for years with no data loss. Modern file systems are great.

We jokingly called it the "Alice Boot".

I'd make sure the Mac is backing up to the NAS and make sure the NAS is shutting down properly. No real point in going any further.

As far as the WOL, it's unlikely it's the router. I assume the synology is on a static IP? It's not staying awake or waking up to renew a DHCP lease is it?

If the Mac is backing up to it with Time Machine, that's probably what's waking it up.
 
I had a coworker who shut down her laptop by just holding the power button until it powers off, who did this for years with no data loss. Modern file systems are great.

We jokingly called it the "Alice Boot".

I'd make sure the Mac is backing up to the NAS and make sure the NAS is shutting down properly. No real point in going any further.

As far as the WOL, it's unlikely it's the router. I assume the synology is on a static IP? It's not staying awake or waking up to renew a DHCP lease is it?

If the Mac is backing up to it with Time Machine, that's probably what's waking it up.


All great points. The Mac is backing up via Time Machine, but it's not what's waking the Synology as it was doing it long before I got the Mac. I get what you're saying that I shouldn't worry about Mac shutdown, the protection is purely preventative; why rebuild a system from backup when you can prevent the crash occurring in the first instance?!

The Synology is statically assigned. Typically it will go to sleep (more like napping) and then wake a few minutes later, no surfing of the logs to know that, I can hear the drives and cooling fan spinning up. Along with acoustically poor placement to amplify the sound, it's annoyance quotient has increased, hence why I want to do something about it.
 
Can you dig through the logs looking for "power state"? Finding that and what's around that statement should tell us something.
 
Looks like I will have to. In the meantime, I will soon upgrade the router to DD-WRT capability. The one I have just wont cut it. Then while I'm at it I will buy my own modem and send Verizon's back and reclaim a monthly rental fee.

Secondly, found a Network UPS Server setting built into the NAS. Its based on NUT Network UPS Tools. I know nothing about installing from source, as thats what I found online to use as a client. Documentation indicates that Yosemite may reject it. :dunno:
 
Never seen NUT work right in a multivendor environment. In fact never seen any UPS integration work right in a multivendor environment. It's not important enough in the enterprise world where power doesn't go off on critical systems and when it does you'll be working on recovery, it's only useful in consumer applications. And frankly no UPS vendor cares at that point beyond telling a single machine to shut down.
 
Never seen NUT work right in a multivendor environment. In fact never seen any UPS integration work right in a multivendor environment. It's not important enough in the enterprise world where power doesn't go off on critical systems and when it does you'll be working on recovery, it's only useful in consumer applications. And frankly no UPS vendor cares at that point beyond telling a single machine to shut down.

You make a point I hadn't thought of since our each UPS in each datacenter is backed by generators... but if they weren't, I suppose I'd do some kind of power verification and graceful shutdown procedure myself as a handler for the trap from the UPS.

That'd get ugly, though. Even if a generator fails, that's what a second independent power bus is for.

And my mind wanders when I'm down and sick... go figure. This cold is sucking the life right out of me.
 
You make a point I hadn't thought of since our each UPS in each datacenter is backed by generators... but if they weren't, I suppose I'd do some kind of power verification and graceful shutdown procedure myself as a handler for the trap from the UPS.



That'd get ugly, though. Even if a generator fails, that's what a second independent power bus is for.



And my mind wanders when I'm down and sick... go figure. This cold is sucking the life right out of me.


Yeah at most data centers a full power drop is a serious event that no one bothers to plan for other than having a second geographically diverse data center.

I stood in the parking lot of a [insert major data center player name here] data center after a manufacturing defect in a copper bus bar finally triggered an explosion (put shrapnel half an inch into two wood desks below the conduit, thankfully the engineers had gone home for the night or they'd have had shrapnel in their heads) and the fire department deemed the building unsafe to enter.

Eventually the FD relented and big name data center company let folks go grab critical things from their racks one customer at a time, escorted, with flashlights to see where you were going and doing, to drive across town to their other data center where they set up emergency space and power for them.

Site was completely black for over 48 hours.

We had already planned to build out another site so all we needed was a single hard disk with the database logs on it. If it'd happened a week later we wouldn't have even needed that.

I've been through three total power losses at data centers and one that was minutes from happening until we pushed the generator start switch and overrode the oil pressure warning on a very expensive genset. Thankfully on that last one, the sensor was bad and there really was oil pressure.

Data center power outages are eerie. Gets really dark real fast and all the fan and disk noise goes away in a winding down noise like a turbine spooling down.

You're there in the dark and the growing quiet thinking "oh ****. There goes the next two days of sleep..."
 
Yeah at most data centers a full power drop is a serious event that no one bothers to plan for other than having a second geographically diverse data center.

I stood in the parking lot of a [insert major data center player name here] data center after a manufacturing defect in a copper bus bar finally triggered an explosion (put shrapnel half an inch into two wood desks below the conduit, thankfully the engineers had gone home for the night or they'd have had shrapnel in their heads) and the fire department deemed the building unsafe to enter.

Eventually the FD relented and big name data center company let folks go grab critical things from their racks one customer at a time, escorted, with flashlights to see where you were going and doing, to drive across town to their other data center where they set up emergency space and power for them.

Site was completely black for over 48 hours.

We had already planned to build out another site so all we needed was a single hard disk with the database logs on it. If it'd happened a week later we wouldn't have even needed that.

I've been through three total power losses at data centers and one that was minutes from happening until we pushed the generator start switch and overrode the oil pressure warning on a very expensive genset. Thankfully on that last one, the sensor was bad and there really was oil pressure.

Data center power outages are eerie. Gets really dark real fast and all the fan and disk noise goes away in a winding down noise like a turbine spooling down.

You're there in the dark and the growing quiet thinking "oh ****. There goes the next two days of sleep..."

I wish I didn't know how you feel... but that's why we treat DR with such importance. If only leadership would invest the same money in to DR that they do in our prod dc.

Problem is that our DR DC is ~3mi from prod at the moment, but it's going to be shipped across the country here very soon.
 
I turned on and opened up the ports for telnet and this is what I got
Last login: Tue Mar 24 21:57:22 on console
Jaybirds-iMac:~ Jaybird$ telnet 192.168.1.x
Trying 192.168.1.x...
Connected to 192.168.1.x.
Escape character is '^]'.

DS01 login: root
Password:


BusyBox vX.YY.PP (2015-01-07 15:12:56 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

DS01> ls
DS01> help
Built-in commands:
------------------
. : [ [[ alias break cd chdir continue eval exec exit export
false getopts hash help let local printf pwd read readonly return
set shift source test times trap true type ulimit umask unalias
unset wait

DS01> ..
-ash: ..: Permission denied
DS01> .
DS01> ls
DS01> ?
-ash: ?: not found
DS01> help
Built-in commands:
------------------
. : [ [[ alias break cd chdir continue eval exec exit export
false getopts hash help let local printf pwd read readonly return
set shift source test times trap true type ulimit umask unalias
unset wait

DS01> alias
dir='ls -al'
ll='ls -la'
DS01> chdir /etc/chrontab
-ash: chdir: can't cd to /etc/chrontab
DS01> cd /etc/chrontab
-ash: cd: can't cd to /etc/chrontab
DS01> [
ash: missing ]
DS01> exit
Connection closed by foreign host.
So now, I have to figure out how to interact with it.
 
Last edited:
Busybox is a tiny linux-like shell for embedded systems that's extremely limited.

Guessing at what you were trying to do, you're looking for /etc/crontab probably. Not "chrontab".
 
Crontab was my thought as well but hey, I'm just a curmudgeon Oracle engineer.
 
You also can't cd to crontab, it's a file. cat it to display the contents.
 
You also can't cd to crontab, it's a file. cat it to display the contents.
It looks like cat is not one of the available commands (see above posting), but I will give that a shot.
 
crontab -l to list the current crontab file ... but if you not gots "cat" ..... :D
 
It looks like cat is not one of the available commands (see above posting), but I will give that a shot.
As also stated, crontab -l will work, but also check and see if 'more' or 'less' is available. Both will show you what you want. Also look in /etc/cron.d/ and /etc/cron.* (cron.hourly, cron.daily, etc.).
 
Back
Top