title: filename matching pattern

text: I have a folder of 200 satellite files to process. There are three steps in the process and I want to use a shell script under ubuntu to process them. I am using a for loop. My problem is the filenames. An example is A2013290123000.L1A_LAC.Ireland.hdf. I can create variables ie.               DATE=A2013     DATE1=`date +%j` #gives me the number of days since jan 1st 2013 in example above this would be 290     .L1A_LAC.Ireland.hdf part of the name doesn't change.      My issue is with the middle part of the name, in example above:123000 There is no pattern to this part of the name. It is a time stamp but varies with each file. I want to create a variable in the script such as               TIMESTAMP=$DATE$DATE1$DATE2      Where DATE2= the middle part of the file name. Is it possible to specify this variable as a wild card something like:               DATE2=$*      I hope to have the value of the variable `TIMESTAMP= A2013209123000`               #!/bin/sh          #set -e          set -x #debug mode          <<comment     export OCSSWROOT=/home/seadas/seadas-7.0/ocssw     source $OCSSWROOT/OCSSW_bash.env     export PATH=$PATH:/home/seadas/seadas-7.0/bin     comment          DATE=A2013     DATE1=`date +%j`     DATE2=$*     TIMESTAMP=$DATE$DATE1$DATE2     LOCATION_NAME=Ireland          DATADIR=/home/MODIS     L2_DIR=/home/MODIS/L2     GEO_FILE_DIR=/home/MODIS/GEO     L1B_DIR=/home/MODIS/L1B     SCRIPTDIR=/home/seadas/seadas-7.0/ocssw/run/scripts     FILTERDIR=/home/seadas/seadas-7.0/ocssw/run/data/common     FUNCTION=/home/seadas/seadas-7.0/ocssw/run/bin/linux_64          HDFFILE=$TIMESTAMP.L1A_LAC.$LOCATIONNAME.hdf     GEOFILE=$LOCATION_NAME-$TIMESTAMP.GEO     LACFILE=$TIMESTAMP.L1B_LAC     HKMFILE=$TIMESTAMP.L1B_HKM     QKMFILE=$TIMESTAMP.L1B_QKM     L2FILE=$TIMESTAMP.L2.hdf               for i in `ls -r $DATADIR`          do         echo "Start a Process for file $i";          'Generating geolocation file' $SCRIPTDIR/modis_GEO.py -d $DATADIR/$HDFFILE -o $GEO_FILE_DIR/$TIMESTAMP.GEO --threshold=95;          'Generating L1B file' $SCRIPTDIR/modis_L1B.py $DATADIR/$HDFFILE $GEO_FILE_DIR/$TIMESTAMP.GEO -o $L1B_DIR/$LACFILE -k $L1B_DIR/$HKMFILE -q $L1B_DIR/$QKMFILE;          'Generating L2 product'$FUNCTION/l2gen ifile=$L1B_DIR/$LACFILE geofile=$GEO_FILE/$TIMESTAMP.GEO par=$FILTERDIR/msl12_defaults.par ofile=$L2_DIR/$L2FILE resolution=-1 l2prod="default,sst,qual_sst,qual_sst4,sstref,sst4" filter_opt=0 proc_ocean=1 gas_opt=15;          echo "it $i is finished..."               echo "\n"     done


title: How can I find the sort order for ls with my locale?

text: I was using `ls -l` on a directory, and was surprised that spaces and underscores were ignored for the sort order. For example,               $ echo $LANG     en_AU.UTF-8     $ ls -l     total 0     -rw-r--r-- 1 sparhawk sparhawk 0 Nov 20 21:12 a_a     -rw-r--r-- 1 sparhawk sparhawk 0 Nov 20 21:13 a b     -rw-r--r-- 1 sparhawk sparhawk 0 Nov 20 21:13 a_c     -rw-r--r-- 1 sparhawk sparhawk 0 Nov 20 21:13 a d     $ LANG=en_AU ls -l     total 0     -rw-r--r-- 1 sparhawk sparhawk 0 Nov 20 21:13 a b     -rw-r--r-- 1 sparhawk sparhawk 0 Nov 20 21:13 a d     -rw-r--r-- 1 sparhawk sparhawk 0 Nov 20 21:12 a_a     -rw-r--r-- 1 sparhawk sparhawk 0 Nov 20 21:13 a_c      In my default locale, spaces and underscores are interchangeable, and without UTF-8, spaces come before underscores. I see similar results for `en_US` and `en_US.UTF-8`. I have two questions:   1. Am I interpreting this correctly? Are they interchangeable?   2. Is there a list of my locale's sort order? I want to find a character that precedes underscore.


title: How does a package run without all the dependencies being installed on the target system?

text: I am trying to build the latest version of `subversion` on ubuntu 12.10 and was having some trouble completing `./configure` as I seemed to be getting a never ending stream of `configure: error: x not found` messages. I installed `apr` and supplied the paths to the `apr-1-config` file to get rid of the first, then I installed `sqlite` etc. and currently I am working on `configure: error: Expat not found`. Prior to attempting an install of `1.7.7`, I had just used `apt-get install subversion` which installed `1.7.5` and was working fine. My question is, why does `1.7.5` work on my machine if I didn't have `sqlite`, `apr` and all the other dependencies that seem to be needed now that I'm it from the source? does `1.7.5` not have such dependencies or were they installed during my `apt- get` command and I just needed to link to them?


title: How can one switch to ttyX in virtualbox?

text: I run VirtualBox in Linux , running CentOS in it , and I can't switch to ttyX in the CentOS since I'll go to the ttyX in my Linux. Any solutions ?


title: Kernel 3.3.2-6.fc16.x86_64 broadcom wireless not appearing

text: I'm using kernel 3.3.2-6.fc16.x86_64 and I have a Broadcom 4312. When I run `iwconfig`, I get the following:               lo        no wireless extensions.     p2p1      no wireless extensions.      I cannot use wireless, I have to use cable. How can I get my wireless network adapter up and running?


title: Cannot boot Fedora Linux

text: I cannot boot the operating system on my laptop. I have three versions of the kernel installed and none of them will boot. Booting into Windows (installed in a separate partition) still works, so I suspect the hardware is not at fault. I may have tried to update drivers before the problem occurred, so that could be the cause. I have also tried resetting the BIOS, to no effect. I am using GRUB v1.99. Selecting "Fedora (3.6.11-1.fc16.x86_64)" from the GRUB menu, the following is displayed:               Fedora (3.6.11-1.fc16.x86_64)     Loading initial ramdisk ...      Then I get the normal splash screen. But then it returns to the black screen with just the above two lines being displayed and hangs indefinitely. Enabling verbose mode yields the following:               Fedora (3.6.11-1.fc16.x86_64)     Loading initial ramdisk ...     ... (many lines - can transcribe if relevant) ...     Started Machine Check Exception Logging Daemon             [OK]     Started Install ABRT coredump hoot                         [OK]     Started Console Mouse manager                              [OK]     Started irqbalance daemon                                  [OK]     Started SSH server keys generation                         [OK]     Started Kernel Samepage Merging                            [OK]     Started Harvest vmcores for ABRT                           [OK]     Started ACPI Event Daemon                                  [OK]     Started Display Manager                                    [OK]     _     (hangs here)      No obvious errors are displayed - it just stops. The grub config looks like:               setparams 'Fedora (3.6.11-1.fc16.x86_64)'          load_video     set gfxpayload=keep     insmod gzio     insmod part_msdos     insmod ext2     set root='(hd0,msdos2)'     search --no-floppy --fs-uuid --set=root dd61afbf-2b76-44ab-b2ca-0e65f0664425     echo 'Loading Fedora (3.6.11-1.fc16.x86_64)'     linux /boot/vmlinuz-3.6.11-1.fc16.x86_64 root=UUID=dd61afbf-2b76-44ab-b2ca-0e65f0664425 ro rd.md=0 rd.lvm=0 rd.dm=0 quiet SYSFONT=latarcyrhebsun16 rhgb KEYTABLE=uk rd.luks=0 LANG=en_US.UTF-8     echo 'Loading initial ramdisk ...'     initrd /boot/initramfs-3.6.11-1.fc16.x86_64.img      /boot is in /dev/sda2; using a livedisk to inspect the directory yields the following:               cd /mnt/sda2/boot     ls -ld *     -rw-r--r--. 1 root root   119880 2012-08-15 17:01 config-3.4.9-1.fc16.x86_64     -rw-r--r--. 1 root root   122870 2012-12-17 16:33 config-3.6.11-1.fc16.x86_64     -rw-r--r--. 1 root root   122897 2012-10-31 23:53 config-3.6.5-2.fc16.x86_64     drwxr-xr-x. 2 root root     4096 2013-02-02 13:44 extlinux     drwxr-xr-x. 2 root root     4096 2011-12-03 11:22 grub     drwxr-xr-x. 3 root root     4096 2013-01-21 03:37 grub2     -rw-r--r--. 1 root root 17757091 2012-08-31 05:50 initramfs-3.4.9-1.fc16.x86_64.img     -rw-------. 1 root root 18065462 2013-01-21 03:37 initramfs-3.6.11-1.fc16.x86_64.img     -rw-------. 1 root root 18052180 2012-11-07 17:15 initramfs-3.6.5-2.fc16.x86_64.img     -rw-r--r--. 1 root root   593313 2012-01-16 17:29 initrd-plymouth.img     -rw-------. 1 root root  2444127 2012-08-15 17:01 System.map-3.4.9-1.fc16.x86_64     -rw-------. 1 root root  2497974 2012-12-17 16:33 System.map-3.6.11-1.fc16.x86_64     -rw-------. 1 root root  2496741 2012-10-31 23:53 System.map-3.6.5-2.fc16.x86_64     -rwxr-xr-x. 1 root root  4728480 2012-08-15 17:01 vmlinuz-3.4.9-1.fc16.x86_64     -rwxr-xr-x. 1 root root  4824784 2012-12-17 16:33 vmlinuz-3.6.11-1.fc16.x86_64     -rwxr-xr-x. 1 root root  4822224 2012-10-31 23:53 vmlinuz-3.6.5-2.fc16.x86_64      I'm not very good at sysadmin tasks, so I apologise if I am being stupid. However, I really cannot figure out what is going wrong - I would be incredibly grateful if anyone can help?


title: Mapping AltGr to left control

text: I mapped my `AltGr` key to `Ctrl` with the following command:               setxkbmap -option ctrl:ralt_rctrl      However, when displaying the bindings with               xmodmap -pke      I can see that the keycode is associated to                  keycode 108 = Control_R Control_R Control_R Control_R      **I would like to bind` AltGr` to LEFT Control.** Is it possible? This is important for Emacs, otherwise I don't get the same input when pressing C-S-b with the original Left Control or with AltGr.


title: Which was the very first music player application for Linux?

text: I'm writing an article about FOSS and Linux music players. What was the very first music player application for Linux? Was there ever a time when the players didn't support proprietary formats like MP3s?


title: Cannot make anyfs-tools. My e2fslibs package seems not to be the compatible version

text: anyfs-tools promises to convert a ntfs partition into ext3. That's what I want to do. (I have backed up what was necessary).    But when I try to compile anyfs-tools I get a `make` compilation error complaining about the ext2fs library. So I suppose I do not have the good version that makes this executable compile. What should I do when such case happens ?   * Should I search for the version of e2fslibs that is compatible and install it so as the `make` can succeed. Could it break my current distro ?    * Or should I **try** to modify the code of anyfs-tools (that has not been updated since 2010-06-19) This is the output of make:               gcc -O3 -Wall -Winline --param inline-unit-growth=1000 --param large-function-growth=10000 -std=gnu99 -I../../include -I/usr/include/ext2fs -I/usr/include/et   -g -O2 -o anysurrect anysurrect.o  -rdynamic -L../../lib -lany  -ldl  -lext2fs   -L. -lanysurrect     ./libanysurrect.so: undefined reference to `ext2fs_unmark_block_bitmap_range2'     ./libanysurrect.so: undefined reference to `ext2fs_inode_data_blocks2'     ./libanysurrect.so: undefined reference to `ext2fs_mark_block_bitmap_range'     ./libanysurrect.so: undefined reference to `ext2fs_unmark_generic_bitmap'     ./libanysurrect.so: undefined reference to `ext2fs_group_last_block2'     ./libanysurrect.so: undefined reference to `ext2fs_get_generic_bitmap_end'     ./libanysurrect.so: undefined reference to `ext2fs_test_block_bitmap_range2'     ./libanysurrect.so: undefined reference to `ext2fs_group_of_blk2'     ./libanysurrect.so: undefined reference to `ext2fs_get_generic_bmap_end'     ./libanysurrect.so: undefined reference to `com_err'     ./libanysurrect.so: undefined reference to `ext2fs_test_generic_bitmap'     ./libanysurrect.so: undefined reference to `ext2fs_mark_generic_bitmap'     ./libanysurrect.so: undefined reference to `ext2fs_group_first_block2'     ./libanysurrect.so: undefined reference to `ext2fs_unmark_block_bitmap_range'     ./libanysurrect.so: undefined reference to `ext2fs_get_generic_bmap_start'     ./libanysurrect.so: undefined reference to `ext2fs_unmark_generic_bmap'     ./libanysurrect.so: undefined reference to `ext2fs_test_generic_bmap'     ./libanysurrect.so: undefined reference to `ext2fs_mark_block_bitmap_range2'     ./libanysurrect.so: undefined reference to `ext2fs_test_block_bitmap_range'     ./libanysurrect.so: undefined reference to `ext2fs_mark_generic_bmap'     ./libanysurrect.so: undefined reference to `ext2fs_get_generic_bitmap_start'     collect2: ld returned 1 exit status     make[2]: *** [anysurrect] Error 1     make[2]: Leaving directory `/usr/local/src/anyfs-tools-0.85.1c/src/anysurrect'     make[1]: *** [anysurrect_util] Error 2     make[1]: Leaving directory `/usr/local/src/anyfs-tools-0.85.1c/src'     make: *** [progs] Error 2


title: Error: integer expression expected

text: I have written a script to determine the Load average on the server as follows:               #!/bin/bash          loadavg=`top -b -n1 | grep -i load | awk -F, '{print$4}'| awk -F: '{print $2}'`          if [ "${loadavg}" -le  1 ]     then     echo "OK - Load Average = ${loadavg} | Load_Average=${loadavg}"     exit 0;     elif [ "${loadavg}" -gt 1 ] && [ "${loadavg}" -le 2 ]     then     echo "WARNING - Load Average = ${loadavg} | Load_Average=${loadavg}"     exit 1;     elif [ "${loadavg}" -gt 2 ]     then     echo "CRITICAL - Load Average = ${loadavg} | Load_Average=${loadavg}"     exit 2;     else     echo "UNKNOWN - Load Average = NaN | Load_Average=NaN"     fi      When the script is executed, it displays following error:               ./loadavg.sh     ./loadavg.sh: line 5: [:  0.06: integer expression expected     ./loadavg.sh: line 9: [:  0.06: integer expression expected     ./loadavg.sh: line 13: [:  0.06: integer expression expected     UNKNOWN - Load Average = NaN | Load_Average=NaN


title: Is there any tools which can be used to make ports available from any firewall network?

text: I have been testing my application which has TCP/UDP ports for peer to peer with the help of server signalling commands for making communication, that works when I have Public IP or Lan IP and not firewall/port blocks are involved. I will name my end points here: a) PC1 - running in European commission having Lan IP and unknown Wan IP b) PC2 - running in European commission having Lan IP and unknown Wan IP c) Server 1 - running in Amazon with public IP Now the same Application I am testing in European commission/Airport/Rail way networks where there internet inbound/outbound traffics are having firewall and rules as a result it fails to communicate with server for mapping and application algorithms. On those PC1/PC2 how-ever I tested Skype and it simply works without caring firewall or all those network issues. Skype simply works. So I was thinking is there any third party tools which I can use in my PC1/PC2 to make list of ports available remotely to access via TCP/UDP (without caring what firewall or network they are located?) . So that from Server I can do the port mapping and bridge or relay there packets? (For example Skype works in such complicated network, is there any tools we have in Linux to use it as external package)


title: How to disable requiretty for a single command in sudoers?

text: I want to disable requiretty so that I can sudo within scripts, but I'd rather only disable it for a single command rather than everything. Is that possible within the sudoers config?


title: Arch Linux Ethernet to WiFi bridge

text: I want to use a Raspberry Pi running Arch Linux to extend my WiFi network. My situation is that I have a spare WiFi router that I want to use to expand my WiFi reception range as well as give me a few extra Ethernet connections to my network. I have tried setting up the router itself to create a bridge to my existing router but it seems the two different types of routers that I have to not really mesh but that's another story. What I want to do is connect my Pi to my existing WiFi network and then bridge its WiFi adapter with its Ethernet adapter and connect the Ethernet adapter to my second router. I will then disable DHCP and NAT on the second router allowing it function only as an access point and a switch. I would prefer if devices connected to the second router could be on the same subnet as those on the first but I that's not possible I guess they could be on a different subnet and then the Pi would just have to be set up as a gateway. My problem is that I cannot find any instructions for setting up either of these systems on Arch Linux. All I can find are seemingly promising instructions for Debian and ways of setting up Arch as an internet gateway. I would prefer to use Arch because I have an image for it and downloading a Raspbian one will take an eternity on my connection, I also believe that Arch has a much smaller footprint and will run faster on the Pi. PS. I have tried brctl but it tells me that adding a wlan adapter to the bridge is not supported.


title: How to kill tmux window automatically when terminal window closed?

text: I am new to tmux. I am starting a process in a tmux window in a terminal window. When I close the terminal window, the process not killing automatically but If I kill tmux window before close terminal window, the process killing. How can I kill related tmux window when the terminal window closed ? Can we bind commands the close event of the terminal window ?


title: CentOS - acts abnormal every week and causes my whole setup to be down, how can I rollback / restore back to one week?

text: I have CentOS and Red hat enterprise Linux running, where I have now working Google Apps Engine and related other Python web applications. Every week or depending on any Google Apps Engine latest release my working setup does not work any longer (right now its working but after one week it won't work again and its very weird problem without any answer from Google Apps Engine team members either). For the time being the only solution for this is to rollback the whole CentOS/RHEL to 1 week back configuration including if kernel changes or anything related. How can I tell CentOS/RHEL, go back to a installation point of one week back or to any restore point, so that it can reverse back to old setup when it was working for sure?


title: Why server load is significant when CPU IO and memory are only lightly use

text: I have a very powerful server. 32 core and 64G memory with SSD Here is the result of iostat -xk 5               avg-cpu:  %user   %nice %system %iowait  %steal   %idle               13.43    0.00    8.68    1.74    0.00   76.15          Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await  svctm  %util     sda               0.77     0.00    0.50    0.00     1.97     0.00     7.94     0.00    0.10   0.10   0.00     sdb            1487.51   562.92 3596.86  299.21 21888.08  3448.81    13.01     9.94    2.55   0.10  40.26     sdd               5.03    57.98   65.03   86.51   679.05   578.13    16.59     0.28    1.82   0.12   1.80     sdc               2.21     0.00    0.82    0.00    12.24     0.00    29.67     0.00    0.27   0.25   0.02          avg-cpu:  %user   %nice %system %iowait  %steal   %idle               12.98    0.00    8.46    0.41    0.00   78.15          Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await  svctm  %util     sda               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00     sdb              35.80   377.40  656.80  237.00  3714.40  2457.60    13.81     1.34    1.50   0.17  14.96     sdd               0.00   106.20    2.00  143.80     8.00  1000.80    13.84     0.43    2.96   0.12   1.80     sdc               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00          avg-cpu:  %user   %nice %system %iowait  %steal   %idle               10.96    0.00    7.11    0.16    0.00   81.78          Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await  svctm  %util     sda               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00     sdb              10.60   190.60  429.80  220.40  2637.60  1644.00    13.17     0.50    0.76   0.12   7.94     sdd               0.00    58.40   17.80   69.80   345.60   512.80    19.60     0.23    2.65   0.12   1.04     sdc               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00      and top               root@host [/]# top     top - 18:20:27 up 15 min,  1 user,  load average: 4.81, 5.63, 3.90     Tasks: 802 total,   3 running, 786 sleeping,   0 stopped,  13 zombie     Cpu(s): 13.4%us,  8.4%sy,  0.0%ni, 76.2%id,  1.7%wa,  0.0%hi,  0.2%si,  0.0%st     Mem:  15981924k total,  1705512k used, 14276412k free,   457408k buffers     Swap:  4194296k total,        0k used,  4194296k free,   455800k cached            PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND     14351 investgr  20   0     0    0    0 Z 28.3  0.0   0:00.15 php <defunct>     14377 sexsmovi  20   0     0    0    0 Z 24.5  0.0   0:00.13 php <defunct>     14359 hearsttr  20   0     0    0    0 Z 20.7  0.0   0:00.11 php <defunct>     14348 sexsmovi  20   0     0    0    0 Z 18.8  0.0   0:00.10 php <defunct>     14350 sexsmovi  20   0 35420  11m 4668 S 17.0  0.1   0:00.09 php     14362 cuntschi  20   0     0    0    0 Z 17.0  0.0   0:00.09 php <defunct>     14367 investgr  20   0     0    0    0 Z 15.1  0.0   0:00.08 php <defunct>     14366 investgr  20   0 33568 9064 4472 S 13.2  0.1   0:00.07 php     14372 investgr  20   0 33568 8904 4420 S 13.2  0.1   0:00.07 php     14373 investgr  20   0 33568 9028 4456 S 13.2  0.1   0:00.07 php     14376 hearsttr  20   0     0    0    0 Z 11.3  0.0   0:00.06 php <defunct>     14336 hearsttr  20   0 34656  10m 4684 S  9.4  0.1   0:00.11 php     14340 root      20   0  3096 1444  760 R  5.7  0.0   0:00.05 top     14388 sexsmovi  20   0 30720 5996 3896 R  5.7  0.0   0:00.03 php      1161 root      20   0     0    0    0 S  1.9  0.0   0:00.40 flush-8:48      1959 root      20   0     0    0    0 S  1.9  0.0   0:01.22 kondemand/1      5546 nobody    20   0  153m  78m 1568 S  1.9  0.5   0:00.25 httpd      5842 nobody    20   0  153m  78m 1544 S  1.9  0.5   0:00.26 httpd      5843 nobody    20   0  153m  78m 1544 S  1.9  0.5   0:00.23 httpd      6012 nobody    20   0  153m  78m 1568 S  1.9  0.5   0:00.32 httpd      6041 nobody    20   0  153m  78m 1536 S  1.9  0.5   0:00.19 httpd      9143 nobody    20   0  153m  78m 1556 S  1.9  0.5   0:00.26 httpd      9158 nobody    20   0  153m  78m 1536 S  1.9  0.5   0:00.17 httpd     11916 nobody    20   0  153m  78m 1552 S  1.9  0.5   0:00.07 httpd     12508 nobody    20   0  153m  78m 1504 S  1.9  0.5   0:00.03 httpd     12523 nobody    20   0  153m  78m 1504 S  1.9  0.5   0:00.04 httpd     14051 investgr  20   0 33568 9360 4612 S  1.9  0.1   0:00.08 php     14076 investgr  20   0 33568 9328 4640 S  1.9  0.1   0:00.08 php     14306 hearsttr  20   0 34392  10m 4636 S  1.9  0.1   0:00.09 php     16554 nobody    20   0  153m  78m 1572 S  1.9  0.5   0:01.11 httpd     20263 nobody    20   0  153m  78m 1584 S  1.9  0.5   0:00.99 httpd     26535 nobody    20   0  153m  78m 1576 S  1.9  0.5   0:00.64 httpd     26738 nobody    20   0  153m  78m 1584 S  1.9  0.5   0:00.67 httpd     26740 nobody    20   0  153m  78m 1580 S  1.9  0.5   0:00.68 httpd     26963 nobody    20   0  153m  78m 1572 S  1.9  0.5   0:00.78 httpd     30587 nobody    20   0  153m  78m 1568 S  1.9  0.5   0:01.78 httpd         1 root      20   0  2900 1436 1212 S  0.0  0.0   0:01.99 init         2 root      20   0     0    0    0 S  0.0  0.0   0:00.00 kthreadd         3 root      RT   0     0    0    0 S  0.0  0.0   0:00.39 migration/0


title: Oracle 11gR2 grid silent installation: error for privateinterconnects

text: I am installing Oracle grid 11gR2 using silent install with response file. I am getting error after "Collecting interface information for node 1" in logs. I have a feeling that this could be due to option `oracle.crs.config.privateinterconnects=eth0:xxx.xxx.xxx.xxx:1,eth1:xxx.xxx.xxx.xxx:2` Here I have specified only for 1 node. Do I need to specify interconnects for both nodes. `ERROR message: One or more nodes have interfaces not configured with a subnet that is common across all nodes.`


title: ERROR:While Updating

text: I am using RHEL6.Whenever I am tryiung to update my machine it says that               [root@ASL-DRDO manmatha]# yum update     Loaded plugins: product-id, refresh-packagekit, security, subscription-manager     This system is receiving updates from Red Hat Subscription Management.     rhel-6-workstation-rhev-agent-rpms                                                                                rhel-6-workstation-rpms                                                                                | 3.7 kB     00:00          Setting up Update Process     Resolving Dependencies     --> Running transaction check     ---> Package glib.i686 1:1.2.10-33.el6 will be updated     --> Processing Dependency: libglib-1.2.so.0 for package: 1:gtk+-1.2.10-70.el6.i686     --> Processing Dependency: libglib-1.2.so.0 for package: 1:imlib-1.9.15-14.el6.i686     --> Processing Dependency: libgmodule-1.2.so.0 for package: 1:gtk+-1.2.10-70.el6.i686     --> Processing Dependency: libgmodule-1.2.so.0 for package: 1:imlib-1.9.15-14.el6.i686     ---> Package glib.x86_64 1:1.2.10-33.el6.rf will be an update     ---> Package glib-devel.i686 1:1.2.10-33.el6 will be updated     ---> Package glib-devel.x86_64 1:1.2.10-33.el6.rf will be an update     --> Finished Dependency Resolution     Error: Package: 1:gtk+-1.2.10-70.el6.i686 (@epel)            Requires: libgmodule-1.2.so.0            Removing: 1:glib-1.2.10-33.el6.i686 (@epel)                libgmodule-1.2.so.0            Updated By: 1:glib-1.2.10-33.el6.rf.x86_64 (rpmforge)                Not found     Error: Package: 1:imlib-1.9.15-14.el6.i686 (@epel)            Requires: libgmodule-1.2.so.0            Removing: 1:glib-1.2.10-33.el6.i686 (@epel)                libgmodule-1.2.so.0            Updated By: 1:glib-1.2.10-33.el6.rf.x86_64 (rpmforge)                Not found     Error: Package: 1:gtk+-1.2.10-70.el6.i686 (@epel)            Requires: libglib-1.2.so.0            Removing: 1:glib-1.2.10-33.el6.i686 (@epel)                libglib-1.2.so.0            Updated By: 1:glib-1.2.10-33.el6.rf.x86_64 (rpmforge)                Not found     Error: Package: 1:imlib-1.9.15-14.el6.i686 (@epel)            Requires: libglib-1.2.so.0            Removing: 1:glib-1.2.10-33.el6.i686 (@epel)                libglib-1.2.so.0            Updated By: 1:glib-1.2.10-33.el6.rf.x86_64 (rpmforge)                Not found     You could try using --skip-broken to work around the problem     You could try running: rpm -Va --nofiles --nodigest      What does this message mean?


title: Dual boot - Kubuntu and Windows 8 - how to?

text: I recently installed Windows 8 on my computer. These are the specs:   * Fx-8150 CPU   * 8 GB RAM   * ATI HD7870   * 120 GB SSD   * 2 TB HDD   * Mainboard: Gigabyte GA-970A-UD3 (rev 1.1) (only bios but EFI mode possible for starting from CD) I already tried in the past to install a linux distro after installing Windows 8. But during the installation a "critical error" occurred (without further details) and the installation of linux was not "clean". I couldn't install a lot of packages and I found out that there was no boot loader. When restarting it only loaded Windows 8 directly. I tried to reconfigure the partitions in linux but I kind of destroyed the boot partition and wasn't able to boot anything. I couldn't even repair the Windows installation and had to re- install Windows. I need help in finding the correct way of using the partitions. _Windows is installed on C: while D: contains only data_ ![Partitions](http://i.stack.imgur.com/ywSzc.png) How do I pre-configure my partitions so that I can install and dual-boot Kubuntu? I'd prefer to install it on my SSD (having like 30 GB) but I would be fine if it's only possible to install it on the HDD. I will be using Kubuntu 12.04 LTS (Installation DVD for 64bit)   * What do I need to do in order to have the correct bootloader (I presume it's grub?)   * How do I have to prepare my partitions for a correct linux installation? * * * **Update:**   When I try to install Kubuntu from a bootable USB-stick I don't see my partitions. There is sda with 120GB free space and sdb with 2TB of free space... How can I make the partitions I configured in Windows be visible in Linux? ![enter image description here](http://i.stack.imgur.com/8yWkQ.jpg) * * * **Update 2:**   It seems my whole GPT was corrupt. So I re-installed Windows 8, wiped out all partitions and drives and now have a clean Windows 8 installation looking like this: ![enter image description here](http://i.stack.imgur.com/fTBBn.png) Any advice on how to prepare the partitions for a dual-boot Kubuntu installation? * * * **Update 3:**   Here is what I've done so far:   * Shrinking C by 30 GB for my linux installation   * Leave the 30 GB unallocated   * boot from Kubuntu 12.04 USB stick   * Go through the installation procedure   * In the free space creating the following      * Created /sda5 as ext2 with 250 mb and mount point /boot     * Created /sda6 as swap with 4096 mb     * Created /sda7 as ext4 file system with about 25 gb and mount point /     * After warning from the program I did the following:        * Created /sda8 as dos boot part with 1 mb (the program recommended it)   * as boot loader location I choose /dev/sda5 The installation starts without warnings but when it's almost done it says "grub coul not be installed in /dev/sda5". I followed a tutorial step-by-step but still got the same message. Any advice on that?


title: Is there something that will generate keyboard's click sounds?

text: I miss using a clicky keyboard at work. It's a fairly quiet office, so I'm stuck using a nearly silent keyboard. The upshot is that I can wear headphones. Is there something in Linux or X that can respond to all keyboard events with a nice, sharp click, giving me that audio feedback? Before you think I'm crazy, I know some high-end keyboards even have speakers in them to reproduce this click for those who like the audio feedback. I'm looking for something at the operating system level.


title: How to pan the terminal beyond desktop window to view all output on watch?

text: I am watching my iptables with               watch -d 'iptables -vnL --line-numbers'      As the output above extends beyond the current desktop window height, how can I pan the terminal display to view information beyond? Currently, I can only drag the top bar to move the terminal display around, but I am not able to grab the terminal anywhere else with my mouse to pan it up further so that I can see information further down.


title: lookbehind and using it with grep in Vi?

text: Trying to get into Vi (not Vim), after learning Vim.   1. Vim has a lookabehind like `/\\(Not this\\)\@<!$`, how to do it in Vi?   2. If I want to search recurvively down directory in Vim, I could do `:vimgrep /\\(Not this\\)\@!$ -r *`, what about Vi?   3. if (1) and (2) are not available in Vi, how do you accomplish them? Please, create tag `lookbehind` and `regex`.


title: How do I setup Alpine to connect my Gmail account using IMAP?

text: I am using FreeBSD 8.1 and just installed Alpine email client. I wonder if anybody knows how to setup Alpine to get mail from a Gmail account using IMAP.


title: How can I run keychain in a way that only has the first shell prompt for keys on startup?

text: I open multiple shell tabs when I start KDE, and I've just added `keychain` to my `~/.shellrc` the problem is that all the tabs prompt for key passwords when I login. This is quite annoying to do this. Is there any good solution for this so that all the tabs simply start, and once I've logged into one tab, all of them have the keys loaded?


title: Checking if PATH contains $HOME/mydir and adding it if not (all in a script)

text: > **Possible Duplicate:**   >  keep duplicates out of $PATH on source I am not an expert with Unix scripting. Some of my scripts are located in `$HOME/mydir`. Unfortunately, they are not accessible from elsewhere if this dir is not part of `PATH`. I would like to create a small scripts checking whether `$HOME/mydir` is part of `PATH`. If it is not, `PATH` should be updated with it and `EXPORTED`. My question is: which command can I use to check whether `$HOME/mydir` is part of `PATH`? Thanks. **SOLUTION** For the records, I implemented the following:               echo "Before: $PATH"          echo $PATH | grep -q "$HOME/scripts"          if [ $? -eq 0 ]; then       PATH=$PATH:$HOME/scripts       export PATH     else       export PATH     fi          echo ""     echo "After: $PATH"


title: MP3+FLAC tag editor for Linux

text: > **Possible Duplicate:**   >  Which mp3 tagging tool for Linux? Are there any good batch tag editors for Ubuntu/Fedora? Which one is the best?


title: rxvt and Inconsolata (a font)

text: Is it possible to use the rxvt terminal emulator with Inconsolata? Is it possible to use any TrueType fonts with rxvt? I'd like to use rxvt but would love to use my own fonts.


title: Search & remove text in files from a source file

text: I want to search for and remove a block text from several files. The block of text to be matched against is in file, say `/home/user/myblock.txt` I want to parse the directory `/home/user/rep` and remove the content of `mybloc.txt` from all the files in the directory.


title: Wrong route taken on a network with two gateways

text: In the following output, why does `vpn1` route pings to 10.100.0.1 instead of 10.100.0.112? 10.100.0.1 is a network gateway with no NAT; 10.100.0.112 is a dual-homed host with NAT enabled.               root@vpn1:~# ip ro     10.8.0.21 dev tun0 proto kernel scope link src 10.8.0.22     8.8.8.8 via 10.100.0.112 dev eth0 src 10.100.0.5     10.8.0.0/24 via 10.8.0.21 dev tun0     192.168.124.0/24 dev eth1 proto kernel scope link src 192.168.124.1     10.100.0.0/24 dev eth0 proto kernel scope link src 10.100.0.5     192.168.123.0/24 via 10.8.0.21 dev tun0     default via 10.100.0.1 dev eth0 metric 100     root@vpn1:~# traceroute 8.8.8.8     traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets     1 10.100.0.1 (10.100.0.1) 0.287 ms 0.257 ms 0.317 ms     2 * * *     3 * * *     4 * * *     5 * * *     6 * * *     7 * * *     8 * * *     9 * * *     10 * * *     11 * * *     12 * *^C     root@vpn1:~# ping 10.100.0.112     PING 10.100.0.112 (10.100.0.112) 56(84) bytes of data.     64 bytes from 10.100.0.112: icmp_req=1 ttl=127 time=0.321 ms     ^C          --- 10.100.0.112 ping statistics ---     1 packets transmitted, 1 received, 0% packet loss, time 0ms     rtt min/avg/max/mdev = 0.321/0.321/0.321/0.000 ms


title: VirtualBox guest hangs when starting vbox additions

text: I have a Fedora 14. I installed the Ubuntu 11.04 i386 mini.iso in Virtualbox. After install when I reboot it, and wanted to start it: ![enter image description here](http://i.stack.imgur.com/hhFlh.png) it just hangs...for minutes... what can I do?


title: VirtualBox guest hangs when: Starting Apparmor profiles

text: I have a Fedora 14. I installed the Ubuntu 11.04 i386 mini.iso in Virtualbox. After install when I reboot it it just hangs with this message:               /dev/mapper/vg-root: tiszta, 52354/5103616 fájl, 559633/20408320 blokk     init: ureadahead-other main process (420) terminated with status 4     [   14.569632] piix_smbus 0000:00:07.0: SMBus base address uninitialized - upgrade BIOS or use force_addr=0xaddr      * Starting AppArmor profiles    [ OK ]      First line translates from Hungarian to English as:               /dev/mapper/vg-root: clean, 52354/5103616 files, 559633/20408320 blocks      What should I do to boot this Ubuntu guest? Is it a bug? UPDATE: If I switch to another tty then I can see the log in screen/terminal and I can log in too... ohh well, it's just a test guest vm... I hope when it comes to installing ubuntu minimal on a real machine it wont stop at the apparmor message.


title: linux udev rule to load gadget module for client driver

text: I'm having a hard time automating loading a gadget module and bringing up the usb0 device as a eth interface. The interface in question is g_ether for a embedded Linux device and connecting to a PC. I imagine there is a way to see the event from the plugin and run a script with udev. When I plug my device into a PC, I don't see any events. I tried different variations of udevadm monitor and I'm not sure how to find out what I can use as a udev rule to modprobe a gadget module. Part of the reason I'm trying to load the otg module is because we are mostly using g_ether. I want to use avahi-autoipd but its getting an IP address before its plugged in. If I use allow-hotplug in the network interface it never automatically brings the interface up when its plugged in. So in theory, I want to plug in the device to a PC, run avahi-autoipd on the new network interface to retrieve an IP, and dhcpd to give one to the host. Since someone else starting helping me in the stackoverflow (reposting here) I've got some more info.               /sys/bus/usb/devices$ ls     1-0:1.0  2-0:1.0  3-0:1.0  3-1  3-1:1.0  usb1  usb2  usb3     [ 4297.515400] g_ether gadget: high speed config #2: RNDIS     [ 4300.379021] g_ether gadget: high speed config #1: CDC Ethernet (ECM)     sys/bus/usb/devices$ ls     1-0:1.0  2-0:1.0  3-0:1.0  3-1  3-1:1.0  usb1  usb2  usb3      I've tried running                  udevadm monitor --environment        udevadm monitor --environment --udev         udevadm monitor        udevadm monitor --kernel        udevadm monitor --kernel --udev      unplugging and plugging the device in doesn't show anything. The manpage says it " Listens to the kernel uevents and events sent out by a udev rule" and I have no rules on my device. So I'm assuming that's probably why nothing prints out ever, even if I try to do some things with other hardware? I'm running an embedded Linux distribution. I imagine I might not have everything a desktop has? Its come to my attention I might have an issue with my g_ether module? These outputs never change. cat /sys/class/net/usb0/carrier cat: read error: Invalid argument cat /sys/class/net/usb0/operstate down


title: list full path of file without tying it from relative relative path

text: I could do this               root@server [/home/user/public_html]# ls /home/user/public_html/.htaccess       but I'd like to do this               ls --switch .htaccess     /home/user/public_html/.htaccess      is it possible?


title: convention regarding offline temporary data

text: When writing small utility programs, I sometimes want to keep small amounts of data around _between_ executions, usually for caching purposes, but don't want the program to run as a daemon. Are there any conventions regarding this? Making files in `/tmp` seems obvious, as it is usually kept in memory, and is only wiped at shutdown, but I'm curious if there are other ways. Also, is there a convention for naming files in `/tmp`?


title: Gnome panel missing application icons, chat bubble menu, and power menu

text: I've been messing around with my system too much and messed something up. I'm new to Ubuntu, but have been using linux on servers for a few years. I'm not sure of the correct terminology so I'm including screen shots to explain what is going on. First, system specs: > Ubuntu 10.4 LTS x64 Lucid   >  Core i7-970   >  Nvidia GTX 480   >  Dual Screen with Twinview   >  Nvidia proprietary dev driver 260.24 (64-bit) Now what I screwed up: First major customization was `ppa:goehle/goehle-ppa` customizations for keeping evolution open after closing the main window. That worked fine until I started messing with getting hibernate working. I never got hibernate working even after installing `linux-generic-tuxonice`; it gave a warning about usb09 not stopping. The only things that I have in USB are a keyboard and mouse. Then I started getting the error: ![The panel encountered a problem while loading "OAFIID:GNOME_FastUserSwitchApplet"](http://i.stack.imgur.com/Fe6ca.png) Trying to fix this, I reinstalled the Evolution customizations. The error persists and now the panel is messed up as well. I'm not getting the application icons, the menu with the chat status, or the shutdown/restart/lock screen menu. This is what it should look like: ![Expected panel](http://i.stack.imgur.com/Apl4R.png) But this is what I'm getting now: ![Actual panel](http://i.stack.imgur.com/3WoNd.png) How do I get my icons back? * * * **EDIT:** I found how to get my application icons back.   1. Right-click on panel   2. Add to Panel ...   3. Notification Area. I still have not figured out what the chat bubble menu and power menu are called.


title: How can I debug a Suspend-to-RAM issue on Linux?

text: I'm hoping to get experience-based suggestions on how to go about debugging suspend-to-RAM issue. Advice specific to my situation(detailed below) would be great, but I am also interested in general advice about how to debug such issues. **The problem:** Often, when I attempt to suspend my machine, it gets stuck in a "not suspended but not awake" state. Often the screen will be completely black but sometimes it will have the following error message on it:               GLib-WARNING **: getpwuid_r(): failed due to unknown user id (0)       Also, this state will also be accompanied by the fans kicking into high gear. The only way to get it out of this state is to manually power off the laptop. **Some Information**               $ uname -a     Linux baltar 2.6.35-22-generic #34-Ubuntu SMP Sun Oct 10 09:26:05 UTC 2010 x86_64 GNU/Linux          $ lsb_release -a     Distributor ID:    Ubuntu     Description:    Ubuntu 10.10     Release:    10.10     Codename:    maverick      I've taken a look at `/var/log/dmesg` and `/var/log/pm-suspend.log`, but I don't know what I'm looking for and nothing stands out. I'm unsure if it is related, but I did find a lot of the following in `/var/log/kern.log`:               EXT4-fs (dm-0): re-mounted. Opts: errors=remount-ro,commit=600


title: How similar is Apple's terminal.app to a bash terminal on Linux?

text: I know that Apple's Terminal.app provides a bash shell. Are there any differences between this and a bash on Linux?


title: Writing a makefile to install manual pages for a library

text: If I have a C library, let's say "apple", and "apple" contains functions "banana" and "carrot", how do I write the "install" line in the makefile so that "man banana" brings up the manual page for the "apple" library?


title: How would I go about getting UPnP working on a Slackware server/firewall?

text: I'm a long time fan of Slackware and I've always had a machine serving as my main server/firewall with the latest version installed. I have it now but I'm struggling to find information on how to setup UPnP on it. Can anyone please provide some good links where I can investigate further. Many thanks.


title: Fix X11 forwarding on OSX

text: I am looking for a way to fix/debug a X11 forwarding session on OSX. Here is my situation:   * From my mac I connect to a Ubuntu workstation with `ssh -X` (tried `ssh -Y` as well).   * X11 forwarding works perfectly with firefox for instance, X11/Quartz is started automatically on OSX and firefox is displayed.   * X11 forwarding does not work with bat (Bacula graphical console): X11 is started but no window is displayed. There are no errors (`/private/var/log/system.log`). When I try doing the same from another Ubuntu workstation, it works perfectly for both firefox and bat. I guess the problem is on OSX side then. I tried switching some options in X11 but nothing works. Would you have any idea on how to move forward?


title: iptables ignores other rules after add last rule

text: I have written these rules in `iptables`:               -A FORWARD -i eth1 -o eth0 -p icmp -m limit --limit 1/hour --limit-burst 5000 -j ACCEPT     -A FORWARD -i eth1 -o eth0 -p udp -m limit --limit 1/hour --limit-burst 200 -j ACCEPT     -A FORWARD -i eth1 -o eth0 -p tcp -m limit --limit 1/hour --limit-burst 200 -j ACCEPT     -A FORWARD -i eth1 -o eth0 -m limit --limit 1/hour --limit-burst 100 -j ACCEPT     -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT     -A FORWARD -i eth1 -o eth0 -p tcp -m tcp --dport 443 -j limitlog     -A FORWARD -i eth1 -o eth0 -p tcp -m tcp --dport 80 -j limitlog     -A FORWARD -i eth1 -o eth0 -p udp -m udp --dport 53 -j limitlog     -A FORWARD -i eth1 -o eth0 -p udp -m udp --dport 123 -j limitlog     -A FORWARD -i eth1 -o eth0 -p tcp -m tcp --dport 21 -j limitlog     -A FORWARD -i eth1 -o eth0 -p tcp -m tcp --dport 20 -j limitlog     -A FORWARD -i eth1 -o eth0 -p tcp -m tcp --dport 22 -j limitlog     -A FORWARD -i eth1 -o eth0 -p tcp -m tcp --dport 5123 -j limitlog     -A FORWARD -i eth1 -o eth0 -p udp -m udp --dport 5123 -j limitlog     -A limitlog -i eth1 -o eth0 -p tcp -m tcp --dport 443 -j LOG --log-prefix "HTTPS z HP: "     -A limitlog -i eth1 -o eth0 -p tcp -m tcp --dport 443 -m limit --limit 1/hour --limit-burst 900 -j ACCEPT     -A limitlog -i eth1 -o eth0 -p tcp -m tcp --dport 80 -j LOG --log-prefix "HTTP z HP: "     -A limitlog -i eth1 -o eth0 -p tcp -m tcp --dport 80 -m limit --limit 1/hour --limit-burst 960 -j ACCEPT     -A limitlog -i eth1 -o eth0 -p udp -m udp --dport 53 -j LOG --log-prefix "DNS z HP: "     -A limitlog -i eth1 -o eth0 -p udp -m udp --dport 53 -m limit --limit 1/hour --limit-burst 360 -j ACCEPT     -A limitlog -i eth1 -o eth0 -p udp -m udp --dport 123 -j LOG --log-prefix "NTP z HP: "     -A limitlog -i eth1 -o eth0 -p udp -m udp --dport 123 -m limit --limit 1/hour --limit-burst 300 -j ACCEPT     -A limitlog -i eth1 -o eth0 -p tcp -m tcp --dport 21 -j LOG --log-prefix "FTP z HP: "     -A limitlog -i eth1 -o eth0 -p tcp -m tcp --dport 21 -m limit --limit 1/hour --limit-burst 900 -j ACCEPT     -A limitlog -i eth1 -o eth0 -p tcp -m tcp --dport 20 -j LOG --log-prefix "FTP DATA z HP: "     -A limitlog -i eth1 -o eth0 -p tcp -m tcp --dport 20 -m limit --limit 1/hour --limit-burst 900 -j ACCEPT     -A limitlog -i eth1 -o eth0 -p tcp -m tcp --dport 22 -j LOG --log-prefix "SSH/SCP z HP: "     -A limitlog -i eth1 -o eth0 -p tcp -m tcp --dport 22 -m limit --limit 1/hour --limit-burst 900 -j ACCEPT     -A limitlog -i eth1 -o eth0 -p tcp -m tcp --dport 5123 -j LOG --log-prefix "5123TCP z HP: "     -A limitlog -i eth1 -o eth0 -p tcp -m tcp --dport 5123 -m limit --limit 1/hour --limit-burst 300 -j ACCEPT     -A limitlog -i eth1 -o eth0 -p udp -m udp --dport 5123 -j LOG --log-prefix "5123UDP z HP: "     -A limitlog -i eth1 -o eth0 -p udp -m udp --dport 5123 -m limit --limit 1/hour --limit-burst 300 -j ACCEPT      `eth0` is the external network and `eth1` is the internal network. It works correct, but if I add this rule:               iptables -A FORWARD -i eth1 -o eth0 -j DROP      all previous rules are ignored and traffic ends on this last rule. I do not understand... Why? If I remove this rule and modify rules in my chain `limitlog` for example from `ACCEPT` to `DROP` it works too.


title: Looking for the path of a particular file provided by a particular rpm in a spec

text: I want to know the path of `apxs` provided by `httpd-devel`, on a machine that might have other copies of `apxs`, that would be resolved by `which` first. I can be reasonably confident this command will work:               rpm -ql httpd-devel | egrep 's?bin/apxs2?$'      However, is there a way to test without piping through `grep` and regex?


title: extract the 4th column from a csv file using unix command

text:
I have a csv file formatted as below.               "col1","col2","col3","col4"     "1","text1","
big           html          text
     ","4th column"     "2","text2","
big2           html2          text2
     ","4th column2"      I want to extract the 4th column using. I think that `awk` is the best tool for this ( let me know if I am wrong). I tried this               awk -F, '{print $4}' myFile.csv       but it fails. I think because the 3rd column is multiline one. How can I use `awk` or any other unix command to extract the 4th column. I am looking for an efficient solution since my real file is big (> 2GB)


title: How to setup wireless AP with two wifi cards and ethernet as WAN on debian?

text: I'm trying to build wireless AP with 2 Atheros cards (AR5413 / AR5414 both), and one ethernet card to act as WAN. I am also having doubts if I should use `ath5k` or `madwifi` drivers. I've tried both already but none worked as I wanted Here is what I want (if possible):   1. wireless cards (`wlan0` / `wlan1`) in ap/master mode   2. wpa2 encryption on both interfaces   3. each wireless interface has static IP (ex: `10.0.1.1` for `wlan0`, and `10.0.2.1` for `wlan1`)   4. each wireless interface has dhcp-server for managing client's addresses (ex: pool for `wlan0`: `10.0.1.100-10.0.1.120`, pool for `wlan0`: `10.0.2.100 - 10.0.2.120`)   5. `eth0` should be WAN interface with dhcp-client (public ip)   6. forward traffic (and internet) from WAN to wireless interfaces (not sure how this should be done... `iptables+dnsmasq`?)   7. `QoS` control (optional) I've tried and managed to get wireless `essid` on box using `hostapd` (with `WPA2` working), but it requires bridge (`br0`) interface to work (not sure how). This bridge forces ethernet and wireless card **not** to have IP addresses and bridge takes public IP from cable modem via `eth0`. As I try to connect my wireless ESSID my client machine (cell phone for ex.) can't get IP (no dhcp-server) and I don't know what configuration to put addresses manually because there is no local IP on `wlan0` interface itself. Just to recap:               [INTERNET] <---- eth0(WAN) <----?NAT?----> wlan0/wlan1      Any suggestion is welcome (due concept or implementation).


title: LVM + LUKS partition - Is this architecture dependent or independent?

text: I've been recently dealing with an LVM + LUKS partition trying to install a new linux (ubuntu in this case). I tried a few different options to make it work, but the pc resisted, the only system I could make work was the 32bit version of ubuntu 12.04. After succeeding with this (discarding all the twists to make the encryption work) I thought give it another try with the 64bit version since the pc is a 64bit after all. But at this time I didn't re-set up the LVM nor re-partitioned it at all. Right now, and just out of curiosity I would like to know, how architecture- dependant or not may an LVM partition be? I mean, was I wrong by assumming I didn't need to repartition/reformat it before installing a 64bit system? Thanks for any information!


title: How to use a timer in bash?

text: I needed a timer which will start at the very beginning of the script and stops at the end.Can anyone help me with that?


title: Gnome3.6.2 - empathy chats do not appear in the notification bar after a while in fedora 18

text: I am using fedora 18 with Gnome 3.6.2 and I've updated empathy to the latest version (Empathy 3.6.4) yesterday. it works fine at first, but after a while, the notification bar which is at the down part of the screen disappears and no notifications will be shown there anymore. so for new conversations, I hear the sound notification for the message which is received, but because no pop up window is shown, I can't find out who has sent the message and I miss them. I think the problem is not because of empathy and the main problem is the notification bar which is disappeared. How can I solve this problem?


title: Error while mounting directory from host via NFS

text: I've been looking around the site but I couldn't find anyone with the same problem. On VirtualBox, I have a machine with IP *.28 and another one with IP *.20. The latter should mount a directory exported by the former. *.28:/etc/exports               /myfolder *.20(rw,sync,no_root_squash,subtree_check)      *.20:/etc/fstab               *.28:/myfolder /myfolder nfs defaults 0 0      The recipient just does not mount the directory at startup. When I try to manually mounting via: mount /myfolder I get this error message:               mount: wrong fs type, bad option, bad superblock on *.28:/myfolder,     missing codepage or helper program, or other error     (for several filesystems (e.g. nfs, cifs) you might     need a /sbin/mount.<type> helper program)      Any idea why this happens? (Or where I can get this "helper program" that I'm apparently missing?)


title: simultaneously share /dev/videoX with multiple applications?

text: the goal is to use the same webcam for video chat apps and for home security at the same time. Currently, the webcam is working just fine with either VLC (or mjpg-streamer) and with Kopete - just not simultaneously. I am on Kubuntu 10.4 but at least one of these setups will be on Debian/Linux. A GNU/Linux generic method would be best, but Debian/Linux specific (with udev?) would be just fine. I have a custom udev rule to control naming of the webcam and I had tried adding "MODE = "0666"" and I have tired running Kopete as root after opening the device with VLC, a permissions angle might not the trick. Any brilliant insights?


title: Reverse DNS lookups slowing down network operations on LAN

text: # Environment My LAN setup is quite basic:   * A router connected to the ISP's modem and the internet   * My development pc directly connected to the router The router provides DHCP but does not run its own DNS server. In fact, there is no DNS server hosted anywhere on my LAN (typical home network setup). The router is configured to send the ISP's DNS servers as part of the DHCP lease information. I set up a VirtualBox machine on my development PC and installed Debian Squeeze (6.0.4) on it. The VirtualBox network mode is `Bridged Adapter` to simulate a standalone server on my LAN. Being a VirtualBox server instead of a physical server is not really important, but I mention it for completeness. # The Problem Every time a network operation executes a DNS reverse lookup of a LAN ip prior to executing, the server has long delays. Some examples of slow network operations:   * SSH connection to the server from my dev PC   * Connection to admin port of Glassfish server   * `netstat -l` (`netstat -nl` is very fast)   * `Starting MTA: exim4` on boot takes a long time to complete Some of these have workarounds like adding my dev pc's Ip to `/etc/hosts` or adding a command-specific option to avoid doing DNS reverse lookups. Obviously, using `/etc/hosts` only goes so far because it is at odds with DHCP. However, I can't help but think that I'm missing something. Do I _really_ need to setup a DNS server somewhere on my LAN? That seems like a huge and useless effort for my needs and I can't believe there isn't another option in a DHCP environment like mine. I searched the net a lot for this and maybe I don't have the right search terms, but I can't find the solution... ### update 1 following BillThor's answer Using host (dig gives the same results):               # ip of stackoverflow.com     $ time host -v 64.34.119.12     Trying "12.119.34.64.in-addr.arpa"     ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 15537     ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0          ;; QUESTION SECTION:     ;12.119.34.64.in-addr.arpa.     IN      PTR          ;; ANSWER SECTION:     12.119.34.64.in-addr.arpa. 143  IN      PTR     stackoverflow.com.          Received 74 bytes from 192.168.1.1#53 in 15 ms          real    0m0.020s     user    0m0.008s     sys     0m0.000s          # ip of dev pc     $ time host -v 192.168.1.50     Trying "50.1.168.192.in-addr.arpa"     ;; connection timed out; no servers could be reached          real    0m10.004s     user    0m0.004s     sys     0m0.000s      My /etc/resolv.conf (was automatically created during installation)               nameserver 192.168.1.1      Both host and dig return very fast for a public ip but take 10s to timeout for a LAN ip. I guess 10s is my current timeout value. ### update 2 With `dev-pc` in /etc/hosts file:               $ time getent hosts 192.168.1.50     192.168.1.50    dev-pc          real    0m0.001s     user    0m0.000s     sys     0m0.000s      Without `dev-pc` in /etc/hosts file:               $ time getent hosts 192.168.1.50          real    0m10.012s     user    0m0.004s     sys     0m0.000s      It looks more and more like I'll have to find piecewise program options or parameters for each one trying to do reverse DNS lookups! None of the machines (virtual or not) can act as a DNS server on my LAN since they are not always up. Unfortunately, the router's firmware doesn't include a DNS server.


title: High CPU usage with CFS?

text: I asked a previous question to try and isolate the source of an increase in CPU usage when moving an application from RHEL 5 to RHEL 6. The analysis that I did for that seems to indicate that it is being caused by the CFS in the kernel. I wrote a test application to try and verify if this was the case (original test application removed to fit in size limit, but still available in git repo. I compiled it with the following command on RHEL 5:               cc test_select_work.c -O2 -DSLEEP_TYPE=0 -Wall -Wextra -lm -lpthread -o test_select_work      I then played with the parameters until the execution time per iteration was about 1 ms on a Dell Precision m6500. I got the following result on RHEL 5:               ./test_select_work 1000 10000 300 4     time_per_iteration: min: 911.5 us avg: 913.7 us max: 917.1 us stddev: 2.4 us     ./test_select_work 1000 10000 300 8     time_per_iteration: min: 1802.6 us avg: 1803.9 us max: 1809.1 us stddev: 2.1 us     ./test_select_work 1000 10000 300 40     time_per_iteration: min: 7580.4 us avg: 8567.3 us max: 9022.0 us stddev: 299.6 us      And the following on RHEL 6:               ./test_select_work 1000 10000 300 4     time_per_iteration: min: 914.6 us avg: 975.7 us max: 1034.5 us stddev: 50.0 us     ./test_select_work 1000 10000 300 8     time_per_iteration: min: 1683.9 us avg: 1771.8 us max: 1810.8 us stddev: 43.4 us     ./test_select_work 1000 10000 300 40     time_per_iteration: min: 7997.1 us avg: 8709.1 us max: 9061.8 us stddev: 310.0 us      On both versions, these results were about what I expected with the average amount of time per iteration scaling relatively linearly. I then recompiled with `-DSLEEP_TYPE=1` and got the following results on RHEL 5:               ./test_select_work 1000 10000 300 4     time_per_iteration: min: 1803.3 us avg: 1902.8 us max: 2001.5 us stddev: 113.8 us     ./test_select_work 1000 10000 300 8     time_per_iteration: min: 1997.1 us avg: 2002.0 us max: 2010.8 us stddev: 5.0 us     ./test_select_work 1000 10000 300 40     time_per_iteration: min: 6958.4 us avg: 8397.9 us max: 9423.7 us stddev: 619.7 us      And the following results on RHEL 6:               ./test_select_work 1000 10000 300 4     time_per_iteration: min: 2107.1 us avg: 2143.1 us max: 2177.7 us stddev: 30.3 us     ./test_select_work 1000 10000 300 8     time_per_iteration: min: 2903.3 us avg: 2903.8 us max: 2904.3 us stddev: 0.3 us     ./test_select_work 1000 10000 300 40     time_per_iteration: min: 8877.7.1 us avg: 9016.3 us max: 9112.6 us stddev: 62.9 us      On RHEL 5, the results were about what I expected(4 threads taking twice as long because of the 1 ms sleep but the 8 threads taking the same amount of time since each thread is now sleeping for about half the time, and a still fairly linear increase). However, with RHEL 6, the time taken with 4 threads increased by about 15% more than the expected doubling and the 8 thread case increased by about 45% more than the expected slight increase. The increase in the 4 thread case seems to be that RHEL 6 is actually sleeping for a handful of microseconds more than 1 ms while RHEL 5 is only sleep about 900 us, but this doesn't explain the unexpectedly large increase in the 8 and 40 thread cases. I saw similar types of behaviour with all 3 -DSLEEP_TYPE values. I also tried playing with the scheduler parameters in sysctl, but nothing seemed to have a significant impact on the results. Any ideas on how I can further diagnose this issue? UPDATE: 2012-05-07 I added measurements of the user and system CPU usage from /proc/stat//tasks//stat as an output of the test to try and get another point of observation. I also found an issue with the way the mean and standard deviation were being updated that was introduced when I added the outer iteration loop, so I will add the new plots that have the corrected mean and standard deviation measurements. I have included the updated program. I also made a git repo to track the code and it's available here.               #include <limits.h>     #include <math.h>     #include <poll.h>     #include <pthread.h>     #include <sched.h>     #include <stdio.h>     #include <stdlib.h>     #include <time.h>     #include <unistd.h>     #include <sys/select.h>     #include <sys/syscall.h>     #include <sys/time.h>               // Apparently GLIBC doesn't provide a wrapper for this function so provide it here     #ifndef HAS_GETTID     pid_t gettid(void)     {       return syscall(SYS_gettid);     }     #endif               // The different type of sleep that are supported     enum sleep_type {       SLEEP_TYPE_NONE,       SLEEP_TYPE_SELECT,       SLEEP_TYPE_POLL,       SLEEP_TYPE_USLEEP,       SLEEP_TYPE_YIELD,       SLEEP_TYPE_PTHREAD_COND,       SLEEP_TYPE_NANOSLEEP,     };          // Information returned by the processing thread     struct thread_res {       long long clock;       long long user;       long long sys;     };          // Function type for doing work with a sleep     typedef struct thread_res *(*work_func)(const int pid, const int sleep_time, const int num_iterations, const int work_size);          // Information passed to the thread     struct thread_info {       pid_t pid;       int sleep_time;       int num_iterations;       int work_size;       work_func func;     };               inline void get_thread_times(pid_t pid, pid_t tid, unsigned long long *utime, unsigned long long *stime)     {       char filename[FILENAME_MAX];       FILE *f;            sprintf(filename, "/proc/%d/task/%d/stat", pid, tid);       f = fopen(filename, "r");       if (f == NULL) {         *utime = 0;         *stime = 0;         return;       }            fscanf(f, "%*d %*s %*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u %Lu %Lu", utime, stime);            fclose(f);     }          // In order to make SLEEP_TYPE a run-time parameter function pointers are used.     // The function pointer could have been to the sleep function being used, but     // then that would mean an extra function call inside of the "work loop" and I     // wanted to keep the measurements as tight as possible and the extra work being     // done to be as small/controlled as possible so instead the work is declared as     // a seriees of macros that are called in all of the sleep functions. The code     // is a bit uglier this way, but I believe it results in a more accurate test.          // Fill in a buffer with random numbers (taken from latt.c by Jens Axboe <jens.axboe@oracle.com>)     #define DECLARE_FUNC(NAME) struct thread_res *do_work_##NAME(const int pid, const int sleep_time, const int num_iterations, const int work_size)          #define DECLARE_WORK() \       int *buf; \       int pseed; \       int inum, bnum; \       pid_t tid; \       struct timeval clock_before, clock_after; \       unsigned long long user_before, user_after; \       unsigned long long sys_before, sys_after; \       struct thread_res *diff; \       tid = gettid(); \       buf = malloc(work_size * sizeof(*buf)); \       diff = malloc(sizeof(*diff)); \       get_thread_times(pid, tid, &user_before, &sys_before); \       gettimeofday(&clock_before, NULL)          #define DO_WORK(SLEEP_FUNC) \       for (inum=0; inum<num_iterations; ++inum) { \         SLEEP_FUNC \          \         pseed = 1; \         for (bnum=0; bnum<work_size; ++bnum) { \           pseed = pseed * 1103515245 + 12345; \           buf[bnum] = (pseed / 65536) % 32768; \         } \       } \          #define FINISH_WORK() \       gettimeofday(&clock_after, NULL); \       get_thread_times(pid, tid, &user_after, &sys_after); \       diff->clock = 1000000LL * (clock_after.tv_sec - clock_before.tv_sec); \       diff->clock += clock_after.tv_usec - clock_before.tv_usec; \       diff->user = user_after - user_before; \       diff->sys = sys_after - sys_before; \       free(buf); \       return diff          DECLARE_FUNC(nosleep)          {       DECLARE_WORK();            // Let the compiler know that sleep_time isn't used in this function       (void)sleep_time;            DO_WORK();            FINISH_WORK();     }          DECLARE_FUNC(select)     {       struct timeval ts;       DECLARE_WORK();            DO_WORK(         ts.tv_sec = 0;         ts.tv_usec = sleep_time;         select(0, 0, 0, 0, &ts);         );            FINISH_WORK();     }          DECLARE_FUNC(poll)     {       struct pollfd pfd;       const int sleep_time_ms = sleep_time / 1000;       DECLARE_WORK();            pfd.fd = 0;       pfd.events = 0;            DO_WORK(         poll(&pfd, 1, sleep_time_ms);         );            FINISH_WORK();     }          DECLARE_FUNC(usleep)     {       DECLARE_WORK();            DO_WORK(         usleep(sleep_time);         );            FINISH_WORK();     }          DECLARE_FUNC(yield)     {       DECLARE_WORK();            // Let the compiler know that sleep_time isn't used in this function       (void)sleep_time;            DO_WORK(         sched_yield();         );            FINISH_WORK();     }          DECLARE_FUNC(pthread_cond)     {       pthread_cond_t cond  = PTHREAD_COND_INITIALIZER;       pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;       struct timespec ts;       const int sleep_time_ns = sleep_time * 1000;       DECLARE_WORK();            pthread_mutex_lock(&mutex);            DO_WORK(         clock_gettime(CLOCK_REALTIME, &ts);         ts.tv_nsec += sleep_time_ns;         if (ts.tv_nsec >= 1000000000) {           ts.tv_sec += 1;           ts.tv_nsec -= 1000000000;         }         pthread_cond_timedwait(&cond, &mutex, &ts);         );            pthread_mutex_unlock(&mutex);            pthread_cond_destroy(&cond);       pthread_mutex_destroy(&mutex);            FINISH_WORK();     }          DECLARE_FUNC(nanosleep)     {       struct timespec req, rem;       const int sleep_time_ns = sleep_time * 1000;       DECLARE_WORK();            DO_WORK(         req.tv_sec = 0;         req.tv_nsec = sleep_time_ns;         nanosleep(&req, &rem);         );            FINISH_WORK();     }          void *do_test(void *arg)     {       const struct thread_info *tinfo = (struct thread_info *)arg;            // Call the function to do the work       return (*tinfo->func)(tinfo->pid, tinfo->sleep_time, tinfo->num_iterations, tinfo->work_size);     }          struct thread_res_stats {       double min;       double max;       double avg;       double stddev;       double prev_avg;     };          #ifdef LLONG_MAX       #define THREAD_RES_STATS_INITIALIZER {LLONG_MAX, LLONG_MIN, 0, 0, 0}     #else       #define THREAD_RES_STATS_INITIALIZER {LONG_MAX, LONG_MIN, 0, 0, 0}     #endif          void update_stats(struct thread_res_stats *stats, long long value, int num_samples, int num_iterations, double scale_to_usecs)     {       // Calculate the average time per iteration       double value_per_iteration = value * scale_to_usecs / num_iterations;            // Update the max and min       if (value_per_iteration < stats->min)         stats->min = value_per_iteration;       if (value_per_iteration > stats->max)         stats->max = value_per_iteration;       // Update the average       stats->avg += (value_per_iteration - stats->avg) / (double)(num_samples);       // Update the standard deviation       stats->stddev += (value_per_iteration - stats->prev_avg) * (value_per_iteration - stats->avg);       // And record the current average for use in the next update       stats->prev_avg= stats->avg;     }          void print_stats(const char *name, const struct thread_res_stats *stats)     {       printf("%s: min: %.1f us avg: %.1f us max: %.1f us stddev: %.1f us\n",           name,           stats->min,           stats->avg,           stats->max,           stats->stddev);     }          int main(int argc, char **argv)     {       if (argc <= 6) {         printf("Usage: %s <sleep_time> <outer_iterations> <inner_iterations> <work_size> <num_threads> <sleep_type>\n", argv[0]);         printf("  outer_iterations: Number of iterations for each thread (used to calculate statistics)\n");         printf("  inner_iterations: Number of work/sleep cycles performed in each thread (used to improve consistency/observability))\n");         printf("  work_size: Number of array elements (in kb) that are filled with psuedo-random numbers\n");         printf("  num_threads: Number of threads to spawn and perform work/sleep cycles in\n");         printf("  sleep_type: 0=none 1=select 2=poll 3=usleep 4=yield 5=pthread_cond 6=nanosleep\n");         return -1;       }            struct thread_info tinfo;       int outer_iterations;       int sleep_type;       int s, inum, tnum, num_samples, num_threads;       pthread_attr_t attr;       pthread_t *threads;       struct thread_res *res;       struct thread_res **times;       // Track the stats for each of the measurements       struct thread_res_stats stats_clock = THREAD_RES_STATS_INITIALIZER;       struct thread_res_stats stats_user = THREAD_RES_STATS_INITIALIZER;       struct thread_res_stats stats_sys = THREAD_RES_STATS_INITIALIZER;       // Calculate the conversion factor from clock_t to seconds       const long clocks_per_sec = sysconf(_SC_CLK_TCK);       const double clocks_to_usec = 1000000 / (double)clocks_per_sec;            // Get the parameters       tinfo.pid = getpid();       tinfo.sleep_time = atoi(argv[1]);       outer_iterations = atoi(argv[2]);       tinfo.num_iterations = atoi(argv[3]);       tinfo.work_size = atoi(argv[4]) * 1024;       num_threads = atoi(argv[5]);       sleep_type = atoi(argv[6]);       switch (sleep_type) {         case SLEEP_TYPE_NONE:   tinfo.func = &do_work_nosleep; break;         case SLEEP_TYPE_SELECT: tinfo.func = &do_work_select;  break;         case SLEEP_TYPE_POLL:   tinfo.func = &do_work_poll;    break;         case SLEEP_TYPE_USLEEP: tinfo.func = &do_work_usleep;  break;         case SLEEP_TYPE_YIELD:  tinfo.func = &do_work_yield;   break;         case SLEEP_TYPE_PTHREAD_COND:  tinfo.func = &do_work_pthread_cond;   break;         case SLEEP_TYPE_NANOSLEEP:  tinfo.func = &do_work_nanosleep;   break;         default:           printf("Invalid sleep type: %d\n", sleep_type);           return -7;       }            // Initialize the thread creation attributes       s = pthread_attr_init(&attr);       if (s != 0) {         printf("Error initializing thread attributes\n");         return -2;       }            // Allocate the memory to track the threads       threads = calloc(num_threads, sizeof(*threads));       times = calloc(num_threads, sizeof(*times));       if (threads == NULL) {         printf("Error allocating memory to track threads\n");         return -3;       }            // Initialize the number of samples       num_samples = 0;       // Perform the requested number of outer iterations       for (inum=0; inum<outer_iterations; ++inum) {         // Start all of the threads         for (tnum=0; tnum<num_threads; ++tnum) {           s = pthread_create(&threads[tnum], &attr, &do_test, &tinfo);                if (s != 0) {             printf("Error starting thread\n");             return -4;           }         }              // Wait for all the threads to finish         for (tnum=0; tnum<num_threads; ++tnum) {           s = pthread_join(threads[tnum], (void **)(&res));           if (s != 0) {             printf("Error waiting for thread\n");             return -6;           }                // Save the result for processing when they're all done           times[tnum] = res;         }              // For each of the threads         for (tnum=0; tnum<num_threads; ++tnum) {           // Increment the number of samples in the statistics           ++num_samples;           // Update the statistics with this measurement           update_stats(&stats_clock, times[tnum]->clock, num_samples, tinfo.num_iterations, 1);           update_stats(&stats_user, times[tnum]->user, num_samples, tinfo.num_iterations, clocks_to_usec);           update_stats(&stats_sys, times[tnum]->sys, num_samples, tinfo.num_iterations, clocks_to_usec);           // And clean it up           free(times[tnum]);         }       }            // Clean up the thread creation attributes       s = pthread_attr_destroy(&attr);       if (s != 0) {         printf("Error cleaning up thread attributes\n");         return -5;       }            // Finish the calculation of the standard deviation       stats_clock.stddev = sqrtf(stats_clock.stddev / (num_samples - 1));       stats_user.stddev = sqrtf(stats_user.stddev / (num_samples - 1));       stats_sys.stddev = sqrtf(stats_sys.stddev / (num_samples - 1));            // Print out the statistics of the times       print_stats("gettimeofday_per_iteration", &stats_clock);       print_stats("utime_per_iteration", &stats_user);       print_stats("stime_per_iteration", &stats_sys);            // Clean up the allocated threads and times       free(threads);       free(times);            return 0;     }      I re-ran the tests on a Dell Vostro 200 (dual core CPU) with several different OS versions. I realize that several of these will have different patches applied and won't be "pure kernel code", but this was the simplest way that I could run the tests on different versions of the kernel and get comparisons. I generated plots with gnuplot and have included the version from the bugzilla about this issue. All of these tests were run with the following command with the following script and this command `./run_test 1000 10 1000 250 8 6 <os_name>`.               #!/bin/bash          if [ $# -ne 7 ]; then       echo "Usage: `basename $0` <sleep_time> <outer_iterations> <inner_iterations> <work_size> <max_num_threads> <max_sleep_type> <test_name>"       echo "  max_num_threads: The highest value used for num_threads in the results"       echo "  max_sleep_type: The highest value used for sleep_type in the results"       echo "  test_name: The name of the directory where the results will be stored"       exit -1     fi          sleep_time=$1     outer_iterations=$2     inner_iterations=$3     work_size=$4     max_num_threads=$5     max_sleep_type=$6     test_name=$7          # Make sure this results directory doesn't already exist     if [ -e $test_name ]; then       echo "$test_name already exists";       exit -1;     fi     # Create the directory to put the results in     mkdir $test_name     # Run through the requested number of SLEEP_TYPE values     for i in $(seq 0 $max_sleep_type)     do       # Run through the requested number of threads       for j in $(seq 1 $max_num_threads)       do         # Print which settings are about to be run         echo "sleep_type: $i num_threads: $j"         # Run the test and save it to the results file         ./test_sleep $sleep_time $outer_iterations $inner_iterations $work_size $j $i >> "$test_name/results_$i.txt"       done     done      Here's the summary of what I observed. I will compare them in pairs this time because I think that it is a bit more informative that way. # CentOS 5.6 vs CentOS 6.2 The wall clock time (gettimeofday) per iteration on CentOS 5.6 is more varied than 6.2, but this makes sense since the CFS should do a better job of giving the processes equal CPU time resulting in more consistent results. It's also pretty clear that CentOS 6.2 is more accurate and consistent in the amount of time that it sleeps for with the different sleeping mechanisms. ![gettimeofday CentOS 5.6](https://dl.dropbox.com/s/haof76bfxp0dk75/centos_5.6_gettimeofday.svg?dl=1) ![gettimeofday CentOS 6.2](https://dl.dropbox.com/s/jqwxjy3fp976j3x/centos_6.2_gettimeofday.svg?dl=1) The "penalty" is definitely apparent on 6.2 with a low number of threads (visible on gettimeofday and user time plots) but it seems to be reduced with a higher number of threads (the difference in user time may just be an accounting thing since the user time measurements are so course). ![utime CentOS 5.6](https://dl.dropbox.com/s/s65yo4p9x4tvvyy/centos_5.6_utime.svg?dl=1) ![utime CentOS 6.2](https://dl.dropbox.com/s/1jomoep38rl07en/centos_6.2_utime.svg?dl=1) The system time plot shows that the sleep mechanisms in 6.2 are consuming more system than they did in 5.6, which corresponds with the previous results of the simple test of 50 processes just calling select consuming a non-trivial amount of CPU on 6.2 but not 5.6. ![stime CentOS 5.6](https://dl.dropbox.com/s/ly1icnv3hfd4j35/centos_5.6_stime.svg?dl=1) ![stime CentOS 6.2](https://dl.dropbox.com/s/qxj2vxy63eidfap/centos_6.2_stime.svg?dl=1) Something that I believe that is worth note is that the use of sched_yield() doesn't induce the same penalty as seen by the sleep methods. My conclusion from this is that it's not the scheduler itself that is the source of the issue, but the interaction of the sleep methods with the scheduler that is the issue. # Ubuntu 7.10 vs Ubuntu 8.04-4 The difference in the kernel version between these two is smaller than that of CentOS 5.6 and 6.2, but they still span the time period when CFS was introduced. The first interesting result is that select and poll seem to be the only sleep mechanisms that have the "penalty" on 8.04 and that penalty continues to a higher number of threads than what was seen with CentOS 6.2. ![gettimeofday Ubuntu 7.10](https://dl.dropbox.com/s/h5pkc7lpc91suuy/ubuntu_7.10_gettimeofday.svg?dl=1) ![gettimeofday Ubuntu 8.04-4](https://dl.dropbox.com/s/enqymkz15e6snw9/ubuntu_8.04-4_gettimeofday.svg?dl=1) The user time for select and poll and Ubuntu 7.10 are unreasonably low, so this appears to be some sort of accounting issue that existed then, but I believe is not relevant to the current issue/discussion. ![utime Ubuntu 7.10](https://dl.dropbox.com/s/tn82pvvfgn6apod/ubuntu_7.10_utime.svg?dl=1) ![utime Ubuntu 8.04-4](https://dl.dropbox.com/s/036rqqvy3qsgp1p/ubuntu_8.04-4_utime.svg?dl=1) The system time does seem to be higher with Ubuntu 8.04 than with Ubuntu 7.10 but this difference is FAR less distinct than what was seen with CentOS 5.6 vs 6.2. ![stime Ubuntu 7.10](https://dl.dropbox.com/s/aqnd8p3kjuunjfa/ubuntu_7.10_stime.svg?dl=1) ![stime Ubuntu 8.04-4](https://dl.dropbox.com/s/qe887mmh9q2kj9d/ubuntu_8.04-4_stime.svg?dl=1) # Notes on Ubuntu 11.10 and Ubuntu 12.04 The first thing to note here is that the plots for Ubuntu 12.04 were comparable to those from 11.10 so they not show to prevent unnecessary redundancy. Overall the plots for Ubuntu 11.10 show the same sort of trend that was observed with CentOS 6.2 (which indicates that this is a kernel issue in general and not just a RHEL issue). The one exception is that the system time appears to be a bit higher with Ubuntu 11.10 than with CentOS 6.2, but once again, the resolution on this measurement is very course so I think that any conclusion other than "it appears to be a bit higher" would be stepping onto thin ice. # Ubuntu 11.10 vs Ubuntu 11.10 with BFS A PPA that uses BFS with the Ubuntu kernel can be found at https://launchpad.net/~chogydan/+archive/ppa and this was installed to generate this comparison. I couldn't find an easy way to run CentOS 6.2 with BFS so I ran with this comparison and since the results of Ubuntu 11.10 compares so well with CentOS 6.2, I believe that it is a fair and meaningful comparison. ![gettimeofday Ubuntu 11.10](https://dl.dropbox.com/s/dmxzq2uganakjlc/ubuntu_11.10_gettimeofday.svg?dl=1) ![gettimeofday Ubuntu 11.10 with BFS](https://dl.dropbox.com/s/5xf4pgm9crr7fk8/ubuntu_11.10_bfs_gettimeofday.svg?dl=1) The major point of note is that with BFS only select and nanosleep induce the "penalty" at low numbers of threads, but that it seems to induce a similar "penalty" (if not a greater one) as that seen with CFS for a higher number of threads. ![utime Ubuntu 11.10](https://dl.dropbox.com/s/sh1vz69sf32duln/ubuntu_11.10_utime.svg?dl=1) ![utime Ubuntu 11.10 with BFS](https://dl.dropbox.com/s/oide7zsj5x1e518/ubuntu_11.10_bfs_utime.svg?dl=1) The other interesting point is that the system time appears to be lower with BFS than with CFS. Once again, this is starting to step on thin ice because of the coarseness of the data, but some difference does appear to be present and this result does match with the simple 50 process select loop test did show less CPU usage with BFS than with CFS. ![stime Ubuntu 11.10](https://dl.dropbox.com/s/be28wbmeyetezx5/ubuntu_11.10_stime.svg?dl=1) ![stime Ubuntu 11.10 with BFS](https://dl.dropbox.com/s/cc1p12gkdbd1do6/ubuntu_11.10_bfs_stime.svg?dl=1) The conclusion that I draw from these two points is that BFS does not solve the problem but at least seems to reduce its affects in some areas. # Conclusion As previously stated, I don't believe that this is an issue with the scheduler itself, but with the interaction between the sleeping mechanisms and the scheduler. I consider this increased CPU usage in processes that should be sleeping and using little to no CPU a regression from CentOS 5.6 and a major hurdle for any program that wants to use an event loop or polling style of mechanism. Is there any other data I can get or tests I can run to help further diagnose the problem? # Update on Jun 29, 2012 I simplified the testing program a little bit and can be found here (The post was starting to exceed the length limit so had to move it).


title: xfs quota not reliable

text: I have enabled quotas on an xfs-partition. But it seems to be broken:               $ echo asdf >/disk/l/data/avi/foo     -su: /disk/l/data/avi/foo: Disk quota exceeded          $ quota -f /disk/l     Disk quotas for user avi (uid x):       Filesystem  blocks   quota   limit   grace   files   quota   limit   grace      /dev/md0 1801035344  3000000000 4000000000           38063       0       0       Any ideas why? Edit: grpquotas explained the problem for some users, but I still have users quota issues for other users.               $ touch a     touch: cannot touch `a': Disk quota exceeded     $ quota -f .     Disk quotas for user s (uid 2267):       Filesystem  blocks   quota   limit   grace   files   quota   limit   grace        /dev/md0  293812  1000000000 2000000000               8       0       0     $ mount     /dev/md0 on /disk/l type xfs (rw,usrquota,grpquota)     # xfs_quota -x -c report |grep -v -- '------'     User quota on /disk/l (/dev/md0)                                Blocks                          User ID          Used       Soft       Hard    Warn/Grace               Group quota on /disk/l (/dev/md0)                                Blocks                          Group ID         Used       Soft       Hard    Warn/Grace          [... i.e. no groups or users over their soft limit ...]


title: 3D Acceleration/Compiz Failure

text: I've installed Linux Mint 12 & Fedora 16 in VB 4.1.10 on a Windows 7 Host which has a Intel i3 processor and Intel HD 3000 graphics card. For both Linux installations I've enabled 3D acceleration and installed guest additions. However, with 3D acceleration enabled the Linux Mint installation fails immediately after user login. The Fedora installation displays a message indicating "zeitgeist-0.8.2-2.fc16 error," but continues functioning WITHOUT compiz functionality. From the research I've done online it seems that the Intel HD 3000 does support 3D acceleration and compiz/opengl. Does anyone what could be work or at least what I can do to find the root problem? Thanks.


title: Netboot - How to set a static IP

text: I've modified a CentOS net install image to load my kickstart file over http. This works great when running on a network that has a DHCP server. Obviously, without DHCP this fails because the installer cant acquire an IP. So, my question is what do I need to modify in order to set a static IP?


title: Which user group can use the 'tap' net device?

text: I use the 'tap' net device with KVM to get my vm connect to the Internet. But I have to be root, or use 'sudo', which is inconvenient. I think I can put my user account into some group so I can access the net device without root privilege. I tried the **netdev** group, but does not work. My account is already in the **kvm** group. What else should I do? Or is there any way to allow me using KVM freely without permission issue?


title: Most "effective" archive to convert to

text: If you are like me, you have tons of archives lying around in different formats (zip, tar, rar, tgz, tar.bz2 etc). In cleaning up my stuff, I have decided to basically leave my archives alone ( and generally access contents via archivemount or avfs ). As a brief aside, for the most part I will not be writing to these archives, but on occasion I or an application may be write configuration files/index files/description files/stray files ... to these archives. However, I would like to have a preferred format that I convert these archives to when I clean up an archive. Some factors for this archive format are clear: it should be easy to convert other formats to this format, preferably directly; accessing files in the archive should not have significant overhead, size is of some consideration but not major, as long as an archive is not twice as big as the same files when extracted. Now I am not so naive as to expect people to reply with "the best archive format is ...", rather I hope to get some ideas of the pros and cons oif various archive formats that you might use in this situation.


title: Emacsclient docs mention emulating Gnuclient. What is the relationship?

text: When opening a file in GNU Emacs GUI, I use `gnuserv` to attach to an already running emacs. I use 'gnuserv' only because the first documentation I read on the subject suggested it. Today I was looking for a way to open a file at a specific line number, and found a reference to using emacsclient -c +4:3 FILE... When I ran the command, it complained about _needing to start the server_...   `gnuserv` was running, so gnuserv and emacsclient are apparently not complementary components.. What is the relationship between these two client-server systems?   eg. Can they co-exist?.. Is one more 'up-to-date'?... Is one for the terminal only? .. Do they perform similar functions?..


title: Is there a file menu plugin for vim (not gVim) that creates a text-based GUI menu system?

text: I'm curious to see if there are any plugins that create a menu inside vim (not gVim). Perhaps something simple like a menu bar at the top, with drop down menus that are drawn with text. EDIT: The focus here is a menu system that behaves like the menu system in gVim, but inside console vim. So in other words, a drop down menu system that you can click on, and submenus (if any) open to the right in a new drop down.


title: Is it possible to capture all network traffic using tcpdump?

text: I have 3 computers on the same sub-net. Computer A and B are communicating with each other (ping, telnet, etc.). I'd like to see the packets between A and B on computer C. Is it possible to do this with tcpdump? I've read the manual and Googled this to no end but I can't make it work. tcpdump running on C does not see traffic between A and B. I know tcpdump is working because if either A or B pings C, tcpdump shows the network traffic. I've also manually put the interface on promiscuous mode (ifconfig ethx promisc) but still no output. > Comp-A, IP: 192.168.0.100   >  ping Comp-B ==> Comp-A gets reply from Comp-B > > Comp-B, IP: 192.168.0.101   >  tcpdump -Xi eth1 ==> Sees ping packets from Comp-A > > Comp-C, IP: 192.168.0.102   >  tcpdump -Xi eth1 ==> No output, just the generic tcpdump initial message


title: Bash history: "ignoredups" and "erasedups" setting conflict with common history across sessions

text: First of all, this is not a duplicate of any existing threads on SE. I have read these two threads (1st, 2nd) on better bash history, but none of the answers work - - I am on Fedora 15 by the way. I added the following to the `.bashrc` file in the user directory (/home/aahan/), and it doesn't work. Anyone has a clue?               HISTCONTROL=ignoredups:erasedups  # no duplicate entries     HISTSIZE=1000                     # custom history size     HISTFILESIZE=100000                 # custom history file size     shopt -s histappend                      # append to history, don't overwrite it     PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"  # Save and reload the history after each command finishes      Okay this is what I want with the bash history (priority):   * don't store duplicates, erase any existing ones   * immediately share history with all open terminals   * always append history, not overwrite it   * store multi-line commands as a single command (which is off by default)   * what's the default History size and history file size?


title: assigning files of a group to another one

text: I want to delete a group using `groupdel` command, but before doing this I want to assign all files belonging to this group to another one is there a way to do this? I know that I can use `find / -gid group_id` to find files that belong to this groups and then manually assign them to new one. I seek a way to automatically do the task.


title: cat command from textbook is not working on my Ubuntu Natty

text: I am trying to reproduce the following command from my textbook on my system, `cat("2 3 4 5", "11 13 14 15", file="ex.dat", sep="\n")` but I keep getting this error:               bash: syntax error near unexpected token `"2 3 4 5"'


title: Configuring syslogd in Ubuntu

text: In CentOS and many other distros you can configure `syslogd` using `/etc/syslog.conf` but in Ubuntu there is no such file. Which file I should edit for configuring `syslogd` in Ubuntu.


title: What is the difference between "sort -u" and "sort | uniq"?

text: Everywhere I see someone needing to get a sorted, unique list, they always pipe to `sort | uniq`. I've never seen any examples where someone uses `sort -u` instead. Why not? What's the difference, and why is it better to use uniq than the unique flag to sort?


title: How to link a folder to create a shortcut

text: I have this folder:               /var/www/vhosts/foo      that I need to access often. If I do (I'm root):               ln -s /var/www/vhosts/foo/     cd foo      `pwd` tells me `/root/foo` What can I do to really go into the folder `/var/www/vhosts/foo`. I know that every action on `/root/foo` goes to `/var/www/vhosts/foo`, but what can I do so that `pwd` will tell me `/var/www/vhosts/foo`?


title: Tuxcut -software in ubuntu

text: I need to know how Tuxcut works. I am using it to cut the IP address of other computers in my subnet (Local Area Network) in college. I have searched but haven't found anything. Any suggestions?


title: Can someone recommend a Linux Distro for purposes of just running a DNS?

text: I'm looking for an easy to setup Linux distro for just running a DNS server (and nothing else) with something easy to setup like DNSMasq. At home I run OpenWRT with DNSMasq on my Router, and at work I've been given the freedom to run a distro with a DNSMasq for purposes of doing development. I take my development laptop home and to work, so I want the setup to be nearly the same between locations. (of course I'll have to change it a little bit, the DNS server at home cannot have the same ip as the one at work).


title: Use of ls with wc command

text: What does the command :               ls | wc -l      do? I know               wc <filename>      gives lines, words, and characters, and               wc -l <filename>       print the line count. But how it is being used with ls` is not clear. What does it do?


title: How can I make shell aliases available when shelling out from Vim?

text: In my `.zshrc`, I declare some aliases. Eg, `which dbstart` shows the contents of that alias. If I open vim from that shell, it is a child process. In Vim, I can run shell commands with `:! some_command`. If I do `:! echo $0` to see what shell Vim is using, it outputs '/bin/zsh'. However, my aliases are unavailable there. **How can I make my normal shell alises available when I shell out from Vim?** Two ideas:   * Somehow `EXPORT` the aliases from the original shell, to its child process `vim`, and again to its shell child process   * Configure Vim to read my `.zshrc` when creating its subshells


title: Which configuration option controls whether Nautilus "copies" or "moves" a file/folder on drag and drop for a remote target directory?

text: In the Nautilus file manager (Files 3.6.3), when dragging and dropping a file into a directory, the behaviour appears to be dependent on the file-system location of the target folder. (either local or remote) Dragging and dropping to a local directory triggers a "move" of the source item, and this is the behaviour that I am used to and prefer. But if the target directory is a remote directory, for example on an NFS mount, then it triggers a "Copy" action. As it's not immediately obvious from the icon or context that the directory is remote, and further that the copy action might take some time, I am often left with the source files in place, and I don't notice that has happened until later. This is undesirable. I am aware that I can force a "Move" action using a `<Shift>` and `Drag`, and also that I can force a move using the `mv` command line. However I wish to configure Nautilus to attach the "Move" action to the drag and drop of a file to a remote directory. For me, this is the most common use case, and simplest and most efficient way to achieve that. I understand that this choice to default to copy-for-remote-targets may have derived from a desire to ensure the consistency of the operation. However it breaks the abstraction of the common interface provided by the virtual file system. I am looking for the configuration options that control that behaviour.


title: dynamically generated logfile in screenrc shown in hardstatus

text: I want to use a combination of the date and time at startup as filename for GNU screen's logfile. In screenrc, if I put               logfile '~/log/screen_%H_%m%d%Y_%0c-%t.%n'      I get a dynamically generated file, e.g.               screen_nanna13_06062012_08:03-bash.0      Now I want screen to display this filename in the hardstatus bar. I cannot use               hardstatus string '~/log/screen_%H_%m%d%Y_%0c-%t.%n'      because the placeholders are updated whenever the time changes. The solutions I can come up with involve a bash code executed before screen- startup but that's not good because the separate screen-windows are supposed to get their own dynamic logfile. Is there a variable-substitution mechanism in screen?


title: Solaris disk failed, how to remove it?

text: I have a system with Solaris 10. One of the internal disks is broken:               c0t0d0s2     auto:sliced    rootdisk1_1  rootdg      online               c0t0d0s2         -     c0t1d0s2     auto           -            -           error                c0t1d0s2         -     c1t0d0s2     auto:sliced    rootmirror1_1  rootdg      online               c1t0d0s2     c1t1d0s2     auto:sliced    rootmirror2_1  rootdg      online               c1t1d0s2         -      When I run the `format` command, it becomes hung, because of the c0t1d0s2 disk. Is there a way to completly remove it from the system so that `format` can work again?


title: How to mount FreeBSD 9.0 iso file writable mode?

text: I want to edit bsdinstall script of freebsd 9.0 iso file. I tried to extract files,edit and recreate iso but I couldn't boot it.I realized that some of files missed while extracting. I also use tools like "ISO Master" but when I try to open it, I get this error: > Failed to read directory tree: 'Rockridge filename missing when expected on > image' Now I am trying to mount it and edit inside mounted directory. But I can mount it only read-only format. Is there any way to mount writable format so that I can edit it?


title: How to repeat currently typed in parameter on bash console?

text: I was just typing something along the lines of:               mv foo/bar/poit/zoid/narf.txt      and suddenly realized, damn, I have to type large parts of that parameter again               mv foo/bar/poit/zoid/narf.txt foo/bar/poit/zoid/troz.txt      Even with tabcompletion, quite a pain. I know I can copy paste the parameter by mouse-selecting the text and middleclick but that is not good enough. I want to remain on the keyboard. So is there a way to copy paste the current parameter of the line using the keyboard?


title: Installing firefox in debian 7

text: I'm new the Debian 7, I can't install my Mozilla Firefox, can someone recommend me a working way to install it properly.


title: ices-cc (libvorbis) linking fails on Ubuntu 13.04 - lgcc_s not found

text: I'm trying to compile compile ices-cc into a set of static files on Ubuntu Server 13.04. I use the automatic Centova's build-ices.sh script and use the following command:               ./buildices.sh --prefix=/opt/ices --usefaad=1 --static --proceed      Unfortunately, the linking fails with following error:               gcc -O20 -ffast-math -D_REENTRANT -fsigned-char -I/usr/local/ices//include -DUSE_MEMORY_H -I/usr/local/ices//include -o decoder_example decoder_example.o -Wl,-Bstatic  -L/usr/local/ices//lib ../lib/.libs/libvorbis.a -L/opt/ices/lib /opt/ices/lib/libogg.a -lm     /usr/bin/ld: cannot find -lgcc_s     /usr/bin/ld: cannot find -lgcc_s     collect2: error: ld returned 1 exit status     make[2]: *** [decoder_example] Error 1     make[2]: Leaving directory `/usr/local/src/ices/libvorbis-1.1.2/examples'     make[1]: *** [all-recursive] Error 1     make[1]: Leaving directory `/usr/local/src/ices/libvorbis-1.1.2'     make: *** [all] Error 2     Make failed for libvorbis.tar.gz; aborting      How can I fix this?


title: WM-independent way to focus/raise URGENT window

text: I would like to have a keyboard shortcut to "go to" (focus + raise) window ~~with URGENT flag set~~ which looks like URGENT: it appears on the taskbar (Gnome + Metacity) even if it is on desktop other than current and starts to blink (thanks to @slm for pointing it out). This window might be on other virtual desktop than current. In this particular case it is Skype windows which set urgency flag, and so they appear in `alt-tab` popup (metacity WM) but I can't switch to this window if it is not on current virtual desktop. I was looking into `xdotool` and `wmctrl` command with no luck. Any ideas or clues? * * * **Update:** It appears, that I'm talking about `_NET_WM_STATE` = `_NET_WM_STATE_DEMANDS_ATTENTION` ...