Saturday, July 25, 2015

Analyzing and troubleshooting network and bandwidth issues

Full diagnostics

http://n1.netalyzr.icsi.berkeley.edu/analysis/

This site reports back a great deal of helpful information.  I recently installed Tomato USB firmware (Shibby) on a Netgear R7000 and as part of the setup process, used this site to help with QOS setup and inspecting for any other issues.

Tuesday, July 21, 2015

Windows Update - accidentally applied update during production hours and now have restart countdown timer - how to stop it

I was troubleshooting a problem on a Windows 2008 R2 server that would not install an update properly.  After much Googling, I resorted to this:
  1. Computer>Manage>Configuration>Services
    1. Right click Windows Update service and choose Stop.  Set Startup Type to disabled.
    2. That stopped the restart countdown timer (where you can choose to postpone 10 minutes to 4 hours).  I need this server up all day and I could not sit and keep clicking postpone.
    3. Just stopping the service is not enough.  It will automatically restart itself (it use delay startup).  So you need to set the Startup Type to disabled.
    4. This should get us through the working day without an extremely important server rebooting.
Some notes about the problem.

Microsoft had released an out of band update and the server kept erroring over night trying to install it.  I stopped Windows Update Service, deleted the C:\Windows\SoftwareDistribution folder's contents, and then restarted Windows Update Service.

Apparently that took care of it because after a bit I received notification that the update was applied and the computer needed to restart.

This was not supposed to happen based on GPO settings but after review I saw that the time for installing the update was wrong (11AM instead of 11PM).

Finally,
To finish this I need to get back on the server this evening after work hours, and set the Windows Update service back to Automatic-Delayed and then Start the service.  That should restore the status of Update services and I can then safely reboot the server.

Another tip: I have read only another solution to this was to run the command 'shutdown /a'.  This was supposed to clear the pending reboot.  It did not.  The command returned the message that no reboots were pending.

If you run into this situation you may want to try what I posted above, just remember to re-enable the Windows Update service and remove the Disabled startup type.  This will allow your system to resume normal updating.

Saturday, May 09, 2015

More on Wink Hub and open source home automation software

I own two Wink hubs.  One, using their cloud service, the other I kept offline for rooting and testing.  The night Quirky pushed the bad firmware, my online hub got it.  At the time I had no idea what happened.  I spent hours trying to get it functioning again.

The next day the announcement about the bricked firmware came out.  Once the instructions were posted on how to fix the hub yourself I followed them.  Apparently it worked.  The hub flashed and then stopped on blue.  After that I could get the hub online for short periods (blue light) and then it would go back to flashing purple.  I spent a good while addressing this, but I never was able to get it working reliably.

I pulled out the other hub, went through the whole thing again, apparently updated to the fixed firmware, and then had exact same problem.  It would connect to the home network for a while and then eventually go back to flashing purple.

So I've given up on Wink hub.

I went out and got a Hue bridge and some bulbs.  Since I already had GE Link light bulbs I needed something that would work with them.  So these days I have a mix of Hue bulbs and GE Link lights all controlled by the Hue bridge.

Home Assistant works with the Hue bridge.  I am still using Home-Assistant as my home automation software.  It meets all of my needs.  The developer and members of the group are continuing to add functionality to the software.  More device support, added features, etc.

I also spent plenty of time testing various other open source offerings.  Nothing has yet to best Home-Assistant.

Although there is not a downloadable application for Home Assistant, it does work with mobile devices and renders nicely.

Home Assistant source code on GitHub

Friday, May 08, 2015

Ubuntu - new setup of nginx, mysql, and php5 - permission denied when trying to view info.php

I followed the very helpful guide here:
https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-12-04


I actually did the setup on Ubuntu 15.04 and they worked.  There is one part where you have to change the codename used.


The last step is to create a info.php file that displays all of the php5 information.
When attempting to view this file I would get error 404.  I googled and started trying to find the issue.  The log stated the file was not found.  Since this is new to me I wanted to make sure the correct location was being used for my files and that the permissions were set correctly.


I checked the permissions on the files in the html directory and they were correct.
So I created a test html file in the
/usr/share/nginx/html
directory.  A simple hello.html.  I tested and the page displayed.


So it appeared that my info.php file was both in the correct location and permissions were correct.


Next I checked what accounts the nginx server process was using, and the php5-fpm process.  I found that the server worker process was running as user nginx and the php5-fpm worker process was running as www-data.  It was my intention that both be running as www-data.


I check to see if nginx was a member of www-data:
$ id nginx
-output: uid=121(nginx) gid=133(nginx) groups=133(nginx)
No, nginx is not a member of www-data.


To resovle this issue I need to give the nginx account access to the php5-fpm.  To do this I needed to add the user nginx to the www-data group (www-data is the user and is a member of the group www-data).


To do this I ran usermod -a -G <groupname> username
$ sudo usermod -a -G www-data nginx


Next, confirm the user is in the group:
$ id nginx
-output: uid=121(nginx) gid=133(nginx) groups=133(nginx),33(www-data)


As another way to confirm one can run:
$ awk -F':' '/www-data/{print $4}' /etc/group
nginx
www-data


Now nginx is a member of www-data.  Next I restarted nginx server and php5-fpm
$ sudo service nginx restart
$ sudo service php5-fpm restart


This time browsing to http://localhost/info.php displayed my php info properly.


I hope this possibly helps someone.

Friday, April 24, 2015

Have you tried Sublime Text for script editing?

I recently stumbled upon Sublime Text.  I was working on a new build of Linux and Googled for a good script editor.  Sublime Text came up.  I gave it a try.  First the none beta version, version 2.  After a bit I tried the new version 3 beta.

I REALLY like this program.  I have been using the free Komodo Edit and while it is great, and I still use it too (they just released version 9 with some nice features), I mostly use Sublime Text.

Aside from having many built-in features that one wants in a coding platform, Sublime also has a Package Manager (Control) which can easily be installed.  Once added, the Package Control opens up so much more versatility, expandability, and support it is emmensly valuable.

In addition to the features, customizations, and add-ons, I particularly enjoy the massive selection of themes for the coding environment.  I have become a fan of alternate color schemes which help me identify different elements of code more quickly.  There is almost an infinite amount of pre-made themes free to download.  Additionally, one can create your own themes.

Sublime Text offers a fully functional trial version that does not expire.  It will prompt occasionally about using an unregistered version, but this trial is enough to get you hooked and want to buy a license.  Even better, the licensing is per user.  So once you buy a license, you are permitted to install Sublime Text on all of your computers.  Even work computers.  As long as it is you using it.

At the time of my purchase it was $70 USD.  It is worth it.

I'm sorry Komodo.  I still love you.  But Sublime has become my new coding best friend.

Here are some links to get an idea of what Sublime looks like:
And have a look at this! - Package Control

Thursday, April 23, 2015

Taking existing HD image and applying to SSD - test your alignment

To fully gain the performance benefits offered by switching to an SSD, the clusters need to be properly aligned with the physical sectors on the SSD.  If not, the performance gain from the SSD will be dramatically impacted and can also contribute to increased wear of the SSD.

First, a clean install of Windows 7 or newer onto an SSD is already setup to do proper alignment. This is not an issue.

The issue can occur when an image is captured from a mechanical (traditional) hard drive and then applied to a Solid State drive.  This could result in mis-alignment of the beginning of th clusters and physical sectors.

If you have taken an image of your computer and then applied it to a new SSD, and would like to know if you are properly aligned, perform these steps.

1) Open a command prompt (cmd) - Start>All Programs>Accessories>Command Prompt
2) Type in this command: wmic partition get Name, StartingOffset and hit <Enter> key
This will return something like this:
Disk #0, Partition #0 1048576
Disk #0, Partition #1 524288000

Now open calculator (Start>All Programs>Accessories>Calculator)

Now divide the value return by the command by 4,096.  If the result is an integer (no decimal value), then your partitions are properly aligned.

So in the example above division produced these results:
256
128000

That indicates proper alignment.  Had the results been something like 254.415 then alignment is offset.

If alignment is offset there are ways to correct the issue. You may want to take a look at these free tools:
http://www.partitionwizard.com/
http://www.disk-partition.com/download-home.html

For the record, a SSD partition can be created with command line parameters to set alignment.
Diskpart
List disk
Select disk n (where n is the number that was given for your SSD in List disk)
Clean
Create partition primary align=1024
Format fs=ntfs quick
Active (assuming you want to install an OS)
Exit

The above commands are not a fix for a improperly aligned disk post imaging, this is a command to create the partition with proper alignment.

If these issue affect your or you are interested I suggest doing some googling and more reading.

Sunday, April 19, 2015

Wink bricked by update (~4/18/2015) - how to use your GE Link Bulbs with something else (link a Hue Bridge)

Update:
In case you have a bricked Wink hub I received an email from Wink and it is possible to repair your hub without having to send it in, provided you have the means necessary to follow these instructions.

I wanted to post this for anyone who might not have gotten the email:

We’re writing again to apologize for the current situation.  As previously mentioned, we suffered an outage this weekend that caused your Wink Hub to fall offline.  This outage was preventable and we are deeply sorry. It pains us to have inconvenienced you as much as we know we have.

While last night’s report was grim, we are now offering two solutions to users who are affected by this outage:

Send Us Your Wink Hub -  We’ll supply a box and roundtrip shipping.   A box will be at your door early this week, and you’ll have your hubs back (with all of the settings preserved) very quickly.    If you’re not into technical stuff- this is probably the easiest route for you.   To send us your hub click here.

Fix it Yourself -  If you are comfortable making some quick changes to your home’s router settings, we can likely get you back up and running in 10 minutes.While this fix requires one to have some degree of technical skill, we’re happy to offer it to all who want to try.  We can even walk you through it over the phone if you give us a ring at 844-WINK-APP . 

You can view instructions on how to repair your Wink Hub yourself via this link recovery.wink.com  These instructions now apply even if you previously deleted your hub.

We are happy to accommodate whichever route you prefer and apologize for creating extra work for you.  Please note that this outage was caused by a security measure put in place to protect you.  Although your home is offline and your hub is inactive - your home and your information remain safe.

The Wink Team
Above is an update, here is the original post...

I think I am done with Wink hub.  It is an extraordinary ordeal to get a simple API access token. Something that could be spit out on a web form just by authenticating with your account takes 7+ weeks from Quirky, if they get back at all.  And that includes occasional check-in emails with them asking 'what is the status of my request'.  I am not disparaging Wink\Quirky staff.  There is just clearly some sort of ignorance to customer support.  For me, without a token, the device is nearly useless for my purposes.

Interestingly one night I had to chat with them for support due to an issue with my hub and I brought up the API request and 7 weeks going by and what the status was.  I was told that an update would be made to my request, and to expect a response in 2 to 7 weeks.  :(

To their credit, the next day I got an email with my API information.  Very much appreciated that they got on it after so long.

So yesterday was the day I was up until 3AM trying to figure out why my hub would not connect. Then today I find out about the firmware update that was pushed and bricked many Wink hubs.

The Wink hub is nice in the variety of radios on board, and potential for supported devices.  And the cost.  But on the downside, cloud only access, extreme difficulty getting an API key (why so hard?  I happen to know it can be down instantly with user login and pass... but that is another story).  What started out as a pretty solid (as in, online all the time) device, took a turn for the worse with firmware 0.77.0.  By this point, I started having a lot of inconsistent, and frustrating issues.  Lights turning on - on their own.  Light groups turning on, leaving one off.  Or turning off, leaving one on.  Devices needing to be re-added.  Slow reaction times.

Other than the brick update, none of the above is really a deal killer for a $50 hub.  But what is confusing is the reluctance to turn this into something great with a reasonable pace.

1) An open source project called Home Assistant, which was the only home automation project I was aware of that you could get a token immediately, was my saving grace.  Otherwise, I would have been real frustrated with the wait for them to issue me API access. But by going to the Home Assistant site, you could put your Wink user and pass in, and immediately get back a token that would allow integration into Home Assistant home automation project.  This tells me that there was really no reason to wait 7 weeks for API access, and just by chance finally get it.  It was a simple as a web form.

2) With potential support for so many protocols and devices, why keep it so limited?  Why not take a more agressive approach and open things up.  That would spur sales, community development, growth, and a more ROI product.

3) Considering the amount of competition in the market, I never have been able to understand why the Wink hub was rolled out, locked down, and eventually (unfortunately, blundered into uselessness).  I'm done.  Had a different, more open, more inviting approach been taken, the Wink hub could have been a tremendously popular device.  But no...

The real purpose of the post is a tip on how to re-associate items, like GE Link light bulbs with another device if they were not removed from the Wink hub (because you couldn't!).

First, the GE Link bulbs use Zigbee.  The Hue bridge supports Zigbee, and these bulbs.  The way to reset these bulbs for pairing is as follows:
Power on the bulb for about 5 seconds.  Turn off for about 3 seconds.  Repeat this 5 times.  On the fifth time you may see the bulb fade after power on, and at this point it should be cleared for easy pairing with another device like the Hue bridge.

Also, the bulbs have a serial number.  It may be possible to do manual additions using the serial number.

I just wanted to pass along if you try to use a bulb with another hub, and it does not pair right away, don't worry, the bulb can be cleared and paired.

BTW, the GE Link bulbs are easy to setup with the Hue bridge.  Compare to a Hue bulb, they do not dim as much, but they do work fine, and can be grouped into scenes.


New beginner's guide to PowerShell on my GitHub page

 I created a beginner's guide to PowerShell here: https://github.com/aamjohns/Powershell_Guide/blob/main/README.md I hope it helps someo...