Skip to main content


Showing posts from 2015

ipython && tmux - saving history to a file

Hey, I had an ipython console open inside a tmux split window and I needed to save the history to a file. Since I can't copy & paste the data from the screen (I was in the middle of a session, so the next time I would configure it correctly using  this ). So I found a quicker way,  Roberto Z  wrote in his comment  that in order to save the session's history you can use readline  package: import readline readline.write_history_file('/home/user/current_history') This works like a charm in Ubuntu. - Tal Kain

Linux: iptables: Removing a collection of iptables rules at once

Here is a small trick for removing several iptables rules at once, Let's assume we would like to add some rules: iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE I can use the comment match and add a comment to this line: iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE -m comment --comment "SOME_COMMENT" Now, cleaning all the relevant rules in a simple command would be: # iptables-save | grep -v SOME_COMMENT | iptables-restore  Probably not the best way to do it, but it's simple and fast. Have fun, -Tal Kain

Installing NVIDIA CUDA on an Amazon Web Services (AWS) machine (Ubuntu 14.04)

Disclaimer: I wrote this post several months ago and did not publish it for unknown reason, I assume that the information below is still relevant and correct. While trying to install the machine, I started my research by reading  Traun Leyden 's great blog post:  (you should too) Amazon offers two types of machines that includes GPUs ( ) High-performance NVIDIA GPUs, each with 1,536 CUDA cores and 4GB of video memory While writing this post, I used the  g2.2xlarge  machine, but you can also use the 8xlarge. This will be quick and simple: 1. Make sure you are fully up-to-date sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade  When prompted, choose the "install maintainer package...." 2. Reboot the machine (so it will load the new kernel) 3. Install the kernel's header f

Ubuntu Linux: cannot find modules.dep.bin

While trying to load some kernel modules in one of my projects, I encounter the following errors: root@ubuntu:~# modprobe carl9170 modprobe: ERROR: ../libkmod/libkmod.c:556 kmod_search_moddep() could not open moddep file '/lib/modules/3.10.17/modules.dep.bin' and the following error: modprobe: ERROR: ../libkmod/libkmod-index.c:821 index_mm_open() magic check fail: d00dfeed instead of b007f457 To solve this issue, run depmod # depmod From : "depmod creates a list of module dependencies, by reading each module under /lib/modules/ version and determining what symbols it exports, and what symbols it needs. By default this list is written to modules.dep in the same directory. If filenames are given on the command line, only those modules are examined (which is rarely useful, unless all modules are listed)." After running depmod, everything should work as expected. - Tal K

Ubuntu: schroot cannot bind the home directory

Hey everyone, Several weeks ago I had to compile gdb and strace to a target device that runs on ARM (EBI).  This time, instead of cross compile it, I decided to use my favorite way - schroot environment. I had the pleasure of using schroot on my old system - an Ubuntu 12.04 desktop, and this was the first time I needed to use it on my current Ubuntu 14.04 system. The problem started after creating the schroot environment and trying to use it. As you will see in the following lines, I tried getting into the environment and got an error: root@ubuntu:/home/talkain# schroot -c ubuntu-armel -u talkain W: line 11 [ubuntu-i386] union-type: Configuration key name ‘union-type’ is not a permitted name. W: line 11 [ubuntu-armel] union-type: Configuration key name ‘union-type’ is not a permitted name. W: Failed to change to directory ‘/home/talkain’: No such file or directory I: The directory does not exist inside the chroot. Use the --directory option to run the command in a d

Ubuntu: Installing a missing ath3k firmware

While trying to prepare a new Ubuntu box to use a new card based on the Atheros chipset, I encounter the following error: Bluetooth: Firmware file "ath3k-1.fw" not found According to : ath3k is the Linux Bluetooth driver for Atheros AR3011/AR3012 Bluetooth chipsets. I saw this blog post: So I decided to try installing the package linux-firmware which contains the relevant file (I used  dlocate  to $ dlocate linux-firmware | grep -i ath3 linux-firmware: /lib/firmware/ath3k-1.fw or you can find it by searching for ath3k: $ dlocate ath3k-1.fw linux-firmware: /lib/firmware/ath3k-1.fw I just ran: # apt-get install linux-firmware and it fixed it by installing the missing firmware file. Good luck! Tal Kain