This is an old revision of the document!


Tips and Tricks

You have a tip you think might be useful for other grml-users? Please document it! Don't forget to add your contact information so we can contact you if we think your tip might be useful for integration into official documents! Sonu 09255164555

grml-tips

Starting with grml 0.6 and grml-small 0.2 a script named 'grml-tips' is available on the live-CD. Just run 'grml-tips $KEYWORD' to get tips, tricks and useful hints on $KEYWORD.

Switch language/keyboard

If you want to change the keyboard layout (default is us) use the bootparam “lang”. For example boot with “grml lang=de” to activate german keyboard and settings ($LANG, $LC_…). If you have a running grml-system and want to switch between german and english use “grml-lang”, for example “grml-lang de” to switch to german settings. Take a look at the language section in the FAQ for more details.

If you want to change the default keyboard layout, you just have to append (really append it! Does not work if it is the first argument in the APPEND-Line!) “lang=de” to the APPEND line in syslinux.cfg/isolinux.cfg

Boot grml via floppy disk

Your computer can not boot from CD-ROM but provides a floppy disk? Take a look at ubcd4win, Smart Boot Manager or Plop Boot Manager, they provide support for booting from CD-ROM via a special floppy disk.

Mount USB-stick

If your usb-stick has a partition like /dev/sda1 just use 'mount /mnt/external1' to mount it. 'mount /mnt/external' corresponds to /dev/sda. [Tip by mika]

Install (plain) Debian via Grml

It is possible to install a plain(!) Debian system via Grml. This might be useful for example if Debian does not boot on your hardware but Grml does. This is possible via running grml-debootstrap. [Tip by mika]

grml as AFS client

With the next three lines you could activate the OpenAFS functions within grml 0.6. The krb5 is needed for the cells with krb5-auth. The krb5 is NOT fully integrated, e.g. no krb5-capable ssh. First create the afs cache as a ramdisk. After this you configure the krb5 realm and after that you configure OpenAFS with your cell name and your databaseservers for that cell. Please activate the freelancer mode, it makes accessing other cells easier.

prepare_ramdisk.sh /var/cache/openafs start
dpkg-reconfigure krb5-config
dpkg-reconfigure openafs-client

After this two steps you should be able to obtain valid krb5 tickets and should be able to access various afs cells. Maybe a aklog tells you it can't find the correct cell.

aklog -d -cell cell.name.tld -k KRB5.REALM.TLD

Is the correct term for aklog to obtain a valid OpenAFS-token after obtaining a valid krb5-ticket.

Notice: grml 0.7 ships the openafs kernel module named libafs as used by upstream (reason: Debian kernel source package wasn't useable for kernel 2.6.16 at time of release). A symlink lets you use 'modprobe openafs' as well as 'modprobe libafs', but the kernel module registers itself as 'libafs' so you have to run 'rmmod libafs' to remove it.

grml and vmware

Probing of IDE-devices by the kernel might last long (tested with vmware 5.0.0), see relevant output of dmesg:

ide1: BM-DMA at 0x1458-0x145f, BIOS settings: hdc:DMA, hdd:pio
Probing IDE interface ide1...
hdc: VMware Virtual IDE CDROM Drive, ATAPI CD/DVD-ROM drive
ide1 at 0x170-0x177,0x376 on irq 15
Probing IDE interface ide0...
Probing IDE interface ide2...
Probing IDE interface ide3...
Probing IDE interface ide4...
Probing IDE interface ide5...
hdc: ATAPI 1X CD-ROM drive, 32kb Cache, UDMA(33)

So in this case only ide is relevant. Let's skip probing of the other ide-devices via kerneloption ide?=noprobe. Usage example:

grml ide0=noprobe ide2=noprobe ide3=noprobe ide4=noprobe ide5=noprobe

[Tip by mika]

Boot grml without CD

Besides the possibilities to boot grml from CD, USB/Firewire device or via network using grml-terminalserver you can boot a grml-ISO from your harddisk as well.

* Copy the grml-ISO to a partition on your harddisk (e.g. hda5):

grml tohd=/dev/hda5

* Reboot to your Linux box and create a directory named grml in /boot of your linux partition ('mkdir /boot/grml').

* Copy the files “linux26” and “minirt26.gz” from grml_CD/boot/isolinux to /boot/grml/.

* Adjust your bootloader.

  • Example for Grub: add an entry for grml to /boot/grub/menu.lst:
# this entry boots grml from iso_image  on /dev/hda5
title   Grml
root  (hd0,4)
kernel  /boot/grml/linux26 fromhd=/dev/hda5 ramdisk=100000
initrd  /boot/grml/minirt26.gz
  • Example for /etc/lilo.conf:
image=/boot/grml/linux26
  append="fromhd=/dev/hda5 ramdisk=100000"
  label=Grml
  initrd=/boot/grml/minirt26.gz

* That's it. Reboot and pick Grml from the bootloader.

[Tip by boulhian and mika]

Reinstall all packages

For example on the heavily stripped down grml-small it might be useful to reinstall all (already installed) packages. Just start aptitude, get the cursor over the “Installed Packages” category and press Shift-L and run update/upgrade afterwards. [Tip by mika]

System recovery

ddrescue: Probably you already know 'dd' for copying files. ddrescue is an improved version of dd which 'tries to read and if it fails it will go on with the next sectors, where tools like dd will fail.' (manpage of ddrescue). Use this tool if a filesystem/partition is quite broken and you want to restore some data anyway. [Tip by mika]

NTFS: problems with an NTFS partition? Take a look at the packages salvage-ntfs and scrounge-ntfs. If you want to resize a NTFS-partition use ntfsresize (part of ntfsprogs). [Tip by mika]

Texttools

mutt/mutt-ng: You don't know how to configure the console mailclient? Just run grml-mutt/grml-muttng! [Tip by mika]

slrn: You don't know how to configure the console newsreader? Just run grml-slrn! [Tip by mika]

Sysadmin

grml-hwinfo: Run grml-hwinfo to collect hardware-information. You will get a file info.tar.bz2 which contains all relevant files. Run grml-hwinfo as user root (or via 'sudo grml-hwinfo') to get even more information. [Tip by mika]

Hauppauge PVR150/250/350/500

Notice: Applies to grml 0.5-6, please report feedback if you've tested it! To use the Hauppauge PVR250 with grml just download the firmware from http://xs.qapla.org/ivtv/ivtv-fw.tar.bz2 and extract it to /lib/modules/:

# dmesg | grep tveeprom

should output something like

ivtv0: i2c attach to card #0 ok [client=tveeprom, addr=50]
tveeprom 0-0050: Hauppauge model 48134, rev J342, serial# 6564630
tveeprom 0-0050: tuner model is Temic 4009FR5 (idx 42, type 20)
tveeprom 0-0050: TV standards PAL(B/G) (eeprom 0x04)
tveeprom 0-0050: audio processor is MSP4418 (idx 25)
tveeprom 0-0050: decoder processor is SAA7115 (idx 19)
tveeprom 0-0050: has radio, has IR remote

the interesting part is the line “tuner model is …”. note the tuner type, you'll need it later.

To set up ivtv write the following to /etc/modutils/ivtv:

   alias char-major-81 videodev
   alias char-major-81-0 ivtv
   options ivtv ivtv-debug=0 mpg_buffers=90
   options tuner type=$tunermodel
   options msp3400 once=1 simple=1 debug=0
   add below ivtv msp3400 saa7115 tuner

With $tunermodel= the number you got from dmesg earlier.

For the pvr500 or multiple other cards, you'll need more than one of this blocks. See docs on www.ivtvdriver.org

# rmmod tveeprom
# rmmod ivtv
# wget http://xs.qapla.org/ivtv/ivtv-fw.tar.bz2 && tar -C /lib/firmware/ -p -xjf ivtv-fw.tar.bz2
# cd /lib/firmware
# mv ivtv-fw-enc.bin v4l-cx2341x-enc.fw
# mv ivtv-fw-dec.bin v4l-cx2341x-dec.fw
# modprobe ivtv
% mplayer /dev/video0

You can use ptune to change the channel.

# ptune --freqtable pal-europe --tuner-num 0 --input /dev/video0 --channel SE1

More information (especially for the firmware-stuff) available on: http://home.comcast.net/~alf_park/mythtv.html

Even more informnation is in the wiki on the Homepage of ivtv at www.ivtvdriver.org

[Tip by Christian Scheucher] [Updated by Spida]

Packages which might be useful on a harddisk installation

  • cppunit
  • doc-linux-html + doc-linux-nonfree-html
  • dpkg-www + dwww
  • dvdrip
  • emacs-goodies-el
  • foomatic-db + foomatic-db-engine foomatic-filers python-foomatic + foomatic-filters-ppds + foomatic-db-hpijs + foomatic-gui
  • gimp + gimp-help-de + grokking-the-gimp + libgimp-perl + libgtk2-perl
  • gnus-bonus-el
  • graphviz
  • gxine
  • heartbeat
  • libaudiofile-dev libxpm-dev libglib2.0-dev libssl-dev
  • lmodern
  • lsh-client lsh-server
  • luma
  • manpages-posix-dev
  • mew
  • msttcorefonts
  • openswan
  • oprofile
  • osirisd + osirismd
  • php4-cli
  • printconf
  • samhain
  • spikeproxy
  • svk
  • svn-arch-mirror
  • systemimager-…
  • transcode
  • w32codecs + libdvdcss / libdvdcss2

[Tip by mika]

How to add your own files to a second session on a grml cd

This is only useful with grml-small since it's the only flavor which has space left on the cd.

  * Get the grml iso 
    e.g.: "wget http://mirror.inode.at/data/grml/grml_small_0.2.iso"
  * Burn the first session
    e.g.: "cdrecord dev=4,0,0 -v -multi -tao grml_small_0.2.iso"
  * Create a directory to store your files
    e.g.: "mkdir mydata"
    (This directory will be located in /cdrom after burning the second session.)
  * Add all your files you want to have on the cd
    e.g.: "cp -r /home/jimmy/.ssh mydata/"
    "mkdir mydata/files"
    "cp /home/jimmy/files/*.txt mydata/files/"
  * Create the second sessions containing theses files
    e.g.: "mkisofs -M grml_small_0.2.iso -C `cdrecord -msinfo dev=4,0,0` -R -o 2nd_session.iso mydata"
  * Append the second session to the cd
    e.g.: "cdrecord dev=4,0,0 -v -multi -tao 2nd_session.iso
  * Boot from your new personalized grml cd.

[Tip by jimmy]

If both sessions contain identical paths, the file from the second session takes precedence. This does not hold for files that are needed before the actual boot, such as isolinux.cfg, since isolinux only sees the first session.

How to make an audio file out of a DVD track

There are some ways to do that but one way that I like does not involve mencoder and so can be used with a GRML-live cd. It uses special files called named pipes. These are files like pipes but with a name and functioning like a first-in first-out batch, thus the name. So one program puts something in this special file and one program waits on the other end to do something with it.

  • First you create a named pipe with
mkfifo /tmp/fifo.wav
  • Then let one sound encoder sit on one side with (mppenc [musepack] is a very excellent program to encode your music, though sadly not widely known):
mppenc /tmp/fifo.wav track04.mpc&
  • On the other side you put a dvd-player like mplayer with
 
mplayer -af resample=44100 -vc null -vo null -ao pcm:fast:file=/tmp/fifo.wav -chapter 4-4 dvd://1
  • It's sensitive to use 44.1 khz for the output file and “vc null -vo null” does tell mplayer to not display video at all which makes it faster to encode.

[Tip by Matthias Kopfermann]

How to make a fully automatic rescue disk with fixed configuration

Sometimes, one is in charge of a remote system where no linux-savvy local admins are around. In this case, it is a good idea to have a CD on site which allows the system to boot in case the locally installed Linux system is broken.

While the “debnet” boot option does a good job in locating the network configuration of a Debian installation on the local disk, taking the data found there to configure the network, there might be cases where the local system is completely broken and /etc/network/interface cannot be found. In this case, a specially crafted grml can be used to

  • configure the network according to a configuration hard-coded on the CD
  • set a password for the grml user which is hard-coded on the CD
  • start an ssh daemon

In short, with this CD, the system will come up with the network configured and ready for remote administration. The local admin only needs to boot from the CD, the rest is automated.

To do this, you can either

  • Put the additional files on a second session on the GRML CD or
  • remaster grml. No change to the squashfs is necessary.

Remastering grml has the advantage that you can edit the isolinux boot message file to say that this is a specially crafted grml, and that the result is a single .iso file which can be sent over the internet and burned to a CD-R with any CD burner software including Windows software.

  • Create 'bootparams/bootparams' on the GRML CD with the contents 'nodhcp scripts'. This will disable DHCP IP address configuration and allows scripts/grml.sh to be executed.
  • Modify boot/isolinux/boot.msg and/or boot/isolinux/isolinux.cfg to your needs. If you need to modify isolinux.cfg, you can't take the multisession approach and need to remaster grml.
  • Create 'scripts/grml.sh' with the following contents
#!/bin/bash

ip link set dev eth0 up
ip addr add dev eth0 <address>/<prefix> brd +
ip route add default via <gateway>
echo "grml:<password>" | chpasswd
/etc/init.d/ssh start

Substitute address, prefix, gateway and password with your values. If you don't want to use the plain text password here, use chpasswd –encrypted and pass a crypt(1)ed password.

[Tip by Marc 'Zugschlus' Haber]

Transparent Debian Proxy

While apt-proxy might have some cool features, apt-cacher turned out to be the perfect solution for me, because it can be used transparently on a router:

Install of apt-cacher, the default config will do:

apt-get install apt-cacher

Usually you would now edit the clients sources.list to use apt-cacher. However, i wanted to force the clients to use apt-cacher without clientside modification. I found out that this can be done the same way like a transparent squid. You just have to decide for which debian mirrors you want to enforce the transparent proxying.

Find out the ip's of the debian mirrors. For example: ftp.de.debian.org is 141.76.2.4 and ftp.at.debian.org is 213.129.232.18. Then add this to your firewall script:

DEBIAN_MIRRORS="141.76.2.4 213.129.232.18"

for ip in ${DEBIAN_MIRRORS} ; do
  ${IPTABLES} -t nat -A PREROUTING -s $subnet -d $ip -p tcp --dport 80 -j REDIRECT --to-port 3142
done

( where ${IPTABLES} is the location of your iptables binary and $subnet is your internal subnet )

Voila, everybody in your subnet who does access either ftp.de.debian.org or ftp.at.debian.org will actually access your apt-cacher

To use apt-cacher on the router itself, you add this to your /etc/apt/apt.conf:

Acquire::http::Proxy "http://localhost:3142/";
 
tips.1326707132.txt.gz · Last modified: 2012/01/16 10:45 by mika
 
Recent changes RSS feed Creative Commons License Valid XHTML 1.0 Valid CSS Grml homepage Driven by DokuWiki