Linux Support, Hosting & Security Hertfordshire

Monday, 2 July 2012

evms_activate is not available on boot

Problem

You have (or had) encrypted partitions in your system and are now getting the following error on boot;

evms_activate is not available

WARNING: This is only applicable if you have already checked your /etc/fstab and /etc/crypttab and made sure there are no errors etc in those.

Solution

You need to rebuild your initramfs to fix/remove the pointers to the encrypted partitions. The following command will do this;

update-initramfs -u -k all

One method of doing this is to boot from a Linux boot cd, mount your FS, chroot into your install and rebuild the initramfs.

Step-by-Step fix

  • Boot from your favourite distros Live CD. (e.g. Ubuntu 64bit desktop)
  • Open a terminal and run the following commands, replacing sda1 with your root partition (if your /boot is on a separate partition, then you will need to mount that also)
sudo su
mkdir /mnt/fix
mount /dev/sda1 /mnt/fix
mount -t proc none /mnt/fix/proc
mount -o bind /sys /mnt/fix/sys
mount -o bind /dev /mnt/fix/dev
chroot /mnt/fix /bin/bash
update-initramfs -u -k all
exit
  • Reboot the system and cross your fingers!

Did this post help you? Thank us with bitcoin;

Monday, 30 April 2012

Shrink windows guest Virtualbox VDI disk

Intro

Shrink/compat a windows guest dynamically allocated NTFS disk image which is in the Virtual box .VDI format to its minimum size.

In order to achieve this, there are a number of programs and steps you need to take;

Steps Outlined

  • Clean up your windows FS
  • Defrag your windows guest fs and optimise it into a solid block of data.
  • Ensure that all free space on the disk is zero'ed out, so Virtual box can see what is unused. This might increase your VDI file to the maximum size, so make sure you have the free space. Virutal box documentation on the flags to use with sdelete are at present wrong! Dont use -c, use -z.
  • Tell Virtual box to compat the VDI disk image

The Steps

  1. Boot up your windows guest and uninstall/delete all unwanted programs and files
  2. Install Ultra Defrag
  3. In Ultra Defrag, run a Defragment [F6]
  4. In Ultra Defrag, run a Full Optimization. [Ctrl+F7]
  5. Download the latest version of sdelete and Extract sdelete zip to c: (or what ever drive your shrinking).
  6. Click Start> Run and type cmd. in the command prompt type;
    c:\sdelete.exe -z c:
  7. Shutdown the windows guest
  8. Run the following command on the linux host (windows virtual box has a similar command and syntax);
VBoxManage modifyhd /path/to/disk.vdi compact

Did this post help you? Thank us with bitcoin;

Thursday, 12 January 2012

ZEND: Merge multiple xml configs for Zend_Navigation

If are using Zend_Navigation and wish to use mutliple xml Zend_Config_Xml files to build your Navigation object then it is possible to merge xml configuration files using Zend_Config::merge and pass the resulting object into Zend_Navigation. (e.g if a module/plugin wishes to append further navigation elements into your main navigation.xml)

The following example will merge two different xml config files and pass the resulting config to Zend_Navigation

//Make an empty Zend_Config object
$config = new Zend_Config( array(), true);

//Merge 1st xml file  (navigation.xml)
$config->merge( 
    new Zend_Config_Xml(
        APPLICATION_PATH . '/configs/navigation.xml', 
        'nav'
    )
);

//Merge 2nd xml file (navigation2.xml)
$config->merge( 
    new Zend_Config_Xml(
        APPLICATION_PATH . '/configs/navigation2.xml', 
        'nav'
    )
);

//Pass the resulting config to Zend_Navigation
$navigation = new Zend_Navigation($config);

Did this post help you? Thank us with bitcoin;