Categories: , ,
Posted by: bjb

I found this procedure for starting to use IPv6 on a home network. It is specific to Debian and the SixXS tunnel broker. Many thanks to Martin Krafft for this very nice description that starts with the firewall rules and moves on from there.

Posted by: bjb

Making xen images from tar files means I get to work with large files. Sometimes I need to poke inside those files before they are made into a disk image. I found that tar on Debian lenny does not have the --occurrence keyword for stopping after the n’th occurrence of a file in the image. tar on Debian squeeze has that keyword. Unfortunately there is no tar in backports, so I get to build the tar sources from squeeze (1.23) on lenny.

I need this because I have stored some parameters into the tarfile for quick extraction at restore time. I made sure to put that file early in the tarfile, but because tar on lenny doesn’t understand the --occurrence=1 parameter it still takes something like 5 or 10 minutes to read through the whole file before moving on to the next step. That’s just a tad painful when developing and testing restore scripts.

For reference:

  • tar on Debian lenny: 1.20-1+lenny1
  • tar on Debian squeeze: 1.23-3

    bjb$ tar --help | egrep occur
          --occurrence[=NUMBER]  process only the NUMBERth occurrence of each file

Categories: ,
Posted by: bjb

I want to get an IPv6 address from The first step is to apply for an account. They gave me one. I tried to use the username/password credentials to log in, and was not able to read the page. I guess it must be xhtml, and it had some kind of error right after the head element. So all I got was a message in the browser saying that there was an error on line 14 character 8.

I tried logging in again today, and was able to see a page full of info.

I don’t know what the problem was. Could have been a problem on the remote end, or maybe I didn’t have cookies enabled. It works now, and I was able to apply for a tunnel. We’ll see what happens next!

Categories: , , ,
Posted by: bjb

I’m trying to run xen 4.0 but it’s not working, It seems that the input devices (keyboard and mouse) are not being supplied to the linux kernel from the xen hypervisor.

I’m keeping this here for easy reference.

Categories: ,
Posted by: bjb

Another bug I want to keep track of:

This one refers to the breakage of the —ip=auto in xen-create-image from xen-tools 4.2-1. Some parameter checking was implemented, and the value if the —ip option is supposed to resemble an IPv4 address (but the literal string “auto” obviously doesn’t look like an IPv4 address).

UPDATE: fixed in 4.2.1-1. Yay! Unfortunately, it’s not in Debian squeeze, it’s in unstable. To get it, but still prefer stable packages for everything else:

echo 'deb unstable main' >> /etc/apt/sources.list
echo 'APT::Default-Release "stable" >> /etc/apt/apt.conf
apt-get update
apt-get install -t unstable xen-tools
Categories: ,
Posted by: bjb

When learning about formsets, it was never clear to me how many submit buttons there would be:

  • one per form
  • one for the whole formset.

It turns out, there is one submit button for the whole formset.

Posted by: bjb

Using xen-create-image in a “restore from backup tgz” scenario.

xen-create-image  --dist option

can create your own distro (called option) hooks that might:

  • adjust the new ip address (add extra interfaces as on old machine)
  • restore the database from a proper dump

Don’t run the distro hooks (like lenny) that would destroy your carefully crafted old machine

Note that the --dist option is NOT ignored when you use --install tar option. You will need to make your own dist script set (on Debian, look in /usr/lib/xen-tools).

In addition, you can run extra scripts using the —role option. Roles can be combined: --role udev,pg_restore,etc

Note that the xen-create-image --config option takes a xen-tools config file, not a xen cfg file. Also, the —config option does not replace the “global” config file, it augments it.

Categories: ,
Posted by: bjb

South migration names cannot have hyphens in them. grrr.

In fact they cannot have anything but alphanumeric characters and underscore.

Categories: , ,
Posted by: bjb

If you’re getting the error:

-sh: <( compgen -f -X -- 'b' ): No such file or directory

when you’re trying to invoke filename completion, for example like this:

bjb@edouard:/etc$ ls b<tab>

where you typed a b and then tab, to find all the directory entries in /etc that start with b, then you might have the posix option set on your shell while using an old version of bash_completion package. The version that gave me grief was 20080705. Another machine has version 1:1.2-3 and it doesn’t suffer from this problem.

You can check by showing the contents of $SHELLOPTS:


(And getting the package version number: apt-cache policy bash_completion.)

If the contents of the SHELLOPT shell variable includes the posix keyword, then you will need to disable posix because the shell completion implementation in bash-completion 20080705 doesn’t seem to be posix compliant.

set +o posix

will turn OFF posix mode, and

set -o posix

will turn ON posix mode.

So to make command line completion work, I had to give the command set +o posix CORRECTED 2010-12-16

Figuring this out introduced me to an interesting shell construct that I hadn’t seen before. In the old version of /etc/bash_completion, in function _filedir, you see this:

        local IFS=$'\t\n' xspec

        _expand || 0

        local toks=( ) tmp
        while read -r tmp; do
                [[ -n $tmp ]] && toks[${#toks[@]}]=$tmp
        done < <( compgen -d -- "$(quote_readline "$cur")" )

        if [[ "$1" != -d ]]; then
                while read -r tmp; do
                        [[ -n $tmp ]] && toks[${#toks[@]}]=$tmp
                done < <( compgen -f -X "$xspec" -- "$(quote_readline "$cur")" )

        COMPREPLY=( "${COMPREPLY[@]}" "${toks[@]}" )

It is the <( some command with output to stdout ) construct that I hadn’t seen before. It represents “process substitution” and the man page says it “is supported on systems that support named pipes (FIFOs) or the /dev/fd method of naming open files. It takes the form of <( list ) or >( list ). The process list is run with its input or output connected to a FIFO or some file in /dev/fd. The name of this file is passed as an argument to the current command as the result of the expansion. If the >(list) form is used, writing to the file will provide input for list. If the <(list) form is used, the file passed as an argument should be read to obtain the output of list.”

And also I relearned about the declare -f which will show you all the function definitions your shell currently knows about.

Categories: ,
Posted by: bjb

My app wasn’t running in the virtualenv I had prepared for it … I activated a virtualenv by sourcing /usr/local/pythonenv/DJANGO-1-1/bin/activate, and then ran ./ runserver. However, according to the debug stuff I put in the template (django.get_version() and python.VERSION), the app wasn’t using the right django.

It turns out that has #!/usr/bin/python at the top — it wasn’t running the python in the path but a hardcoded path to the system python. To use the virtualenv’s python, change that top line to:

#!/usr/bin/env python

This will use the python that can be found in the path of the calling process — which is what you want when using virtualenv.

It may be that newer django’s will generate the /usr/bin/env line, but if you created your project with an older django, you might need this step.