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

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?


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

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


Oracle 11gR2 grid silent installation: error for privateinterconnects

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.`


ERROR:While Updating

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?


Dual boot - Kubuntu and Windows 8 - how to?

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?


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

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.


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

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.


lookbehind and using it with grep in Vi?

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`.


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

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.


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

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?


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

> **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"


MP3+FLAC tag editor for Linux

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


rxvt and Inconsolata (a font)

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.


Search & remove text in files from a source file

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.


Wrong route taken on a network with two gateways

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


VirtualBox guest hangs when starting vbox additions

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?


VirtualBox guest hangs when: Starting Apparmor profiles

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.


linux udev rule to load gadget module for client driver

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


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

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?


convention regarding offline temporary data

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`?


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

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.


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

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


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

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


Writing a makefile to install manual pages for a library

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?


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

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.


Fix X11 forwarding on OSX

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?


iptables ignores other rules after add last rule

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.


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

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?


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

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)


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

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).


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

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!


How to use a timer in bash?

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?


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

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?


Error while mounting directory from host via NFS

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?)


simultaneously share /dev/videoX with multiple applications?

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?


Reverse DNS lookups slowing down network operations on LAN

# 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.


High CPU usage with CFS?

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).


xfs quota not reliable

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 ...]


3D Acceleration/Compiz Failure

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.


Netboot - How to set a static IP

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?


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

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?


Most "effective" archive to convert to

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.


Emacsclient docs mention emulating Gnuclient. What is the relationship?

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?..


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

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.


Is it possible to capture all network traffic using tcpdump?

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


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

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?


assigning files of a group to another one

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.


cat command from textbook is not working on my Ubuntu Natty

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"'


Configuring syslogd in Ubuntu

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.


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

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?


How to link a folder to create a shortcut

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`?


Tuxcut -software in ubuntu

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?


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

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).


Use of ls with wc command

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?


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

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


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

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.


dynamically generated logfile in screenrc shown in hardstatus

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?


Solaris disk failed, how to remove it?

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?


How to mount FreeBSD 9.0 iso file writable mode?

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?


How to repeat currently typed in parameter on bash console?

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?


Installing firefox in debian 7

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


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

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?


WM-independent way to focus/raise URGENT window

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` ...


Can I "export" functions in bash?

source some_file      some_file:               doit ()     {       echo doit $1     }     export TEST=true      If I source **some_file** the function "doit" and the variable TEST are available on the command line. But running this script: script.sh:               #/bin/sh     echo $TEST     doit test2      Will return the value of TEST, but will generate an error about the unknown function "doit". Can I "export" the function, too, or do I have to source some_file in script.sh to use the function there?


kvm doesn't load Windows 8

I'm launching kvm with the following parameter: `kvm -m 2g -smp ncores=2 -hda disk.img -cdrom win8.iso` My CPU has VT support and enabled, ![enter image description here](http://i.stack.imgur.com/02vFI.png) **EDIT** I seems to have limited emulate type:               pc                   Standard PC (alias of pc-1.1)     pc-1.1               Standard PC (default)     pc-1.0               Standard PC     pc-0.15              Standard PC     pc-0.14              Standard PC     pc-0.13              Standard PC     pc-0.12              Standard PC     pc-0.11              Standard PC, qemu 0.11     pc-0.10              Standard PC, qemu 0.10     isapc                ISA-only PC


How to increase the link count for a directory, link count went to 0?

I have made myself land in this situation, it is a chrooted workspace on my system where I virtualize the entire file system ( so its not actual /var/log ) Is there a way that I can either delete this file completely or increase the link count ? When I delete it, it says, Device or resource busy, but I can't find this inode number 91849100 in lsof. I am not able to figure out what to do next. Please help               stat /var/log stat /var/log   File: `/var/log'   Size: 0               Blocks: 8          IO Block: 4096   directory Device: 97fh/2431d      Inode: 91849100    Links: 0 Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root) Access: 2013-08-07 04:26:47.231703346     -0700 Modify: 2013-08-07 04:26:47.231703346 -0700 Change: 2013-08-07 04:26:47.231703346 -0700


Linux Kernel limit access to root with a button?

Is it possible to limit the access to a root account from within the kernel? I mean that if I press a button then the system detects the button being pressed and then allows access to the root account at boot. To me this could be useful to prevent a hacking attack from a bug of one of my programs that have an open port and maybe are vulnerable to attacks! If I can limit the attacker's movement maybe I can restrict the information it can have access to not compromising sensitive data. Is there a special way of doing this? Permissions like how android manage access, a boot parameter or another kernel? It is possible?


netstat shows an ESTABLISHED connection with no process

I am debugging some problems with postfix. When I establish a connection nothing happens and `netstat` shows:               $ netstat -anp     ...     tcp        0      0 129.132.202.106:25          129.132.179.232:60154       ESTABLISHED -                         Why is the process missing? `lsof` does not show the established connection               $ lsof -n -i :25     COMMAND   PID    USER   FD   TYPE DEVICE SIZE/OFF NODE NAME     master   6139    root   11u  IPv4 472858      0t0  TCP 127.0.0.1:smtp (LISTEN)     master  20033    root   11u  IPv4 523921      0t0  TCP 129.132.202.106:smtp (LISTEN)     smtpd   20042 postfix    6u  IPv4 523921      0t0  TCP 129.132.202.106:smtp (LISTEN)      Traffic:               11:26:44.182443 IP 129.132.179.232.59517 > 129.132.202.106.25: S 3522488764:3522488764(0) win 65535 <mss 1460,nop,wscale 5,nop,nop,timestamp 73851028 0,sackOK,eol>     11:26:44.182831 IP 129.132.202.106.25 > 129.132.179.232.59517: S 3950923498:3950923498(0) ack 3522488765 win 5792 <mss 1460,sackOK,timestamp 18832449 73851028,nop,wscale 7>     11:26:44.183150 IP 129.132.179.232.59517 > 129.132.202.106.25: . ack 1 win 4117 <nop,nop,timestamp 73851029 18832449>      and then nothing more How do I find out why the listening process is not there? If I attach `strace` to `master` nothing is shown. No activity whatsoever during the attempted connection.


How to prevent ELinks from staying in scrollback buffer?

After quitting `elinks`, the browser page history is lingering in my scrollback buffer, and therefore not returning to whatever was buffered on screen when I launched `elinks`. Inside a GNU screen with `altscreen` enabled, this does _not_ happen. But in any normal terminal session elinks stays in the buffer. I note that other terminal programs like Vim and lynx _do not_ stay in the scrollback buffer, and instead return the buffer to its state at the time they were launched. I am not finding a configuration option in ELinks to ensure it switches to the alternate terminal, however.               $TERM=xterm-256color        Is there a configuration option to prevent ELinks sticking around in the scrollback buffer? ### Update: On a little further investigation, the scrollback problem occurs only in iTerm2 and Terminal.app on OSX. In an XTerm, ELinks does not modify the scrollback buffer.


Write to error stream in while loop

I’ve got approximately the following code:               cat infile | while read line; do         echo 2> 'log ' $line         echo $line     done > outfile      `outfile` is created correctly. However, the STDERR output just vanished: it’s neither displayed on the terminal nor in `outfile`. If I replace the last line above with `done > outfile 2> errfile` then `errfile` is created, but empty. Can I capture the error output from within the loop, preferably by streaming it directly into the parent STDERR (the above is part of a larger script whose standard error stream is captured by yet another process)?


Headless use of open office or libreoffice in Ubuntu 14.04

I want to install openoffice headless in Ubuntu 14.10, but when I try to install it, it says there is no package for that name. I installed `libreoffice-common` using `apt-get`, but I can't find headless. How can I install Openoffice headless?


awk + gsub + how to work with all kind of characters

The following `awk` command target is remove spaces and unnecessary quotes from CSV file and only from single words between separators               awk 'gsub(/("[ ]+|[ ]+")/,"\""){$0=gensub(/"([[:alnum:]]+)"/,"\\1","g")}1' file.csv      example: ( before )               1,"1.0348    54 35.5",""45356",""4"""""35,"578 "      example: ( after )               1,"1.0348    54 35.5","45356,"4""""35,578      the problem is that `awk` can’t handle when characters are non alpha numeric example               1,"  jde7@&^%  "," &^!@  ",)(*&^," (*^%%^&*( "      my target is to work with all kind of characters non alpha numeric and alpha numeric as               (  A-Z , !@#$%^&&**( , 1-9 , etc )      I guess I need to replace the **[[:alnum:]]** with some other syntax. What do I need to change in my `awk` syntax in order to support all kind of characters?


Can I create override dns similar to writing in /etc/hosts without root access

I want to set a dns record that my browser will use, but I don't have root access, so I can't modify `/etc/hosts`. I need to do this for testing vhosts with apache, whose dns hasn't yet been set up. I have access to firefox, and chrome, so if there's a plugin that could facilitate it; or other options are helpful. **update:** the alternative to overriding the dns is probably modifying the HTTP headers, if the correct ones are sent to apache, the correct content should be returned.


Add files to an iso image and auto run a script post installation

I'd like to add a tar archive in the standard Red Hat installation CD image and untar the same at a desired location using some post install scripts. Can you kindly suggest me how to proceed? In particular:   1. How do I add the tar in the iso image.   2. Where should I place the script.   3. How to link the script so that it is executed at the end of the installation process.


USB HDD Enclosure works with Ubuntu, but not Raspbian

SOLVED: Even though the enclosure came with its own power supply, it required a powered USB hub, probably for some internal components that don't draw power from the main supply. I have this dual HDD enclosure. http://www.raidsonic.de/data/products/icybox/IB-3620/E_IB-3620_Series_manual_v1.1.pdf Basic model IB-3620U3. The enclosure implements JBOD(single) so the installed drives are seen separately by the OS. I have no problems when I plug the device into my Ubuntu 14.04 laptop, I can see both HDDs and the "usb" LED(that shows it is connected by USB) lights up on the device. However, when I plug the device into my Raspberry Pi, running Raspbian, the HDDs are not seen and even the "usb" LED on the front of the device does not light. ## Outputs (pastebin urls) ### Raspbian: `lsusb` `dmesg` `uname -a` `fdisk -l` (just SD card) ### Ubuntu(laptop): `lsusb` `dmesg` `uname -a` `fdisk -l` **Note:** If I power up the device, while already plugged into my raspberry pi, the device's "usb" LED lights up, but there is no difference. **Note2:** I know the device doesn't officially support Linux, but hardly anything does on the box. I have 2 of these USB HDD docks which work perfectly with Raspbian. http://www.amazon.co.uk/Optimized-Inateck-Including-Comaptible-Tool- Free/dp/B00GIDNLI6/ref=sr_1_1?s=computers&ie=UTF8&qid=1403606340&sr=1-1&keywords=inateck+dock **Note3:** One drive is ext4, and the other is NTFS. Thank you for any help getting this thing working in Raspbian ### Edit: As requested, here is `lsmod(unplugged)` `lsmod(plugged-in)` on the Ubuntu laptop. And, `lsmod(unplugged)`, for raspbian. Doesn't change after plugging the device in. At a glance, it looks like the top modules `usb-storage`, `ccm`, and `ctr`, are the only ones to change on the laptop when plugging the device in. Where do I got from here ?


How do I make a multi-threaded app use all the cores on Ubuntu under VMWare?

I have a multi-threaded C++ app (using pThreads) that processes a massive flat file that works great on Windows - uses all four cores on my puny CPU. Client wants to run the same code on Red Hat on a fire-breathing 64 Xeon CPU machine. So I compile it here (g++), ran it on Ubuntu on VMWare, and code only used one of the four cores. So I'm thinking that is a VMWare problem, and I send code to client - where it does the same thing (as far as I can tell remotely - mpstat -P ALL shows the CPUs barely loaded). Do I need to do something to force Red Hat to spread out the threads? Is there something I'm missing - I'm trying to get the "nice" priority changed next - but I feel like I'm missing something. I can post code - but like I said, works great on Windows, uses pThreads, etc.


Errors dual booting Ubuntu Studio 13.10 and Windows XP Pro x64 using GRUB 2

Getting the following errors when I try to boot Windows XP Professional x64 Edition (on /dev/sda1) using GRUB 2: error: no such device: A8542EOA542DDC36. error: invalid signature. I originally had XP Pro x64 installed, then I installed Ubuntu Studio 13.10 to a second hard drive sda0. Unfortunately, there is no option in the BIOS to select which hard drive to boot from, so I had to physically swap the hard drive cables to get the hard drive with Ubuntu Studio to boot. But I get the errors listed above when I select Windows XP Professional x64 Edition (on /dev/sda1) from the GRUB 2 menu. UbuntuStudio GNU/Linux (lowlatency) boots with no issues, I just also need to boot to XP x64 without swapping cables every time. Could this have something to do with the XP PRO x64 hard drive being EFI? I tried to install rEFInd but got errors during installation? Am I getting these errors because XP PRO x64 is installed on a secondary drive ( /dev/sda1) as opposed to trying to boot off the same drive ( /dev/sda0)? Any help appreciated!


mutt: bind CTRL+c to abort (CTRL+g)

In mutt, when I use the key combination `Ctrl`+`C`, I want it to behave as if I had pressed `Ctrl`+`G`. I understand that simple `bind`, such as the following, will not work:               bind    index   \Cc             <abort>      but there must be some way how to do it (perhaps some macro?). My question is similar to this question, but the accepted answer is not acceptable for me. I need some way how to solve this problem in mutt (and not in the terminal).


xmonad: default workspaces

I'm using xmonad with a dual monitor setup. Here is a stipped down version of my config:               import XMonad          main = do       xmonad $ defaultConfig {          workspaces  = ["1:db", "2:mail", "3:web", "4:dev", "5", "6", "7", "8:chat", "9", "10"]       }      Is there a way to configure it so that my left screen defaults to workspace `2:mail` and right screen to workspace `3:web` ?


Right button drag with synaptics

I thought it would be useful to tap-and-drag with two fingers, which would represent dragging with right mouse button. But after reviewing synaptic man options I can't see any option close to this. Is it possible?


Simple problem with netcat tool

Can anybody tell me why I am getting `bad request` while executing this command               echo -e "GET http://www.yellowpages.com.eg/Mjg3NF9VUkxfMTEwX2h0dHA6Ly93d3cubG90dXMtYWlyLmNvbV8=/Lotus-Air/profile.html HTTP/1.1\n\n" | nc www.yellowpages.com 80       The same web site opens fine in the browser.


purpose of run-parts(8) utility

At least under Debian-based systems, there is a `run-parts` utility in **debianutils** package which is used in various scripts. For example in /etc/X11/Xsession. It will run all the executable files found in a directory. Why is run-parts needed while one could use `find` with `-perm` option or `test` utility? In addition, what does `run-parts` consider as an executable file? Looks like it does not simply check the file permissions:               # run-parts --list --lsbsysinit /etc/X11/Xsession.d | tail -1     /etc/X11/Xsession.d/90x11-common_ssh-agent     # ls -l /etc/X11/Xsession.d/90x11-common_ssh-agent     -rw-r--r-- 1 root root 629 2010-11-02 23:17 /etc/X11/Xsession.d/90x11-common_ssh-agent     # head /etc/X11/Xsession.d/90x11-common_ssh-agent     # $Id: 90x11-common_ssh-agent 305 2005-07-03 18:51:43Z dnusinow $          # This file is sourced by Xsession(5), not executed.          STARTSSH=     SSHAGENT=/usr/bin/ssh-agent     SSHAGENTARGS=          if has_option use-ssh-agent; then       if [ -x "$SSHAGENT" ] && [ -z "$SSH_AUTH_SOCK" ] \     #


Can someone clarify this Bash script

I'm learning something about Bash scripting, and I came across this example: The task is to write a Bash script that reads a file, given with the first argument, pulls out those records that have the same ID which is given with the second argument and live in the place given with the third argument. So, the file is a list of users, with info about one user per line, and it looks something like this (ID, name, father's name, location, phone)               43  John  Mike  Smith  Boston  +3 685 123456      After the "filtering", I have to write the found data to standard output, with the following modifications : first letter of the location should be concatenated with the ID, and then the name should only contain the first letter of the father's name and a phone without any prefixes. The output for the given example would look like this:               B43 John M Smith 123456      The solution is:               #!/bin/bash     cat $1|grep "^$2[0-9]*.*$3  +[0-9]*\ [0-9]*\ [0-9]*"|     sed "s/\([0-9]*\)\t\(.*\)\t\(.\).*\t\(.*\)\t\(.\).*\t+[0-9]*\ [0-9]*\     \([0-9]*\)/\5\1 \2 \3 \4 \6/"      I don't understand what's the point of `|` vertical lines - I understand they are pipes, and the output data from one 'query' serves as a input data for another 'query'. By query I mean a shell command. I get the part with the `grep` command. I don't get the `sed` command. How exactly does this work? How does it 'know' to put the first letter of the location at the beginning of the line?