Category Archives: Linux

Dual boot Ubuntu and Windows 7, with Safeboot / Mcafee Endpoint Encryption

First you need to install Windows 7, and safeboot / Mcafee endpoint protection.

Then you need to take a backup of the MBR, this is done with a Ubuntu live cd, run this commands:

dd if=/dev/sda of=/path/safeboot.mbr bs=512 count=1

 

Put it on a USB flash drive or something else, that you can access after the installation.

After you have make a backup of the MBR, just install Ubuntu the normally way, after you have make changes to grub2 config files.

cp /path/safeboot.mbr /boot/
nano /etc/grub.d/40_custom

At the buttom of this files you need to insert this:

menuentry "Windows 7" {
set root='hd0,msdos1'
chainloader (hd0,msdos5)/boot/safeboot.mbr
boot
}

Where set root=’hd0,msdos1′ is becuase my windows 7 root partition is locate on disk 0, and msdos partition 1, and chainloader (hd0,msdos5)/boot/safeboot.mbr is because my ubuntu partition is located on disk 0 and msdos partition 5.

Upgrade firmware on Dellservers running XenServer and get Dell Openmanage aswell

First you need to enable some standard Repos first

vi /etc/yum.repos.d/CentOS-Base.repo

Enable base and updates.

Then you need to enable Dell yum Repos

wget -q -O - http://linux.dell.com/repo/hardware/latest/bootstrap.cgi | bash

This will automatically create the repo files in /etc/yum.repos.d
Next we will install Dell OMSA (Openmanage) and the firmwall tools needing to upgrade firmware on a Dell Server.

yum install srvadmin-all firmware-tools

 

Then we have to start the Dell Openmanage software this can be done with

/opt/dell/srvadmin/sbin/srvadmin-services.sh start

And after this we can run

/opt/dell/srvadmin/sbin/srvadmin-services.sh status

To check that the Dell Openmanage is running okay.
Now you just need to enable port 1311TCP in the firewall of yours Xenserver

nano /etc/sysconfig/iptables

Now add the following line:

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 1311 -j 
ACCEPT

And restart Xenserver firewall with this commands:

service iptables restart

Now you should be able to browse to https://IPADDROfXenserver:1311 and logon with root and the root password.

If you want to enable SNMP Traps:
To make SNMP Traps working in DOM, you need to enable it:

nano /etc/snmp/snmpd.conf

insert at the buttom of the file:

trapsink IPADDR Communityname

And then restart SNMPD

service snmpd restart

To update Dell firmware tools, you can use this commands:

yum install $(bootstrap_firmware)
update_firmware --yes

This will run for some time.

Kubuntu – Blankpage / hang after logon

Today I have a problem with my Kubuntu, that after i have apply my password for my user, I just got a blank page, only with the standard background of Kubuntu.

I found that I couldn’t start KDE, with the command startkde in the console, I don’t know how, but i was missing the apt-get packet name “kde-workspace-bin”

So I run this command:

sudo apt-get install kde-workspace-bin

Tips:  You can get into the console but holding down the following keys: CTRL ALT F1

Compiling Linux Kernel 3.6.X the debian/ubuntu way for Hyper-V

Here is a guide to compile a kernel 3.6.X kernel for hyper-v the debian way.

sudo apt-get install git-core kernel-package fakeroot build-essential ncurses-dev

#Download the latest kernel
cd /usr/src
sudo wget --continue http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.6.6.tar.bz2
sudo tar jxvf linux-3.6.6.tar.bz2
cd linux-3.6.6

#Copy kernel config to the new source
sudo cp /boot/config-`uname -r` ./.config

#Choice what you want
#Hyper-V is locate at: Device Drivers, Microsoft Hyper-V guest support
sudo make menuconfig

#Compile the kernel
sudo make-kpkg clean
sudo fakeroot make-kpkg --initrd --append-to-version=-hyperv01 kernel_image kernel_headers
cd ..
sudo dpkg -i linux-image-3.6.*
sudo init 6

Delete mails from a sender or to recipient address

Here is a simple script “pfdel” that can be use to delete a mail from a sender or recipient address.
Save the perl script as pfdel in /usr/local/bin and chmod +x /usr/local/bin/pfdel

Then you can use the perl script as: pfdel [email protected] then it will delete all messages where ether [email protected], is in there sender or recipient address.

#!/usr/bin/perl -w
#
# pfdel – deletes message containing specified address from
# Postfix queue. Matches either sender or recipient address.
#
# Usage: pfdel
#

use strict;

# Change these paths if necessary.
my $LISTQ = “/usr/sbin/postqueue -p”;
my $POSTSUPER = “/usr/sbin/postsuper”;

my $email_addr = “”;
my $qid = “”;
my $euid = $>;

if ( @ARGV != 1 ) {
die “Usage: pfdel \n”;
} else {
$email_addr = $ARGV[0];
}

if ( $euid != 0 ) {
die “You must be root to delete queue files.\n”;
}

open(QUEUE, “$LISTQ |”) ||
die “Can’t get pipe to $LISTQ: $!\n”;

my $entry = ; # skip single header line
$/ = “”; # Rest of queue entries print on
# multiple lines.
while ( $entry = ) {
if ( $entry =~ / $email_addr$/m ) {
($qid) = split(/\s+/, $entry, 2);
$qid =~ s/[\*\!]//;
next unless ($qid);

#
# Execute postsuper -d with the queue id.
# postsuper provides feedback when it deletes
# messages. Let its output go through.
#
if ( system($POSTSUPER, “-d”, $qid) != 0 ) {
# If postsuper has a problem, bail.
die “Error executing $POSTSUPER: error ” .
“code ” . ($?/256) . “\n”;
}
}
}
close(QUEUE);

if (! $qid ) {
die “No messages with the address ” .
“found in queue.\n”;
}

exit 0;