Sys Admin

Activating Windows 8 64bit Enterprise from TechNet

For some reason the 64bit download of Windows 8 Enterprise from TechNet does not prompt for a license key but does try and activate – and then fails every time. When it does enter the normal activation process you’re likely to see a DNS error or something along the lines of being unable to connect to the remote activation service.

So credit to the forum at Techplex for the simple solution, albeit unclear why it is needed in the first place.

Solution: Right-click in the lower left screen corner and open a command prompt as admin. Type in the following and hit Enter.

slui.exe 3

The Windows Activation process will start, you can enter your TechNet license key and then the app will connect to the remote system and you should then have a properly activated Windows 8 device.

Infrastructure Design Sys Admin

IIS User Authentication

I’ve been designing a new secure Windows domain whose users need access to an IIS website in another domain. The obvious question is, “How can we transparently auth users to that site from both domains?” which IIS looks to make pretty easy – as long as there is a domain trust in place.

Looking around for more info I found an excellent article on WindowsITPro that explains all the various IIS authentication types. So I needed to share its goodness.

Sys Admin

Apport Disk Full Error Using apt-get

If you’re a Ubuntu user who finds themselves with an ugly message like this one day when running a apt-get update,

No apport report written because the error message indicates a disk full error

you may have thought you’ve run out of disk space and run the command,

df -h

but then found you had plenty of space free. Well maybe you do have plenty of bytes free but what about inodes? They’re effectively a limitation of the number of files you can have in a filesystem.

How-To Sys Admin

DRBD: Forcing a full re-sync in a split-brain situation

I have a DRBD setup similar to an old post that’s being used between two Ubuntu servers hosting MySQL. Every few months though the pair goes into a split-brain situation where the secondary can’t see the primary and refuses to reconnect. Users are unaffected as the primary is still working fine, but the HA is lost.

After trying a few different combinations of commands this is what seems to work best for me and cause the quickest recovery. I’m only dealing with a 10GB device so a full sync takes about 10min. If you’re using DRBD for a much larger device, make sure you consider the sync time before doing this.

On the secondary node:
drbdadm secondary all
drbdadm disconnect all (it's status goes to Secondary/Unknown)
drbdadm invalidate all
drbdadm connect all

On the functioning primary node:
drbdadm connect all (a full sync now starts)

Remember, it’s your data you’re dealing with so make sure you’re responsible before you run commands like this.

Update – no sign of the root cause of the issue either. After a system update that included the drbd package, things seem to have settled down.

Sys Admin

Using SQL Management Studio in Windows 7

If you happen to be using SQL Management Studio in Windows 7 and need to connect to a SQL 2005 instance not running on the standard port of 1433, you might be having some problems connecting. For some reason this mix seems to require the SQL port to be manually defined when connecting to any named instance.

The fix is to specify the port in the server name used in the Connection prompt. So if your SQL instance was called SQL02 and running on port 3433, you’d use “MySql2005Server,3433 SQL02”.

If you don’t know the port that SQL server is running on (maybe you have an external vendor supporting SQL), you can connect to the server from a Windows XP machine and run,

netstat -a | find /i "mysqlserver"

This will show you the network connection from your machine to the SQL server and the port being used.

Code Sys Admin

Using PHP exec() with IIS6

There are a few work arounds I’ve found since having to use PHP under IIS6 and Windows 2003. Every now and again I come across something that just doesn’t work the same way with this variation of web server, OS and PHP.

I needed to double-check the DNS hostname being reported from users on an internal website. Our DNS is a little scratchy when it comes to scavenging and keeping itself tidy, so often a DNS lookup of the client IP will give an incorrect name. This happens especially for laptops that hop off and on wireless APs.

So to compare against DNS (and because it’s an internal site) I thought to query the machines NetBIOS name with,

exec("nbtstat.exe -A",$r);

and that quickly fails with an error about “failing to fork”. Essentially this means, PHP can’t do what you want.

It boils down to file permissions. you need to run cmd.exe and nbtstat.exe with that single command. Both those files are secured against non-system users – probably rightly so too.

To resolve, just allow your IUSR_SERVER user to have read and execute permissions on both those files. Your exec() command should now be working.

REMEMBER: You are responsible for the security of your server. If you really don’t need to let programs run on your web server, then don’t.

Sys Admin

Watching your Network Usage

I’m sure everyone else knows about the iftop tool, but it was new to me. I needed to confirm that traffic from DRBD was using a particular interface and iftop does the job by showing traffic sources, speed and culmulative data counts per interface.

The iftop tool shows you usage per interface
How-To Sys Admin

Missing Network Interfaces in Ubuntu Under VMware ESXi

Every now and again I clone a VM and add it to another host. ESXi prompts you for a new UID when you start the VM and I always remove the virtual network card(s) from the machine and re-add them later. I do this to make sure I don’t have two machines with the same MAC addresses on the network. But if you do this with Ubuntu, the new NIC(s) don’t get picked up by the OS. This is almost certainly not specific to VMware or their ESXi product, it’s just the environment I’m using.

This problem seems to be caused by a lack of automatic hardware probing at boot, probably for a good reason but I’m no Linux kernel guru so won’t make a judgement there. The root of the issue is located in the file /etc/udev/rules.d/70-persistent-net.rules where you’ll see the old interfaces still listed alongside the new ones. Simply remove the old NIC(s) and ensure the new ones have the MAC addresses you expect and the correct ethx labels. Give the system a reboot and you should be happy.

Steps to resolve a missing network interface in Ubuntu 10.04 Lucid Lynx (and possibly earlier):

  1. sudo nano /etc/udev/rules.d/70-persistent-net.rules
  2. Delete the lines with the old interfaces after comparing with your VMs newly assigned MAC addresses.
  3. Confirm the interface names are what you expect at the end of each line.
  4. Ctrl-X to save and exit.
  5. sudo shutdown -r now
  6. Run ifconfig to confirm the interfaces are up with the correct IPs.
  7. If the interfaces are up, check your /etc/network/interfaces config to adjust IP settings as required.
How-To Sys Admin

Installing VMware Server 2.0.2 in Ubuntu 10.04

After updating my trusty old server to Ubuntu Lucid Lynx 10.04 the installation of VMware Server 2.0.1 started giving problems. Resinstalling VMware didn’t help as I was repeatedly getting compilation problems in vmmon and vmnet modules. Luckily I stumbled across the following process from one of the VMware forum pages which pointed to a great work-around from the radu cotescu site.

So I take no credit for this but simply repeat it here so that the search gods may recognise it’s usefulness and +1 it’s importance.

Start by downloading VMware Server 2.0.2 from the official VMware site. If you haven’t already got a few licenses, get one now. (They’re free so you might as well get a few) I’m going to assume the downloaded file is in your home directory.

You also need to update the header files for your current kernel so that the configuration scripts from VMware can build the appropriate modules.

sudo apt-get install linux-headers-`uname -r` build-essential

Now just run the following commands.

cd /usr/local/src
sudo wget []
sudo tar xvzf raducotescu-vmware-server-linux-2.6.3x-kernel-592e882.tar.gz
cd raducotescu-vmware-server-linux-2.6.3x-kernel-592e882/
sudo cp /home/<your_username>/VMware-server-2.0.2-203138.i386.tar.gz .
sudo tar xvzf VMware-server-2.0.2-203138.i386.tar.gz
sudo chmod +x

If you have a previous installation of VMware Server, you’ll be prompted that it’ll be removed as part of the install. Don’t worry, any guest VMs you had should still be there afterwards. The script will run through the usual prompts and you’ll see references to the patched files from Radu Cotescu. After a few minutes you should have a working install of VMware Server 2.0.2 on your Ubuntu 10.04 server.

Sys Admin


If you’re struggling to get the LDAP extension to work in PHP and IIS6 then you may want to read on. In my situation both the web server and PHP were confirmed to be working fine and reading the correct php.ini. But even with the correct line enabled in the php.ini file, LDAP would refuse to show in phpinfo() output.

After some searching of my own, it turns out that IIS6 on Windows Server 2003 (possibly XP too) will not properly read the PATH variable. So if you add the path to your PHP directory to the end of PATH, the DLLs required are still not found. This looks to affect IIS6 specifically as filesystem calls to the same DLLs did find them.

The solution – add the path to your PHP install to the start or earlier in the PATH variable and restart IIS. In my experience you will now see the LDAP options appear in your phpinfo() output.