31. December 2012

KVM error: internal error no HVM domain loader – solution

It’s very pleasant situation when you reboot Linux server and it starts.

It’s very unpleasant situation when this server contains many KVM virtual servers and none of them start. 🙁

virsh list displays just this:

Id Name State
 0 Domain-0 running

That’s nonsense. There was no such virtual with name Domain-0.

When you try to create domain you can see this fancy error message:

[root@server qemu]# virsh create ./virtual-01.xml
error: Failed to create domain from ./virtual-01.xml
error: internal error no HVM domain loader

What went wrong? How to fix it?

I spare you long story with server diagnostic.

The problem was that server started different kernel after reboot. In this case it was different kernel with Xen support. Centos kernel with Xen support does not have KVM support. That’s quite logical. It was sufficient to change default kernel in grub.conf to non-Xen version, restart machine and everything was working like a charm.

1. December 2012

Common mistake when creating new git repo. Error: src refspec master does not match any.

Creating new git repo and pushing it to remote server is fairly easy.

mkdir my-project
cd my-project
git init

You can work with project localy. When you want to push it to remote server, then it is necessary to add remote repo url.

git remote add origin <MY-URL>

Now you can push it:

git push -u origin master

When it works. Hooray. Sometimes you may find following error:

error: src refspec master does not match any.
error: failed to push some refs to '<MY-URL>'

The reason why this happens is not that obvious. 🙂

Git creates master branch only after commit to your local repo. If you just initialize repo then there is no master. How to fix it?

Just add and commit at least one change to your repo and re-run push command. You can add e.g. .gitignore.

You can find more info at StackOverflow.

17. June 2012

How to solve some problems with Drupal after upgrade to PHP 5.4

I’ve found several interesting issue after upgrading PHP 5.3 to PHP 5.4 on Drupal 6 and Drupal 7 sites.

The first biggest problem was that Drupal was displaying Access denied message on all web pages. It was not possible to login to system. Even http://localhost/?q=admin didn’t work.

I had to create temporary session. It is quite easy when using Drush:

drush user-login

Drush displayed one time session for admin. This solved the problem with admin login.

The other issue was that there was Access denied message on every page. There were also other very useful messages flooding each page:

Notice: Undefined index: access in function _menu_link_translate() …

I spent some time searching for any hint how to resolve this weird behavior. It was necessary to delete all Drupal’s caches.

Configuration -> Development -> Performance -> Delete cache

After this clean up Drupal was working correctly.

Then I checked one older Drupal 6 site and there was nice big red warning:

Warning: strtotime() [function.strtotime]: It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier.

The problem was that there was no default timezone in php.ini. It was sufficient to add timezone to /etc/php5/apache2/php.ini to section

; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = "Europe/Prague"

You can find more info about timezones at php.net/date.timezone.

After reloading Apache configuration everything was ok.

22. December 2011

How to disable stealing of focus by Console in Eclipse

There is one very annoying issue in Eclipse: stealing of focus by Console window.

Console window is displayed when you run application.

When you set focus to some other window like Search results and application prints something on output then Eclipse will automatically switch to Console window. Your search results are gone.

There is simple way how to get rid of such a behavior.

Go to Window -> Preferences -> Run/Debug -> Console. Uncheck options:

  • Show when program writes to standard out
  • Show when program writes to standard error

20. November 2011

Unexpected token ILLEGAL in jQuery.i18n.properties

jQuery.i18n.properties is useful library based on jQuery. You can use it to load .properties files with localization to web application.

I made upgrade of jQuery in my application from version 1.6.2 and application failed with error:

Uncaught SyntaxError: Unexpected token ILLEGAL

I spent some time debugging jQuery and i18n and I found out that one of .properties file contains weird property with name:

1_guide=1 guide

Problem was in numeric prefix. Solution is quite easy: fix property.

one_guide=1 guide

This problem occurs when you upgrade jQuery to 1.6.3 and higher.