Category Archives: Remember This

Invalid method in request \x16\x03\x01

So, ran into this one. Firefox is throwing this error, along with ‘SSL_ERROR_RX_RECORD_TOO_LONG’. Turns out, apache was serving plain HTTP on port 443, as it hadn’t been given a default SSL config.

Other causes may be: Corrupted SSL cert (rare). Mis-configured proxy. Not adding “SSLEngine On” after configuring an SSL cert. But mostly, you’re trying to talk HTTPS to an HTTP serving webserver.

`a2ensite default-ssl` (on debian) fixed it. Well, fixed in in that the default server now has a snake-oil self-signed cert, but, you know, fixed it. 🙂

Possible missing firmware on debian squeeze

If you get these errors:
W: Possible missing firmware /lib/firmware/rtl_nic/rtl8105e-1.fw for module r8169
W: Possible missing firmware /lib/firmware/rtl_nic/rtl8168e-2.fw for module r8169
W: Possible missing firmware /lib/firmware/rtl_nic/rtl8168e-1.fw for module r8169
W: Possible missing firmware /lib/firmware/rtl_nic/rtl8168d-2.fw for module r8169
W: Possible missing firmware /lib/firmware/rtl_nic/rtl8168d-1.fw for module r8169


W: Possible missing firmware /lib/firmware/rtl_nic/rtl8168f-2.fw for module r8169
W: Possible missing firmware /lib/firmware/rtl_nic/rtl8168f-1.fw for module r8169
W: Possible missing firmware /lib/firmware/rtl_nic/rtl8105e-1.fw for module r8169
W: Possible missing firmware /lib/firmware/rtl_nic/rtl8168e-3.fw for module r8169
W: Possible missing firmware /lib/firmware/rtl_nic/rtl8168e-2.fw for module r8169
W: Possible missing firmware /lib/firmware/rtl_nic/rtl8168e-1.fw for module r8169
W: Possible missing firmware /lib/firmware/rtl_nic/rtl8168d-2.fw for module r8169
W: Possible missing firmware /lib/firmware/rtl_nic/rtl8168d-1.fw for module r8169

Do this as root (or using sudo):

#  apt-get install firmware-realtek


If you have other firmware issues, n1md4 suggested installing: firmware-linux and firmware-linux-nonfree in the comments (thanks!)

Eaccelerator mirror / downloads

Eaccelerator is insanely useful in my line of work. However, their main downloads are down right now, so I’m mirroring the latest version here:

You can see the files sha1sums here:

Alternatively, if you’re scripting (we are), you can use the following to get my (‘up-to-date’) version:

bz2.. because that’s the version we use here 😉


Quick useful sysadmin stuff

Two useful things I have found or use 🙂

Firefox Awesomebar search trick

A wonderful tip, that someone sent into the ubuntu-uk podcast. (I can’t remember who, or the episode. Comment if you know and I’ll credit them here! 🙂 )

You can search, in any website’s search function, using firefox’s address bar. Now, at first glance this sounds really boring and useless, but it really isn’t, at all.

First, we need to find a website to search. Let’s use launchpad’s bugs search, for Ubuntu. So, we go here:

Screenshot Firefox add search bookmarkThen, right click on the search box, and click “Add a keyword for this search”. This brings up the standard bookmark – your search keywords are stored as a bookmark. Give it a useful name, something to help you next time you go sorting through your book marks. Now, the keyword is how we use this trick. I’m going to use “bugs”, but you can use anything you want, just remember, this is the word you put before your search string in the address bar. Click Add.

Screenshot Firefox address bar search for bugsNow, all we have to do, is to search for a bug. Let’s use the classic bug 1.

Open a new tab (CTRL + T), then in the address bar type [your keyword] microsoft market share, and hit enter.

Lo and behold:

Screenshot Firefox launchpad bug 1

Testing SMTP-AUTH the fast way

Found a really handy little command line program called “swaks”. Great if you’ve ever needed to test SMTP-AUTH, and didn’t want to have to base64 the username and password yourself. Here’s a quick rundown on the command and flags I use with them. (Should be fairly obvious, comment if not!)

swaks -s [smtp-server-name-or-ip] -au [smtp-auth-user] -ap [smtp-auth-password] -f [from-address-of-testing-email]

Hit enter, and it’ll ask you the “to” email address. Type it in, and it gives you the full connection readout, just as if you were doing it with telnet (or netcat) on the command line:

<- 220 ESMTP
-> EHLO gemini
<- 250 8BITMIME
<- 334 Z29vZCB0cnkgOikK

And so on. 🙂

Day 4 – Falling back to the meta-referance

Last night I posted on twitter that I was struggling to find stuff to post about. jkblacker (Not bassets, sorry Josh!) suggested that I post about how I’m finding it hard to find stuff to post about… so here it is 😉

Not exactly the most spectacular day 4, especially since I’ve got 26 left to go, but we’ll see what happens.

Parts for my new computer started arriving today. I’d hoped that it would all arrive, but unfortunately not. So, right now I’ve got RAM, the PSU, Motherboard, CPU cooler and a copy of Windows. (Yes, I know, horrible, but I’m building a gaming machine, wine isn’t there yet, and Linux hasn’t reached critical mass 🙁 )

Sporadically over the past week or so, I’ve been trying to use search and replace in vi/vim. Finally got it drummed into my head! Here’s the syntax for single item search and replace:


If you want to replace every item in a document, then add “g” to the very end. “g” in this context means “greedy” – i.e. replace everything. (Thanks JPE – I did learn it after all!)

This is the same sort of syntax as usable in the command line tool “sed”. For example, if you wanted to replace a space in a file with a comma, then you’d do:

sed 's/ /,/g' oldfile > newfile

I’m sure there’s a better way to specify that syntax… please feel free to comment 🙂

Firefox won’t upgrade!

Firstly, apologies about the lateness of writing a new post. I’ve been struggling with my server, trying to work out why apache2 is eating RAM. I’ve made a really nasty hack to sort it out for the moment though, which will give me more time to find out what is going wrong.

One of my old friends from Church sent me an email, asking me what was wrong with his firefox. Every time he launched it, what appeared was firefox 2. Very strange, since the version of firefox he has installed is:

3.0.1+build1+nobinonly-0ubuntu0.8.04.3 - meta package for the popular mozilla web browser

Well,  that looks like the normal browser to me. At one point, he has had the “ubuntuzilla” browser installed for a little while. (But not anymore).

A couple of questions on the Ubuntu-uk mailing list didn’t turn up anything. So, I asked “how do you find what binary a command runs”? The answer came back from Matthew Wild (thanks!):

ls -l $(which firefox)

I cheated a little. I’ve not come across $(command), but I have come across `command`. So, I asked my friend to run “ls -l `which firefox`”. He replied with:

lrwxrwxrwx 1 root root 20 2008-02-09 17:16 /usr/bin/firefox -> /opt/firefox/firefox

Er.. that looks wrong to me. The packaged firefox binary for version 3 is in /usr/bin/firefox-3.0. Looks like the uninstall of ubuntuzilla didn’t go so well. I asked him to run:

"rm /usr/bin/firefox && ln -s /usr/bin/firefox-3.0 /usr/bin/firefox"

Which removed the old link, and added the correct one. (I should have asked him to run those commands through sudo thinking about it..)

That solved his issue and he’s now happily running firefox 3. Anyone have a better way to implement this fix, if we ever need it again?

Matthew kindly explained the difference between “$(command)” and “`command`” in earlier today. No difference 🙂

$(command) is easier to send to people so they don’t have to find the backtick key. (UK keyboards, above the tab key)

Hidden Ubuntu Gems: Window Selection, Always on Top & Password Gen

I thought it was probably a good time for another Ubuntu-related post, so here we go.

Window Selection

Window controls, selection raising etc

Something I found on one of my explorations, is this really handy feature (handy for me at least), which allows you to give a window “focus” (or selection) merely by putting your mouse over it. To activate it, click on “System”, go to “Preferences”, and then click on “Window”. Up pops a small selection window.

As you can see, I’ve ticked “Select windows when the mouse moves over them”. You can also have windows be raised to the top of the screen if you hold your mouse over them for a certain length of time. As my collegue at work found, setting the interval to “0” is not very useful…

There are a couple of other tweaks you can make here. I’ll let you explore them on your own 🙂

Always on Top

“Always on Top” allows you to basically tell the system that you want a window to be the upper-most on the screen, no matter what else you do. You can’t “Raise” anything above it. I tend to use this little gem with my next tip.

Set a window to be always on top by right clicking on the title bar (the big orange bar at the top of the window, which contains the minimize, maximize and close buttons). Click the “Always on Top” option. That  window will now stick on top of your screen. Undo it, by right clicking again on the title bar, and clicking “Always on Top” again.

Password Gen (pwgen)

pwgen is a small, neat, command-line program to quickly generate fairly easy-to-remember, fairly secure passwords. You can install it by clicking here, or going to whichever package manager you prefer (synaptic, Add-Remove Programs, apt-get or aptitude) and installing “pwgen”.a screenshot of pwgen with my preferred settings in use

Use it simply by typing “pwgen” in a terminal (“Applications” > “Accessories” > “Terminal”). I tend to run it with the command “pwgen 8 1”, which generates one 8 character password.

Now, if you’re adding a lot of users to a system or something (I am currently at work), using a combination of these tips will save you time… I’ll leave it up to you to work out how to combine them. (Hint: resizing a terminal window like I did above is a good starting point.)

Notes / MySQL Transactions

Why should you not use your notepad as a coaster? This is why:

The notes did say this, before my lovely hot black coffee destroyed them:

“begin” == Start transaction
“commit” == End transaction, saving all changes
“rollback” == Undo all changes that you’ve made in the transaction

What are they? In mySQL 5, with a table storage type of “innodb” you can use transactions. This means, that you can make a set of changes together, like recording the removal of a credit, and the adding of an advert to a website, at one instance, even if it’s multiple mysql transactions within one connection.

You do that, by sending the command (literally “BEGIN;” or “begin;”) to start a transaction, run all the queries you need to run, and then run the commit if you want the all the changes to take, or rollback if you don’t. If any one of the sql queries fails after you’ve made a begin, and it shouldn’t have, you can rollback *all* the changes you’ve made to the database. Obviously, this needs one mySQL connection, but if you’re using more than one each run of the program you’re using, I’d be very surprised.

Xen Gutsy Links

A post full of links and unsorted info about using Xen on Ubuntu Gutsy Gibbon, so that I don’t forget. (This lot has taken ~2 days to collect…) May make a full howto sometime… probably not though, as my boss knows this stuff better than I. Xen is pretty cool though… (useless for gutsy…)

The Xen console doesn’t work (xm console <domU>), network works once, and then never again… Going to paste this here as its in a pastebin, not sure when it will expire… (Have tweaked slightly, snipped a couple of things out, added couple of things in)

>> OK, I have made a little progress on this.  I mounted my VM image on a
>> loopback and chroot'd to it.  I opened /etc/init.d/
>> and /etc/init.d/ and added the following to the top of each
>> file:
>>   exit 0


sudo xm create -c </path/to/config/file>


# Ever-increasing network device names?

# Just disable the correspondent udev rules by deleting/renaming your
/etc/udev/rules.d/<NUMBER>persistant-net.rules. (number was 70 for us...)

guest# mv /etc/udev/rules.d/{,.}z25_persistent-net.rules

# And then make sure your vif (in your instance config file) contains your mac
# address like:
vif = ['ip=,mac=<random valid mac addy>']

Just be sure to stop the instance (domU), and then restart (re-create) it again when needs be…

Also, when in the Xen console, try hitting enter before using the escape sequence (CTL +]) if it’s not working. Sometimes it enters into the console after the “login:” prompt has been printed, and doesn’t seem to pick up that its just had a new connection…
The ALSO SEE link:

Using Serial console & xen console (serial console conflicts with xen console):

/boot/grub/menu.lst stuff, to enable us to use a serial console as well as xen:

serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
terminal --timeout=2 serial console

Goes in the top of your menu.lst, outside the automagic sections…

## additional options to use with the default boot option, but not with the
## alternatives (These options are not used with the Xen Kernel!)
# defoptions=quiet splash console=ttyS0,115200n8

For the default kernel, (NOT the xen kernel).
Goes inside the AUTOMAGIC section of your menu.lst, adding to the options already there.

## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0 console=ttyS0,115200n8 xencons=ttyS9

Note the xencons=ttyS9. Use a serial port (ttyS<No.>) that doesn’t already exist.

Your Xen kernel definition should look something like this, after you’ve run “update-grub”:

title           Xen 3.1 / Ubuntu 7.10, kernel 2.6.22-14-xen
root            (hd0,0)
kernel          /xen-3.1.gz
module          /vmlinuz-2.6.22-14-xen root=/dev/mapper/volume-root ro console=tty0 console=ttyS0,115200n8 xencons=ttyS9
module          /initrd.img-2.6.22-14-xen

The guys on irc ##xen @ freenode are really helpful…

Useful Linux (Ubuntu) Tidbits

Here are just some morsels of information about the Linux Command line, and more specifically, Ubuntu Linux Command line / system.

  • Users can be added to a group with the command:
sudo adduser <username> <groupname>

In ubuntu, the default system shell is “Dash”. That does speed up your system boot, but it also introduces problems with those scripts which are designed to run in bash, but use /bin/sh to execute. (Which is a surprising amount… this has solved many problems for me. Especially with Asterisk and freePBX.)

  • To set Ubuntu back to using bash from dash, run the following command…
cd /bin && sudo rm sh && sudo ln -s /bin/bash /bin/sh
  • To add a user to the sudoer list (the list that controls who can use “sudo”) use the command
sudo visudo
  • Add a user underneath the “# User privalage specification” comment. If you want just a bog standard sudo user, able to do all on the system, add the line:
<username>    ALL=(ALL) ALL
  • ?Fun? tip: add “insults” to the end of the list of “Defaults” in visudo, so it will look like:
Defaults        !lecture,tty_tickets,!fqdn,insults
  • The system will insult you every time you enter your sudo password wrongly. For a random example, it just gave me this when I deliberately triggered it:
You speak an infinite deal of nothing
  • In Firefox, select the address bar quickly by hitting the “F6” key.
  • Type “pwd” to get the full path to your current directory. e.g.:
kirrus@asus:~$ pwd
  • Monit is a useful program, that gives you a good way of keeping an eye on your servers, making sure they don’t run out of harddisk space, or get a high CPU load. It can either perform some function (like stopping a program from running) during high CPU, or send you a warning email. (useful howto/basic guide) (main website)

Monit is in the ubuntu repositories:

aptitude install monit