Thomas Mathiesen’s Blog


SSH authorized_keys command per key
December 17, 2009, 12:06 pm
Filed under: Linux

Almost Christmas and we’ve got some snow here in The Netherlands!!!!

Ever wanted to authenticate ssh using keys, but allowing only a specific command to be run? It’s actually very easy:

Forced command

If the options phrase at the beginning of a line (in authorized_keys) contains the keyword command=”string”, then any ssh connection that authenticates using that particular key will only run the command specified, even if the command line it was given specified another command.

Nice :)



CentOS 5.3 and Acer Power 1000
November 22, 2009, 6:16 pm
Filed under: Linux

Ever come across a Acer Power 1000 not wanting to run CentOS 5.3 installer? It just hangs?
Well, enter this at the prompt: linux noapic acpi=off

..and it works :)



Careful with Carparc in Haaksbergen (NL)
November 20, 2009, 10:38 am
Filed under: Life in general | Tags:

We’re looking for a new car, and Kia Sorento seems to be the best choice for us and the to-be-born baby. Trying to get a good car for a good price has taken us on quite a trip around The Netherlands. Here’s a story about one of the dealers we visited…

My wife and I drove 2 hours (from The Hague) to Carparc (Haaksbergen) and had a look at a Kia Sorento.

..and then my story ends because..

Reviewing Carparc got us a fax from their lawyer, threatening to take us to court!! I still believe that it should be allowed to give your opinion about dealers and their behavior, but I simply do not want to have to get a lawyer to prove my case.

So, my new review is: I do not like Carparc due to their attitude and they will send a lawyer if you try to write a negative review.. Saying this can’t be illegal?

Cheers
/Thomas Mathiesen



Centos:Xen cannot connect to console
September 28, 2009, 10:21 am
Filed under: Linux

I have seen a nasty issue with Xen; trying to connect to a vm guest console, and it spits out this error:

[root@server ~]# xm console myserver
xenconsole: Could not open tty `/dev/pts/4′: No such file or directory

The problem is fixed by running xenconsoled command :)

/Thomas



KVM USB passthrough
September 26, 2009, 5:28 pm
Filed under: Linux

This is just a note to self.. as I sometimes need to access USB devices on a KVM virtual guest. This time it’s actually for a freaking Scandisk USB device with something called U3. I need to use the USB stick to install easypeasy on my asus eeepc.. and I need to use the USB stick as a normal stick …
See this page for instructions



Ubuntu 9.04 + KVM + Networking
June 30, 2009, 8:42 pm
Filed under: Linux

KVM seems to be the hot thing for the future, so I had to dig into it.. giving up VMWare and Virtualbox (keeping Xen knowledge as I work with it daily).

KVM with virtual manager is a breeze on Ubuntu 9.04, but if you want bridging it’s a whole different story.

So, here’s a note-to-self;

1. Setup br0 on Ubuntu (https://help.ubuntu.com/community/KVM)
2. Add your user to group libvirt and tun (create if needed)
3. run virsh
4. dump xml file of virtual guest
5. change from ‘user’ to ‘bridge’:

6. import xml (define /path/to/xml/file)
7. start virtual machine

ta-ta



borther mfc-5490cn unknown option calibration-cache
June 30, 2009, 7:29 pm
Filed under: Linux

Brother is really linux friendly, but using gscan2pdf is a bit of a pain when you have a webcam and two scanners.

My canon has an option called “calibration-cache”, which Brother doesn’t understand. If you run Ubuntu and gscan2pdf, just do this to get rid of the problem:

1. Open gscan2pdf
2. Click “scan”
3. If the new window starts by showing the canon scanner, change that to Brother.
4. Try to scan.. you will probably see the error “unknown option…”.
5. Close gscan2pdf and start it again..

After restarting gscan2pdf, it’ll default to the Brother scanner if that was the last one that you had chosen.. and only the Brother options are loaded.

Happy Linux’ing :D

/Thomas



Expanding xen disk file image
May 10, 2009, 2:10 pm
Filed under: Linux

If you run out of diskspace on a xen virtual machine (guest), it’s quite easy to expand the image file. I stole this receipt from here, just to make sure that I have a copy in case his/her website goes offline:

1. Stop the virtual server that is using the loop filesystem
2. Add some extra space to your loop filesystem file
# dd if=/dev/zero bs=1024k count=1024 >> loop_image_file

This adds 1GB to the end of a file called loop_image_file (make sure to use the append output redirector >> not a single >, otherwise you’ll have an empty 1GB file!)

3. Force a check on the resized/increased filesystem
# e2fsck -f loop_image_file

4. Resize the filesystem within the loop filesystem file
# resize2fs loop_image_file

5. Start the virtual server again



Adding poweroff icon to Gnome desktop
April 30, 2009, 8:43 pm
Filed under: Linux

I have been trying to add a “shutdown icon” to the gnome desktop on Ubuntu 8.10. The goal is for the user to just double-click that icon, and the machine shuts down.
My issue was that triggering the /sbin/poweroff binary would only ask for my password:

myuser@mydesktop:/tmp$ sudo /sbin/poweroff
password:

So, I added myself to the /etc/sudoers file:
myuser ALL = NOPASSWD: /sbin/poweroff

and it simply DID NOT work!

I came across a post telling me why…
The reason is that /etc/sudoers is being read from the bottom and up. So, I was in a group that was mentioned on the bottom, which required passwords for everything. Now I move the line (myuser ALL = NOPASSWD: /sbin/poweroff) to the bottom of the file, and my gnome launcher works fine!



CentOS Xen: Error: 4 Out of memory
April 28, 2009, 10:23 pm
Filed under: Linux | Tags: ,

CentOS + Xen is driving me nuts! I came across a nasty issue, which makes me (try to) pull my hair:

xm create -c whateverdomain
Some pygrub output…
and then.. Error: (4, ‘Out of memory’, “xc_dom_boot_mem_init: can’t allocate low memory for domain\n”).

Googling this for a few hours and actually trying different distros (even trying out Lenny!) gave me nothing. One post (that I finally found) says this issue maybe caused by trying to start an image (created on a 64 bit Xen) on a 32bit Xen.

So now I am installing CentOS 5.3 64bit on my Vaio laptop. It comes with a Centrino (Core 2 Duo I believe).

and runs like a charm :D