Sebastian Mogilowskis Blog

Just another blog about administration, linux and other stuff

Language: German English

New year new theme

Happy new year !

A new theme is online.
It’s a modified version of black-with-orange.

Now with a little bit more colors and more cats.

I hope everything works for you. If not please let me know !

Color Bash Prompt on Ubuntu and Debian

Ubuntu

Green Prompt for your user

Edit ”~/.bashrc” and change:

#force_color_prompt=yes

to:

force_color_prompt=yes

To change it for all new users make the same in ”/etc/skel/.bashrc”.

Red Prompt for root

Edit ”/root/.bashrc” and change ”force_color_prompt=yes” like for your user.

Now change the color to red. Search this line:

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

and change it to:

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

Note: For this change to take effect, you must log out then log in again.

Debian (older versions)

Green Prompt for your user

Open ”~/.bashrc” and append:

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

Red Prompt for root

Edit ”/root/.bashrc” and append:

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$ '

Other colors

Color	Code
Black	30
Blue	34
Green	32
Cyan	36
Red	31
Purple	35
Brown	33
Blue	34
Green	32
Cyan	36
Red	31
Purple	35
Brown	33

,

Create a Linux or Utility Live Stick

Create Linux Live USB Stick with UNetbootin.

Easy way to test a lot of other linux distributions or play around with some system utilities

You can install the following OS and System utilities with unetbootin.

Operating Systems

* Ubuntu		* Fedora
* Debian		* PCLinux OS
* Linux Mint		* Sabayon Linux
* openSUSE		* Gentoo
* Arch Linux		* MEPIS
* Damn Small Linux	* Zenwalk
* SliTaz		* Slax
* Puppy Linux		* Dreamlinux
* gNewSense		* Elive
* FreeBSD		* CentOD
* NetBSD		* Mandravia
* Frugalware Linux	* xPUD

System utilities

* Parted Magic
* SystemRescueCD
* Super Grub Disk
* Dr. Web Antivirus
* F-Secure Rescue CD
* Kaspersky Rescue Disk
* Backtrack
* Ophcrack
* NTPasswd
* Gujin
* Smart Boot Manager
* FreeDos

1. Installation

aptitude install unetbootin

2. Create Live USB Stick

Open UNetbootin from your start menue:

llcd1

Select Distribution and Version with the Selectbox on the top. I choose Ubuntu 11.10 for example.

llcd2

Make sure you have selected the correct USB-Drive at the bottom of the window.

llcd3

UNetbootin now download the selected Operating System and install it on the Stick.

llcd4llcd5llcd6llcd7

3. Boot from USB

Unmount the stick and reboot your system. Make sure you are booting from USB-Drive.

llcd8llcd9llcd10

Note: UNetbootin is available for Linux, Windows and MacOS !

4. Links

* http://unetbootin.sourceforge.net

, , ,

Encrypt your USB Stick

Encrypt your USB Stick with cryptsetup or TrueCrypt on Ubuntu.

1. Use cryptsetup

1.1 Install cryptsetup:
aptitude install cryptsetup
1.2 Setup cryptsetup volume:

Unmount the stick and format it:

umount /dev/usb1
cryptsetup luksFormat /dev/usb1

Type “YES” an choose a password.

Open the crypt partition:

cryptsetup luksOpen /dev/usb1 crypt_USB

Create new Filesystem and mount it:

mkfs.ext4 /dev/mapper/crypt_USB
mount /dev/mapper/crypt_USB /mnt

Remove the drive:

umount /dev/mapper/crypt_extern
cryptsetup luksClose crypt_extern
1.3 Mount cryptsetup:

Now reattach the stick. Ubuntu ask you for the password (LUKS passphrase) you choose and mount the crypted partition.Nun den Stick wieder einstecken. Ubuntu fragt nun nach dem Passwort (LUKS passphrase) welches man vorher festgelegt hat und mountet die verschlüsselte Partition

luks_passphrase1

Note: “/dev/usb1″ is may be different on your System.

2. Use TrueCrypt

2.1 Installation:

Download tar.gz from truecrypt.org

Extract and run setup script:

tar vfx truecrypt-7.1-linux-x64.tar.gz

./truecrypt-7.1-setup-x64

Select “Install TrueCrypt” and accept the licence terms.

tc1tc2

Press enter to exit the setup tool.

tc3

2.2 Setup TrueCrypt Volume

Run TrueCrypt from your Start Menu and select “Create Volume” now choose “Create a volume with a partition/drive” and press “Next”.

tc4tc5

Choose “Standard TrueCrypt volume” select a Volume and select your preferred encryption options:

tc6tc7tc8

Now enter a password for your usb stick, enable the large file support and select the filesystem type. (I take ext4)

tc9tc10tc11

If you want to use your usb stick on other operating system than linux you can enable the cross-platform support. But you have to choose a filesystem type which windows and/or macos understand in the previous step.

tc12

Now make some random moves with your mouse and select “Format”. (This will take a few minutes)

tc13tc14

2.3 Mounten:

Run TrueCrypt from your Start Menu.

“Select Device” and select your TrueCrypt Partition:

tc15

Press “Mount” and enter your password.

tc16

Device “truecrypt1″ is now mounted on your system and ready to use.

3. Links:

* http://www.selbstdatenschutz.info/linux/externe_datentraeger_verschluesseln

* http://wiki.ubuntuusers.de/truecryptn

, , , ,

Fix Ubuntu 11.10 Oneiric Ocelot dbus Problem

After uprade to Ubuntu 11.10 Oneiric Ocelot i get the following message during the system boot:

Waiting for network configuration

It takes a long time and leads to a black screen.

You can see the following message sometimes, too.

Unable to connect to the system bus: Failed to connect to socket /var/run/dbus/system_bus_socket: Connection refused

The quick fix was to delete zu dbus files in “/var/run/dbus/”

rm /var/run/dbus/*

and reboot the system.

But you will get the same problem again after the next reboot.

A stable solution is to move the “/var/run” and “/var/lock” directories.

First move all contents from “/var/run” into “/run” and from “/var/lock” into “/run/lock”.

mv /var/run/* /run/
mv /var/lock/* /run/lock/

Note: If you have installed VMWare you have to unmount “vmblock-fuse”. Before moving the content.

umount /var/run/vmblock-fuse

Now delete “/var/run” and “/var/lock”:

rmdir /var/run
rmdir /var/lock

and replace them with symlinks to the new destination:

ln -s /run /var/run
ln -s /run/lock /var/lock

Now reboot your system.

Links:

* https://bugs.launchpad.net/ubuntu/+source/dbus/+bug/811441

* https://bugs.launchpad.net/ubuntu/+source/lightdm/+bug/856810

* http://forum.ubuntuusers.de/topic/nach-upgrade-problem-mit-dem-networkmanager/#post-3473007

, ,

Convert PDF to Image

Using “convert” from “imagemagick” to convert a PDF to Image.

Example:

convert -geometry 1024x768 -density 200 -colorspace RGB input.pdf output.jpg

Or use a other geometry, quality and no color:

convert -geometry 2048x1536 -density 400 -colorspace gray input.pdf output.jpg

Links:

* http://www.imagemagick.org/script/convert.php

, , ,

System Administrator Appreciation Day – 2011

To all other system adminstrators “HAPPY SYSADMIN DAY !”

http://www.sysadminday.com

and, of course


Sources:
http://www.userfriendly.org
http://xkcd.org

Install Sun Java with Puppet on Ubuntu

Sun wants you to agree to its license before installing the JRE/JDK. For an unattended install you need a preseed file.
You get the content of this file with “debconf-get-selections | grep sun-” on a system where you have already installed the required packages.

Create a file “/etc/puppet/files/sun-java6.preseed” with the following example content:

sun-java6-bin shared/accepted-sun-dlj-v1-1 boolean true
sun-java6-jdk shared/accepted-sun-dlj-v1-1 boolean true
sun-java6-jre shared/accepted-sun-dlj-v1-1 boolean true
sun-java6-jre sun-java6-jre/stopthread boolean true
sun-java6-jre sun-java6-jre/jcepolicy note
sun-java6-bin shared/error-sun-dlj-v1-1 error
sun-java6-jdk shared/error-sun-dlj-v1-1 error
sun-java6-jre shared/error-sun-dlj-v1-1 error
sun-java6-bin shared/present-sun-dlj-v1-1 note
sun-java6-jdk shared/present-sun-dlj-v1-1 note
sun-java6-jre shared/present-sun-dlj-v1-1 note

I use this APT-Module to add the Ubuntu partner repository. (Required for Sun-Packages)

apt::source { "partner":
    location => "http://archive.canonical.com/ubuntu",
    release => "${lsbdistcodename}",
    repos => "partner",
    include_src => false,
}

Now you can install the sun package:

file { "/var/cache/debconf/sun-java6.preseed":
    source => "puppet://$server/filesserver/sun-java6.preseed",
    ensure => present
}
package { "sun-java6-jdk":
    ensure  => installed,
    responsefile => "/var/cache/debconf/sun-java6.preseed",
    require => [ Apt::Source["partner"], File["/var/cache/debconf/sun-java6.preseed"] ],
}

Note: I use sun-java6-jdk but you can install sun-java5-jre in the same way.

, , ,

Install latest Broadcom bnx2 linux driver

Install new broadcom driver on Ubuntu or Debian:

1. Download Linux driver

http://www.broadcom.com/support/ethernet_nic/downloaddrivers.php

2. Unpack

unzip linux-6.2.23.zip
cd Server/Linux/Driver
tar vfx netxtreme2-6.2.23.tar.gz
cd netxtreme2-6.2.23

3. Install build tools and install the driver

sudo aptitude install build-essential linux-headers
make
sudo make install

4. Test

before installation:

$ ethtool -i eth0
driver: bnx2
version: 2.0.2
firmware-version: 4.6.1 ipms 1.6.0
bus-info: 0000:05:00.0

after installation:

$ ethtool -i eth0
driver: bnx2
version: 2.0.23b
firmware-version: bc 4.6.1 ipms 1.6.0
bus-info: 0000:05:00.0

, , ,

Install VMware Tools on Debian Squeeze

1. Install required packages

aptitude install autoconf automake binutils cpp gcc linux-headers-$(uname -r) make psmisc

2. Mount VMware Tools

mkdir /tmp/vmtools
mount /dev/cdrom /tmp/vmtools

3. Unzip the tools

tar -C /tmp -vfx /tmp/vmtools/VMwareTools*.tar.gz

4. Run install script

cd /tmp/vmware-tools-distrib
./vmware-install.pl

Note: You can also use the “open-vm-tools” instead of installing the VMware Tools.

aptitude install open-vm-tools

You need to add “contrib” to your sources.list !

, , ,

Previous Posts