Install Ouimeaux on Raspberry Pi

I am working on a custom home automation solution that combines several different systems in a single easy to use control panel. The design is to have a Raspberry Pi 3 B running Ubuntu Mate 16.04 LTS become a hub device that can control all the devices that have automation built in.

The first item on my list is to get my WeMo setup responding to basic commands, to do this we will be installing ouimeaux. The first step is to install the the prerequisites.

sudo apt-get install python-setuptools python-dev

Next we will run the installer, we will install the server version so that we can use the default web interface and use the REST API in a later project.

sudo pip install ouimeaux[server]

We will need to open a port on the firewall or we will not get any response from any device, I am using ufw. We need to port 54321 for discovery of devices, 5000 for the rest api for the server, and 80 if you will be running the web app.

sudo ufw allow 54321
sudo ufw allow 5000

Now we will want to see if everything is working properly by running the following command to detect and list any devices found.

wemo list

If everything worked properly we should see a list of devices returned like the example below.

Bridge: WeMo Link
Light: lightBedroom
Light: lightHallway

If everything is working properly you can now start the server by running wemo server, if you wanted to keep the server running in the background it would be best to launch with the server with screen or a cron job. you can now open your browser to http://localhost:5000/ to use the page control page provided with Ouimeaux.

Install and configure CJDNS on Ubuntu 14.04

I have wanted to create a way to secure the communicates between the my VPS’s that are located at several geologically different datacenters. Normally each server being it’s own island is not an issue, but this does not work very well if you want the servers to communicate on a secure channel for monitoring and deploying configuration. This type of communication is normally done on an internal network that does not route publicly. Some of the more standard configuration options would be to setup a VPN, or host all the systems in one location on the same subnet. These options are all good but do provide the same interest as setting up CJDNS to route the traffic. Here I will cover how to setup CJDNS to communicate between two freshly installed Ubuntu 14.04 systems.

First we need to install the the prerequisites to build the current version of CJDNS.

sudo apt-get install git build-essential nodejs

Next we will need to download a copy of the project from GIT and run the build.

sudo mkdir -p /opt/cjdns
sudo git clone https://github.com/cjdelisle/cjdns.git /opt/cjdns
cd /opt/cjdns
sudo ./do

CJDNS will use the tun device to communicate, we need to verify that it is working properly.

cat /dev/net/tun

If we see cat: /dev/net/tun: File descriptor in bad state then everything is working properly at this stage.
If we see cat: /dev/net/tun: No such file or directory we will need to create the tun device by running the following commands.

sudo mkdir -p /dev/net
sudo mknod /dev/net/tun c 10 200
sudo chmod 0666 /dev/net/tun
cat /dev/net/tun

If we get the result of cat: /dev/net/tun: Operation not permitted it is likely that your VPS provider has not enabled TUN/TAP device by default. You will need to be activated the TUN/TAP device from the VPS control panel, or by creating a support ticket with your VPS provider.

Next we need to generate the the config file.

sudo mkdir -p /etc/cjdns
sudo chmod 755 /etc/cjdns
./cjdroute --genconf > ~/cjdroute.conf
sudo mv ~/cjdroute.conf /etc/cjdns/cjdroute.conf

Now we need to make some changes to the config file. Open ‘/etc/cjdns/cjdroute.conf’ in an editor and make the following changes.
Find the setting "beacon": 2; and change it to "beacon": 0; to prevent connections to other systems that are broadcasting.
Find the line "your.external.ip.goes.here" in the "authorizedPasswords" section and replace it with your external IP address. In the same section locate the line "peerName":"your-name-goes-here" And change the value "your-name-goes-here" to a human readable name for the system like "CortanaRouter1".

Next copy the connection credentials that we just configured, they should look like this:

"192.168.0.93:7829": {
"login": "default-login",
"password":"9mdh745er8tde3ji927p5nh0",
"publicKey":"6lclpygw4s9m8ksw4k58k5e7haw7b9mpfun1m0.k",
"peerName":"CortanaRouter1"
},

This is an example connection and will not work if used. We will now past this into the "connectTo" section for IPv4 or IPv6 depending on what the system.

We will want to set one of the systems to print the log to the terminal for testing by changing the following settings. First we will set "noBackground":0, to "noBackground":1, and uncommenting the line "logTo":"stdout" in the config. Remember this step is for testing only will will need to be reverted after we have confirmed that the setup is functional.

Now we will want to start the service on the systems by running the following command.

sudo /opt/cjdns/cjdroute < /etc/cjdns/cjdroute.conf

To test if the connection has been setup successfully we will want to ping the IPv6 address assigned to the tun device. The IPv6 address is located at the start of the config file at the setting "ipv6": "fc1b:ddbd:29f1:39fe:95e8:122:4c30:f253",.

Now that we have a CJDNS working we need to setup a proper init script to run on startup, and to control the service. I have modified the init script provided at https://github.com/ProjectMeshnet/CJDNS-init.d-Script/ to work with this guide, you can download it from http://www.jenovarain.com/blog/wp-content/uploads/2016/05/cjdns.txt.

Run the following commands to download and configure the script.

wget http://www.jenovarain.com/blog/wp-content/uploads/2016/05/cjdns.txt
sudo cp cjdns.txt /etc/init.d/cjdns
sudo chmod +x /etc/init.d/cjdns
sudo update-rc.d cjdns defaults

You can now test the new init script by running the following command:

sudo service cjdns status

You should see Cjdns is running if everything is working properly.

You should now have CJDNS setup and configured to start on boot and peered with both system letting you securely route data between the two systems.

We have not covered restricting communication between the systems to only use this new route, and how to segregate peer connections if you connect to other CJDNS peers.

Event ID 4319 NetBIOS over TCP/IP with Dual Nic’s

We have received many alerts on the error Event ID 4319 as seen below.

Event log: System
Event Source: NetBT
Event ID: 4319
Message Contents: A duplicate name has been detected on the TCP network.
The IP address of the computer that sent the message is in the data.
Use nbtstat -n in a command window to see which name is in the Conflict state.
netbios-nbtstat

View of the nbtstat -n command result

The cause of this issue has been systems that have more than one network card, this is more common in laptops that will use a hardline in the office. you can see this by using the command ‘nbtstat -n’ multiple network cards have the same NetBIOS name.

To correct this behavior you could prevent both network cards from connecting at the same time, although that is not a viable tactic to us. What we have decided to do is disable NetBIOS over TCP/IP on the wireless card.  If you are doing this remotely you can run the following commands.

First you will need to know what the index number of your network card is, you can retrieve that with the following command.

wmic nicconfig get caption,index,TcpipNetbiosOptions
netbios-nicindex

View of the network cards and the index numbers

You can see the index number listed next to each network card name, in this case we are looking for the wireless card, that would be index number ‘2’. You can also see the TcpipNetbiosOptions column is showing a ‘0’, that means it is set to DHCP server options or fail over to enabled if DHCP has no options set. we will need the TcpipNetbiosOptions value to be ‘2’ to disable NetBIOS over TCP/IP, and with the index number we can run the following. (Change the index to the nic relevant to your issue.)

wmic nicconfig where index=2 call SetTcpipNetbios 2
netbios-settcpipnetbios

Result of setting NetBIOS over TCP/IP off.

The Shape of Tomorrow

One of the ideas that is common to hear is ‘tomorrow will be so different’ and the recently more common ‘this will change everything’. The idea being that the next thing on the horizon will change the world in ways that we could never imagine and that is not going to happen to our civilization without a revolution in technology itself.

Let us consider the example of the horseless carriage, or not since we have beaten that to death. Let us instead look to your home, it is a nice place, it has 4+ walls, a solid flooring, and one would hope a roof over your head. This basic idea has not changed much but our execution of this simple concept can now take us from a dry hole in a hill to any modern dwelling.  but we have mastered the building style, tools, and knowledge to make a modern structure. The story of how the food go to your plate is a much better story to show how things change and yet can stay the same, contemplate the supply chain needed to get you that produce on time.

We can see the changes coming that sound big take for example the idea that all stores will have robotic attendants, and all manufacturing is done by machines creating on demand custom handbag to the new kitchen counters. We can imagine this because it is already happening. You only need to look at manufacturing, farming, and distributors to see how they use more advanced tools like robotics to see how this will have a reduction in the need for humans on site.

The shape of the world has is not changed from how it was, we are still going about our daily life handling many small items, doing a task, and interacting with others around us. The idea that things will change beyond our imagining is a farce to help us deal with change in general.

We constantly change but we also adapt and accept the changes. Lets look at something simple like keeping your floor clean, wipe or pickup all the dirt if you do not have a broom or mop the carpet need to be beaten if you do not have a vacuum cleaner. Or jumping forward actually vacyume if you do not have a robotic vacuum. From this simple idea we can see that soon the laundry will be folded for you, the dishes cleaned, and put away.

When you can go down to the local store and pickup a personal attendant for the cost of a small appliance it will be common place. and just like with robotic vacuums nothing will have really changed.  We as a species do change more every day and at a faster rate then ever before but your life will not change fundamentally, it will just be improved like it was yesterday.

Job Losses, Basic Income, and EVE.

The modern person works a job to pay the bills and support their way of life and improve it, hopefully by doing something that they enjoy and find rewarding. I would like to ask what happens when you do not have an income and compare this to the MMO Game EVE.

A job is very important to the average person because it pays for the most important things you need like food, and shelter. I do not know anyone that can do without food, and most places are not sunny year round requiring shelter to survive. You might be luck and your parents, partner or to a limited extent governments can provide a limited coverage when you can not support your self. But if government support runs out or parents have issues how do you survive?

If you are luck to find a job you like and you are good at, you should not have many issues providing for yourself. Many people though do not know what they want to do, or have no support to test the waters and get the first job they can. Many articles have been written on the topic of job progression and how once you are in a job that only provides the basics of survival you do not have much ability to progress to better employment, you cannot risk what little you have. To progress you might need to take risks and the risks need to be balanced against what you might gain and what you might loss. If you risk losing your survival you will not take the risk and this would result in becoming trapped and unable to escape.

In most MMO games you do not need to survive in the traditional sense, in EVE you can sit in a space station forever and never pay for rent or food. Now this is not much of an existence but it does something very basic, you can fail at everything in the game and still have a second chance. You can start a company in game, you can explore the universe, you can do literally everything that is offered until you succeed. But the important thing here is that you can and will fail, and that is not a problem in the game world. Because of this safety net you can keep trying and learning from the mistakes and improving until you do something great, and when someone bigger takes it all away you can still try again.

This is where Basic Income would help society grow by giving everyone a guarantee of survival even if they lost everything. We need to provide the basics of food and shelter to all people with no restrictions if we want to encourage people to take the risks to do something great. We normally can not take the same risks we do in games, but if we could build a safety net like Basic Income then we would finally be able take many of the risks in life, imagine what we could accomplish.

If you would like to read more on Basic Income read the Wiki on the topic. http://en.wikipedia.org/wiki/Basic_income
I also recommend keeping up with the reddit community. http://www.reddit.com/r/BasicIncome/

Error: The application failed to initialize properly (0xc0000135)

If you are getting the error “The application failed to initialize properly (0xc0000135). Click on OK to terminate the application.” when you are launching an application you do not have the .NET Framework installed.

You can go to http://www.microsoft.com/en-us/download/details.aspx?id=22 to download the .NET Framework from Microsoft.

This can be an issue with XP systems as they do not come with .NET Framework by default, most Vista and newer systems will have .NET Framework 3.5 SP1 installed by default. Please remember that .NET Framework 4.0 is not backwards compatible with .NET Framework 3.5.

Windows ReportQueue Eating the Drive

Working on a few system I have found that the following folder has filled up at times with error report files eating all available drive space.

C:\Users\All Users\Microsoft\Windows\Wer\ReportQueue\*

Now I know that this if you have files collecting here you might have bigger issues with the system and you should check that out in time. The files are safe to delete and will not cause any issues after removed. You can also disable error reporting on the system to stop the generation of the error reports.

Goodbye our friend NPAPI

We are starting to see changes in web browsers that will let us move forward, towards a future of the web that works for everyone on any device. Google has announced that it will stop supporting NPAPI in it’s Chrome browser and Mozilla has announced that it is changing how NPAPI works in the Firefox browser. This is a big change because mobile devices, tablets and locked down systems do not have plugins or can not have plugins installed.

With the advent of new web standards like HTML5, WebRTC, and others the operating system that runs your browser is less vulnerable to security holes, bugs or other attacks that can corrupt the operating system. The operating system should be silent and out of the way. What you want to do is use the tools and services provided, you should not be required to learn how to install a printer, find missing DLL’s, or patch the kernel.

Example of the command line

Example of the command line.

The natural progression of computers is to reduce the focus on the operating system in the same way we stopped using the command line. What is meant by this is that you can still use the command line if you really wish, but most people will never need to use it. The command line is not the focus of the operating system anymore and has been locked out or hidden. Over time the operating system will slowly fade in to be the background much like the command line, and we will only care about programs and services that are really part of the web and accessed through the browser regardless of what operating system you use.

Imagine a time when you do not need to be setup on the computer, you do not need to install your programs, you can toss your computer in a lake (DO NOT TOSS YOUR COMPUTER IN A LAKE) and all of your files, work, tools, and services are instantly on any system you sign on to. With the Web as the next layer of computing we can have this vision but it is only after we have abandoned our demand that all games, programs, and services are installed locally to one machine. We have many more reasons to do this and many companies are working hard at pushing hard for this vision of the future. 

References:
http://blog.chromium.org/2013/09/saying-goodbye-to-our-old-friend-npapi.html
https://blog.mozilla.org/security/2013/01/29/putting-users-in-control-of-plugins/

Revised with: Mitchel Holt

Google Eric Schmidt Cover

Governments should change tax laws

“If the British system changes the tax laws, then we will comply,” Schmidt said. “If the taxes go up, we will pay more, if they go down, we will pay less. That is a political decision for the democracy that is the United Kingdom.”

This sums up my thoughts beautifully, at no point has this company paid less than it should, it paid exactly what the government permitted it to pay in taxes. If you want more taxes from companies and you want the companies to stop using loopholes in the tax code then close all of the loopholes and stop permitting new loopholes to be made. It might be time to fully review the tax code and find all the issues and loopholes that allow companies and people to avoid paying what they should.

I am interested in how they avoided paying  taxes that the governments are claiming they should be paying, but the issue is that the tax law let them avoid paying a large sum of money that the government believes they should be paying.

What Google is trying to do is force a change in the law so that they must pay the proper amount and can not use loopholes. This will have the effect of stopping all companies from using the loopholes not just Google. This will increase the tax flow from all companies and allow the government to provide the services that society needs to operate.

Source: BBC News

The Imagination Engine

I am a big fan of shows like Star Trek, and Doctor Who. I have seen one very strong theme running through all of the shows and one that most people have a hard time grasping. We are constantly creating our future through our imagination.

What do I mean? Well the shows primary source of material is examining how will humanity develop. Do we want to be a war like race (Klingons), do we want to be greedy and only care about money (Ferengi), what about tech do we upgrade our bodies with no care of humanity (Cybermen). The list of villains in these shows normally depict the worst that we could be.

We use our imaginations to find out what things could be like and how we can fix the issues before we even reach the problems, we are a people that shape our world based on our thoughts.