edit {hack} a .deb package to remove user options – silent install.

So, with my new Dell M1000e and M600 blades now sitting in their new home in my workshop and having tested all the blades are working (-1) I now need to load test them. I could just use a program designed for this, but i’m thinking that as i’ll be burning through a chunk of electricity i’ll put the compute cycles to good use (the heat will be keeping me warm). So i’m going to do some Folding at Home. If you don’t know about this, then you should check out this great project.

My team id is 232280. Feel free to join me.

Anyway, i’ll be running Ubuntu on the blades for a while (when I can get the latest version installing from USB), so I played around with installing inside a VM. The instructions for this can be found http://folding.stanford.edu/home/guide/linux-install-guide/ but take them with a pinch of salt as a few links are broken/need fixing (i’m letting them know on the forum). The installer asks for user details as part of the package and you can’t do an ‘unattended install’ which is what I was after (for a very specific reason). NVM, i’ll just figure out how to disassemble the .deb package and change it.

I haven’t done this before so I started not know that it was possible, but it’s actually quite simple. I found a post explaining how to open and then recreate the .deb package.

mkdir tmp 
dpkg-deb -R original.deb tmp 
# edit DEBIAN/postinst 
dpkg-deb -b tmp fixed.deb 

…and then had a bit of a read up of what I found inside – read this, sec 7.6. After a bit of head scratching and a few edits that didn’t work I finally worked out what I needed to do to remove the user interaction. (some of this helped.) Rename the templates file and comment out the lines referencing db_get then add in the variables for user, team, passkey, power and autostart. (One thing I would like to do is add some sort of reference to different machines MAC address in the user but i’ll look into that later.) After doing this i’ve hacked the .deb into something that I can script silently – which means remote deployment :D.

I also came across https://www.linux.com/learn/writing-simple-bash-script while wondering the web – it’s really well written for beginners like me.

You can find my hacked .deb here. My team id is baked in. Install using:

wget http://www.crazy-logic.co.uk/wp-content/uploads/2017/01/FAHinstaller.deb
sudo dpkg -i --force-depends FAHinstaller.deb

ver 2 now includes the mac address in the username so i can see how much each blade will have done.

The DHT11 temperature-humidity sensors pt 2

Here’s the graphs from my recent experiment, and here’s the data.

Temperature from 11 DHT11 sensors over 22900 data readings for each sensor

Temperature from 11 DHT11 sensors over 22900 data readings for each sensor

Humidity from 11 DHT11 sensors over 22900 data readings for each sensor

Humidity from 11 DHT11 sensors over 22900 data readings for each sensor

min, avg, max and variance of temperature from 11 DHT11 sensors over 22900 data readings for each sensor

min, avg, max and variance of temperature from 11 DHT11 sensors over 22900 data readings for each sensor

min, avg, max and variance of humidity from 11 DHT11 sensors over 22900 data readings for each sensor

min, avg, max and variance of humidity from 11 DHT11 sensors over 22900 data readings for each sensor

and a brief video…

The DHT11 temperature-humidity sensors

So I have loads of these from an old project that you guessed it – I never got round to, but how accurate are these cheapest of cheap things?

Set up an Arduino/RasPi with all the sensors and get it to read them all back – if all in one location then they should all be the same right? Lets see how accurate they are! I’ll run the test for a week (probably longer) with various conditions and then report back.

oh and some code….


// origional code from ladyada, public domain
#include "DHT.h"
#include
#include

DHT dht0(2, DHT11);
DHT dht1(3, DHT11);
DHT dht2(5, DHT11);
DHT dht3(6, DHT11);
DHT dht4(7, DHT11);
DHT dht5(8, DHT11);
DHT dht6(9, DHT11);
DHT dht7(A0, DHT11);
DHT dht8(A1, DHT11);
DHT dht9(A2, DHT11);
//older sensors
DHT dht10(A4, DHT11);
DHT dht11(A5, DHT11);

float temps[12];
float hmids[12];

void setup() {
Serial.begin(9600);
Serial.println("DHT test!");
dht0.begin();
dht1.begin();
dht2.begin();
dht3.begin();
dht4.begin();
dht5.begin();
dht6.begin();
dht7.begin();
dht8.begin();
dht9.begin();
dht10.begin();
dht11.begin();
SD.begin(4);
}

void loop() {
// Wait a few seconds between measurements.
delay(30000);

hmids[0] = dht0.readHumidity();
temps[0]= dht0.readTemperature();

hmids[1] = dht1.readHumidity();
temps[1]= dht1.readTemperature();

hmids[2] = dht2.readHumidity();
temps[2]= dht2.readTemperature();

hmids[3] = dht3.readHumidity();
temps[3]= dht3.readTemperature();

hmids[4] = dht4.readHumidity();
temps[4]= dht4.readTemperature();

hmids[5] = dht5.readHumidity();
temps[5]= dht5.readTemperature();

hmids[6] = dht6.readHumidity();
temps[6]= dht6.readTemperature();

hmids[7] = dht7.readHumidity();
temps[7]= dht7.readTemperature();

hmids[8] = dht8.readHumidity();
temps[8]= dht8.readTemperature();

hmids[9] = dht9.readHumidity();
temps[9]= dht9.readTemperature();

hmids[10] = dht10.readHumidity();
temps[10]= dht10.readTemperature();

hmids[11] = dht11.readHumidity();
temps[11]= dht11.readTemperature();

Serial.print("Temps ");
for (int i=0;i<12;i++)
{
Serial.print(temps[i]);
Serial.print(", ");
}
Serial.println();

Serial.print("humids ");
for (int i=0;i<12;i++)
{
Serial.print(hmids[i]);
Serial.print(", ");
}
Serial.println();

//write data to SD card
File dataFile = SD.open("dhtdata.txt", FILE_WRITE);
if (dataFile) {
dataFile.print("Temps, ");
for(int i=0;i<11;i++)
{
dataFile.print(temps[i]);
dataFile.print(", ");
}

dataFile.print("Humids, ");
for(int i=0;i<11;i++)
{
dataFile.print(hmids[i]);
dataFile.print(", ");
}
dataFile.println(';');

dataFile.close();
}

//Serial.println(t);
}

Hyper-V and Vlans

So I’ve now got 2 identical hosts running server 2012 datacenter, with VM’s on both. Now it’s time to get them talking to one and other. Simple right, just sit them all on ‘external’ virtual switches and they can use the physical network to talk to each other. Great except… I don’t really want my test environment hooked upto my live environment, not do I want to change my existing DHCP server settings or have two on the same broadcast domain!

So, Hyper V can use VLANs to segregate traffic. This is the way forward for me.

  1. 1 create a new VLAN for the test environment,
  2. tag the ports for the VLAN,
  3. put all VMs on the new VLAN…
  4. oh and change the management VLAN in the virtual switch manager for the hosts…

Groovey now I can talk to the host over my LAN (on VLAN 1) and the VMs can talk to each other on VLAN 200, but they as VLANs are completely segregated in terms of broadcast domains (for DHCP) and packets. Now I can set up a (virtual) router to bridge between them. PFSENCE time.

Oopsie, server failure

So just turned my server on to play with Hyper V stuffage, and hummmm…. it wont pass POST. It beeps telling me there’s a RAID failure, but then dies before showing me the diagnostics page that it would normally show… HuMmM!

SO, pop the hood, thinking maybe it’s a RAM failure and I knocked a CPU heat sink… which then fell off. Think I’ve found the problem then.

Oh, and then I’ve run into this again….

SLAT error :/

SLAT error :/

Time to break out Server 2012 DC edition again….Which also doesn’t like the server, time to break out the server 2008 disk, which supports SLAT, but didn’t require it. Might have better luck with it. Only problem there is that Server 2008 doesn’t support live migration and replication in the way that 2012 does :/.

*As a heads up for anyone wanting to play around – save some time and do some research on your processor. It needs to be 64bit, support Intel VT-x and Intel VT-x with Extended Page Tables (EPT). The best place to find this information is in the Intel ARK if you are using Intel proc’s. Have a look at my proc’s here. *

Hyper-V = Hyper Frustrating

So it’s about time that I pick up with my Microsoft certs, seeing as I’m now back in IT. I should have done them a long time ago, but nvm. Now’s a good a time as any.

The first thing when embarking on a challenge like this is to set some goals: I want to be MCSE certified within a year, and I don’t want to spend too much time (or money) doing it. I also want it to be useful to me (and look good on my CV). Choosing the right track is also important. Have a look at a recent road map here.

I’m choosing the server route. I’m yet to decide which of the MCSE’s within the route I want, but the first three exams are all the same.  So 410,411 and 412 to start with. I have a good grounding in MS server tech, having built domains from scratch in the win2k days and working for a length of time in a win 2k3/xp+win7 environment, so I don’t think it’ll be too difficult to move the core skills into the 2012  exam direction.

First things first…

… I’ll be using a set of study books 410, 411 and 412, they don’t really cost that much and should be a good resource for the exams. I’ll also be using various Microsoft Virtual Academy resources as I go. I can’t tell you which ones as I haven’t had an in depth look as of yet.

The most important thing I’ll be using in my test environment. This will be key, as there’s no better way to understand how things work that to get stuck in making them work, breaking them, and fixing them again. It’ll also allow me to experiment with redundancy in a safe way, as I really do like pulling network cables out and watching things fail over.

My test environment will be made from a few machines sitting on my home network. The first is my old workstation, 8GB RAM with Intel Core 2 Quad Q9300. I downloaded my images from MS tech-net for 2012 and 8.1 evals (and the tech previews for Win 10) and proceeded to install Hyper-V Server 2012 as a hypervisor for my VM’s which I shall use.

FAIL#1 So Hyper-V Server is a server core install with no GUI. Which is great if you know all of the powershell, but I find it easier with a GUI. So, another OS is needed. (I could have left Win7 on the machine and use virtualbox, which is my preferred desktop VM solution, but I thought Hyper-V would be a more interesting learning curve.) So onto Win8.1….

FAIL#2 win 8.1 – no slats?, i’ll be honest I don’t really know why this is in place, nore do I really care. It’s only because i’m running old hardware (I did say I was doing this on the cheap). Off to Windows Server 2012 datacenter it is then.

FAIL#3 managed to install Win Serv 2012 DC, but processor visualization was disable in the bios. Turned it on, and voila – a working Hyper-V host.

Lets go virtual

Got it up and running surprisingly quickly too.1 server os choice

So I managed to get a few VM’s up and running, and all talking to each other via a Hyper-V virtual switch (bridged to my home LAN also). WINNING!

New server time

So my other host will be a dual quad core Xeon X5355  system with 32GB of RAM. NICE. It’s an older Intel 1u rack server with 8 SAS drives in the enclosure (although I only have one actual drive).  Anyway here’s some Windows experience numbers.

results

Pretty good on the CPU and RAM, which is always good 😀 – the mobo is Intel S5000pal 

Here’s some pics.

a pic of the server with the lid off and some RAM removed for testing purposes. Check out all the fans.

a pic of the server with the lid off and some RAM removed for testing purposes. Check out all the fans.

The BIOS loading page.

The BIOS loading page.

CPU cores :)

CPU cores 🙂

SAS drive performance.

SAS drive performance.

Intel s5000pal motherboard

Intel s5000pal motherboard

additional SATA ports on the motherboard

additional SATA ports on the motherboard

a funky shot of the SAS drive bays

a funky shot of the SAS drive bays

code for parallel bit bang

I’ve just uploaded a video showing an update to driving ws2801 strings. This code is for driving them in parallel serial data strings, rather than sequential serial.

#define numleds 32
#define ledsperline 8
#define updatespeed 0
//this code is written for 4 lines of serial data!
int RED[numleds];
int GREEN[numleds];
int BLUE[numleds];
//
//line pin def's
int clockpin1 = 2;
int dataPin1 = 3;
int clockpin2 = 4;
int dataPin2 = 5;
int clockpin3 = 6;
int dataPin3 = 7;
int clockpin4 = 8;
int dataPin4 = 9;
//
//setup stuff
void setup()
{
//pinMode(13, OUTPUT);
pinMode(clockpin1, OUTPUT);
pinMode(dataPin1, OUTPUT);
pinMode(clockpin2, OUTPUT);
pinMode(dataPin2, OUTPUT);
pinMode(clockpin3, OUTPUT);
pinMode(dataPin3, OUTPUT);
pinMode(clockpin4, OUTPUT);
pinMode(dataPin4, OUTPUT);
for (int i = 0; i < numleds; i = i++)
{RED[i]=0;GREEN[i]=0;BLUE[i]=0;}
}
//
void loop() {
for(int l=0;l<32;l++){
RED[l]=l*8+1;BLUE[l]=0;
updatestring();
delay(updatespeed);
}
for(int l=0;l<32;l++){
GREEN[l]=l*8+1;RED[l]=0;
updatestring();
delay(updatespeed);
}
for(int l=0;l<32;l++){
BLUE[l]=l*8+1;GREEN[l]=0;
updatestring();
delay(updatespeed);
}
}
//
//main loop
void loop1() {
//assumption made that blue is on...
//fade to purple
for (int i=0;i<256;i++)
{for (int l=0;l<32;l++)
{RED[l]=i;}
updatestring();
}
//fade to red
for (int i=0;i<256;i++)
{for (int l=0;l<32;l++)
{BLUE[l]=255-i;}
updatestring();
}
//fade to yellow
for (int i=0;i<256;i++)
{for (int l=0;l<32;l++)
{GREEN[l]=i;}
updatestring();
}
//fade to green
for (int i=0;i<256;i++)
{for (int l=0;l<32;l++)
{RED[l]=255-i;}
updatestring();
}
//fade to cyan
for (int i=0;i<256;i++)
{for (int l=0;l<32;l++)
{BLUE[l]=i;}
updatestring();
}
//fade to blue
for (int i=0;i<256;i++)
{for (int l=0;l<32;l++) {GREEN[l]=255-i;}
updatestring();
}
}
//
//update function
void updatestring() {
for (int i =0;i<ledsperline;i++)
{
shiftOut1( BLUE[i],BLUE[i+ledsperline],BLUE[i+2*ledsperline],BLUE[i+3*ledsperline]);
shiftOut1( GREEN[i],GREEN[i+ledsperline],GREEN[i+2*ledsperline],GREEN[i+3*ledsperline]);
shiftOut1( RED[i],RED[i+ledsperline],RED[i+2*ledsperline],RED[i+3*ledsperline]);
}
for (int i =0;i<ledsperline;i++)
{
//shiftOut1(dataPin2, clockpin2, BLUE[i+ledsperline]);
//shiftOut1(dataPin2, clockpin2, GREEN[i+ledsperline]);
//shiftOut1(dataPin2, clockpin2, RED[i+ledsperline]);
}
for (int i =0;i<ledsperline;i++)
{
//shiftOut1(dataPin3, clockpin3, BLUE[i+2*ledsperline]);
//shiftOut1(dataPin3, clockpin3, GREEN[i+2*ledsperline]);
//shiftOut1(dataPin3, clockpin3, RED[i+2*ledsperline]);
}
for (int i =0;i<ledsperline;i++)
{
//shiftOut1(dataPin4, clockpin4, BLUE[i+3*ledsperline]);
//shiftOut1(dataPin4, clockpin4, GREEN[i+3*ledsperline]);
//shiftOut1(dataPin4, clockpin4, RED[i+3*ledsperline]);
}
//eerr
//delay(1);
delayMicroseconds(900);
}
//
//shift out fn
//http://forum.arduino.cc/index.php?topic=45529.0
void shiftOut1(uint8_t val1,uint8_t val2,uint8_t val3,uint8_t val4)
{
uint8_t i;
//
for (i = 0; i < 8; i++) {
digitalWrite(dataPin1, !!(val1 & (1 << (7 - i))));
digitalWrite(dataPin2, !!(val2 & (1 << (7 - i))));
digitalWrite(dataPin3, !!(val3 & (1 << (7 - i))));
digitalWrite(dataPin4, !!(val4 & (1 << (7 - i))));
digitalWrite(clockpin1, HIGH);
digitalWrite(clockpin2, HIGH);
digitalWrite(clockpin3, HIGH);
digitalWrite(clockpin4, HIGH);
digitalWrite(clockpin1, LOW);
digitalWrite(clockpin2, LOW);
digitalWrite(clockpin3, LOW);
digitalWrite(clockpin4, LOW);
}
//
}