#
# mail servers
74.125.67.18 mail.google.com
69.147.112.160 mail.yahoo.com
69.147.112.160 login.yahoo.com
216.10.106.149 giles.net
#
# misc
208.65.153.251 youtube.com
80.237.234.20 goosh.org
#
# apt ips
128.31.0.36 security.debian.org
194.8.57.6 www.backports.org
35.9.37.225 ftp.us.debian.org
192.25.206.10 debian.org
128.101.240.212 ftp.debian.org
Wednesday, July 23, 2008
Thursday, May 8, 2008
Remaster Knoppix Overview
Remaster Knoppix Overview
Files:
Get the bash scripts
http://pclug.info/meeting_0056/remasterKnoppixFiles.tar.gz
Credits:
Knoppix Remastering Howto
http://www.knoppix.net/wiki/Knoppix_Remastering_Howto
PCLug
http://pclug.info/meeting_0051/slide_03.html
Goals:
Have a portable personalized remaster of Knoppix
- multimedia apps that I like to use
- window manager other that KDE
- access to virtual machines using virtualbox
- boot off of a usb drive
Commentary:
The basic remastering process is what it is. I've written
some bash scripts to semi-automate the process. These
scripts were developed out of the necessity of the trial
and error process that I went through.
Setting up for remastering
The script below will copy the files that you need from
the CD to the local filesystem.
Boot your machine from a Knoppix CD, mount the partition
where you want to host your remastering. Run the following
script. Be sure to set the variables to the correct values
before execution.#!/bin/bash
# setupForRemastering.sh
#
# boot from the Knoppix CD, open a root shell, and
#then run this script
# to setup an environment for remastering
# constants
DEVICE='/dev/hda5'
MOUNTPOINT='/media/hda5'
ROOTDIR="$MOUNTPOINT""/knx"
# find a partition to work in the
# partition should have a minimum of 3GB free space
# mount the partition
#mount -rw "$DEVICE" "$MOUNTPOINT"
# create a root directory to work in if the above
# mountpoint is not the root directory that you
# want to work in
#mkdir "$ROOTDIR"
# make two directories, one for the new master cd,
# and one for the source. also make additional
# directories under these named KNOPPIX
mkdir -p "$ROOTDIR""/master/KNOPPIX"
mkdir -p "$ROOTDIR""/source/KNOPPIX"
# copy the KNOPPIX files to your source directory
# this will take a long time. you are copying 2GB
cp -Rp /KNOPPIX/* "$ROOTDIR""/source/KNOPPIX"
# copy the 'boot' folder from your cdrom
# you need these to build the ISO later
cp -ar /cdrom/boot "$ROOTDIR""/master/"
# for Knoppix 5.0.1 you also have to copy the
# 'modules' folder
cp -ar /cdrom/KNOPPIX/modules \
"$ROOTDIR""/master/KNOPPIX/"
# copy the main HTML page for the startup page
cp /cdrom/index.html "$ROOTDIR""/master/"
# copy everything necessary except the ~700MB KNOPPIX
# file
cd /cdrom && find . -size -10000k -type f -exec \
cp -p --parents '{}' "$ROOTDIR""/master/" \;
Setup the environment for chroot
To add packages while remastering, you will need
internet access. To use the internet, we will copy
resolv.conf from the host machine to the remastering
environment. We do this right before chroot so
we capture the current nameserver of the host machine.
Then bind some mountpoints necessary for remastering
and enter the chroot environment.
The script below should be located at the root of
the remastering directory tree.#!/bin/bash
#chroot.sh
# copy resolv.conf into the chroot folder
cp -a /etc/resolv.conf source/KNOPPIX/etc/dhcpc/
# bind temp vars
mount --bind /dev source/KNOPPIX/dev
mount --bind /proc source/KNOPPIX/proc
mount --bind /sys source/KNOPPIX/sys
# chroot into source home directory
chroot source/KNOPPIX
Modify packages
Below are the scripts that I use to modify
the packages in my remaster. The script,
aptConfigChanges.sh, is built like a stack.
Start at the bottom and move up.
The below script should be located at
ROOTDIR/source/KNOPPIX.#!/bin/bash
#aptConfigChanges.sh
###################################################
# DO NOT REMOVE the following packages
#mutt
# DO NOT INSTALL the following packages
#nfs-common nfs-kernel-server syslinux xdm sysv-rc
#sysvinit sysvinit-utils udev
###################################################
#aptitude update
#apt-get update
###################################################
# purge 8th pass
#aptitude purge eterm qterm wterm rxvt-beta lynx \
scantv xawtv xawtv-plugins configure-xawtv pia \
nxclient unp unzip vrms vgabios locales \
util-linux-locales scribus nessus nessusd \
nessus-plugins startnessus-knoppix \
gaim gaim-data gaim-encryption gnome-icon-theme \
# install 8th pass
#aptitude install x11-common xorg xserver-xorg \
xserver-xorg-core xserver-xorg-video-all \
xserver-xorg-video-fbdev xserver-xorg-video-i810 \
xserver-xorg-video-neomagic xserver-xorg-video-savage \
ajaxterm xterm xtermcontrol xtermset whiptail wodim \
mplayer openvpn ffmpeg flac flac123 vorbisgain mplayer \
update-inetd util-linux xdelta xdialog xmms xpdf \
xpdf-common xpdf-reader xpdf-utils xsane xsane-common \
xmms xterm vim vim-common vim-gtk vim-gui-common \
vim-runtime vnc-common tar tcpd tcpdump tk8.4 tshark \
wireshark wireshark-common tzdata centericq \
centericq-common samba samba-common sane sane-utils \
scrollkeeper sendfile smbclient smbfs ssh ssl-cert \
rdesktop readline-common rsync passwd perl perl-base \
perl-modules perl-suid php4-common playmidi portmap \
ppp pppconfig pppoeconf psfontmgr python2.4 \
python2.4-minimal openbsd-inetd openssl nessus-plugins \
netbase netpbm ntpdate man-db mkisofs mknbi \
module-init-tools mount
###################################################
# purge 7th pass
#aptitude purge imaze fortune-mod fortunes-min \
aalib-bin php4-mysql autotrace libautotrace3 bb \
bochsbios dante-client dict ding euro-support \
euro-support-console gocr gsm-utils ncpfs radio \
user-de xaos
###################################################
# install 6th pass
#aptitude install linux-kernel-headers \
linux-sound-base login loop-aes-utils lsb-base
###################################################
# install 5th pass
#aptitude install icedax imagemagick initramfs-tools \
initscripts iputils-arping iputils-ping \
iputils-tracepath hal hdparm hpijs gaim gim-data \
genisoimage gimp gimp-data gpgv gpm grub grub-disk \
gs-esp gv gcc gcc-3.3-base gcc-4.1 gcc-4.1-base \
fileutils findutils fontconfig fontconfig-config \
foomatic-filters e2fslibs e2fsprogs dialog elinks \
file firefox dpkg dpkg-dev dselect debconf \
debconf-utils debian-archive-keyring debootstrap \
cups-pdf cupsys cupsys-bsd cupsys-client cupsys-common \
cron console-common console-data coreutils cpio \
cdda2wav cddb cdrecord adduser apt apt-utils \
alsa-base alsa-utils
###################################################
# remove 4th pass
#aptitude purge kbackup kbackup-multibuf \
keyboard-tr-knoppix mikmod ibod ipppd isdnactivecards \
isdnlog isdnutils isdnutils-base isdnutils-xtools \
isdnvboxserver libcapi20-2 pppdcapiplugin speex joe \
irda-common irda-tools twm zile nedit nano
###################################################
# remove 3rd pass
# remove KDE packages
#aptitude purge ark k3b kaffeine kalarm kamera kandy \
kappfinder kate katomic kbattleship kcalc kcharselect \
kcontrol kdelock-knoppix kde-menu-knoppix \
kde-services-knoppix kdeaddons-kfile-plugins \
kdeadmin-kfile-plugins kdebase kdebase-bin \
kdebase-data kdebase-kio-plugins \
kdegraphics-kfile-plugins kdelibs-data kdelibs4c2a \
kdemultimedia-kfile-plugins kdemultimedia-kio-plugins \
kdenetwork-kfile-plugins kdepasswd \
kdepim-kfile-plugins kdepim-kio-plugins kdeprint \
kdesktop kdessh kdf kdm kfax kfind kfloppy kget \
kghostview khelpcenter khexedit kicker kiconedit \
klaptopdaemon klipper kmahjongg kmail kmailcvt \
kmenuedit kmix knode knoppix-menu knotes konq-plugins \
konqueror konqueror-nsplugins konsole konsolekalendar \
kooka kpackage kpager kpdf kpersonalizer kpf kppp krdc \
kreversi krfb ksmserver ksnapshot ksokoban ksplash \
ksudoku ksync ksysguard ksysguardd ksysv kteatime \
ktimer ktip ktnef ktuberling kuickshow kuser kview \
kviewshell kwin kwlan libk3b2 libkcal2b libkcddb1 \
libkdegames1 libkdepim1a libkleopatra1 libkmime2 \
libkonq4 libkpimidentities1 libkscan1 libksieve0 \
libktnef1 libmimelib1c2a lisa networkstatus vimpart
##################################################
# remove 2nd pass
#aptitude purge synaptic wvdial modemtool-knoppix \
openoffice-de-en openoffice.org-debian-menus \
tty-openoffice icedove frozen-bubble \
frozen-bubble-data clamav clamav-base \
clamav-freshclam lftp ftpd trans-de-en brltty \
manpages-de mysql-client mysql-client-5.0 mysql-common \
amanda-client amanda-server amanda-common squid \
squid-common squidclient apache2 apache2-mpm-prefork \
apache2-utils apache2.2-common
# install 2nd pass
#aptitude install virtualbox abiword atanks vsftpd \
openssh-server openssh-client chkrootkit chntpw \
xmms-flac xmms-mp4 xmms-oggre xmms-xmmplayer ripperx \
screen jpilot
####################################################
# removed at initial remaster
#apt-get remove --purge wine kde-i18n-de kde-i18n-es \
kde-i18n-fr kde-i18n-it kde-i18n-ja kde-i18n-nl \
kde-i18n-pl kde-i18n-tr k3b-i18n sun-java5-bin \
sun-java5-demo sun-java5-jdk sun-java5-jre \
sun-java5-plugin qemu
# installed initial configuration
#apt-get install aptitude gpg gnupg
The below script should be located at
ROOTDIR/source/KNOPPIX. It is used to get
public keys for certain apt repositories.#!/bin/bash
#getAptPublicKeys.sh
# get virtualbox public key
wget -q http://www.virtualbox.org/debian/innotek.asc \
-O- | apt-key add -
# get debian-multimedia-keyring
apt-get install debian-multimedia-keyring
# get debian-unofficial public key
wget http://ftp-master.debian-unofficial.org/other/ \
openpgp/archive-key-2008.asc -O - | apt-key add -
# get debian backports public key
wget -O - http://backports.org/debian/archive.key | \
apt-key add -
The below script should be located at
ROOTDIR/source/KNOPPIX. It displays the size
of the packages installed#!/bin/bash
# querySizeOfPackages.sh
dpkg-query -W --showformat='${Installed-Size}\t \
${Package}\t${Description;60}\n' | sort -n
The below script should be located at
ROOTDIR/source/KNOPPIX. It removes packages
that have been orphaned#!/bin/bash
#removedOrphanedPackages.sh
deborphan | xargs apt-get -y remove
Leave the chroot environment
The below script should be located at
ROOTDIR/source/KNOPPIX. It cleans up apt
packages and umounts /proc. After running
the below script, press CTRL+D to exit.#!/bin/bash
#leaveChroot.sh
aptitude clean
umount /proc
After pressing CTRL+D, you will exit the chroot
environment. Then run the below script to umount
the previously bound mountpoints.#!/bin/bash
#unchroot.sh
# release the binding of the temp vars
umount source/KNOPPIX/dev
umount source/KNOPPIX/sys
umount source/KNOPPIX/proc
mount
Other Customizations
sources.lst# official stable
deb http://ftp.debian.org/debian/ stable main contrib
deb-src http://ftp.debian.org/debian/ stable main \
contrib
deb http://security.debian.org/ stable/updates main \
contrib non-free
deb-src http://security.debian.org/ stable/updates \
main contrib
# unofficial
#deb http://ftp.debian-unofficial.org/debian/ etch \
main contrib non-free restricted
deb http://ftp.debian-unofficial.org/debian/ stable \
main contrib non-free restricted
# supplementary repositories
# backports
deb http://www.backports.org/debian etch-backports \
main contrib non-free
# virtual box
deb http://www.virtualbox.org/debian etch non-free
# for java
deb http://ftp.us.debian.org/debian stable main \
contrib non-free
## Christian Marillat's Mult-Media Repository
## for Unstable
deb http://www.debian-multimedia.org etch main
Change default window manager
Open /etc/init.d/knoppix-autoconfig and modify
the line
[ -n "$DESKTOP" ] || DESKTOP="kde"
I changed my default window manager to icewm.
Change the boot message
Open ROOTDIR/master/boot/boot.msg and modify.
I added my name, the date, and a remaster tag.
Remastering the ISO
Below is the script I use to actually remaster the ISO.
This script encompasses the final steps of the Knoppix
Remastering Howto. I do copy the aptConfigChanges.sh
out of source/KNOPPIX and I backup the previous
knoppix.iso that I generated from a previous remastering.
I need to add some variables so this is more readable.#!/bin/bash
#Remastering the ISO
#We've finished customizing and ready to burn!
#First do some cleanup:
# * remove any .bash_history files, tmp files, etc.
# * back out any changes you don't want burned back
# to the disc
echo ""
echo "remove .rr_moved from source/KNOPPIX"
rm -rf source/KNOPPIX/.rr_moved
echo "copy aptConfigChanges from source/KNOPPIX to ."
cp source/KNOPPIX/aptConfigChanges.sh .
echo "cp knoppix.iso to iso/knoppix.rem05.iso"
cp knoppix.iso iso/knoppix.rem05.iso
#KNOPPIX Compressed Image
echo ""
echo "make the compressed filesystem"
mkisofs -R -U -V "KNOPPIX.net filesystem" -publisher \
"KNOPPIX www.knoppix.net" -hide-rr-moved -cache-inodes \
-no-bak -pad /knx/source/KNOPPIX | nice -9 \
/usr/bin/create_compressed_fs - 65536 > \
/knx/master/KNOPPIX/KNOPPIX
#Live CD ISO
echo "make the final cdrom image"
cd /knx/master
find -type f -not -name md5sums -not -name boot.cat \
-not -name isolinux.bin -exec md5sum '{}' \; > \
KNOPPIX/md5sums
#Now to burn the image
echo "burn the cdrom image"
mkisofs -pad -l -r -J -v -V "KNOPPIX" -no-emul-boot \
-boot-load-size 4 -boot-info-table -b \
boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat \
-hide-rr-moved -o /knx/knoppix.iso /knx/master
#(the ISO is stored in /mnt/hda1/knx/knoppix.iso)
Test the remastered iso
I usually try to boot up the remaster iso in virtualbox
to verify that my remaster is good. If it is good,
I will copy the knoppix remaster to a usb drive. If it
is not good, I'll extract a knoppix source tree from a
previous remaster that I know is good.
Both of those steps are described below.
Copy the Knoppix remaster to usb drive
Below is the script I use to copy the necessary Knoppix
files to a usb drive. Modify the path to the mountpoint
for your own use.#!/bin/bash
#copyKnoppixMasterToUsb.sh
echo ""
echo ""
echo "ls -lah /media/usbfat"
ls -lah /media/usbfat
echo ""
echo "rm -drf /media/usbfat/knoppix"
rm -drf /media/usbfat/knoppix
echo ""
echo "cp -R master/KNOPPIX /media/usbfat"
cp -R master/KNOPPIX /media/usbfat
echo ""
echo ""
echo "ls -lah /media/usbfat/knoppix"
ls -lah /media/usbfat/knoppix
One Step Backward
If you'll remember, one of the lines in the remaster iso
script, backups up a previously remastered iso. When I
totally hose up a remaster, since I have a backup remaster
that works, I can get back to a good source. Below is the
script I use to extract a Knoppix source tree from a
compressed iso. Modify the variables for your own use.#!/bin/bash
#getKnoppixSourceFromCompressedIso.h
COMPRESSED_ISO="/knx/iso/knoppix.rem05.iso"
MOUNTPOINT1="/media/iso"
MOUNTPOINT2="/media/image"
TEMP_ISO="/knx/tmp.iso"
KNOPPIX_SRC="/knx/source/KNOPPIX"
echo ""
echo "mount compressed iso"
mount -o loop "$COMPRESSED_ISO" "$MOUNTPOINT1"
echo ""
echo "extract compressed iso to temporary iso"
extract_compressed_fs "$MOUNTPOINT1""/KNOPPIX/KNOPPIX" \
> "$TEMP_ISO"
echo ""
echo "umount compressed iso"
umount "$MOUNTPOINT1"
echo ""
echo "mount temporary iso"
mount -o loop "$TEMP_ISO" "$MOUNTPOINT2"
echo ""
echo "remove knpppix source"
#rm -drf "$KNOPPIX_SRC""/*"
rm -drf source/KNOPPIX/*
echo ""
echo "list mounted temporary iso"
ls -lah "$MOUNTPOINT2"
echo ""
echo "copy knoppix source from mounted temporary iso \
to chroot location"
#cp -Rp "$MOUNTPOINT2""/*" "$KNOPPIX_SRC"
cp -Rp /media/image/* source/KNOPPIX/
echo ""
echo "umount temporary iso"
umount "$MOUNTPOINT2"
echo ""
echo "remove temporary iso"
rm -drf "$TEMP_ISO"
Future Modifications
Virtual Box is not working correctly
Customize icewm
Customize Knoppix Kernel
Eliminate duplicate functionality (packages)
Remaster from within a remastered knoppix
Friday, February 29, 2008
usb devices in virtualbox on ubuntu 7.10
the article at www.arsgeek.com/?p=2776 has all the necessary steps to follow for getting a windows xp vm to recognize usb devices on an ubuntu 7.10 system.
Thursday, December 13, 2007
using screen as a terminal
from duane's pclug 14 slides at http://duane.freeshell.net/pclug/meeting_0014/slide_04.html
All screen commands start with the keystroke CTRL-a. We'll learn the most important one first CTRL-a ? This shows us the keystroke reference for screen. Now we'll list the open windows with CTRL-a w. We see that we only have one window open. Let's fix that by creating a new window with CTRL-a c. Now CTRL-a w shows us windows 0 and 1. To switch back to the first window, we use CTRL-a 0.
All screen commands start with the keystroke CTRL-a. We'll learn the most important one first CTRL-a ? This shows us the keystroke reference for screen. Now we'll list the open windows with CTRL-a w. We see that we only have one window open. Let's fix that by creating a new window with CTRL-a c. Now CTRL-a w shows us windows 0 and 1. To switch back to the first window, we use CTRL-a 0.
Thursday, November 8, 2007
Using a torrent to download from the command line
i was trying to download the dvd iso images of the debian distro. i downloaded the torrent files to the directory /data/iso/debian using the firefox browser. then i used btlaunchmany to actually download the iso images. i used the following command
btlaunchmany /data/iso/debian --max_upload_rate 5
/data/iso/debian is the directory that contains the torrent files
--max_upload_rate limits the rate at which packets can be uploaded from your machine
i didn't realize it when i started this process, but the bittorrent-downloader man page describes a --url option that downloads the torrent info file.
btlaunchmany /data/iso/debian --max_upload_rate 5
/data/iso/debian is the directory that contains the torrent files
--max_upload_rate limits the rate at which packets can be uploaded from your machine
i didn't realize it when i started this process, but the bittorrent-downloader man page describes a --url option that downloads the torrent info file.
Burn content to a DVD
use aptitude or apt-get to verify that you have dvd+rw-tools installed.
use the following command
growisofs -dvd-compat -input-charset=ISO-8859-1 -Z /dev/hda -R -J -pad "/my/directory/datas"
/dev/hda is the dvd burner device
/my/directory/datas is the path to the content to be burned
use the following command
growisofs -dvd-compat -input-charset=ISO-8859-1 -Z /dev/hda -R -J -pad "/my/directory/datas"
/dev/hda is the dvd burner device
/my/directory/datas is the path to the content to be burned
How to format a DVD-RW
use aptitude or apt-get to verify that you have dvd+rw-tools installed.
use the following command
dvd+rw-format -force /dev/hda
/dev/hda is the dvd burner device
use the following command
dvd+rw-format -force /dev/hda
/dev/hda is the dvd burner device
Burn iso to a DVD from the Command Line
use aptitude or apt-get to verify that you have dvd+rw-tools installed.
use the following command
growisofs -dvd-compat -Z /dev/hda=/path/to/image.iso
/dev/hda is the dvd burner device
/path/to/image.iso is the iso file to burn
use the following command
growisofs -dvd-compat -Z /dev/hda=/path/to/image.iso
/dev/hda is the dvd burner device
/path/to/image.iso is the iso file to burn
Thursday, October 4, 2007
using sed to edit a string in a file
action:
use sed to change a windows path 'g:\\' to a unix path '/share/data' in a file
command:
sed -e 's/g:/\/share\/data/g' -e 's/\\\\/\//g'file.2
comment:
sed == is a stream editor that can be used from the command line
format is - sed [command] <[inputfile]>[outputfile]
-e == is followed by a command, in this case a regex
< == is the input file
> == is the output file
use sed to change a windows path 'g:\\' to a unix path '/share/data' in a file
command:
sed -e 's/g:/\/share\/data/g' -e 's/\\\\/\//g'
comment:
sed == is a stream editor that can be used from the command line
format is - sed [command] <[inputfile]>[outputfile]
-e == is followed by a command, in this case a regex
< == is the input file
> == is the output file
vi keybindings for xpdf
Here is how to enable vi keybindings for xpdf navigation (j for up, k for down, h for left, l for right).
Add the following line to your ~/.Xresouces file.
xpdf.viKeys: trueThen run xrdb to load the changes:xrdb ~/.Xresouces
source: http://linuxwisdom.blogspot.com/search?q=xpdf
Wednesday, September 19, 2007
vga boot modes
i found the following info when trying to change the screen resolution at the command line (http://www.pendrivelinux.com/2007/05/24/
vga-boot-modes-to-set-screen-resolution/).
VGA Resolution and Color Depth reference Chart:
vga-boot-modes-to-set-screen-resolution/).
VGA Resolution and Color Depth reference Chart:
| Depth | 800×600 | 1024×768 | 1152×864 | 1280×1024 | 1600×1200 |
| 8 bit | vga=771 | vga=773 | vga=353 | vga=775 | vga=796 |
| 16 bit | vga=788 | vga=791 | vga=355 | vga=794 | vga=798 |
| 24 bit | vga=789 | vga=792 | vga=795 | vga=799 |
Friday, August 24, 2007
date format
date +%F\@%H%M
will display
2007-08-24@1439
will display
2007-08-24@1439
vim keystrokes
1. Shift-k displays man page
place the cursor on a unix command word and press Shift-k
the man page for the command will be displayed
place the cursor on a unix command word and press Shift-k
the man page for the command will be displayed
Thursday, August 23, 2007
file diff using vim
starting diff mode
vimdiff file1 file2 or vim -d file1 file2
while already in vim you can start diff mode in three ways.
:diffsplit {filename} - open a new window on the file {filename}
:diffthis - make the current window part of the diff windows
:diffpatch {patchfile} - use the current buffer, patch it with the diff found in {patchfile} and open a bufer on the result
jumping to diffs
[c - jump backwards to the previous start of a change
]c - jump forwards to the next start of a change
diff copying
:[range]diffg[et] - modify the current buffer to undo difference with another buffer
:[range]diffpu[t] - modify another buffer to undo difference with the current buffer
do - same as ":diffget" without argument or range. the "o" stands for "obtain"
dp - same as ":diffput" without the argument or range
when no [range] is given, the diff at the cursor position or just above it is affectes.
vimdiff file1 file2 or vim -d file1 file2
while already in vim you can start diff mode in three ways.
:diffsplit {filename} - open a new window on the file {filename}
:diffthis - make the current window part of the diff windows
:diffpatch {patchfile} - use the current buffer, patch it with the diff found in {patchfile} and open a bufer on the result
jumping to diffs
[c - jump backwards to the previous start of a change
]c - jump forwards to the next start of a change
diff copying
:[range]diffg[et] - modify the current buffer to undo difference with another buffer
:[range]diffpu[t] - modify another buffer to undo difference with the current buffer
do - same as ":diffget" without argument or range. the "o" stands for "obtain"
dp - same as ":diffput" without the argument or range
when no [range] is given, the diff at the cursor position or just above it is affectes.
Wednesday, August 22, 2007
find and overwrite a file
i had a need to find all files of a certain name, 'file1.file' and a certain size, greater than 20k, and overwrite every occurence with a different file 'file2.file'.
find ./ -type f -iname 'file1.file' -size +20k -exec cp ~/trunk/file2.file '{}' \;
./ == start find from the current directory
-type f == search for files
-iname 'file1.file' == insensitive case of the file named file1.file
-size +20k == search for files 20k in size or greater
-exec cp ~/trunk/file2.file '{}' \; == for each file found in the find, copy ~/trunk/file2.file and overwrite
find ./ -type f -iname 'file1.file' -size +20k -exec cp ~/trunk/file2.file '{}' \;
./ == start find from the current directory
-type f == search for files
-iname 'file1.file' == insensitive case of the file named file1.file
-size +20k == search for files 20k in size or greater
-exec cp ~/trunk/file2.file '{}' \; == for each file found in the find, copy ~/trunk/file2.file and overwrite
Tuesday, August 21, 2007
initial postgres login
i recently installed postgres 8.1 on my debian system using aptitude. following are the steps i used to create a new database or user.
1. su to super user
2. su to postgres user
3. create a new database or user
for more follow http://blog.revsys.com/2007/05/common_postgres.html
1. su to super user
2. su to postgres user
3. create a new database or user
for more follow http://blog.revsys.com/2007/05/common_postgres.html
Tuesday, August 7, 2007
audio and usb on winxp vm in virtualbox
below is what i did on my debian box to get audio and usb to work on my winxp vm in virtualbox. i would expect this to work just fine on ubuntu also.
audio
open the innotek virtualbox program
choose the winxp vm and click the settings button for the vm
select audio in the left hand menu
select enable audio
select host audio driver to be ALSA audio driver
usb
execute the following command from the command line as root and add the following command to your /etc/rc.local file
chown -R root:vboxuers /proc/bus/usb
add to following line to the bottom of /etc/fstab
none /proc/bus/usb usbfs devgid=1003,devmode=666 0 0
then execute "mount -a" from the command line as root
start winxp vm
then put a usb thumb drive in a usb port and start a winxp vm in virtualbox
you should be able to here all the cool windows startup sounds ;^)
you should also be able to access any usb device
audio
open the innotek virtualbox program
choose the winxp vm and click the settings button for the vm
select audio in the left hand menu
select enable audio
select host audio driver to be ALSA audio driver
usb
execute the following command from the command line as root and add the following command to your /etc/rc.local file
chown -R root:vboxuers /proc/bus/usb
add to following line to the bottom of /etc/fstab
none /proc/bus/usb usbfs devgid=1003,devmode=666 0 0
then execute "mount -a" from the command line as root
start winxp vm
then put a usb thumb drive in a usb port and start a winxp vm in virtualbox
you should be able to here all the cool windows startup sounds ;^)
you should also be able to access any usb device
Tuesday, July 10, 2007
steps to compile a debian kernel
DebianKernelCompileSteps
These following steps to compile a Linux kernel for Debian are taken from steps published on the web by Falko Timme [at] falkotimme [dot] com. I modified his steps for grub. He originally used lilo.
Be aware that there is some risk in compiling your own kernel! For example, it could happen that your machine does not boot properly after you have installed the new kernel so you might be forced to boot from a rescue CD to repair your system. You have been warned! This document comes without warranty of any kind!
Prepare Your Current Machine
First login to your Debian machine on the command line as root. Install the prerequisites that we need to compile and run a new kernel. At the command line execute the following:
apt-get update
apt-get install kernel-package ncurses-dev fakeroot wget bzip2 module-init-tools initrd-tools procps
If you are asked the following question:
"If you really want to remove modutils type 'yes':"
type yes.
It might also be necessary to update packages like bind9, quota, etc. - depending on your configuration. If you have problems with your existing packages try to get the appropriate package from www.backports.org.
Get the Kernel Source
Then go to /usr/src:
cd /usr/src
Then get the latest Linux kernel source (or the kernel source you need) from http://www.kernel.org/pub/linux/kernel/v2.6/:
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.8.1.tar.bz2
Unpack the kernel sources:
tar xjf linux-2.6.8.1.tar.bz2
cd linux-2.6.8.1/
Configure the Kernel
It is normally a good idea to take the configuration of your existing (working!) kernel 2.6 as a starting point for the configuration of your new kernel. Usually the current kernel configuration is saved in a file under /boot, e.g. /boot/config-2.6.3. We will load this configuration and then do the changes we desire.
make menuconfig
Select Load an Alternate Configuration File and enter the location of the configuration file of your current kernel (or upload my kernel configuration to your machine and enter its path):
The configuration of your current kernel will be loaded, and you can now browse through the menu and change the configuration to suit your needs. When you are finished, save your new kernel configuration:
Then run the following commands (please note that make dep is not needed any more for kernel 2.6):
make-kpkg clean
fakeroot make-kpkg --revision=custom.1.0 kernel_image
If the compilation stops with an error, run
make clean
and then re-run the previous commands starting with
make menuconfig
Change the kernel configuration where the error occurs. If no error occurs you will find the new kernel as a Debian package called kernel-image-2.6.8.1_custom.1.0_i386.deb under /usr/src.
cd ../
Install Your New Kernel
dpkg -i kernel-image-2.6.8.1_custom.1.0_i386.deb
Create a ramdisk of your new kernel (otherwise your system will most likely not boot):
cd /boot/
mkinitrd -o /boot/initrd.img-2.6.8.1 2.6.8.1
Edit Grub List
We are almost finished now. Edit the Grub stanza in /boot/grub/menu.list and add the line initrd /boot/initrd.img-2.6.8.1.
title Debian GNU/Linux, kernel 2.6.8.1
root (hd0,0)
kernel /boot/vmlinuz-2.6.8.1 root=/dev/hda1 ro
initrd /boot/initrd.img-2.6.8.1
savedefault
title Debian GNU/Linux, kernel 2.6.8.1 (single-user mode)
root (hd0,0)
kernel /boot/vmlinuz-2.6.8.1 root=/dev/hda1 ro single
initrd /boot/initrd.img-2.6.8.1
savedefault
Reboot Your Machine
reboot
and if everything is ok your machine should come up with the new kernel. You can run
uname -a
to verify that. Good luck!
These following steps to compile a Linux kernel for Debian are taken from steps published on the web by Falko Timme [at] falkotimme [dot] com. I modified his steps for grub. He originally used lilo.
Be aware that there is some risk in compiling your own kernel! For example, it could happen that your machine does not boot properly after you have installed the new kernel so you might be forced to boot from a rescue CD to repair your system. You have been warned! This document comes without warranty of any kind!
Prepare Your Current Machine
First login to your Debian machine on the command line as root. Install the prerequisites that we need to compile and run a new kernel. At the command line execute the following:
apt-get update
apt-get install kernel-package ncurses-dev fakeroot wget bzip2 module-init-tools initrd-tools procps
If you are asked the following question:
"If you really want to remove modutils type 'yes':"
type yes.
It might also be necessary to update packages like bind9, quota, etc. - depending on your configuration. If you have problems with your existing packages try to get the appropriate package from www.backports.org.
Get the Kernel Source
Then go to /usr/src:
cd /usr/src
Then get the latest Linux kernel source (or the kernel source you need) from http://www.kernel.org/pub/linux/kernel/v2.6/:
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.8.1.tar.bz2
Unpack the kernel sources:
tar xjf linux-2.6.8.1.tar.bz2
cd linux-2.6.8.1/
Configure the Kernel
It is normally a good idea to take the configuration of your existing (working!) kernel 2.6 as a starting point for the configuration of your new kernel. Usually the current kernel configuration is saved in a file under /boot, e.g. /boot/config-2.6.3. We will load this configuration and then do the changes we desire.
make menuconfig
Select Load an Alternate Configuration File and enter the location of the configuration file of your current kernel (or upload my kernel configuration to your machine and enter its path):
The configuration of your current kernel will be loaded, and you can now browse through the menu and change the configuration to suit your needs. When you are finished, save your new kernel configuration:
Then run the following commands (please note that make dep is not needed any more for kernel 2.6):
make-kpkg clean
fakeroot make-kpkg --revision=custom.1.0 kernel_image
If the compilation stops with an error, run
make clean
and then re-run the previous commands starting with
make menuconfig
Change the kernel configuration where the error occurs. If no error occurs you will find the new kernel as a Debian package called kernel-image-2.6.8.1_custom.1.0_i386.deb under /usr/src.
cd ../
Install Your New Kernel
dpkg -i kernel-image-2.6.8.1_custom.1.0_i386.deb
Create a ramdisk of your new kernel (otherwise your system will most likely not boot):
cd /boot/
mkinitrd -o /boot/initrd.img-2.6.8.1 2.6.8.1
Edit Grub List
We are almost finished now. Edit the Grub stanza in /boot/grub/menu.list and add the line initrd /boot/initrd.img-2.6.8.1.
title Debian GNU/Linux, kernel 2.6.8.1
root (hd0,0)
kernel /boot/vmlinuz-2.6.8.1 root=/dev/hda1 ro
initrd /boot/initrd.img-2.6.8.1
savedefault
title Debian GNU/Linux, kernel 2.6.8.1 (single-user mode)
root (hd0,0)
kernel /boot/vmlinuz-2.6.8.1 root=/dev/hda1 ro single
initrd /boot/initrd.img-2.6.8.1
savedefault
Reboot Your Machine
reboot
and if everything is ok your machine should come up with the new kernel. You can run
uname -a
to verify that. Good luck!
faster debian booting
to speed up my debian booting, i have disabled the following services using the update-rc.d command:
postgresql
bittorrent
tomcat5
bluetooth
apache2
apache-perl
doing this should speed up my systems boot time and still give me access to these services when i choose to use them.
postgresql
bittorrent
tomcat5
bluetooth
apache2
apache-perl
doing this should speed up my systems boot time and still give me access to these services when i choose to use them.
managing system services/daemons
on a debian system, the scripts to start and stop the system's services/daemons reside in /etc/init.d/ . For example, to stop the bittorrent service execute the following at the command line:
>/etc/init.d/bittorrent stop
to start the bittorrent service, execute the following at the command line:
>/etc/init.d/bittorrent start
what if the package apache2 is installed on my system, but i don't want that service to be started when the machine boots.
the command update-rc.d manages the links between the /etc/rc#.d directories and the scripts in the /etc/init.d directory. to enable a service on boot execute the following at the command line:
>update-rc.d "serviceName" defaults
to disable a service on boot execute the following at the command line:
>update-rc.d -f "serviceName" remove
>/etc/init.d/bittorrent stop
to start the bittorrent service, execute the following at the command line:
>/etc/init.d/bittorrent start
what if the package apache2 is installed on my system, but i don't want that service to be started when the machine boots.
the command update-rc.d manages the links between the /etc/rc#.d directories and the scripts in the /etc/init.d directory. to enable a service on boot execute the following at the command line:
>update-rc.d "serviceName" defaults
to disable a service on boot execute the following at the command line:
>update-rc.d -f "serviceName" remove
Subscribe to:
Posts (Atom)