• Category Archives Linux
  • Unix » Linux » Gentoo | Red Hat » Satellite
  • Firewall rules incomplete when using Autodiscovery with RHEL Satellite 6.1

    There are some things not yet in the RedHat manual concerning implementing discovered hosts provisioning through use of the discovery image in Red Hat Satellite Server.

    First of all, the FDI is also running a very limited foreman-proxy server, so to get full functionality you also need to open port 8443 on the subnet where clients are provisioned in the firewalls. Failure to do so will prevent a discovered client to reboot as instructed by satellite and you will have to push the button by hand.

    So if your server runs on and is provisioning for clients on subnet with a firewall in between, you need to “allow” traffic from any port , to destination port 8443/TCP , as well.

    Also not widely documented yet, you can enable SSH login on the discovery image with 2 kernel-boot options , add them as usual in the satellite global PXEboot file.

    fdi.ssh=1 and fdi.rootpw=welcome  , which enables ssh and sets the root password to welcome.

    – Mark.

  • Highlight function with grep

    It’s been a while since I have been blogging, so I will have to start fresh.

    I recently came across this gem which defines a bash function named “highlight” which will highlight the first argument in all subsequent files. if only 1 argument is given, it expects console input for highlighting.


      if [ 1 -eq $# ];
        grep --color -E "$1|$"
        grep --color -E "$1|$" "${@:1}"
    highlight $@

    Realworld examples:

    tail -f /var/log/messages|highlight sshd
    tail -f /var/log/audit/audit.log|grep avc||highlight denied
    highlight “failed” /var/log/secure


  • Easily Find the optimal alignment of VM disks

    Since most System Administrators do not want to do the formulae by hand, there are 2 easy methods.

    First: If you want only 1 partition spanning the whole disk, the easiest will be to use % in parted:

    (parted) mkpart primary ext4 0% 100%.

    The second method is using this awk script from a bash shell:

    awk -v x=$(cat /sys/block/sdb/queue/optimal_io_size) -v y=$(cat /sys/block/sdb/alignment_offset) -v z=$(cat /sys/block/sdb/queue/physical_block_size) ‘BEGIN { print ( x + y ) / z }

  • Default LANG and Locale on a Redhat Enterprise Linux (RHEL) host.

    I had a strange configuration on RHEL causing screen/cygwin/dialog/ncurses to interact badly with eachother.

    My situation:

    I have cygwin on my laptop installed. I am using it to connect to a RHEL 5 host , there I start screen and then use an ncurses application like dialog or midnight commander.

    What happens: The system is completely unreadable and unusable.

    The solution is so easy:

    Redhat screwed up.

    $ echo ${LANG}
    $ locale -a|grep en_US

    woops, my locale is NOT THERE!

    Default $LANG on RHEL-5 = en_US.UTF-8

    However, locale -a displays en_US.utf8

    Luckily, the fix is easy.

    in /etc/sysconfig.d/i18n , you can change the default locale and make it the existing en_US.utf8.

    My terminal now works exactly as predicted and I am happily using mc/dialog and other ncurses apps again.. WHEW!

    If someone can test this on a RHEL-6 host, then I know if i can file a bug report with RedHat! …

    So, if you have “erratic” behaviour on ncurses apps, try checking your locale settings….

  • Datacenter Oliekoets

    Just a quick update, to let you all knowing that the private datacenter is now redundant IaaS. The only thing it does not offer (yet) is a redundant network.

    The main cluster filesystem is spread over 4 hosts on 2 locations, which should improve reliability. Its also reliable to assume, that when you mirror hardware completely, you no longer need a raid-X but only a striping raid, since the whole FS is backed up on multiple hardware hosts.

  • Quickly convert flac audio to mp3 audio with Linux

    First off, you need to have these 3 packages installed:

    – FFMPEG (optional)
    – FLAC
    – LAME

    FFMPEG is by far, the simpelest method. If you use it, it will automaticly convert the tags as well. Be sure that your installed version supports flac/mp3.



    for f in *.flac; do
    ffmpeg -i "$f" -qscale:a 0 "${f[@]/%flac/mp3}"

    Without FFMPEG (Script author is on the ):


    for a in *.flac; do
    # give output correct extension

    # get the tags
    ARTIST=$(metaflac "$a" --show-tag=ARTIST | sed s/.*=//g)
    TITLE=$(metaflac "$a" --show-tag=TITLE | sed s/.*=//g)
    ALBUM=$(metaflac "$a" --show-tag=ALBUM | sed s/.*=//g)
    GENRE=$(metaflac "$a" --show-tag=GENRE | sed s/.*=//g)
    TRACKNUMBER=$(metaflac "$a" --show-tag=TRACKNUMBER | sed s/.*=//g)
    DATE=$(metaflac "$a" --show-tag=DATE | sed s/.*=//g)

    # stream flac into the lame encoder
    flac -c -d "$a" | lame -V0 --add-id3v2 --pad-id3v2 --ignore-tag-errors \
    --ta "$ARTIST" --tt "$TITLE" --tl "$ALBUM" --tg "${GENRE:-12}" \
    --tn "${TRACKNUMBER:-0}" --ty "$DATE" - "$OUTF"

  • Detect VMware guest in cfengine

    There are a few reliable ways to detect if the host is a VMWare guest.

    The ones below make the most sense.

    First choice:
    "vmware_guest" expression => returnszero("/bin/grep -qi vmware /proc/scsi/scsi","noshell");

    Second choice:
    "vmware_guest" expression => fileexists("/usr/sbin/vmware-toolbox-cmd");