Upgrade Ubuntu 12.04 LTS kernel to 3.11

I have various high-end PC’s, because I am really fond of lightning-fast hardware. But my development machines sometimes have issues with older kernels, because the drivers in the Ubuntu 12.04 LTS kernels that I run are outdated and do not support the kick-ass and brand-new hardware.

The reason I run 12.04 LTS is that most servers (I work with) run that version. And by running the latest long-term-stable on your development environment you can avoid writing software that cannot run on your production system, because it would simply not work there as well.

Even when you are limited to Ubuntu 12.04 LTS there are still many things you can choose. One thing you can tweak is your window manager. You can either run Ubuntu (using Unity), Xubuntu (with XFCE), Lubuntu (LXDE) or Kubuntu (KDE). You may run whatever variant you prefer, but Linus uses XFCE. My preference also goes to XFCE, and more particular Xubuntu, since it is lightweight and traditional in its layout.

The other thing you can tweak is the kernel version. You can upgrade to newer kernels if needed, even though these newer kernels are officially not supported on Ubuntu 12.04 LTS. The kind of issues that may be caused by having an old kernel include:

  • Not able to recover from standby (outdated power management support)
  • High power usage or noisy fan (also due to outdated power management support)
  • WiFi card not detected or other wireless issues (outdated WiFi chipsets support)
  • Random freezes or other stability issues (outdated motherboard chipsets support)
  • Crashing window manager or other video issues (outdated video chipsets support)

NB: If your USB device or PCI card is not recognized it may be sufficient to update your PCI and USB id’s with the following command:

sudo update-pciids && sudo update-usbids

The reason to not update to the latest (13.10) Ubuntu is that apart from the kernel, also the software packages will be updated. To get the best of both worlds, you would want to update your kernel, but not update the software packages. The good news is that you can. To get the latest kernel you can either “use the package manager”, “download and install” or “compile it yourself”. This post will cover the easiest of all the options, which is “use the package manager”.

Use the package manager to get a new kernel

To list all Linux kernel meta packages in Ubuntu, execute:

maurits@nuc:~$ apt-cache search kernel | grep linux-image | grep -v "\-3\."
linux-image - Generic Linux kernel image.
linux-image-extra-virtual - Linux kernel extra modules for virtual machines
linux-image-generic - Generic Linux kernel image
linux-image-server - Linux kernel image on Server Equipment.
linux-image-virtual - Linux kernel image for virtual machines
linux-image-generic-pae - Generic Linux kernel image
linux-image-lowlatency - lowlatency Linux kernel image
linux-image-lowlatency-pae - lowlatency Linux kernel image
linux-image-current-generic - Depends on the most recently released generic kernel image.
linux-image-generic-lts-quantal - Generic Linux kernel image
linux-image-generic-lts-raring - Generic Linux kernel image
linux-image-generic-lts-saucy - Generic Linux kernel image
linux-image-hwe-generic - Depends on the generic hardware enablement kernel image and headers.
maurits@nuc:~$ 

To remove all previously installed kernels:

sudo apt-get purge linux-image-* linux-headers-*

To install the latest 3.2 kernel:

sudo apt-get install linux-image-generic linux-headers-generic

To install the latest 3.5 kernel:

sudo apt-get install linux-image-generic-lts-quantal linux-headers-generic-lts-quantal

To install the latest 3.8 kernel:

sudo apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring

To install the latest 3.11 kernel:

sudo apt-get install linux-image-generic-lts-saucy linux-headers-generic-lts-saucy

After rebooting, kernel 3.11 should be loaded. To check the kernel version after rebooting, open a terminal and type “uname -a”.

maurits@nuc:~$ uname -a
Linux nuc 3.11.0-13-generic #20~precise2-Ubuntu SMP Thu Oct 24 21:04:34 UTC 2013 x86_64 GNU/Linux
maurits@nuc:~$ 

That was easy right? Updates should automatically be installed. I hope it solves your Linux hardware issues as well.

Share

Symfony 2.3 LTS: Symfony2 with Long Term Support

Symfony 2.3 LTS (Long Term Support) was finally released yesterday (Monday June 3rd 2013). This is a new Symfony2 version that will be supported for next three years. This is significantly longer than the 8 months that normal releases are maintained for. Longer support means less upgrades and can reduce maintenance costs (although the upgrades will be bigger). Also the promise not to break backward compatibility from this version on is an important one. The complete release process (and the release diagram below) can be found on the Symfony2 release process page of the Symfony website.

release-process

Our LeaseWeb Symfony bundles have all received minor version upgrades to support this new Symfony 2.3 release. However, please report any issues you might find with these new versions.

In previous major version upgrades there was an “UPGRADE.md” (for upgrading from 2.0 to 2.1) and “UPGRADE-2.2.md” (for upgrading from 2.1 to 2.2). This release does not have the file included (probably a mistake), but fortunately you can find “UPGRADE-2.3.md” on the official Github repository and also some upgrade instructions on the official blog. Read it carefully to avoid hitting the issues we found (they are described below).

1: Running LTS with stable versions

To run only stable versions of packagist packages make sure “composer.json” contains the following line:

"minimum-stability": "stable",

It would be strange to run an LTS version with development code wouldn’t it? This is set correctly on a fresh Symfony 2.3 installation, but you should check it locally on your own file to be sure it is set correctly.

2: JMS bundles are missing

When you replace the requirements from your composer.json with the required section from the Symfony 2.3 “composer.json” file, you might get the following error when running the “php composer.phar update”:

PHP Fatal error:  Class 'JMS\AopBundle\JMSAopBundle' not found in app/AppKernel.php on line 19

This happens because there are two lines removed from the composer.json compared to the previous versions:

"jms/security-extra-bundle": "1.2.*",
"jms/di-extra-bundle": "1.1.*",

You should add them again, but with different versions:

"jms/security-extra-bundle": "1.5.*",
"jms/di-extra-bundle": "1.3.*@dev",

Note that in the future, you might want to remove the “@dev” suffix from “jms/di-extra-bundle” that allows the package to run a non-stable version.

Update June 8th 2013: There is a new stable version “jms/di-extra-bundle”, but unfortunately this does not work yet:

"jms/security-extra-bundle": "1.5.*",
"jms/di-extra-bundle": "1.4.*",

This caused by the dependencies on “jms/security-extra-bundle” that have not been adjusted to reflect this new stable version. It complains:

jms/security-extra-bundle 1.5.0 requires jms/di-extra-bundle 1.3.* ...

Update June 9th 2013: There is a new stable version “jms/security-extra-bundle” and all dependencies have been fixed. Thank you!

3: “trust_proxy_headers” option unrecognized

You might run into the issue that the “trust_proxy_headers” option that was already deprecated is removed in Symfony 2.3:

[Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]
Unrecognized options "trust_proxy_headers" under "framework"

To fix this issue open “app/config/config.yml” and remove the “trust_proxy_headers” option and replace it with an “trusted_proxies” option and specify the list of proxies as described in the FrameworkBundle Configuration documentation.

4: Method “hasFlash” does not exist

You might run into a issue with Flash Messages. Flash Messages are (unrelated to Adobe Flash) the green, blue, yellow or red bars that show up on a page that show the result of the previous page (form) submit. Normally they show messages like “Login successful”, “Error submitting form, please try again” or “Sign-up successful, an email has been sent”.

Method "hasFlash" for object "Symfony\Component\HttpFoundation\Session\Session"
does not exist in ::flash.html.twig at line 1

The “hasFlash” method is deprecated since version 2.1 and removed in 2.3. The book has a good section on how to handle flash messages in different versions. To summarize, if you have this:

{% if app.session.hasFlash('success') %}
  {{ app.session.flash('success') }}
{% endif %}

You need to change that construct into this:

{% for flashMessage in app.session.flashbag.get('success') %}
  {{ flashMessage }}
{% endfor %}

Make sure you also change all “setFlash” calls with the following search/replace action: “setFlash” -> “getFlashBag()->add”.

5: Method “bindRequest” does not exist

Make sure you also change all your “bindRequest” calls to “bind” like this:

$form->bind($request); // was: $form->bindRequest($request);

As was well described in the Form Goodness in Symfony 2.1 post.

6: Change Forms (Types) and Validators

In the Type classes add the following use clause:

use Symfony\Component\OptionsResolver\OptionsResolverInterface;

Step 1: Replace the “getDefaultOptions” function like this:

public function getDefaultOptions(array $options)

with:

public function setDefaultOptions(OptionsResolverInterface $resolver)

Step 2: Replace the return value with a call to the resolver “setDefaults” method like this:

return array('validation_constraint' => $collectionConstraint);

with:

$resolver->setDefaults(array('constraints' => $collectionConstraint));

Step 3: Also in your custom validators replace the function “isValid” like this:

public function isValid($value, Constraint $constraint)

with:

public function validate($value, Constraint $constraint)

7: The method “getEntityManager” is deprecated

Replace the deprecated “getEntityManager” method by “getManager” in your controllers like this:

$em = $this->getDoctrine()->getEntityManager();

with:

$em = $this->getDoctrine()->getManager();

As you can also read in the “Persisting Objects to the Database” chapter of the book.

8: The “Min” and “Max” validators are removed

The Min and Max constraints that are deprecated since version 2.1 are removed in Symfony 2.3. You should use Range validator with the “min” and/or “max” option instead.

9: Yours…

If you run into other issues please post them and I’ll add them to this list. For now enjoy this brand new stable Symfony 2.3!

Share