Disabling GDM greeter sound on Fedora 11 [Update]

Due to a bug in GDM there currently is now way of preventing GDM from playing a sound when you login to your Fedora 11 box. This is especially annoying on notebooks, e.g. when you’re sitting in a meeting or in a (quiet) public place like a library.

The only workaround (a bit dirty, granted) is to delete or rename the sound file:

# cd /usr/share/sounds/freedesktop/stereo/
# mv bell.ogg bell.ogg-bak

Enjoy reclaimed silence!

Update: There is a workaround in bugzilla that gets by without deleting or renaming any files.

GDM AutoLogin

      No Comments on GDM AutoLogin

To login a certain user automatically at boot time, you have to change the daemon-section of your /etc/gdm/custom.conf:

[daemon]
TimedLoginEnable=true
TimedLogin=you
TimedLoginDelay=0 

With ‘TimedLogin’ being a valid, non-root user and ‘TimedLoginDelay’ being the login delay in seconds.

An overview of available configuration variables can be found on live.gnome.org

CentOS and Attansic L1 Gigabit Ethernet

      1 Comment on CentOS and Attansic L1 Gigabit Ethernet

There are quite a few mainboards with an onBoard Attansic Gigabit Ethernet Chip:

# lspci
[...]
04:00.0 Ethernet controller: Attansic Technology Corp. L1 Gigabit Ethernet Adapter (rev b0)
[...]

The corresponding driver is part of the mainline kernel since 2.6.21 (April 2007), but CentOS 5.x still uses a kernel version (2.6.18) which lacks this feature.

Jay Cliburn did quite a few enhancements on the original driver from Xiong Huang of Attansic and he even built an rpm package for CentOS:

rpm -ivh ftp://ftp.hogchain.net/pub/linux/attansic/atl1/centos5.2/kmod-atl1-2.1.3-1.i686.rpm

Prebuilt rpms for other kernel flavours (x86_64, PAE and xen) can be found on the ATL1 sourceforge project page.

Send a fax transmission confirmation via eMail

Just as you can formward incoming faxes to you eMail account, you can send a transmission confirmation when a facsimile was sent successfully. You can even send a copy of the fax along with it.

bin/notify is the command script invoked by the facsimile server to notify a user about the status of an outbound job. It parses etc/FaxNotify so you can customize the script by editing the parameter file.

Unfortunately the variable names are quite different from the bin/faxrcvd script. To send a pdf copy of you outgoing facsimiles to you eMail address you have to change FaxNotify as follows:

RETURNFILETYPE=pdf;
mailaddr=user@domain.tld;

The allowed values for the RETURNFILETYPE variable are just the same as for FILETYPE in the bin/faxrcvd script: ps, tif or pdf.

And you can of course alter the bin/notify script itself, too. But as bin/faxrcvd it is part of the package distribution and subject to being overwritten by subsequent upgrades.

Resources:
http://hylafax.sourceforge.net/man/notify.php

Forwarding incoming faxes via eMail

      1 Comment on Forwarding incoming faxes via eMail

bin/faxrcvd is the command script invoked by the facsimile server whenever a facsimile is received. It parses etc/FaxDispatch so you can customize the script by editing the parameter file.
To forward incoming facsimiles to you eMail address change FaxDispatch accordingly:

FILETYPE=pdf;
SENDTO=user@domain.tld;

Allowed values for the FILETYPE variable are ps, tif or pdf. Note that non-ASCII filetypes require an encoder (but normally your HylaFAX rpm package comes with this).

You can of course alter the bin/faxrcvd itself, but it is part of the package distribution and subject to being overwritten by subsequent upgrades.

Resources:
http://hylafax.sourceforge.net/man/faxrcvd.php

Googlemail and sSMTP on CentOS

      3 Comments on Googlemail and sSMTP on CentOS

sSMTP is a very simple and straightforward alternative to big MTAs like sendmail or Exim. Unfortunately CentOS repositories don’t come with it, so you have to fetch it from Fedora’s EPEL repo.

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm

After activating the ‘Extra Packages for Enterprise Linux’ repository, you can install sSMTP:

yum install ssmtp

Configuration is rather simple. Just change the following values in your /etc/ssmtp/ssmtp.conf

# The person who gets all mail for userids < 500
# Make this empty to disable rewriting.
root=youraccount@googlemail.com

# The place where the mail goes. The actual machine name is required
# no MX records are consulted. Commonly mailhosts are named mail.domain.com
# The example will fit if you are in domain.com and your mailhub is so named.
mailhub=smtp.googlemail.com:465

[...]

# Set this to never rewrite the "From:" line (unless not given) and to
# use that address in the "from line" of the envelope.
FromLineOverride=YES

# Use SSL/TLS to send secure messages to server.
UseTLS=YES

[...]

AuthUser=YOURACCOUNT
AuthPass=PASSWORD

You can test by sending a mail to user@domain.tld

# echo test | mail -s "testing ssmtp" user@domain.tld

Resources and further reading:
http://www.boristheengineer.co.uk/slug/configuring_ssmtp.htm
http://www.destr0yr.com/article.php/Gmail_and_sSMTP

Assign hardware to DomU with PCIBack as module [Update]

If the Dom0’s kernel is built with pciback as a module (grep CONFIG_XEN_PCIDEV_BACKEND /boot/config-`uname -r`), using the kernel command-line parameter pciback.hide won’t work.

There is of course more than solution how you can assign hardware to a domU, but the probably easiest one is to to pass the hide parameter to the pciback module in /etc/modprobe.conf:

[...]
 # hide (0000:05:02.0)
 options pciback hide=(0000:05:02.0)
[...]

The xensouce mailing list even tells you how to modify your initrd preloading the pciback driver before all others

# mkinitrd -f --preload=pciback /boot/initrd-$(uname -r).img $(uname -r)

Another (maybe more elegant) solution would be assigning the pci devices in a separate init script:
http://www.bestgrid.org/index.php/Xen:_assigning_PCI_devices_to_a_domain
http://projects.arcs.org.au/trac/systems/wiki/Howto/PciBack

Update: If you want to avoid rebuilding the initial ramdisk manually every time you update your kernel, you may want to put this small script to your /etc/rc.local

/sbin/modprobe pciback
BDF=0000:05:02.0
# Unbind a PCI function from its driver as necessary
[ ! -e /sys/bus/pci/devices/$BDF/driver/unbind ] || \
        echo -n $BDF > /sys/bus/pci/devices/$BDF/driver/unbind
# Add a new slot to the PCI Backend's list
echo -n $BDF > /sys/bus/pci/drivers/pciback/new_slot
# Now that the backend is watching for the slot, bind to it
echo -n $BDF > /sys/bus/pci/drivers/pciback/bind

With the preceding modprobe pciback the module doesn’t have to be preloaded in you initial ramdisk.

Shutting down xen domUs without saving them

Per default, CentOS 5.3 saves a domU’s state when the hypervisor is shut down. In principle this a nice behaviour: The domU will restore its state automagically when the hypervisor comes up again and just continue working. But there are some services (e.g. mldonkey) that don’t like to be restored and refuse to work (i.e. keep in a blocked state forever).

The easiest way of fixing this, is to shut down the domUs gracefully with the hypervisor. In CentOS (as in probably most other distros as well) you can change xen’s shutdown behaviour in /etc/sysconfig/xendomains

[...]
## Type: string
## Default: /var/lib/xen/save
#
# Directory to save running domains to when the system (dom0) is
# shut down. Will also be used to restore domains from if # XENDOMAINS_RESTORE
# is set (see below). Leave empty to disable domain saving on shutdown 
# (e.g. because you rather shut domains down).
# If domain saving does succeed, SHUTDOWN will not be executed.
#
#XENDOMAINS_SAVE=/var/lib/xen/save
XENDOMAINS_SAVE=
[...]

All we have to do is empty the value of the XENDOMAINS_SAVE variable, so SHUTDOWN will be executed instead.

Online resizing ext3 partitions

      16 Comments on Online resizing ext3 partitions

First, we have to delete our current partition and create a bigger one (don’t be afraid, no data will be lost):

# fdisk /dev/xvda

Type m to get a list of all commands:

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Let’s print out the partition table and look for the ext3 partition, we want to enlarge (it’s easy here, there is just one partition):

Command (m for help): p

Disk /dev/xvda: 5218 MB, 5218304000 bytes
255 heads, 63 sectors/track, 634 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1   *           1         634     5092573+  83  Linux

Now we delete the old partition (/dev/xvda1) and create a new one with the maximum available size:

Command (m for help): d
Selected partition 1

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-634, default 1): 
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-634, default 634): 
Using default value 634

Our original /dev/xvda1 had the bootable flag (see fdisk -l output), so we must add it to our new /dev/xvda1 again:

Command (m for help): a
Partition number (1-4): 1

Now let’s write our new partition table and exit fdisk:

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.

After rebooting the system (!) we can online-resize the filesystem with a simple command:

# resize2fs /dev/xvda1 
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/xvda1 is mounted on /; on-line resizing required
Performing an on-line resize of /dev/xvda1 to 1522150 (4k) blocks.
The filesystem on /dev/xvda1 is now 1522150 blocks long.