Posts Tagged linux

USB Transfert making the system unresponsive fix

Sometimes my computer became unresponsive and couldn’t do any action while copying to slow USB Keys. I found online the reason and the solution to this.

Apparently the configuration /sys/kernel/mm/transparent_hugepage/khugepaged/defrag can really influence this issue. If it’s set to “always” the machine will try to defragment pages to have space for huge pages.
Setting it to “madvise” will active the behavior only on address spaces that require it without interfering with the feature (disabling it) ,still allowing HugePages aware applications to use them, and, espescially, will stop your machine from hanging.

As state in a Phoronix article linked at the bottom of the page since Kernel 3.8 this feature avoids allocating huge chunks of memory when not necessary, so maybe setting /sys/kernel/mm/transparent_hugepage/khugepaged/enabled to “always” may be a good idea after all.

Here you can read more about the HugePages support
https://www.kernel.org/doc/Documentation/vm/transhuge.txt

Here you can see some benchmarks
http://structureddata.org/2012/06/18/linux-6-transparent-huge-pages-and-hadoop-workloads/

Here you can read more about it
http://www.phoronix.com/scan.php?page=news_item&px=MTI1MTQ
http://www.phoronix.com/scan.php Za s da ?page=article&item=linux_transparent_hugepages

,

Leave a comment

Hamachi and UDP Broadcast Games

I was recently trying to play some old game (Starcraft, Warcraft 3, and others) in LAN with some friends through the hamachi VPN system. All attempts were unsucessful due to the fact that the broadcasted UDP packet weren’t sent over the VPN interface but only in the local LAN.

To solve this we just had to manipulate the routing table of the systems.
After connecting to the hamachi VPN just do these commands as root user

OS X: as long hamachi uses 5.x.x.x for his nodes
route add -net 255.255.255.255 5.255.255.255

Linux: where ham0 is the hamachi interface. There are 2 options available, test it out that works for you
route add -net 255.255.255.255 netmask 255.255.255.255 dev ham0

sudo route add -n 5.255.255.255 gw 5.0.0.1 dev ham0
as suggested from Blake Lightly

This will redirect all the broadcast packets, maybe it can interfere with some other program, but as long as you want some time off to play it works great. To clear the modification to the routing table we didn’t do anything else then disconnecting from the hamachi VPN, the system handles the disappareance of the interface removing every involved route.

Summing up*

Game Linux MacOS
Warcraft 3 play host
Starcraft host host
Delta Force host untested

* Linux has no other setup then just starting hamachi. This all was tested between a Mac and a Linux systems

If someone can test other games and maybe help on the linux problem that would be great.

Hope this helps!
[last update 2 May 2010]

, , , , , , , , ,

19 Comments

Convert Man pages to PDF

Always wanted to watch a man page in a pdf file? It is clearly needed sometimes, especially on mac, since it is the easiest way i know to print a man page or to read it not from a terminal.

The problem is solved easily for both Mac OS and linux. I had to add control for <code>pstopdf</code> too, since on mac it is called that way and has different parameters (but you may have <code>ps2pdf</code> installed with macports anyway).

#! /bin/bash

if [ $# -eq 1 ] ; then
    to_pdf=$(which ps2pdf)
    if [ -z "$to_pdf" ] ; then
        to_pdf=$(which pstopdf)
    fi

    name="$1"
    case "$to_pdf"  in
        *pstopdf) man -t "$name" | "$to_pdf" -i -o "$fname.pdf" ;;
        *ps2pdf)  man -t "$name" | "$to_pdf" - "$name.pdf" ;;
        *)        man -t "$name" > "$fname.ps"
    esac
    exit $?
fi
echo "Wrong number of parameters"
exit 1

Just call it like man2pdf gcc and you’ll get gcc.pdf

, , , , ,

1 Comment