Tuesday, 6 December 2011

Shutdown stalls using HAST + ZFS

I've been playing around with hast and zfs which is pretty neat.

However, I have found a problem where if you try to restart a host that is running HAST as a primary node with a mounted zpool the server fails to complete the shutdown process and requires a hard reset.

You can fix this by modifying the HAST init script and force it to unmount any zfs filesystems before stopping HAST.

vi /etc/rc.d/hastd


hastd_stop_precmd()
{
        zfs unmount -a
${hastctl} role init all
}

After adding the zfs unmount command into the hastd_stop_precmd section as shown above you should be able to safely restart your system

Note: If you do a csup at any point this change could be overwritten so take care. Also, be aware that this will unmount all zfs filesystems, if you need to only unmount a specific filesystem then you should modify the unmount command accordingly.

Saturday, 3 December 2011

Skyrim

My son is a big Elder Scrolls fan so as soon as Skyrim was released he was on it like fleas on a dog. He kept telling me all about it and didn't appear to have any issues so I broke a long standing rule of mine and actually purchased a new release game for the first time in 5 years or more.

I played for about 40 hours with us chatting via Steam chat and apart from about 3 spontaneous crashes to the desktop and one dungeon (Bonechill Passage) that I had to navigate by walking backwards (otherwise it would crash every time a baddy saw me) I didn't have a lot of trouble with it.

Less trouble than you normally get from a damned Bethesda game anyway.

Then along came the 1.2 patch which purported to fix a whole lot of bugs that I wasn't seeing.

What an unmitigated disaster.

Now, Skyrim is totally unplayable.

For some reason, every time I fire an arrow the game hangs, requiring it to be killed in task manager.

Every. Single. Time.

This sucks because my level 15 wood elf has zero magic skills and is built entirely around sneak and archery.

I've tried reverting to an older save. This seemed to fix it for a bit, until I entered a dungeon, where I attempted to fire off an arrow and, yes, you guessed, lock up city again.

This is fricking ridiculous.

I removed Skyrim from Steam and reinstalled it. First I tried to install it with Steam offline to ensure that the update wasn't slurped down again but of course you can't install a game from DVD while offline because the goddam DRM won't allow it.

Fuckwits.

So, I had to install with Steam online which I did. In order to ensure that the patch wasn't installed I went into Skyrim properties and set it to NOT download updates while the install was going.

The install takes about half an hour, during which time I got distracted (I can only watch a progress bar for so long before I get bored)

When I noticed that the DVD activity LED was no longer showing any activity I jumped back to Steam only to find WTF?, the fricking patch has started downloading and there is no way that it can be stopped.

Skyrim simply refuses to start until the patch has installed.

What the FUCK? Am I playing Battlefield 3 here? A multiplayer game where it is important that all the players are on the same version of code?

No I am NOT.

This is a single player game and it is MY goddam computer. I should decide what version of code to run not some ASSHAT who works at a computer game company.

I've got a good mind to take this game back for a refund and find a pirate version at the bloody pirate bay.

I hate the way the game industry has become over the last 30 years.

Tuesday, 22 November 2011

Update FreeBSD Sources and Rebuild World

To update your source tree and rebuild your kernel to ensure it matches the sources follow these steps.

Copy the sample supfile to /root;

# cp /usr/share/examples/cvsup/standard-supfile ~

Edit the supfile and change the line that says;

*default host=CHANGE_THIS.FreeBSD.org
So that it points to a server that is local to you. On mine I use the au mirror;
*default host=cvsup.au.freebsd.org
If you already have a working supfile, ensure it contains a line;

# src-all

Execute csup to download the kernel sources;

# csup ~/standard-supfile

Compile everything;

# cd /usr/src
# make buildworld
# make buildkernel


Install the new kernel;

# make installkernel

Reboot into single user mode;

# init 6

In single user mode execute these commands;

# adjkerntz -i
# mount -a -t ufs
# mergemaster -p
# cd /usr/src
# make installworld
# mergemaster


Reboot;
# init 6

This was lifted from the FreeBSD documentation;

http://www.freebsd.org/doc/handbook/makeworld.html

Friday, 18 November 2011

Installing VirtualBox OSE in FreeBSD 9

Installing VirtualBox from the FreeBSD ports tree is not as straightforward as you may expect.

You may in fact hit a couple of snags. The first one is that you are required to have the FreeBSD kernel source installed or else it will stop while trying to compile the network drivers.

The second is an incompatibility between VirtualBox and the newer kernels which results in the following error during compilation;

error: 'D_PSEUDO' undeclared here (not in a function)

Perform the following steps as the root user to get Vbox installed.

First, you need to install the kernel sources and rebuild your world and kernel;

Once done, login again as root and change to the directory for the virtualbox-ose port;

cd /usr/ports/emulators/virtualbox-ose

This port will install virtualbox-ose-kmod as a dependency which is where the error causing the error shown above is hiding.

We need to edit one of the source files before we attempt to compile;

# vi ../virtualbox-ose-kmod/work/VirtualBox-4.0.12_OSE/out/freebsd.amd64/release/bin/src/vboxdrv/freebsd/SUPDrv-freebsd.c

On or about line 104 you will see the following C code;

#if __FreeBSD_version > 800061
    .d_flags =          D_PSEUDO | D_TRACKCLOSE | D_NEEDMINOR,
#else
    .d_flags =          D_PSEUDO | D_TRACKCLOSE,
#endif



Change it, removing the D_PSUEDO flag so it looks like this;


#if __FreeBSD_version > 800061
    .d_flags =          D_TRACKCLOSE | D_NEEDMINOR,
#else
    .d_flags =         
D_PSEUDO | D_TRACKCLOSE,
#endif


Now, we are ready to do a normal build of virtualbox;

make install clean


Use these configure options 

To allow VirtualBox access to hardware such as CD/DVD drives you should also install HALD;

cd /usr/ports/sysutils/hal

make install clean


Create /boot/loader.conf and add these lines;

atapicam_load="YES"
vboxdrv_load="YES"


Add these options to your /etc/rc.conf;

vboxnet_enable="YES" # Enable virtualbox
hald_enable="YES" # Required to allow virtualbox to access CDROM device
dbus_enable="YES" # Required by hald


Add these lines to /etc/devfs.conf:

own     vboxnetctl  root:vboxusers
perm    vboxnetctl  0660
perm  cd0   0660
perm  xpt0   0660
perm  pass0   0660


Add all users that need virtualbox to the vboxusers group:

# pw groupmod vboxusers -m username

Finally, reboot the machine;

init 6

Using ZFS on FreeBSD 9

I've decided to retire my Ubuntu based NAS and reload it with FreeBSD so that I can use ZFS.

I wanted to use ZFS deduplication which means that ZFS version 23 or later is required.

Since the upcoming FreeBSD 9 has ZFS v28 I decided to go with that, even though it is still only an RC.

I'm not going to boot off ZFS so there is no need to muck about trying to get that to work, although I believe it can be done.

Maybe another day.

So, I just did a vanilla FreeBSD install to my OCZ SSD and ignored the remaining drives in my server for now.

Once FreeBSD is installed, log in as root and do the following to create some ZFS "pools".

First, you need to identify the hard disks devices that are installed in your system;

# dmesg | grep ad | grep device
ada0: <OCZ 02.10104> ATA-8 SATA 2.x device
ada1: <SAMSUNG 1AA01113> ATA-7 SATA 2.x device
ada2: <ST32000542AS> ATA-8 SATA 2.x device
ada3: <ST32000542AS> ATA-8 SATA 2.x device

ada0 is my system drive which I will ignore.

The Samsung drive is a 1GB drive that I use for non critical stuff while the two ST32000 Seagates are 2TB drives that I will use to create my main pool for a total 4TB capacity.

Creating a ZFS pool is super easy. Lets' create a zpool called "store" out of the 2 x Seagates;

# zpool create store ada2 ada3

We can take a look at our pool;

# zpool list
NAME    SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
store  3.62T  0.00T   3.62T    0%  1.00x  ONLINE  -


To get a more detailed report, use the "status" command;

# zpool status
  pool: store
 state: ONLINE
 scan: none requested
config:

    NAME        STATE     READ WRITE CKSUM
    store       ONLINE       0     0     0
      ada2      ONLINE       0     0     0
      ada3      ONLINE       0     0     0

errors: No known data errors


If I had wanted to make a mirror from my two Seagates, I simply add the raidz paramater;

zpool create raidz store ada2 ada3

So, presently I have a ZFS pool, which has a default filesystem. You can see that it is mounted using the df command;

# df -h
Filesystem       Size    Used   Avail Capacity  Mounted on
/dev/ada0p2       55G     21G     29G    42%    /
devfs            1.0k    1.0k      0B   100%    /dev
store            3.4T    1.0k    3.4T     0%    /store


Normally, you would not just start dumping files straight onto the pool, but instead you create another filesystem to store your files in. You do this with the "zfs" command.

# zfs create store/archive

Check your mounted filesystems again;

# df -h
Filesystem       Size    Used   Avail Capacity  Mounted on
/dev/ada0p2       55G     21G     29G    42%    /
devfs            1.0k    1.0k      0B   100%    /dev
store            3.4T    1.0k    3.4T     0%    /store
store/archive    3.4T    1.0k    3.4T     0%    /store/archive


Now, one of the reasons for using ZFS is to use ZFS's deduplication and compression features. Let's turn those on;

# zfs set dedup=on store/archive
# zfs set compression=on store/archive


You could apply those commands directly to the pool if you like. When dedup is applied to the pool then the deduplication process applies to all filesystems within the pool.

Another neat thing about ZFS is how easy it is to share a filesystem using nfs. Of course NFS must be enabled on your system in /etc/rc.conf for this to work.

With NFS enabled, let's share store/archive;

zfs sharenfs="-maproot=0:0" store/archive

Unlike with "normal" NFS there is no need to restart any services after issuing this command, although you should note that is not recommended that you mix "normal" NFS (ie: /etc/exports) with ZFS controlled NFS.

In other words, keep your /etc/exports file empty.

My archive filesystem is now shared, but it is open to everybody. Usually I don't care about that at home but in other scenarios you may wish to restrict access to certain networks;

# zfs sharenfs="-maproot=0:0 -network 10.1.1.0 -mask 255.255.255.0" store/archive

You can see your existing exports by viewing the zfs/exports file;

# cat /etc/zfs/exports
# !!! DO NOT EDIT THIS FILE MANUALLY !!!

/store/archive    -maproot=0:0


You can get a whole bunch of stuff with this command;

# zfs get all store/archive
NAME           PROPERTY              VALUE                  SOURCE
store/archive  type                  filesystem             -
store/archive  creation              Mon Oct 31 10:39 2011  -
store/archive  used                  0.00K                  -
store/archive  available             3.4T                   -
store/archive  referenced            0.00K                  -
store/archive  compressratio         1.00x                  -
store/archive  mounted               yes                    -
store/archive  quota                 none                   default
store/archive  reservation           none                   default
store/archive  recordsize            128K                   default
store/archive  mountpoint            /store/archive         default
store/archive  sharenfs              -maproot=0:0           local
store/archive  checksum              on                     default
store/archive  compression           on                     local
store/archive  atime                 on                     default
store/archive  devices               on                     default
store/archive  exec                  on                     default
store/archive  setuid                on                     default
store/archive  readonly              off                    default
store/archive  jailed                off                    default
store/archive  snapdir               hidden                 default
store/archive  aclmode               discard                default
store/archive  aclinherit            restricted             default
store/archive  canmount              on                     default
store/archive  xattr                 off                    temporary
store/archive  copies                1                      default
store/archive  version               5                      -
store/archive  utf8only              off                    -
store/archive  normalization         none                   -
store/archive  casesensitivity       sensitive              -
store/archive  vscan                 off                    default
store/archive  nbmand                off                    default
store/archive  sharesmb              off                    default
store/archive  refquota              none                   default
store/archive  refreservation        none                   default
store/archive  primarycache          all                    default
store/archive  secondarycache        all                    default
store/archive  usedbysnapshots       0                      -
store/archive  usedbydataset         0.00K                  -
store/archive  usedbychildren        0                      -
store/archive  usedbyrefreservation  0                      -
store/archive  logbias               latency                default
store/archive  dedup                 on                     local
store/archive  mlslabel                                     -
store/archive  sync                  standard               default
store/archive  refcompressratio      1.00x


Finally, the list command will display all your ZFS filesystems;

# zfs list
NAME            USED  AVAIL  REFER  MOUNTPOINT
store          5.46T   841G  2.60T  /store
store/archive  2.70T   841G  2.70T  /store/archive


You may have noticed the numbers in the above grab and what's that? My store pool has 5.46T used but it only has a capacity of 3.6T! What gives?

Well, this command was issued after loading a whole bunch of files to the NAS and it just so happens that there are a lot of duplicates on there. The zfs list command shows you the total amount of space used as it appears to the operating system as opposed to the actual amount used on the disk.

If I issue the zpool list command I can see how much of my disk is deduped;

# zpool list
NAME    SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
store  3.62T  2.70T   942G    74%  2.02x  ONLINE  -


So, that's the basics of ZFS, enjoy!

Tuesday, 8 November 2011

Creating an MX record using the NetRegistry Zonemanager

I've just spent a frustrating couple of hours struggling to get an MX record to resolve using the NetRegistry "Zonemanager" (netregistry.com).

You need to use their "Zonemanager" web interface to create and update DNS records.


 
The trouble is, if you try to save that page (using the unhelpfully labeled "Edit Record" button) then it will fail because it does not like the trailling fullstop on the text in the "Name" field.

If you remove the full stop then the MX will now fail to resolve. In fact, putting anything in the "Name" field will cause your MX record to fail.

What you need to do is leave the "Name" field completely empty which then causes the "smoke and mirrors" function within Zonemanager to create a record that includes the magical domain name with trailing full stop entry.

Here is what the "Edit MX record" page looks like for a good MX entry.


I'm not even sure what that entry means, because when I set up an MX using bind the MX line has no entry at all in that furthest to the left position.

Anyway, fill your form out like this and it should be OK. The "Is Host Fully Qualified" tickbox doesn't seem to do anything.


This is how you should create an MX record using Netregistry Zonemanager.

Tuesday, 27 September 2011

MS To Use Secure Boot "Feature" To Reinforce Windows Lock-in

"A senior Red Hat engineer has lashed back at Microsoft's attempt to downplay concerns that upcoming secure boot features will make it impossible to install Linux on Windows 8 certified systems"

The Register September 26 2011

Without any doubt, Microsoft are the second most evil company in the world (after Monsanto)

Things that would be fatally damning for most other companies are constantly made public about MS and they continue on unchecked.

On the exceedingly rare occasion that they get prosecuted for something they simply throw a few "free" Windows + Office" licenses at the education institutions in the complaining jurisdiction and their troubles magically disappear.

The U.S. Government won't touch them because the U.S. has only 2 industries of any worth left, Tech and pop culture media.

These are the only things that the U.S. still has the ability to sell to the world, and it is no coincidence that these two industries are given complete freedom to screw everyone over in order to maintain their dominant positions in their respective markets.

Should the likes of MS, Oracle and Apple fall along with the MPAA and RIAA members then the USA would be truly irrelevant to 95% of the planet.

I'm sure their politicians are aware of this and thus they allow them to get away with anti-consumer practices across the board in order to retain their relevance in world markets.

All is not lost however because it is a negative strategy and ultimately negative strategies are destined to fail.

Despite their best efforts to use hostile litigation and anti-competitive lock-in strategies to keep at the top of the heap, eventually others will come along who offer better products with less pent up antagonism directed at them.

People increasingly come to resent being harassed, dictated to and having their choices removed for the benefit of corporate profiteers in another country.

People no longer *like* Microsoft, or their products. They associate them with boring jobs, and having to wait for ages while the crappy slow corp PC they have on their desk reboots after a crash . Even longer for patch Tuesday, not that they know what patch Tuesday is.

Microsoft and Windows are not cool. There is no "wow, I must get the new Windows phone" factor at play and the few remaining OS fanboys that are out there are not enough to sustain a corporation that is the size of the Beast of Redmond. On top of that, most of the OS fanboys have the ability (and willingness) to pirate their copies of Windows Ultimate Whizbang Professional Edition anyway.

If Microsoft do manage to achieve what they are trying to do with this latest lock-in gambit then they will just cause even greater dissent within their existing customer base and increase the rate of user defections to other forms of computing, such as tablets and such.

The thing that killed the netbook was MS and Intel trying to dictate to the OEMs what they could and couldn't build when it came to the Atom based laptops, known as "Netbooks".

In their arrogance they just assumed that everybody had no choice but to purchase PC's, and by creating a set of artificial limitations they could thereby force people to purchase PC's with a more expensive processor and OS just so they could get what they actually wanted, which was usually just a bit bigger screen.

Of course this strategy failed spectacularly and simply left a gaping hole in the market in which Apple promptly shoved the ipad to great success.

If MS succeed in their aims they will just push more people to purchase things other than PC's.

In fact, it is intel who should feel most scared by this. If MS succeed in tying x86 hardware to Windows alone then it will be the ARM vendors who will rush in to take up the slack.

I'm yet to be convinced that MS will be successful in their efforts to port their full Windows + Office stack to ARM so ARM makers would have no reason at all to yield to MS threats and lock their hardware to Windows.

Even if MS do succeed in getting Windows on to ARM, I doubt very much that most of the ARM vendors would be silly enough to listen to such threats anyway as it would mean cutting off what is currently 100% of their market in order to sell in a new market (Windows) which is completely unproven up to this point.

MS will fail. Every time they try one of the tricks that worked for them in the 90's they will find that those tricks no longer work in the more mature market of today.

They remind me of Bart Simpson on that episode where Lisa was using him as a psyche test subject with the electrified cupcake.

Hmmm, cupcake, OUCH!!!

grrrr

Hmmm, cupcake, OUCH!!!

grrrr

Hmmm, cupcake, OUCH!!!

grrrr