Tuesday, September 25, 2012

Debian apt locale errors

Ok, every once in a while, I play with Debian or Ubuntu machines. Recently, on Squeeze, I started getting errors like these. Probably something with my locale has changed, but I'm not sure what and when.
0 packages upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
Do you want to continue? [Y/n/?]
perl: warning: Setting locale failed.   
perl: warning: Please check that your locale settings:
    LANGUAGE = "en_US:",
    LC_ALL = (unset),
    LC_TIME = "nl_NL.utf8",
    LC_MONETARY = "nl_NL.utf8",
    LC_CTYPE = "en_US.UTF-8",
    LC_COLLATE = "en_US.UTF-8",
    LC_MESSAGES = "en_US.UTF-8",
    LC_MEASUREMENT = "nl_NL.utf8",
    LC_NUMERIC = "nl_NL.utf8",
    LANG = "en_US"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_ALL to default locale: No such file or directory
These errors pop up every time I use apt. Now there used to be a configuration file somewhere in /etc that allowed me to set locales in Debian, I'm pretty sure there was. But it's gone.

Apparently, one now has to edit a file in /var. Not sure why a configuration file ends up there, but hey, I'm not an OS developer. Anyway, you need to edit /var/lib/locales/supported.d/local and add your own locale, in my case "nl_NL.UTF-8 UTF-8". After that, just run
$ sudo locale-gen
like you used to. Very strange place to put a configuration file...

Nested virtualization on Fedora for testing Convirt 2

Nested virtualization on Fedora for testing Convirt 2

I am somewhat fascinated by Convirt. I have never tried it, but I've always wondered what it is capable off. I never wanted to potentially kill my laptop by trying Convirt out on it. But there are other ways.

This one seems pretty cool: setting up a Convirt 2 installation, completely in VM's on my laptop :) Interested? Here's what to do.

Assumptions

I am going to assume your are running Fedora and / or EL6. If you are running another recent distribution, like Ubuntu or OpenSUSE, this should work fine. You just need a different document to install Convirt in step 4.

Preparations

Please make sure you have adequate hardware. Older hardware will make this
process painful. Make sure you have Intel VT or AMD-V enabled in your BIOS.
Boot your kernel with "kvm-intel.nested=1" on the "kernel" command line. This
will enabled nested virtualization. Without this option, the setup below will
not work, because the 'vmx' flag will not be exposed to your hypervisor guests.

Step 1

Create three VM's through virt-manager. One for the Convirt console (management interface for the hypervisors) and two as hypervisors. Let's call them 'convirt', 'hyper01' and 'hyper02'.

Step 2

For the hypervisor VM's, start up 'virsh edit' on both of them and add this snippet to the XML:
<cpu match='exact'>
  <model>core2duo</model>
  <feature policy='require' name='vmx' />
</cpu>
This will enable the VM's to start nested VM's of their own. You can read more in this excellent article.

Step 3

Install CentOS6 or something similar on all of the VM's. An installation with just the "Base" package group will work fine for the Convirt VM, but it's recommended to install the "Virtualization Host" package group for the hypervisor VM's.

Step 4

Follow the instructions here to install Convirt on the convirt VM.

Step 5

Follow the instructions here to enable Convirt management of the hypervisor VM's. If you have not installed the "Virtualization Host" package group during install, make sure to install bridge-utils and qemu-kvm manually: the installer script will *not* install these for you and therefore fail.

Make sure to run the convirt-tool commands from a console, not over SSH. Network connection will be lost during it's execution.

Step 6

Log into the Convirt web gui with the default credentials ('admin' for both the username and the password) and add the hypervisor VM's to Convirt. You will need to click "Data Center" in the left menu bar, "Servers" in the main window and then select "Add server" in the "Actions" drop-down menu in the upper right corner of the screen.

Step 7

Create a virtual machine by following the instructions here. This is somewhat awkward, because you need to juggle with templates from the very first beginning, so follow that document. It makes stuff a lot easier.

Step 8

Start the VM and see it soar. Well, not quite, because performance will not be spectacular, but it's not that bad either and it works (at least for me) :)

I haven't tried doing a live migration yet. If you do, please leave a comment to tell how that went for you!