Solutions Log by Dan Reiland

19Aug/090

C compiler cannot create executables received after emerge world

Issue:
When attempting to emerge a new package after a recent emerge -DunNv world the new package emerge fails with:

. . .
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for builtin ELF support... yes
checking for ELF core file support... yes
checking for file formats in man section 5... no
checking for i686-pc-linux-gnu-gcc... i686-pc-linux-gnu-gcc
checking for C compiler default output file name...
configure: error: C compiler cannot create executables
See `config.log' for more details.
. . .

Cause:
The issue is related to gcc being upgraded as part of a previously executed emerge world. The /etc/ld.so.conf and /etc/env.d/05gcc-i686-pc-linux-gnu files no longer point to valid gcc library and binary paths.

Resolution:
Gentoo provides the gcc-config command to set the active gcc compiler profile.

Sample gcc-config run to list the available gcc profiles and set the active profile to option 1:

root # gcc-config -l
 [1] i686-pc-linux-gnu-4.3.2 *
root # gcc-config 1
 * Switching native-compiler to i686-pc-linux-gnu-4.3.2 ...               [ ok ]

Reference: http://forums.gentoo.org/viewtopic.php?t=27486&highlight=gcc

Filed under: Linux, sysadmin No Comments
13Aug/092

Create a Large File For Testing

Issue:
Often you need a set of variable sized files for testing a particular scenario. Generating test data is a painless endeavor.

Resolution:
The Unix dd command is perfectly suited to dispatch this need.

dd if=/dev/zero of=~/testfile.txt bs=1m count=5

The above command will create a 5 megabyte file full of zeroes. Lovely. You may adjust the count (or blocksize) to achieve the results you desire. This data also achieves stellar compression ratios based on its content.

One could also create a test file full of pseudo random data by pointing if to /dev/urandom.

dd if=/dev/urandom of=~/testfile.txt bs=1m count=5

Explanation of /dev/urandom

10Aug/090

Remote Mirroring Using nc and dd

You can use the dd and nc commands for exact disk mirroring from one server to another. The following commands send data from Server1 to Server2:

1
2
Server2# nc -l 12345 | dd of=/dev/sdb
Server1# dd if=/dev/sda | nc server2 12345

Make sure that you issue Server2's command first so that it's listening on port 12345 when Server1 starts sending its data.

Unless you're sure that the disk is not being modified, it's better to boot Server1 from a RescueCD or LiveCD to do the copy.

Reference: http://www.linuxjournal.com/content/tech-tip-remote-mirroring-using-nc-and-dd

29Jul/090

PowerDNS continually dies after creating a slave zone

Issue:
When PowerDNS is configured for a sqlite or sqlite3 backend and a slave zone is added, the PowerDNS daemon continually dies and respawns. This loop persists until the daemon is forcibly terminated.

My logs showed the following:

Jul 29 12:12:38 localhost pdns[14465]: PowerDNS 2.9.22 (C) 2001-2009 PowerDNS.COM BV (Jul 29 2009, 04:47:43, gcc 4.3.3) starting up
Jul 29 12:12:38 localhost pdns[14465]: PowerDNS comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it according to the terms of the GPL version 2.
Jul 29 12:12:38 localhost pdns[14465]: DNS Proxy launched, local port 22293, remote 192.168.8.1:53
Jul 29 12:12:38 localhost pdns[14465]: Launched webserver on 0.0.0.0:8081
Jul 29 12:12:38 localhost pdns[14465]: Master/slave communicator launching
Jul 29 12:12:38 localhost pdns[14465]: Creating backend connection for TCP
Jul 29 12:12:38 localhost pdns[14465]: gsqlite3: connection to '/var/lib/powerdns/pdns.db' succesful
Jul 29 12:12:38 localhost pdns[14465]: gsqlite3: connection to '/var/lib/powerdns/pdns.db' succesful
Jul 29 12:12:38 localhost pdns[14465]: About to create 3 backend threads for UDP
Jul 29 12:12:38 localhost pdns[14465]: gsqlite3: connection to '/var/lib/powerdns/pdns.db' succesful
Jul 29 12:12:38 localhost pdns[14465]: 1 slave domain needs checking
Jul 29 12:12:38 localhost pdns[14465]: Domain domain.local is stale, master serial 349, our serial 0
Jul 29 12:12:38 localhost pdns[14465]: Initiating transfer of 'domain.local' from remote '192.168.8.40'
Jul 29 12:12:38 localhost pdns[14465]: gsqlite3: connection to '/var/lib/powerdns/pdns.db' succesful
Jul 29 12:12:38 localhost pdns[14465]: AXFR started for 'domain.local', transaction started
Jul 29 12:12:38 localhost pdns[14465]: Communicator thread died because of error: Database failed to start transaction: Error while retrieving SQLite query results

Cause:
The PowerDNS sqlite and sqlite3 backends do not support slave zones as of v.2.9.22

Resolution:
Configure PowerDNS to use a different database backend: MySQL, PostgreSQL, Oracle, etc.

9Jul/092

rsync failed to set times on [filename]

This error occurs because the version of rsync on the system cannot preserve modified times for directories.

Run rsync with the following arguments to suppress this warning:

 rsync -avPO ./source/* ./destination

Explanation of switches:

1
2
3
4
a -> Archive mode (do not preserve hard links, ACLs, or extended attributes)
v -> Verbose (I like to know what is happening)
P -> Equivalent to --partial --progress (for long transfers that may be interrupted)
O -> Omit directories from times
Tagged as: , 2 Comments
8Jul/090

Create thumbnails en-masse from a bash prompt

A simple one-liner and ffmpeg, basename, and cut gets this done.

1
for i in *.f4v; do ffmpeg -i `basename $i` -s 320x240 `basename $i | cut -d'.' -f1`.jpg; done

Thumbnail output size is configurable with the -s switch.

8Jul/093

Install VMware Tools on a Gentoo Guest

  1. emerge pciutils mkinitrd
  2. mkdir /etc/rc.d
  3. cd /etc/rc.d
  4. for i in `seq 0 6`; do mkdir rc$i.d; done
  5. File -> Install VMware Tools
  6. mount /mnt/cdrom
  7. cd /tmp
  8. tar xvfz /mnt/cdrom/VMwareTools-3.5.0-158874.tar.gz
  9. cd vmware-tools-distrib/
  10. ./vmware-install.pl
  11. All defaults with the exception of:
    /etc/rc.d -> location of the rc.d directories
    /etc/init.d -> location of the init scripts
  12. When prompted to run vmware-tools-config, decline
  13. rc-update add vmware-tools default
  14. /usr/bin/vmware-config-tools.pl
  15. Verify that everything compiles without error
  16. Reboot
  17. Verify that VMware tools are reported as running in the VI console

Note: This was tested and found working under VMware VI 3.5.x with Gentoo x86_64, kernel 2.6.27-gentoo-r8.

Tagged as: 3 Comments
7Jul/090

Logical Volume Expansion with Linux

  1. Add additional storage to the system. Physically or virtually.
  2. fdisk /dev/newdev - create new partition, set as type 8e (LVM), write partition table
  3. Create a new physical volume on the newly partitioned disk
  4. 1
    pvcreate /dev/newDevPart
  5. Extend an existing volume group
  6. 1
    vgextend tank /dev/newDevPart
  7. Extend the logical volume by the desired amount
  8. 1
    lvextend -L +5G /dev/tank/var
  9. Extend the filesystem on the logical volume
  10. 1
    xfs_growfs /var
Filed under: Linux, sysadmin No Comments
7Jul/090

How To Backup data using Amanda and Amazon S3

http://wiki.zmanda.com/index.php/How_To:Backup_to_Amazon_S3

7Jul/090

Amanda amlabel CURL error: SSL certificate problem when using S3 buckets under Gentoo for backup

This one was fun.

Issue:
The error presented when attempting to label S3 buckets for use by Amanda in a virtual tape changer configuration. The OS is Linux and the distribution, Gentoo.

The exact error encountered was

labeling tape in slot 1 (s3:myBucket/backupSet/0001/):
Reading label...
While trying to read tapestart header: CURL error: SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed (CURLcode 60)
Reading the tape label failed:
  Error was Device error.

Cause:
The error is related to curl's desire to perform peer SSL certificate verification as a default. This is a "good thing" and requires minimal intervention to work around once an admin is aware of the issue.
Reference:
http://curl.haxx.se/docs/sslcerts.html

Resolution:
Gentoo centralizes a collection of CA certificate PEM files with the app-misc/ca-certificates package in portage. This should be installed as part of a normal Gentoo system, however, it is possible that a particular CA PEM may be absent. In this case, download the missing PEM file and place it in /etc/ssl/certs. Once this is done be sure to run the following command to update the local system certificate store:

update-ca-certificates

Tools for extracting Common CA PEM files from Mozilla projects and a standard PEM bundle can be found at: http://curl.haxx.se/docs/caextract.html