Grant McWilliams

Tech

Tech

Fat32 is a very poor filesystem and Nokia chose it for the n900's MyDocs directory so Windows users could view their files if the n900 is plugged into a Windows PC via USB cable. Those of us who use the n900 on Linux machines (or use SSH/SFTP to access files) have the flexibility to use a better filesystem.

 

 

sed -i '1d' /usr/sbin/mmc-mount

echo -e '#!/bin/sh\ncase "$(sfdisk -c $(echo $1 | cut -c1-12) $(echo $1 | cut -c14))" in\n  43|83)\n    mount -t auto -o $3,noauto,nosuid,noatime,nodiratime "$1" "$2" > /dev/null\n    ;;\n  *)\n    '$(cat /usr/sbin/mmc-mount)'\n    ;;\nesac' > /usr/sbin/mmc-mount

sed -i 's/\(| 1e\)/\1 |43|83/' /usr/sbin/osso-mmc-mount.sh

umount /home/user/MyDocs

sfdisk -c /dev/mmcblk0 1 43

mkfs.ext3 -m 0 -L "Nokia N900" /dev/mmcblk0p1

osso-mmc-mount.sh /dev/mmcblk0p1 /home/user/MyDocs

chown -R user:users /home/user/MyDocs

Add a comment

 

You might say I have a long distro history so I'll add my 1.7 cents (it was 2 cents before the recession).

 
Loved Mandrake until it got buggy. 
Mandriva came from Mandrake but never recaptured the glory.
  1. Both had very easy to use but powerful administration tools. 
  2. Wonderful menu structure
  3. Looked good
  4. Excellent hardware discovery. It could load the drivers for your blender if you could plug it in.
  5. Package management from the Gods when mortal man was painting on cave walls.
Why I stopped using them
  1. unstable repositories. Software was constantly broken. 
 
CentOS for servers - it's just the most stable feature rich distro for servers (from the commandline). 
 
SuSe for servers if you insist on using a GUI to manage it. Has the best GUI Server admin tools.
 
Ubuntu 8.04 - 10.10
  1. Tons of software packages
  2. Gnome2 became usable for bipedal primates with large frontal lobes.
  3. Install process so easy a baby stuck in a mineshaft could do it. 
  4. Everything just works and when it stops shaking a rubber chicken seems to help. If it doesn't work on Ubuntu it probably doesn't work on anything that runs Linux including orbiting brain lasers and fembots with a penchant for evil.
Why I'm looking for a replacement
  1. Software packages broken.... sounds familiar.
  2. Got tired of looking at desktop color themes best reserved for a 1970s kitchen with accompanying man cave with wall to wall shag carpet.
  3. Moved to the Unity desktop which is targeted at a branch of hominids possessing much smaller brain functionality that have been extinct for roughly 4 million years. Possibly as a result of a poor market study with limited subject availability to question and those who they could dig up didn't have much to say.
  4. Including the word Ubuntu in my online dating profile has not improved love matches. In addition translating the original Swahili meaning to English only leaves me looking a bit creepy.
  5. Ubuntu sounds like something my kids used to say when they were a year old and needed changed. Looks like it too.
 
Distributions I'm interested in but haven't made a decision about
 
Linux Mint DE
  1. Based on Debian so the software packages may actually work
  2. Uses the XFCE desktop so any sane human should feel comfortable with it.
Possible downfalls:
  1. A bit rough
  2. A bit ugly
  3. Linux Mint DE with a port scanner vs. Clint Eastwood with a Bowie knife would be a good fight.
  4. Having the same name as another distribution that has broken packages gives me the shivers.
 
Mageia

  1. So far every single package in the repository works. Ex Mandrake developers who must have learned their lesson.
  2. Doesn't talk to me like I'm a baby   

Possible downfalls:
  1. Only two packages in the repository.
  2. Just when I learned to pronounce Ubuntu this comes along.

 
The nice thing about Linux is you can try them all for zero dollars. I think a good practice though is to have a shared network drive where you put all of your stuff so if you choose to wipe out your machine you don't lose anything. Actually this is a good practice on any OS.
 

 

Add a comment

 Note: This post will mean a lot more to those of you living in the Seattle/Tacoma/Olympia area and attempting to use public transportation. It's meant to be humorous but based in reality in a sort of depressing way.

The original Sound Transit announcement for reference.

-------------

Your current transit news from your transit news correspondent Haywood Jablomey.

Sound Transit remaps the 574 route to connect with the Sounder which goes in the OPPOSITE direction. So for those people traveling from the Airport to Seattle who want to transfer to the Sounder they can now do it at Lakewood… 35 miles from the city.

Pierce Transit after a massive service hour cut adds the 400 route to duplicate the service offered by the Sounder. Sound Transit counters by canceling a portion of the 578 route that duplicates what the PT 400 duplicates of the Sounder route thus saving tax payers $12 which is handed over to Piece Transit and immediately applied to it’s million dollar shortfall easing the tension between Piece Transit and all the cities that pay for it but it no longer services.

Sound Transit add Sunday service to the 578 for all the people who can’t connect to it using Sounder or Pierce Transit 400 due to there not being any weekend service on either.

Sound Transit discontinues the downtown Tacoma portion of the 586 because countless other services cover that route including the Oly Express which doesn’t stop at Tacoma Dome on hours ending with consonants on days ending in y (unless it’s raining then there’s a 50/50 chance due to the letter y not always being considered a vowel) resulting in 605 riders to the U District moving from a 2 seat ride to a 3 seat ride either 30%, 35% or 48% of the time.

Sound Transit extends Sounder south to get closer to 820 parking spots which couldn’t seem to squeeze near the 2283 already available stalls at Tacoma Dome Station thus encouraging people to drive south to park so they can catch the Sounder north back past their houses giving working husbands and wives a second chance to wave to their spouses and check on their lawns. Nobody else notices since the Oly Express still won’t make any sort of intelligent connection to the Sounder effectively keeping the 59x buses annoyingly full.

To discourage people from taking the Sounder Commuter Train Sound Transit has doubled the frequency of both the 590 and 594 in commute direction only thus making better use of empty parking spaces in the city that so far have not been fully utilized because in the past the buses were busy carrying people around. Coffee shops expect to see an increase in ticket sales from the hordes of ST bus drivers milling about during the day. It’s been proposed that cardboard “Occupy Wall Street” signs be added to their uniform so people won’t notice they are in fact employed bus drivers with nothing better to do.

Afraid that there may be some good news buried in the changes somewhere for at least ONE line Sound Transit has doubled the service runs of the 592 bus but stops short of actually delivering passengers anywhere useful. Options are to take the Sounder, walk a block to board the Link and travel one or two stops further north or south. Proposed changes are intended to either leave 592 riders stranded or irritated. Either is acceptable. Rumors of a conspiracy by Jamie Oliver to force long transit connection in an attempt to “slim Americans down” go unfounded. Rumors of him being awarded a second TED prize for an upcoming speech however just will not go away.

Not to leave a sour taste in anyone’s mouth Sound Transit has added ONE extra ST 510 run per day to Everett. It isn’t presently clear at what time a day it runs and it’s existence hasn’t been proven.

And that’s it for this week folks. Have a happy new year.

Add a comment

Grep in Linux is an amazing tool. Sometimes I just want the simplicity of grep in Python. This isn't the equal to grep but it will take a regular expression as an argument (two examples shown) and give a return code of success if found or None if not. It will also return the line just like grep. 

 

#!/usr/bin/env python
 
import re

def grep(patt,file):
    """ finds patt in file - patt is a compiled regex
        returns all lines that match patt """
    matchlines = []
filetxt = open(file) lines = filetxt.readlines() for line in lines: match = patt.search(line) if match: matchline = match.group() matchlines.append(matchline) results = '\n '.join(matchlines) if results: return results else: return None # Example use textfile = "/etc/hosts" file = open(textfile) criteria = "localhost" expr = re.compile(r'.*%s.*' % criteria) # finds line that starts with anything, ends with anything and has criteria in it #expr = re.compile(r'[0-9].*filename:(%s)\schecksum:.*result: (.*)' % criteria) # more complex example # using return code if grep(expr, file): print criteria + " is in " + textfile else: print criteria + " is not in " + textfile file.seek(0) # rewind file for next test # printing all matching lines results = grep(expr, file) print results file.close()

Since Python is so picky about indention (drives me crazy) you can download grep.py from my downloads section.

Add a comment

Prerequisites

  • XCP/Xenserver

 

Creating a template

The following is how to create new custom templates based on existing templates in Xen Cloud Platform. 

1. Get the template UUID that we want to use as our base. As usual just copy and paste the line in yellow into a root terminal on your XCP host.

xe template-list | grep -B1 name-label | awk -F: '{print $2}'

The output should look like this..

 

 688c625b-93b8-8e66-62e5-4542eca1e597

 Red Hat Enterprise Linux 6 (32-bit)

 

 c4e28252-030f-524a-c5d8-7da85df3ccf5

Windows Server 2003 (64-bit)

......

 

Scroll through the list and find the template you want to clone then copy and past it's UUID number ie.  688c625b-93b8-8e66-62e5-4542eca1e597. Choose a new name for your custom template and enter the following line with the UUID of the template you want to clone and the name you want it to have.

 

xe vm-clone uuid=<UUID> new-name-label="<NAME>"
xe template-param-set uuid=<UUID> other-config:install-methods=http,ftp,nfs other-config:default_template=true

Now you should have a new template of your own that you can customize. More after the jump.

Add a comment

Once you've created a VM from one of my other tutorials (CentOS 64bit/CentOS 32 bit) you may want to make copies/clones and/or backup the images. There are several ways that you can make a backup copy of a VM all with subtle differences so we'll cover them below. 

 

Copying a Virtual Machine

The following is how to make a full copy of a VM on Xen Cloud Platform. When you do a full copy it does just that, it creates a new VM and makes a full copy of the disk.

Syntax from the XenServer Administrators Guide

vm-copy new-name-label=<name_for_copy> [new-name-description=<description_for_copy>] 
[sr-uuid=<uuid_of_sr>] [<vm-selector>=<vm_selector_value>...]

This may need a bit of explaining. You need to know a couple of items before you can make a copy of a VM.

  1. The Name or UUID of the old VM
  2. The Name of the new VM
Optionally
  1. The Description of the new VM
  2. The Storage Repository to hold the new VM

 

The simplest method of copying a VM would be to just accept the defaults.

 

[root@cloud1 ~]# xe vm-list
uuid ( RO)           : adde907a-3b85-80e5-e7c9-47718dd1d55b
     name-label ( RW): baseimage
    power-state ( RO): halted
[root@cloud1 ~]# xe vm-copy name-label=baseimage new-name-label=baseimage-copy
 

This process may take a few minutes depending on the size of the disk image. It's worth noting that it's more reliable to use a VM's UUID to identify it than it's name and the reason for this is that XCP allows you to have more than one VM in a pool with the same name. The line above would look a bit different if we'd used the VM's UUID.

[root@cloud1 ~]# xe vm-list
uuid ( RO)           : adde907a-3b85-80e5 -e7c9-47718dd1d55b
     name-label ( RW): baseimage
    power-state ( RO): halted
 [root@cloud1 ~]# xe vm-copy vm-uuid=adde907a-3b85-80e5-e7c9-47718dd1d55bnew-name-description="Copy of baseimage" new-name-label=baseimage-copy new-name-label=baseimage-copy

 

Using the UUID isn't quite as people friendly as name-label because UUID's are a bit scary looking. I usually use name-label to identify VM's unless something funky is going on then I'll switch over to UUIDs. For instance I rebooted a VM by name-label and was logged into the whole time and it clearly didn't reboot. While troubleshooting I realized I had two VMs with the same name-label and XCP rebooted the one I wasn't logged into. Below is an example of multiple VMs using the same name-label.

  

[root@cloud1 ~]# xe vm-list name-label=baseimage-copy

uuid ( RO)           : 7062651a-6c05-ac3b-fe71-5dd9b6ca2c18

     name-label ( RW): baseimage-copyThe simplest method of copying a VM would be to just accept the defaults.

 

 

 

[root@cloud1 ~]# xe vm-list

uuid ( RO)           : adde907a-3b85-80e5-e7c9-47718dd1d55b

     name-label ( RW): baseimage

    power-state ( RO): halted

[root@cloud1 ~]# xe vm-copy name-label=baseimage new-name-label=baseimage-copy

 

This process may take a few minutes depending on the size of the disk image. It's worth noting that it's more reliable to use a VM's UUID to identify it than it's name and the reason for this is that XCP allows you to have more than one VM in a pool with the same name. The line above would look a bit different if we'd used the VM's UUID.

 

    power-state ( RO): halted

 

uuid ( RO)           : fce951a3-1105-6e36-b6db-09ba3fd37180

     name-label ( RW): baseimage-copy

    power-state ( RO): halted 

 

The other instance where I use UUIDs would be scripting. If I'm managing VMs using a shell script I'll always use UUIDs since shell scripts don't care about pretty name labels and UUIDs are more reliable.

You may want to add a description to the VM as well for future reference.

[root@cloud1 ~]# xe vm-list
uuid ( RO)           : adde907a-3b85-80e5-e7c9-47718dd1d55b
     name-label ( RW): baseimage
    power-state ( RO): haltedthe Man, the Myth, the Legend
 [root@cloud1 ~]# xe vm-copy name-label=baseimage new-name-label=baseimage-copy new-name-description="Copy of baseimage"
[root@cloud1 ~]# xe vm-list name-label=baseimage-copy params=name-description,name-label 
name-label ( RW)          : baseimage-copy
    name-description ( RW): Copy of baseimage
  
 
 
Sometimes you need to specify the Storage Repository to copy the image to. In the examples above the disk image will be copied to the DEFAULT Storage Repository so normally you don't have to specify. However there are several cases where you may want to specify. An example of this would be if the storage repository you want the VM copied to isn't default.
[root@cloud1 ~]# xe sr-list 
uuid ( RO)                : 92bf5d33-a164-d75c-26c0-3f53f0490ba0
          name-label ( RW): iSCSI_Disk2
    name-description ( RW): SSD on cloud0
                host ( RO): <shared> 
                type ( RO): lvmoiscsi
        content-type ( RO): user
[root@cloud1 ~]# xe sr-list
uuid ( RO)                : 92bf5d33-a164-d75c-26c0-3f53f0490ba0
          name-label ( RW): iSCSI_Disk2
    name-description ( RW): SSD on cloud0
                host ( RO): <shared>
                type ( RO): lvmoiscsi 
        content-type ( RO): user
[root@cloud1 ~]# xe vm-copy name-label=baseimage new-name-label=baseimage-copy new-name-description="Copy of baseimage" sr-uuid=92bf5d33-a164-d75c-26c0-3f53f0490ba0
 
 This will copy the VM to the Storage Repository with the UUID of 92bf5d33-a164-d75c-26c0-3f53f0490ba0. Be careful with this though. If the Storage Repository isn't accessible by that host ie. it isn't shared then the VM won't be able to start. 
 

Cloning a Virtual Machine

Cloning a VM is very similar to Copying it with the exception of it being much faster and you can't choose your Storage Repository. You can't specify the Storage Repository because it creates a Copy on Write instance of the original disk. This means the clone goes very fast due to it not writing very much data. As a VM changes the contents of the disk by adding/removing files the changes are stored in the Copy on Write clone and not the original disk. This means you can create them very fast but you can't clone to a new Storage Repository.

[root@cloud1 ~]# xe vm-list
uuid ( RO)           : adde907a-3b85-80e5-e7c9-47718dd1d55b
     name-label ( RW): baseimage
    power-state ( RO): haltedthe Man, the Myth, the Legend
 [root@cloud1 ~]# xe vm-clone name-label=baseimage new-name-label=baseimage-copy new-name-description="Copy of baseimage"
[root@cloud1 ~]# xe vm-list name-label=baseimage-copy params=name-description,name-label 
name-label ( RW)          : baseimage-copy
    name-description ( RW): Copy of baseimage

 

Something to keep in mind. If you clone VM1 to VM2, then clone that to VM3 and so on you will eventually have a great deal of overhead writing to the disks. Each time a VM wants to write to disk Xen Cloud Platform has to check each disk image to see what's changed. Therefor it's recommended to clone the original and not clone a clone. If you have multiple levels of clones you can do a vm-copy to make a fresh new VM disk to restore performance.

 

Add a comment

If you're running virtually any version of Xen Cloud Platform you may have run into this error message.

Your license has expired.  Please contact your support representative.

It's not really possible to have an expired license on Xen Cloud Platform (XCP) since it's FREE. It's just a regressive bug that has been very stubborn. However, until they fix it for real in XCP 1.5 you'll need follow the steps below.  

Open a root terminal on the XCP host and copy and paste the commands below.

 

service xapi stop;sleep 5
NEXTMONTH=`date --date="next Month" '+%Y%m%d'`
sed -i "s/\(expiry.\{3\}\)[0-9]\{8\}/\1$NEXTMONTH/g" /var/xapi/state.db
service xapi start
echo done

 

The last line is only to get all the important lines to run automatically. If you don't hit enter it doesn't hurt anything.  You could also copy and paste these lines into a script and have it run as a cronjob. Because XCP doesn't like you bumping it's "evaluation license" out more than 30 days you might want to run the cronjob once a week to make sure your license doesn't lapse while you're waiting for the cronjob to run

Add a comment

Note: updated for XCP 1.5b/1.6 and Xenserver 6.x.

Install Type

  • Non-interactive
  • Network boot
  • Commandline
  • Paravirtualized

Prerequisites

  • XCP/Xenserver
  • Access to Internet
  • Working DHCP server
  • Working DNS name resolution

Introduction

This tutorial was written in the spirit of my CentOS 6 virtual machine (64 bit) installation on Xen. In those tutorials I created a disk, downloaded a kernel, kickstart file plus a xen config file which installed CentOS using the kickstart file. This has proven very popular since you can't install a paravirtualized domain using an install disk. This has been a very nice installation howto because you don't have to download any install CD/DVDs and you could create VMs using nothing more than a commandline login. It's also very nice because it can be mirrored locally if you're doing a bunch of them just by rsyncing a CentOS mirror locally then downloading my files and editing them.

 

Add a comment

Note: Updated for XCP 1.5b/1.6

Install Type

  • Non-interactive
  • Network boot
  • Commandline
  • Paravirtualized

Prerequisites

  • XCP/Xenserver
  • Access to Internet
  • Working DHCP server
  • Working DNS name resolution

Introduction

This tutorial was written in the spirit of my CentOS 6 virtual machine (32 bit) installation on Xen howto which was based on the CentOS 5 version of the same. In those tutorials I created a disk, downloaded a kernel, kickstart file plus a xen config file which installed CentOS using the kickstart file. This has proven very popular since you can't install a paravirtualized domain using an install disk. This has been a very nice installation howto because you don't have to download any install CD/DVDs and you could create VMs using nothing more than a commandline login. It's also very nice because it can be mirrored locally if you're doing a bunch of them just by rsyncing a CentOS mirror locally then downloading my files and editing them.

I've recently migrated a lot of my XEN systems to Xen Cloud Platform and it's a very different animal indeed. However, I still needed a system of creating CentOS Virtual Machines in that same manner. I didn't want to download a CentOS install DVD or need a graphical login to install the OS thus this tutorial was born.

It uses the very same CentOS 6 kickstart file from my site as the Xen tutorial. It also uses the very same CentOS 6 repositories on the Internet so in a lot aspects it IS the same tutorial crafted for XCP but will be a bit shorter.

 More after the jump.

Add a comment

Note: Updated to work with XCP 1.5b/1.6

Install Type

  • Interactive
  • Network boot
  • Commandline
  • Paravirtualized

Prerequisites

  • XCP/Xenserver
  • Access to Internet
  • Working DHCP server
  • Working DNS name resolution

Introduction

This tutorial was written in the spirit of my CentOS 6 VM (64 bit) automated installation on XCP  howto. In that tutorial I do an automated network installation of CentOS 6. This has proven very popular since you can't install a paravirtualized domain using a physical install media. This has been a very nice installation howto because you don't have to download any install CD/DVDs and you could create VMs using nothing more than a commandline login. It's also very nice because it can be mirrored locally if you're doing a bunch of them just by rsyncing a CentOS mirror locally then downloading my files and editing them.

There became a need to do the same thing using OpenSuse thus this tutorial.  

Add a comment