mii-tool is deprecated, use ethtool

Title says it all. If you want to check (or set) your ethernet NIC configuration or status in Linux, people used to use mii-tools. But there’s a lot more powerful and modern tool that obsoletes it: ethtool
You can install it with your favourite package manager, if it’s not already present in your system.
In Debian/Ubuntu, you can issue
# aptitude install ethtool

Here it is an example:


# ethtool eth0
Settings for eth0:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: g
Wake-on: d
Current message level: 0x000000ff (255)
Link detected: yes

Cron and multiple recipients

If you are using a maintainance user executing scheduled cronjobs, maybe you’ve found yourself needing to report the result of these jobs to different email addresses. Everyone knows for sure the MAILTO parameter, as explained in the crontab(5) manpages.

But maybe you don’t know that MAILTO is interpreted sequencially, when it’s found, so you can have different recipients in the same crontab, like in this example:


MAILTO="user1@domain.tld"
* * * * * echo "abc"

MAILTO=”user2@domain.tld”
* * * * * echo “dfe”

so user1 will get mailed with “abc” and user2 with “dfe”.
It works in the standard “cron” program, so for example you can use this tip in Debian or FreeBSD (and in other Unices to, I guess)

HOWTO: Install DELL OpenManage System Administrator on exotic Linux distributions

If you happen to have to manage some Dell server running some exotic-not-supported-at-all distribution like, for example, Slackware or Gentoo, there’s a trick you can use that can saves you a lot of PITA. It envolves using debootstrap and some well known unofficial Debian Dell repository. Here we go:

  1. First of all, check your kernel has IPMI support. If it doesn’t, rebuild it to have IPMI enabled (Device Drivers -> Character Devices -> IPMI). Build every module you find here.
  2. Load the just built modules:
    modprobe ipmi_msghandler
    modprobe ipmi_si
    modprobe ipmi_devintf
  3. Install debootstrap. With Gentoo, it’s a simple emerge debootstrap
  4. mkdir -p /var/debian
  5. debootstrap --arch amd64 etch /var/debian http://http.us.debian.org/debian
    You can obviously change the –arch parameter with the one that better fits your needs, say i386
  6. Now, let’s wait while debootstrap does all the dirty work :)
  7. mount -o bind /dev /var/debian/dev
  8. mount -t proc none /var/debian/proc
  9. mount -o bind /sys /var/debian/sys
  10. cp /etc/resolv.conf /var/debian/etc
  11. chroot /var/debian/ /bin/bash
  12. Now we are in our new Debian-lite environment.
  13. edit /etc/apt/sources.list to look like this, for example:

    deb http://ftp.belnet.be/debian/ etch main non-free contrib
    deb-src http://ftp.belnet.be/debian/ etch main non-free contribdeb http://security.debian.org/ etch/updates main contrib non-free
    deb-src http://security.debian.org/ etch/updates main contrib non-free

    deb ftp://ftp.sara.nl/pub/sara-omsa dell sara
    deb http://linux.dell.com/repo etch dell-software

  14. apt-get update
  15. apt-get install dellomsa
  16. And we are done! If all went well, you should now be able to run tools like “omreport” to inspect your hardware status and “omconfig” to change BIOS settings and much more!

On a side note, after a reboot you have to repeat steps 7,8 and 10 and once in the chroot, issue a /etc/init.d/dataeng start

Eix: enhancing the Gentoo experience

Everyone knows that if you want to search for a package in Gentoo portage, emerge -s is a real PITA, because is so slooooooooow.
The solution is named Eix, and you can install it with a simple

emerge eix

and, after the package has been emerged, issue a

update-eix

to sync EIX DB with portage or even a

eix-sync

to automatically do an emerge --sync && eix-sync

Now, you can do your search with a simple

eix $pattern

and it will be lightning-fast! eix –help for a load of neat options :)

Gentoo under VMware does not boot

Hello,

If you are tryin’g to install Gentoo using a VMware and you get a error like this:


!! Block device /dev/sdaX is not a valid root device…
!! The root block device is unspecified or not detected.
Please specify a device to boot, or “shell” for a shell…
boot() ::

Solution is to pass option “doscsi” to kernel at boot, since doscsi loads all necessary scsi modules.

We use genkernel and our grub.conf looks like this:

title=Gentoo Linux 2.6.22-r9
root (hd0,0)
kernel /boot/kernel-genkernel-x86-2.6.22-gentoo-r9 root=/dev/ram0 init=/linuxrc ramdisk=8192 real_root=/dev/sda3 udev doscsi
initrd /boot/initramfs-genkernel-x86-2.6.22-gentoo-r9

See you!

HOWTO: Install a basic Gentoo server

If you want to install a new Gentoo server (no graphical system at all), this is the quickest way I’ve found after lots of installations :)

  • First, boot the machine with a live CD
  • create the partitions you want with fdisk/cfdisk/partition tool you like. In our example we create 3 partions (swap, /boot and /) on our disk /dev/sda
  • mkfs.ext2 /dev/sda1
    # mkswap /dev/sda2
    # mkfs.ext3 /dev/sda3
    # mkdir -p /mnt/gentoo && cd /mnt/gentoo
    # wget http://www.gtlib.gatech.edu/pub/gentoo/releases/x86/current/stages/stage3-x86-2007.0.tar.bz2
    # wget http://www.gtlib.gatech.edu/pub/gentoo/snapshots/portage-latest.tar.bz2

    Note: if you are on a different architecture, please use a different release
  • tar xvjpf stage3-*.tar.bz2
    # tar xvjf /mnt/gentoo/portage-latest.tar.bz2 -C /mnt/gentoo/usr
    # nano -w /mnt/gentoo/etc/make.conf
    # cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
    # mount -t proc none /mnt/gentoo/proc
    # mount -o bind /dev /mnt/gentoo/dev
    # chroot /mnt/gentoo /bin/bash
    # env-update
    # source /etc/profile
    # export PS1="(chroot) $PS1"
    # emerge --sync
    # cp /usr/share/zoneinfo/Europe/Paris /etc/localtime
    # USE="-doc symlink" emerge gentoo-sources
    # emerge genkernel
    # genkernel all --menuconfig
    # nano /etc/fstab
    # nano /etc/conf.d/hostname
    # nano /etc/conf.d/net
    # passwd
    # echo "tts/0" >> /etc/securetty
    # nano /etc/rc.conf
    # nano /etc/conf.d/keymaps
    # nano /etc/conf.d/clock
    # emerge syslog-ng && rc-update add syslog-ng default && emerge vixie-cron && rc-update add vixie-cron default && emerge logrotate && emerge slocate && emerge ntp && rc-update add ntpd default && rc-update add ntp-client default && modules-update
    # emerge gcc
    # emerge world
    # emerge grub
    # nano /boot/grub/grub.conf
    # grep -v rootfs /proc/mounts > /etc/mtab
    # grub-install /dev/sda
    # exit
    # cd
    # umount /mnt/gentoo/boot /mnt/gentoo/dev /mnt/gentoo/proc /mnt/gentoo
    # reboot

NOTES: when it’s indicated “nano $SOMEFILE” it means you have to edit and adjust the settings to your own taste.
When you are creating /etc/localtime, use a source file according to your local timezone
And here it is a basic make.conf configuration:

CFLAGS="-O2 -march=i686 -pipe"
CHOST="i686-pc-linux-gnu"
CXXFLAGS="${CFLAGS}"

USE=”-X -qt -gtk -gnome -kde bash-completion -snmp sockets threads latin1 -berkdb -ipv6 snmp perl”

PORTDIR_OVERLAY=”/usr/local/portage”

Obtain the Dell service tag in FreeBSD/Debian/Gentoo

Well, the title could be a little misleading cause this actually works in Linux and with other manufacturer as well, but since we were searching info for this particular topic, and didn’t manage to find anything useful on Google…

Anyway, it’s very very simple. All you have to do is install dmidecode (from Alan Cox) with:

FreeBSD

portinstall dmidecode

or whatever manner you use to install FreeBSD’s ports :)

Debian/Ubuntu

apt-get install dmidecode

Gentoo

emerge dmidecode

NOTE: this work as well with HP servers’ serial numbers and, I suppose, with IBM, Sun etc too.

Once installed, all you have to do is execute

# dmidecode -s chassis-serial-number

et voilĂ , you will get your service tag printed on screen. Moreover if your server is in the datacenter and you cannot remember the exact model

# dmidecode -s system-product-name
PowerEdge 1750

for example.

Just a note: dmidecode is the program used by OCS Inventory client to collect all these data.