Archive

Archive for the ‘Linux’ Category

Tmux Running But No Sessions

December 20th, 2011 No comments

I recently attempted to reattach to a tmux session only to discover that it didn’t think any sessions were running. Reviewing the running processes proved that there was a session still active. A quick review indicated that that the socket was still present as well. Attempting to run tmux but attach to the socket (the -L option) didn’t work either.

Reviewing the manpage for tmux indicated that SIGUSR1 can be sent to force the sockets to be recreated thus as my users I did the following:

$ killall -s SIGUSR1 tmux

Then I was able to reattach to the session. Further reading suggest that I must have updated my tmux whilst it was still running which is officially unsupported, so I was lucky!

Tags: ,

Arch / Yum

December 3rd, 2011 No comments

I recently switched to Archlinux and I have to say I love it a great deal. I really like the simplicity of it, unfortunately due to my long standing usage or yum I have been spoilt. It means that I find myself wishing to have commands like yum install package, so switching pacman’s -S was a little too much. I therefore wrote a wrapper to make it easier for me. Maybe it can help others just starting out in the path to using Archlinux.

In preparation for this, you will need to install yaourt and enable it with sudo access. Either that or replace all the references to yaourt below with pacman.

Drop this into your ~/.bashrc (or zshrc):

function arch() {
        if [ -z "$1" ]; then
                echo "arch  " >&2
                return -1
        fi

        case $1 in
                upgrade)
                        # Synchronize, upgrade
                        shift
                        sudo yaourt -Syu $@
                        ;;
                install)
                        # Install stuff
                        shift
                        sudo yaourt -S $@
                        ;;
                localinstall)
                        # Install file
                        shift
                        sudo yaourt -U $@
                        ;;
                remove)
                        # Remove
                        shift
                        sudo yaourt -R $@
                        ;;
                fullremove)
                        # Remove file
                        shift
                        sudo yaourt -Rns $@
                        ;;
                info)
                        # Display information
                        shift
                        yaourt -Si $@
                        ;;
                search)
                        # Search
                        shift
                        yaourt -Ss $@
                        ;;
        esac
}

Now you can do things like:

$ arch install git
$ arch remove git
$ arch info git
$ arch search git

Hope its handy!

Tags: ,

Conntrack Memory Usage

February 8th, 2011 No comments

Every so often you see messages in your logs regarding ip_conntrack like the following:

ip_conntrack: table full, dropping packet

So my first thought it that it might relate to memory usage. Fortunately enough the kernel provides all the information we need to work it out. The kernel will allocate a “slab” when ever conntrack requires more memory, equally it will retain these slabs for a period of time and reuse if required. Each “slab” represents a number of pages of kernel memory, we can retrieve the current page size by using the following command:

# getconf PAGESIZE
4096

So each page is 4096 bytes. Next lets see how many slabs conntrack is using:

# grep conntrack /proc/slabinfo
ip_conntrack        6537  16620    384  984 1662    1 :  496  124

So that represents the following:

  • ip_conntrack; a human readable name
  • 6537; total number of objects in use.
  • 16620; total available objects (including unused)
  • 384; size of each object.
  • 984; the number of slabs that are active
  • 1662; the total number of slabs
  • 1; the number of pages required to make a slab (normally 1)

The two other columns after the colon relate to SMP CPU information; we don’t need to discuss them.

So 6537 objects each of size 384 bytes, which means that we can fix around 10 per slab (4096/384=10.66). That means that the objects represent 2510208 bytes (~2.4Mb), but because of the overhead we are actually using 654 (6537/10=653.7) slabs or 2.6Mb (654*4096=2678784). So we are wasting around 256 bytes per slab (4096-384*10).

In other words an extremely small amount of memory. So it is very unlikely that is the cause. Further investigation reveal that it is normally due to the conntrack hitting the maximum count which can be viewed by looking at:

# cat /proc/sys/net/ipv4/ip_conntrack_max
65536

Comparing this to the current count:

#  wc -l ./proc/sys/net/ip_conntrack
   5602 /proc/net/ip_conntrack

We now know that it doesn’t use any great deal of memory at all, so we can easily double the count by doing the following:

# echo 131072 >/proc/sys/net/ipv4/ip_conntrack_max

Obviously in this example the memory usage was minor and there was little need to double the count but you can review your own system and increase as you wish now we know that it has a very small memory footprint.

Tags: ,

Dropbox, Fedora14 and SELinux

November 17th, 2010 No comments

I just recently updated to Fedora 14 and came across an issue that many others have. Fortunately enough OpenSourceGeek provided me with an instant solution happy syncing :) !

Accidental Firefox Quits

April 24th, 2010 No comments

Whilst using Firefox I normally use the key press Ctrl+w to close the tabs, however on occasion my fingers strayed into Ctrl+q which, to my horror, quit Firefox!

A quick Google pointed me towards a post on the useful Add-On Mirrors site. I then went to the homepage of the author and installed the nice tool KeyConfig.

A quick restart of Firefox, then open KeyConfig (via Tools > KeyConfig), search for the Ctrl+q key press and disable.

Another restart of Firefox and it’s complete, no more accidental quits of Firefox! KeyConfig is a very nice and simple to use Add-On and will certainly be added to my default Firefox pack from now on, ace!

Tags: ,

Switch to our mobile site