title: Corosync/Pacemaker cluster loss of synchronization

text: I'm facing a problem with the corosync and pacemaker cluster software. I've two virtual nodes (Scientific Linux 6.4) and corosync/pacemaker installed on them: corosync-1.4.1-17.el6.x86_64 pacemaker-1.1.10-14 The corosync's configuration file is:               compatibility: whitetank          totem {         token: 5000         token_retransmits_before_loss_const: 4         vsftype: none         version: 2         secauth: off         threads: 0         interface {             ringnumber: 0             bindnetaddr: 192.168.122.0             mcastaddr: 226.94.1.1             mcastport: 4000             ttl: 1         }     }          logging {         fileline: off         to_stderr: no         to_logfile: yes         to_syslog: yes         logfile: /var/log/cluster/corosync.log         debug: off         timestamp: on         logger_subsys {             subsys: AMF             debug: off         }     }          amf {         mode: disabled     }          service {             # Load the Pacemaker Cluster Resource Manager             name: pacemaker             ver:  1     }          aisexec {             user:   root             group:  root     }      Pacemaker is configured to ignore the missing quorum, and with other 2 things:               crm configure property no-quorum-policy="ignore" pe-warn-series-max="1000" pe-input-series-max="1000" pe-error-series-max="1000" cluster-recheck-interval="1min"     crm configure rsc_defaults resource-stickiness=100     crm configure property stonith-enabled=false      I've created a IPAddr2 resource in the pacemaker configuration:               $ ~>crm configure show p_api-ip     INFO: object cli-prefer-p_api-ip cannot be represented in the CLI notation     INFO: object cli-prefer-g_openstack cannot be represented in the CLI notation     primitive p_api-ip ocf:heartbeat:IPaddr2 \         params ip="192.168.122.202" cidr_netmask="24" nic="eth0" \         op monitor interval="15s"      Then I've created another resource p_myres which manages a server daemon. The p_api-ip and p_myres resources are grouped:               [root@openstack1 ~]# crm configure show g_myres     INFO: object cli-prefer-p_api-ip cannot be represented in the CLI notation     INFO: object cli-prefer-g_myres cannot be represented in the CLI notation     group g_myres p_api-ip p_myres      When I start the resource group g_myres everything works fine, but the fact that I can't migrate the g_myres group to the other node; the command "crm resource migrate g_myres node2" just doesn't do anything and I do not see anything relevant in the syslog. But that is not the worst problem I got... If I just reboot or power off one of the two nodes, the cluster behaves correctly: the resource is migrated to the other node, the crm_mon shows that the rebooted/powered-off node is OFFLINE. If I interrupt the communication between them for a while, for example I issue "service network stop" and after 3 minutes "service network start" on the first node, the second node migrates the resource group g_myres (including the Virtual IP) to itself after a while; and if I try to connect to the Virtual IP I correctly land on the second node, as expected. When the first node returns back online, the second one doesn't realise that; crm_mon continues to show the first node as OFFLINE, the resource group g_myres continues to stay on the second node, but also on the first one! the Virtual IP is on both nodes too! Is there something in the configuration of corosync (and/or pacemaker) I've to check ?


title: How can I check whether I have installed non-free software?

text: I'm thinking of a program which would scan packages and report some statistics about them - and report all packages that contain non-free software. It would of course have to include kernel modules, drivers and other binary blobs that are often allowed in distributions. The wider the scope of the search - the better. I'd like this functionality on Fedora, but something that works on most distributions would be preferred.


title: Store newly self-built installation, with old binary-installed installation

text: I just built the most recent version of `pdftk` by `make -f Makefile.Debian`, and I got an executable `pdftk` in my local directory. (http://www.pdflabs.com/tools/pdftk-server/) I have an older version of `pdftk` under `/usr/bin/`, installed from binary and the software center of my Ubuntu. Is it a good practice just to replace the executable?   * How about the old manpage?   * Will the OS have the information of the new executable, when I query for that by `dpkg -l`?


title: Emacs -- terrible font spacing

text: > System: Archlinux latest > > Emacs: 24.3 > > Emacs Config config: https://github.com/jilen/prelude Seems emacs cannot handle `Ligatures` ![enter image description here](http://i.stack.imgur.com/Yv8Za.png)


title: Configuring Linux Second Monitor

text: I have two identical monitors (Compaq CQ1859s, 1366x768). I just installed Ubuntu onto the computer with which these monitors are being used. Upon installation, one of the monitors had its type detected perfectly, however the second monitor was stuck at 1024x768. I installed the Nvidia drivers and this allowed me to bump it up to 1360x768, however it bugs me greatly because the right monitor is that bit clearer than the left. Is there any way to assign the left monitor to use the same drivers as the right or anything? `xrandr -q` Output:               Screen 0: minimum 8 x 8, current 2726 x 768, maximum 16384 x 16384     DVI-I-0 connected primary 1360x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm        1024x768       60.0 +        1360x768       60.0*    59.8          1152x864       60.0          800x600        72.2     60.3     56.2          680x384        60.0     59.8          640x480        59.9          512x384        60.0          400x300        72.2          320x240        60.1       VGA-0 connected 1366x768+1360+0 (normal left inverted right x axis y axis) 410mm x 230mm        1366x768       59.8*+        1280x1024      60.0          1280x960       60.0          1024x768       60.0          800x600        60.3          640x480        59.9       DVI-I-1 disconnected (normal left inverted right x axis y axis)     HDMI-0 disconnected (normal left inverted right x axis y axis)


title: Boot Mint from USB flash on macmini3,1 (with rEFInd installed)

text: This seems like the Holy Grail: I have installed rEFInd 0.8.3 on my macmini3.1 (late 2009) and have verified that it works correctly: it intercepts the boot process and displays an icon for OSX, and then proceeds to let OSX boot. It's my intention to have a dual- boot OSX/Linux Mint, once I can get Linux installed on the HD. I have downloaded `linuxmint-17-cinnamon-64bit-v2.iso` and confirmed that it boots under VirtualBox 4.3.12 on my MacBookPro 10.1 (Retina, 15-inch, Early 2013). Now, I want to create a bootable USB flash drive that will boot Linux Mint on the Mac Mini. Here's where I've tried all sorts of recipes I've collected from Google, with very little success. This link to an article, written 6/13/2013, described how to   * format one's USB flash drive as FAT32, 1-partition, MBR    * use a free utility called `Mac Linux USB Loader v2.0` to perform the remaining work of putting my Linux Mint image onto the flash drive.  And I was actually able to reboot my MBP, holding down `option`, and select and boot into Mint! However, my Mac Mini does not even recognize the flash drive as being a boot volume. Could this have anything to do with the presence of rEFInd on that machine? The recipes I've tried have been all over the map. Some use GUID Partitions rather than MBR. Some want you to convert the .iso to .dmg. Some are directions for _creating_ a bootable drive, where "bootable" includes the caveat "but not on your Mac". I have no idea what direction to go in (apart from the store, to get a cheap PC, which I'm not quite ready to do yet). Any suggestions or follow-ups would be most welcome.


title: Anyone know a good gui to MariaDB?

text: I'm using MariaDB instead of MySQL in Slackware 14.1, and I need a graphic manager like MySQL Workbench. Can anyone suggest me something? I tried using MySQL WorkBench but it could not connected with MariaDB.


title: What's the + in find /path/ -exec command '{}' + do?

text: What's the `+` in `find /path/ -exec command '{}' +` do? as opposed to `find /path/ -exec command '{}' \;`


title: Which counter generates timer interrupts?

text: I did a `iotop` to observe the interrupts on my computer. This is the interrupt shown most often.                 0 [PIC-edge      time]   247 Ints/s     (max:   389)      I believe it's the `timer interrupt`, well since it's named time and is numbered 0. Where are the timer interrupt signals generated from? Are they triggered after a certain amount of processor ticks passed, or by some external counter? * * * The `Ints/s` vary by amount of +-30. Shouldn't the frequency be stable?


title: Copy a file and overwrite the existing file

text: I have two images (image1.png and image2.png) in the same folder on my server, I want to run a command that overwrites image2.png to image1.png. I prefer to overwrite the image instead of deleting it and then replace it by the other one. How can I achieve that via ssh command line?


title: Pipe the output of a command if it is successful

text: INPUT_FILE=`ls -rt $MY_DIR/FILE.*.xml | head -1 | xargs basename`      I wanted to execute the second command (`head -1`) only if the first command is successful. How do I improve this command?


title: Find out if the OS is running in a virtual environment

text: Is there any way to find out if the OS I'm running (actually installing) is running in a VMWare machine. I need to disable `ntp` settings if the automated install is done on a virtual machine but keep them enabled if installing on bare metal.


title: Are time interrupts always followed by a scheduler call?

text: When a timer interrupt occurred the ISR is called to service the interrupt. Is it okay to assume that every timer interrupt ends with a call to the scheduler on which process should continue running next? Can that be generalized and say that every interrupt must end in a scheduler call?


title: How can I export my aspell dictionary?

text: At the moment, I'm working on a big LaTeX document about mathematics and once in a while I do some spell-checking on it. As you can guess, there are a lot of words which are not in a standard dictionary. But I've added them with `aspell` with `a` to the standard dictionary.               aspell -d de -t -c my-document.tex      Is there a way to export my words (and only those)? Restoring seems to be quite simple: another question.


title: How to make ZSH tab completion work with two tabs

text: I saw a question like this on here, but the answer didn't work for me. I'm trying to set up tab completion and I want it that if I have two files `fileA` and `fileB` and I type `fil<tab>` it first replaces the text with `file` and then after pressing tab again, it should bring up the menu and highlight the first option, `fileA`. I've tried `menu_complete`, which selects `fileA` on the first tab, but does expand to the ambiguous form first (and I sometimes like typing *). `auto_menu` requires 3 tabs to complete, the first fills out the `file` part, the second brings up the menu, and the third brings up `fileA`. This is my zshrc http://pastebin.com/e0BLL1F2 Any ideas? Thanks for the help!


title: How do I know if my microphone is mute or unmute when I have more than one microphone?

text: How do I find out if my microphone is muted or unmuted, when I have more than one microphone such as Motherboard, USB and HDMI? 1) I can't find it with this:               $ cat /proc/asound/cards       0 [PCH            ]: HDA-Intel - HDA Intel PCH                           HDA Intel PCH at 0xfe720000 irq 48      1 [default        ]: USB-Audio - AK5370                                     AKM              AK5370           at usb-0000:00:1a.0-1.1, full s      2) Nor with this               $ amixer -D 'hw:0' | grep Capture       Capture channels: Front Left - Front Right     Simple mixer control 'Capture',0       Capture channels: Front Left - Front Right       Limits: Capture 0 - 46       Front Left: Capture 22 [48%] [6.00dB] [on]       Front Right: Capture 22 [48%] [6.00dB] [on]     Simple mixer control 'Capture',1       Capture channels: Front Left - Front Right       Limits: Capture 0 - 46       Front Left: Capture 42 [91%] [26.00dB] [on]       Front Right: Capture 42 [91%] [26.00dB] [on]       Capture channels: Front Left - Front Right          $ amixer -D 'hw:1' | grep Capture       Capture channels: Mono       Limits: Capture 0 - 78       Mono: Capture 70 [90%] [12.00dB] [off]      3) Nor with:               $ pactl list | sed -n '/^Source/,/^$/p' | grep Mute         Mute: yes         Mute: no         Mute: no          $ amixer scontrols     Simple mixer control 'Master',0     Simple mixer control 'Capture',0      How can I get my `bash` (or other) script to read the value according to a `hw:value,value` format query?


title: Error: ambiguous redirect while transferring output to command

text: Output to redirect in script:               511@ubuntu:~/Unix/test$ ls -ltr |awk '{print $9}'          default.txt     dfah.txt     fruit.txt     fruit_prices.txt     dfh.txt     header.txt     testfile.txt     topoutput.txt Script written on shell :               511@ubuntu:~/Unix/test$      while read line     do      var=`sed -e 's/\.txt/txt\.txt/' $line`      echo $var      done < `ls -ltr |awk '{print $9}'` Getting Error :               -bash: `ls -ltr |awk '{print $9}'`: ambiguous redirect      Can expert help me how ambiguous redirect happen in above code.


title: FreeBSD vs Damn Small Linux for a Really Old Machine?

text: I am doing this just for fun, I have several more powerful machines at hand but thought it would be cool to resurrect an approximately 14 year old machine with a Pentium II processor. I will have to reinstall the RAM so I am not sure how much I will manage to put in there. So should I use FreeBSD or Damn Small Linux as the distro for this project? I anticipate that I will use it mainly from the command line, though a very basic X-Windows manager would also be welcome. I am actually leaning towards FreeBSD, since all my prior experience has been with Linux (Ubuntu and Fedora mainly) and this would be an opportunity to explore FreeBSD. Any suggestions as to distribution, advice or suggestions?


title: Howto fix my PHP install on FreeBSD using pkg

text: I've been messing around with `pkg install`, installing / removing both `php5-5.4.29` and `php55-5.5.13`. But when I run `php` from the command line, it will give me an error like this:               PHP Warning:  PHP Startup: Unable to load dynamic library      '/usr/local/lib/php/20100525/memcache.so' -      /usr/local/lib/php/20100525/memcache.so: Undefined symbol      "php_session_create_id" in Unknown on line 0      If I try the 5.5.13 version, the error is this: `PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20121212/posix.so' - Cannot open "/usr/local/lib/php/20121212/posix.so" in Unknown on line 0` Anyone have some tips how I can clean the mess I've made and do a fresh install of `php55-5.5.13` ? EDIT: I also noticed that an old php version from the ports is installed, which seems to be conflicting with the pkg one. But trying to (re)install from ports will give me: `PHP xx doesn't install the Apache module anymore: update your OPTIONS and build www/mod_php5 port instead`


title: tasklet and interrupt handler synchronization

text: The things I know about tasklet:   1. Tasklet runs with all interrupt enabled.   2. The tasklet runs in interrupt context.   3. It can't sleep.   4. It runs in atomic way.   5. It has the assurance to be scheduled never late than next tick. * * * My questions:   1. Since in bottom half all interrupts are enabled, what happens if a tasklet is running and in between any interrupt comes? Will the tasklet context be stored in a cpu variable (bottom half stack)?   2. I have read that tasklet will always be scheduled upto next tick? why?


title: Quickest way to find and replace a string in numerous HTML files

text: I have numerous HTML files all nested inside different folders contained in a single overall folder. In each of these HTML files I need to replace               /contact/index.html      With               /contact/index.php      Is there an easy way of doing this from the command line?


title: spinlock sharing between process and interrupt context

text: If a spinlock is held in a process context, what will happen if the same spinlock is required in an interrupt context? Either the interrupt handler will wait until the spinlock is released by the process or it will schedule on another processor. Which one actually happens? Also, if local interrupts are disabled on the current processor will the interrupt handler still wait for the spinlock to be released?


title: How to remove a package for the current user?

text: How can I remove a package for a given user but leave it installed so that other users can still access it? I'm using Ubuntu 12.10.


What could cause touch to fail with this error message?               touch: cannot touch `foo': No such file or directory      Note that an error due to incorrect permissions looks different:               touch: cannot touch `foo': Permission denied


title: KDE toolbar background messed up

text: At one day (it has been for a while now) the background of KDE main toolbar started looking really strange: screenshot (it looks to me as the alpha channel of the background image is missing). Debugging I've done:   * When I change the workspace theme in KDE System Preferences to something else than "Air" and back again, the problem disappears.   * When I choose any some other theme than the default "Air" there is no problem, except that I don't like these other themes as much.   * I created a new clean user account and logged in with KDE - the same problem appeared - so it's not that I have some outdated files in my .kde4 config directory.   * I have tried reinstalling several components of KDE that could effect this, but without success - might have not been the right ones, haven't done a complete reinstall of KDE. It probably happened after some update of my Gentoo system, but I may not remember correctly, as I have looked for a solution to this for quite some time now. If only I knew were to look for to find this particular image file and see if there is something wrong with it... but I've grepped and located and finded in /usr/share quite a bit and I don't seem to understand where are those KDE workspace theme files located. Using KDE 4.4.5 with the default "Air" theme.


title: /etc/rc.d vs /etc/init.d

text: Is ubuntu's `/etc/init.d` directory exactly equivalent (functionally) to what I presume to be the more standard `/etc/rc.d/` (at least on arch)? Is there any particular reason canonical used init.d instead of rc.d for startup scripts?


title: When running a terminal, I get the default bash prompt

text: Whenever I run a terminal in Linux (Centos), my console line starts with:               bash-4.1$      During the Centos installation, I created a user 'mark'. Later on that day, I needed to change the name to 'john' for some reason. So I went into these files and changed 'mark' to 'john'               /etc/passwd      /etc/group     /etc/shadow     mv mark john      After a restart, I'm now getting the `bash-4.1$` prompt on the terminal.


title: Split using sed

text: I have to split               [X] ||| you owns the [X,1] ||| you own the [X,1] ||| 1 0.02020 0.07847 0.36788 3 -0.00000 -0.00000      at the pipes and output those line whose 2nd and 3rd argument are different.


title: Mounting Ext3 in linux different user

text: I am trying to mount an ext3 based memory stick in Linux based development board. I used `mount` with `-u` and `-g` for mounting the fat based memory stick with different user. When I tried the same command for ext3, it failed. I read in help that ext3 doesn't support `-g` and `-u`. After reading about `bindfs`, I've built the bindfs for ARM and was able to mirror the already mounted ext3 fs with a different user. Now the issue is the removal of the memory stick, which has to unbind and unmount the fs before removal. Otherwise the OS keeps showing that the ext3 fs is mounted and mirrored. It also hangs the system. Unbinding and unmounting can be done as root only. Is there any other way to mount ext3 without being root? Using `chown` is not an option.


title: RHEL 6.4: Openssl 1.0.0-27 libcrypto and libssl missing

text: I am trying to install `znc` IRC bouncer, which needs openssl libraries:               Error: Package: znc-1.4-1.el6.x86_64 (epel)                Requires: libcrypto.so.10(libcrypto.so.10)(64bit)     Error: Package: znc-1.4-1.el6.x86_64 (epel)                Requires: libssl.so.10(libssl.so.10)(64bit)      `yum whatprovides */lib64/libcrypto.so.10`:               openssl-1.0.0-27.el6_4.2.x86_64 : A general purpose cryptography library with TLS implementation     Repo        : installed     Matched from:     Filename    : /usr/lib64/libcrypto.so.10     Filename    : /usr/lib64/libcrypto.so.1.0.0      `ldconfig -v egrep -i "libssl\.so|libcrypto\.so"`:               ldconfig: /etc/ld.so.conf.d/kernel-2.6.32-358.el6.x86_64.conf:6: duplicate hwcap 1 nosegneg         libssl.so.10 -> libssl.so.1.0.0         libcrypto.so.10 -> libcrypto.so.1.0.0      `yum list openssl`:               Loaded plugins: downloadonly, product-id, refresh-packagekit, rhnplugin, security, subscription-manager     *Note* Red Hat Network repositories are not listed below. You must run this command as root to access RHN repositories.     Installed Packages     openssl.x86_64                                                         1.0.0-27.el6_4.2                                                         @release-rhel-x86_64-workstation-6-r      What am I missing? The package that provides required libraries is installed and libraries are searchable from rpm/yum. Any pointers? I believe similar question was asked in REHL 6.4 and OpenSSL 1.0.1 - Dependency missing.. but it isn't? but that seems to be 32bit vs 64bit issue.


title: ntp not syncing

text: Since my hardware (Rasberry Pi) does not have a hardware-clock, each bootup warps us back to the 1970's, so I use NTP.   The gateway in the wifi I am in provides an NTP-Server-service. my `/etc/ntp.conf` looks like the follwing (commented lines ommitted)               server 192.168.170.254 //gateway that hosts the service     driftfile /var/lib/ntp/ntp.drift      `/etc/profile`:               [connect wifi...]     timeout 15 ntpd -q -g //forces update so I have a time to work with, times out so I don't get a total hang if it doesn't work     systemctl start ntpd.service //in hopes that I will work at some point and to keep it in sync     date //see if it worked     [start main program...]      Am I missing something?   **EDIT**   output of `ntpd -q`               DEC 31 17:00:43 alarmpi ntpd[349]: ntpd 4.2.7p446@1.2483-o Wed Jul  2 03:23:39 UTC 2014 (1): Starting     DEC 31 17:00:43 alarmpi ntpd[349]: Command line: /usr/bin/ntpd -q     DEC 31 17:00:43 alarmpi ntpd[349]: proto: precision = 3000 usec (-18)     DEC 31 17:00:43 alarmpi ntpd[349]: Listen and drop on 0 v4wildcard 0.0.0.0:123     DEC 31 17:00:43 alarmpi ntpd[349]: Listen normally on 1 lo 127.0.0.1:123     DEC 31 17:00:43 alarmpi ntpd[349]: Listen normally on 2 wlan0 192.168.170.100:123     DEC 31 17:00:43 alarmpi ntpd[349]: Listening on routing socket on fd #19 for interface updates     #hangs here till interrupted      output of `systemctl status ntpd`:               * ntpd.service - Network Time Service     Loaded: loaded (/usr/lib/systemd/system/ntpd.service; disabled)     Active: active (running) since Wed 1969-12-31 17:00:43 MST, 16s ago     Process: 332 ExecStart=/usr/bin/ntpd -g -u ntp:ntp -p /run/ntpd.pid (code=exited, status=0/SUCCESS)     Main PID: 335 (ntpd)     CGroup: /system.slice/ntpd.service             `-335 /usr/bin/ntpd -g -u ntp:ntp -p /run/ntpd.pid          DEC 31 17:00:43 alarmpi ntpd[332]: ntpd 4.2.7p446@1.2483-o Wed Jul  2 03:23:39 UTC 2014 (1): Starting     DEC 31 17:00:43 alarmpi ntpd[332]: Command line: /usr/bin/ntpd -g -u ntp:ntp -q /run/ntpd.pid     DEC 31 17:00:43 alarmpi systemd[1]: PID file /run/ntpd.pid not readable (yet?) after start.     DEC 31 17:00:43 alarmpi ntpd[335]: proto: precision = 3000 usec (-18)     DEC 31 17:00:43 alarmpi ntpd[335]: Listen and drop on 0 v4wildcard 0.0.0.0:123     DEC 31 17:00:43 alarmpi ntpd[335]: Listen normally on 1 lo 127.0.0.1:123     DEC 31 17:00:43 alarmpi ntpd[335]: Listen normally on 2 wlan0 192.168.170.100:123     DEC 31 17:00:43 alarmpi ntpd[335]: Listening on routing socket on fd #19 for interface updates     DEC 31 17:00:43 alarmpi systemd[1]: Started Network Time Service


title: How to find the cpu and memory usage of child processes

text: Supervisord is running on centos server. If I do               ps -e -o %mem,%cpu,cmd | grep supervisord | awk '{memory+=$1;cpu+=$2} END {print memory,cpu}'      I get `0 0` just because supervisord is just an initialization daemon. It runs four child processes on my server:               # pgrep -P $(pgrep supervisord) | wc -l     4      How can I find summarized CPU and mem usage of these child processes in one- line-command? Thanks


title: How can I put some comment in yum installation list?

text: Lets say I made a List of installed packages by:               rpm -qa > list      I want to use this list to re-install those Packages on another System, For Example By:               yum -y install $(cat list)        But I need to write some comments in that list, How can I prevent yum from trying to install that Comment lines?


title: Why is NetworkManager package name upper case?

text: All other software packages are lower case, so why NetworkManager upper case?


title: What is the command or hotkey for stopping a running program in DrJava?

text: I installed `DrJava` about a week ago. Its been working fine so far but I ran into an infinite loop and wanted a way to stop the program from running without having to force `DrJava` to quit. Is there a command or hot key that would enable me to do so?


title: Real vs Actual memory in Xymon/Hobbit

text: What is the difference between real and actual memory usage in xymon ?


title: BackTrack 5 R3 programs aren't opening

text: I'm running BackTrack 5 R3 on an old Dell Inspiron 700m using a LiveDVD. I'm running the Gnome 32 bit version. To make X start I had to use the solution here. Once I get X open, I can't seem to open programs. When I click on Applications and then choose an application the cursor turns into a watch and the bottom panel says "Starting " program-Name-Here (Starting gedit). After about fifteen seconds the watch cursor and starting message go away without any program opening. How do I configure BackTrack to be able to open programs? EDIT: I am unable to open the terminal. EDIT 2 and 3: I'm not sure what I did, but after a reboot or two programs are opening properly!


title: Assign diff -y column names

text: I have two files and a shell script. File 1:               Batman     Superman     John Snow     Jack Sparrow     Rob Stark      File 2:               Batman     Ironman     Superman     Spiderman     John Snow     Arya Stark     Jack Sparrow     Rob Stark     The hound      Script:               #!/bin/bash          sort ~/Desktop/file1.txt > ~/Desktop/fileA.txt     sort ~/Desktop/file2.txt > ~/Desktop/fileB.txt     diff -y ~/Desktop/fileA.txt ~/Desktop/fileB.txt > ~/Desktop/diff.txt      The script runs absolutely fine, the output is:                                                 > Arya Stark     Batman                              Batman                                       > Ironman     Jack Sparrow                        Jack Sparrow     John Snow                           John Snow     Rob Stark                           Rob Stark                                       > Spiderman     Superman                            Superman                                       > The hound      But I want to output to automatically be:               File A                               File B                                       > Arya Stark     Batman                              Batman                                       > Ironman     Jack Sparrow                        Jack Sparrow     John Snow                           John Snow     Rob Stark                           Rob Stark                                       > Spiderman     Superman                            Superman                                       > The hound      Whats the best way to so it using diff command only?


title: Setting up the superuser password for the first time

text: How can I set up the super user password for the first time in Zorin OS, since the installer didn't ask me to provide one. I have experience with Fedora and openSUSE, but they asked me for the superuser's password during the installation process.


title: Use remote ViM clipboard from iterm2 on Mac OS X

text: I have been using VNC for a long time for development and now I decided to move to `iterm2` and `screen`. But there is a small problem. I have to ssh into a remote machine and use vim there. And I want to enable `set mouse=a` option. Also I need to be able to use the remote vim clipboard in the ssh session available in the mac applications. For this, I used these instructions, but they did not help. I installed x11, selected the needed options in the `preferences->pasteboard` and ssh'ed to the remote machine with `ssh -x akshya@aksh-vm`. For some reason this does not seem to work. Am I missing some portion?


title: Edit home directory for an LDAP user in Linux

text: I have an LDAP user who accesses a server based on having the appropriate LDAP host attribute via sssd. This user does not show up in /etc/passwd because he is not local. How do I modify his home dir location if he has already logged in and it was created in the default location? RHEL 6 Is it just `usermod -d /new/location -m`?


title: Unable to upgrade Cinnamon with Linux Mint 13

text: I would like to upgrade to the latest version of Cinnamon. I'm running Linux Mint 13 in a virtual machine. Everywhere I look, I see the same instructions:               > sudo add-apt-repository ppa:gwendal-lebihan-dev/cinnamon-stable      > sudo apt-get update      > sudo apt-get install cinnamon      When I do that, apt-get install reports that "cinnamon is already the newest version". When I check the version with "cinnamon --version", it reports 1.4 and not version 1.6 (or later) like I expect. Is there something else I need to do?


title: Where does GCC look for its internal executables?

text: I have installed GCC to a custom prefix. When it is invoked, it complains that it cannot find some of its internal binaries. My computer's "official" GCC keeps them here:               /usr/libexec/gcc/i686-apple-darwin10/4.2.1      This directory is not present in `PATH`. `make install` created a similar hierarchy under my prefix, and the appropriate files were installed there. I could add it to `PATH`, but this was apparently not necessary for the official GCC to run. I would like to avoid cluttering `PATH` if I can. I looked for an option to specify this directory in the `configure` script, but found none. There is also no mention of `libexec` in the GCC manual. How does the official GCC know where its internal binaries live, and how can I give this information to my trunk build of GCC?


title: How to replace the original value of variable in HTML tag

text: I am facing some problems in replacing the value of a variable in a html tag in a unix box. Here are the details. Please help me in finding a solution.               #!/bin/ksh          count=5          line="<td>$count</td>"          echo "$line"      I am expecting the output to be `<td>5</td>` but I am getting the output as `<td>$count</td>`. I tried a lot to solve this but couldn't :(


title: “crash” when switching users in Linux Mint 12

text: I have a clean Linux Mint 12 install on a Lenovo R61i laptop. I have multiple users configured - one for myself, my wife, and my daughter. My account is the only sudoer. Two or three times a week the machine "crashes" when switching users, seemingly only when both users are already logged in. Once the user has requested a switch, typed their password, and hit enter, they are presented with a black screen with a flashing white cursor in the top-left. No matter how long one waits, this screen does not change. The only way I've found out of this situation is to hold down the power button until the machine shuts off, then start her up again. I should point out that we switch users often, most of the time without any issue at all. So it's difficult to reproduce. I've had a search around but haven't been able to determine whether this is a known issue or not. Can anyone offer any advice on how to rectify this? UPDATE: I just had the "crash" again, and tried various key combinations to see if I could get any response whatsoever. Turns out that Ctrl+Alt+Del briefly printed out some standard shutdown messages (too fast for me to relay, I'm afraid) and then restarted the machine. Still eager for a solution to this issue.


title: find & sed (search and replace)

text: I'm using the following command on my mac:               $find . -name “*.java” -exec sed -i ’s/foo/bar/g’ {} \;      and it seems to have no effect. I have two files in the directory that end in .java, which both have the foo text in them. Am I missing something? **EDIT : Results from request of comments**               [aafghani-03:~/test amirafghani]$ find . -name "*.java" -exec sed -i 's/foo/bar/g' {} \;     sed: 1: "./bar.java": invalid command code .     sed: 1: "./foo.java": invalid command code .


title: / readonly on boot, but don't see why. how to investigate and fix?

text: Root filesystem mounted fine under squeeze, and after I upgraded to wheezy. I've been living with it for a bit, so I'm not exactly sure, but I think it started after doing a dist-upgrade on wheezy, but that could be coincidence. The machine is a Lenovo T400 FWIW. boot screen photo1 shows first warnings about read-only file system; nothing is logged obviously fsck finds no problems2               mount -o remount,rw /      above works fine (but I have to restart network-manager and gdm3 to get a usable system; I'm not sure it is related, but I can't seem to connect to a service running on localhost, eg python -m SimpleHTTPServer 8080 and in another terminal w3m times out sending request to localhost port 8080) I don't notice anything amiss in fstab               # /etc/fstab: static file system information.     #     # Use 'blkid' to print the universally unique identifier for a     # device; this may be used with UUID= as a more robust way to name devices     # that works even if disks are added and removed. See fstab(5).     #     # <file system> <mount point>   <type>  <options>       <dump>  <pass>     proc            /proc           proc    defaults        0       0     # / was on /dev/sda1 during installation     UUID=2934c627-6f1a-438b-a877-1544108c7418 /               ext3 errors=remount-ro 0       1     # swap was on /dev/sda5 during installation     UUID=39b1f59e-6193-4c46-8b4d-80b183f0b19c none            swap    sw           0       0     /dev/scd0       /media/cdrom0   udf,iso9660 user,noauto     0       0     /dev/sdb1       /media/usb0     auto    rw,user,noauto  0       0      Any pointers would be much appreciated. Hopefully I'm doing something obviously wrong and fixable, but if not any hints about how to debug? ...               tune2fs -l /dev/sda1      outputs               tune2fs 1.42.2 (27-Mar-2012)     Filesystem volume name:   <none>     Last mounted on:          <not available>     Filesystem UUID:          2934c627-6f1a-438b-a877-1544108c7418     Filesystem magic number:  0xEF53     Filesystem revision #:    1 (dynamic)     Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery sparse_super large_file     Filesystem flags:         signed_directory_hash      Default mount options:    (none)     Filesystem state:         clean     Errors behavior:          Continue     Filesystem OS type:       Linux     Inode count:              14893056     Block count:              59547904     Reserved block count:     2977395     Free blocks:              50391869     Free inodes:              14576981     First block:              0     Block size:               4096     Fragment size:            4096     Reserved GDT blocks:      1009     Blocks per group:         32768     Fragments per group:      32768     Inodes per group:         8192     Inode blocks per group:   512     Filesystem created:       Tue May  3 01:44:56 2011     Last mount time:          Wed Apr 18 13:11:25 2012     Last write time:          Tue Apr 17 23:51:46 2012     Mount count:              5     Maximum mount count:      25     Last checked:             Tue Apr 17 23:51:46 2012     Check interval:           15552000 (6 months)     Next check after:         Sun Oct 14 23:51:46 2012     Reserved blocks uid:      0 (user root)     Reserved blocks gid:      0 (group root)     First inode:              11     Inode size:           256     Required extra isize:     28     Desired extra isize:      28     Journal inode:            8     First orphan inode:       9145036     Default directory hash:   half_md4     Directory Hash Seed:      af8ca7f0-bcad-49f3-98c0-9b19a531a885     Journal backup:           inode blocks      ... It appears that /etc/init.d/checkroot.sh isn't being run at boot, and that's the script that finally remounts root as rw (if I run it after boot, it does exactly that). I'm using Debian testing/wheezy. There are dependency annotations in /etc/init.d files, but beyond that I'm not sure how to tell more about the init system. ... Fixed, but no idea how it happened or if the fix is exactly how the system ought be. I noticed checkfs and mtab in /etc/rcS.d, but no checkroot, so I added it:               cd /etc/rcS.d     ln -s ../init.d/checkroot.sh S06checkroot.sh      After rebooting twice (first time could have been my confusion, but I added some further instrumentation to checkroot.sh between them), I'm back up with rw on boot (and the problem with listening to/requesting from localhost disappeared, so I guess it was related). (I see on a squeeze system I have access to it's at S07checkroot.sh; I was close perhaps.)


title: Sync with a Directory Listing of An Apache Server

text: Is there an easy way to keep a folder synced with a directory listing via HTTP? **Edit** : Thanks for the tip with wget! I created a shell script and added it as a cron job:               remote_dirs=( "http://example.com/" "…") # Add your remote HTTP directories here     local_dirs=(  "~/examplecom" "…")          for (( i = 0 ; i < ${#local_dirs[@]} ; i++ )) do     cd "${local_dirs[$i]}"     wget -r -l1 --no-parent -A "*.pdf" -nd -nc ${remote_dirs[$i]}     done          # Explanation:     # -r            to download recursively     # -l1           to include only one directory depth     # --no-parent   to exclude parent directories     # -A "*.pdf"    to accept only .pdf files     # -nd           to prevent wget to create directories for everything     # -N            to make wget to download only new files      **Edit 2:** As mentioned below one could also use `--mirror` (`-m`), which is the shorthand for `-r -N`.


title: Getting disk i/o statistics for single process in Linux

text: I need to monitor the I/O statistics of a process that writes to disk. The purpose is to avoid write rates too high for long periods. I know there's `iostat` tool to accomplish this task on a system-wide perspective. Is there something similar to monitor single process disk usage?


title: Update from Grub 1.98 to Grub 2

text: I currently have an OS called Backtrack installed alongside Windows 7, and I use Grub to boot. The problem is the Grub that comes with this is version 1.98. I'm fine with it except for one thing: sometimes when I turn on my computer it does funny things, like it will be in a reboot loop or just show a flashing line in the top left of my screen. Meaning that my Grub is somehow corrupted or broken in some way. To fix this I just simply run a live CD of "Boot-Repair-CD" and choose auto fix and then everything is normal. BUT after a little while it will be gone again and I will have to go back to the CD to fix it. I am really getting tired of this and I just want to go to Grub2. I tried through a Ubuntu live CD to download the boot repair thing and ran it, but when I run the option "update grub to latest version" it will start then comes up with an error "grub-pc failed - operation cancelled" or somthing like that. Basically it fails because somthing went wrong. Is there any other way to update Grub? Because this cycle is really annoying.


Trying to edit the prior using `nano /etc/network/interfaces/` in Debian and get the following error:               Error: /etc/network/interfaces/ is a directory!      Can someone help me fix this?


title: General questions about OpenBSD source code and release dates

text: Looking into doing analysis of the lifespan of a line of code, and via another question on stackexchange I was pointed to a research paper on OpenBSD that I've got a few questions about. That being:   * When was OpenBSD source code release as opensource?   * In this sentence, " **We learn that 61% of the lines of code in today’s OpenBSD are foundational: they were introduced prior to the release of the initial version we studied and have not been altered since."**     * does that mean that OpenBSD released the very first batch of source code in "19 May 1998" (see next question for date info),      * or that's just the release they decided to start the 7.5 years of source code review?      * If "19 May 1998" was the first release, where did the other 61% of the code base come from,      * and was that never posted to an open source version control system?   * When that 7.5 years was appears be stated in this sentence: **"We compiled a database of 140 vulnerabilities reported in the 7.5 years between 19 May 1998 and 17 November 2005."**     * where would I find the source code for the patches in those 7.5 years,      * do those dates match releases dates,      * if so, how to I figure that out on my own? Reason I ask all of this is in part because I can't find the information on OpenBSD or Chuck Cranor's website, which states: > I also hosted and helped create the first Anonymous CVS server on the > Internet (the original anoncvs.openbsd.org, which was also know as > eap.ccrc.wustl.edu). Wikipedia states "Initial release: 1 October 1996", but I'm unable to tell if that release was open source.


title: Use convert to grab a specific page from a PDF file?

text: I know I have done this before, so I'm sure it's possible, I just forget how to do it. There's a way to tell convert to grab a specific page of a PDF, and I'd like to keep the format of that page as PDF.


title: can I cd or use hot directory in shell link in mc?

text: can I use **hot directory** or **cd** inside shell link in mc? I access about 40 linux boxes via shell link that have the same dir /var/lib/edumate/backup how can I access this directory   * without typying the whole path and    * without creating extra hot directory entry for every single box?


title: How to automatically refresh Vim on buffer/window focus?

text: I often use Control+L to redraw the screen in Vim. In particular, when I come out of sleep or change monitor configurations I often find that Vim needs to be redrawn. I thought it might be simpler to just add something to my vimrc that redraws on focus.   * Is there a command that I can add to my `.vimrc` file that redraws the buffer when the window/buffer gets the focus? In particular, a good command should have no noticeable negative performance or other related side effects.


title: How do I add an entry to my crontab?

text: I am using crontab for the first time. Want to write a few very simple test cron tasks, and run them.               $crontab * * * * * echo "Hi"      doesn't produce anything.               crontab */1 * * * * echo "hi"      says `*/1: No such file or directory`. Also, how do I list the currently running cron tasks (not just the ones I own, but ones started by other users such as root as well). And how do I delete a particular cron task?


title: How to know the number of messages received in a message queue at a point of time

text: I have a implementation where the hardware dispatches 300 packets every second to a host application through DMA transfer and then to the host application's message queue. When packets are sent at high rate to the app, I see that the app is not receiving one or two packets like this. When I use `tcpdump`, I see that all packets are posted to the host. But how do i know whether where the packet was dropped? Using debug prints will consume CPU usage and not be easy as well. Can I find out how many messages that I received on that message queue? Using `ipcs -q commmand` does not list anything.


title: recovering deleted file held open by apache?

text: suppose an apache log file gets deleted but its held open by apache then this is what i am doing.               pid=$(lsof | grep text.txt | awk '/deleted/ {print $2}')     fd=$(lsof | grep text.txt | awk '/deleted/ {print $4}' | grep -oE "[[:digit:]]{1,}")          cp /proc/$pid/fd/$fd directorytobecopied/testfile.txt      this is what i am doing to recover the file and put it back where it was. is there any simpler way of doing this because above code doesn't look good. and furthermore how do i know from where the file was deleted( **directorytobecopied** ) so that i don't have to manually ask somebody where the file was located originialy and put it back there.


title: CentOS GUI problem using Gnome

text: For some reason lately when I try to set the date using the interface, or simply install a .rpm by double clicking the dialog that should prompt me to input my passowrd just shakes like it has a bug. The dialog window that shakes has the title               "Authenticate"     Privileges are required to change the system time/install software/etc          Ann application is attempting to perform an action that requires privileges.      Authentication as the super user is required to perform this action          Authenticat Failure      And I have to options: `Cancel` and `Authenticate`. The problem is this windows just shakes and disappears so I can't actually press the Authenticate button. And after this window disappears I get a new one that says:               Failed to set the system time:     Not Authorized for action org.gnome.clockapplet.mechanism.settime      Why is this happening? A few days ago I was able to input my password and install software now this happens.


title: Is there any (good) SQLite GUI for Linux?

text: I'm looking for a SQLite graphical administration utility for Linux but I can't seem to find any (I found an extension for Firefox I'm not a user of that browser). Is there any that you know of?


title: Mutt send-hook to sanitize "to" address?

text: Is there a hook available that allows to sanitize email recipients before sending the email? Ideally, upon pressing "y", the name part is removed from all recipients and only the email address remains:               Mike Anderson <ma@example.com>, Andi Mikeson <am@example.com>      becomes:               ma@example.com, am@example.com


title: Install Ubuntu for Android

text: Canonical has an item on their site called Ubuntu for Android. This is a special distribution of Ubuntu which integrates with the Android system. Their website mentions that it is specifically targetted at manufacturers. However, I would also like to install this, does anybody know if this is possible at all? and if so, how this can be done.


title: How to start the cron daemon

text: I am using RHEL 5.4 I killed the cron daemon accidentally. I wanted to stop a cron task, didn't know how to do it, ended up killing the cron daemon itself. How do I start it again?


title: Name of "notified by" resource from "notified" resource in puppet

text: Let's say I have this manifest bit in Puppet:               file { "/whatever/file":         notify => Exec["some_script"]     }      Is there a way to get "/whatever/file" from "some_script"? Or in other words, how can I get the name of a resource that notifies another from the notified one? The use case is this: we're using git to track changes in /etc, and I'd like Puppet to auto-commit the files that I modify from a manifest. For that, I will use a "exec" resource that is notified by each "file" resource that modifies files in /etc. But I need to know which file was modified to commit only that, and avoid doing a blind "commit -a". Of course, if there's a better way to do this, I'm open to suggestions.


title: Why is the current device size bigger that the current volume size after resizing an ntfs partition?

text: I'm resizing an ntfs partition using `ntfsresize` (ntfs-3g) and `fdisk`. I used the following command in order to change the filesystem size:               # ntfsresize -f -s 10G /dev/sdb1     ntfsresize v2013.1.13AR.1 (libntfs-3g)     Device name        : /dev/sdb1     NTFS volume version: 3.1     Cluster size       : 4096 bytes     Current volume size: 31457276416 bytes (31458 MB)     Current device size: 31457280000 bytes (31458 MB)     New volume size    : 9999995392 bytes (10000 MB)     Checking filesystem consistency ...     100.00 percent completed     Accounting clusters ...     Space in use       : 538 MB (1.7%)     Collecting resizing constraints ...     Needed relocations : 23717 (98 MB)     WARNING: Every sanity check passed and only the dangerous operations left.     Make sure that important data has been backed up! Power outage or computer     crash may result major data loss!     Are you sure you want to proceed (y/[n])? y     Schedule chkdsk for NTFS consistency check at Windows boot time ...     Resetting $LogFile ... (this might take a while)     Relocating needed data ...     100.00 percent completed     Updating $BadClust file ...     Updating $Bitmap file ...     Updating Boot record ...     Syncing device ...     Successfully resized NTFS on device '/dev/sdb1'.      The second step is to change the size of the partition, so I divided the new size (`9999995392`) by 512, and I got 19531241 sectors. So, I ran `fdisk` and deleted the first partition, and I created it anew:               # fdisk /dev/sdb     Command (m for help): d     Partition number (1-4): 1          Command (m for help): n     Partition type:        p   primary (1 primary, 0 extended, 3 free)        e   extended     Select (default p): p     Partition number (1-4, default 1):     Using default value 1     First sector (2048-156299374, default 2048):     Using default value 2048     Last sector, +sectors or +size{K,M,G} (2048-61442047, default 61442047): +19531241          Command (m for help): t     Partition number (1-4): 1     Hex code (type L to list codes): 7     Changed system type of partition 1 to 7 (HPFS/NTFS/exFAT)      Everything seems to work, gparted shows no errors: ![screen](http://i.stack.imgur.com/5T7tM.png) But the size of the new partition is bigger compared to its filesystem:               # ntfsresize -i -f /dev/sdb1     ntfsresize v2013.1.13AR.1 (libntfs-3g)     Device name        : /dev/sdb1     NTFS volume version: 3.1     Cluster size       : 4096 bytes     Current volume size: 9999995392 bytes (10000 MB)     Current device size: 9999995904 bytes (10000 MB)     Checking filesystem consistency ...     100.00 percent completed     Accounting clusters ...     Space in use       : 538 MB (5.4%)     Collecting resizing constraints ...     You might resize at 537047040 bytes or 538 MB (freeing 9462 MB).     Please make a test run using both the -n and -s options before real resizing!      It's just one sector (512b). Does anyone know where this extra sector came from?


title: check patterns that don't exist in sqlite

text: I explained a similar situation with plain text files on Grep huge number of patterns from huge file. Many people there said I should, so now I'm migrating my data to a sqlite database: I have a file from which I extract about 10,000 patterns. Then I check if the database doesn't contain such patterns. If it doesn't, I need to save them externally in `file` for further processing:               for id in $(grep ^[0-9] keys); do       if [[ -z $(sqlite3 db.sqlite "select id from main where id = $id") ]]; then         echo $id >>file       fi     done      Since I'm new to SQL, I couldn't find a simple way to do this. Also, this loop is useless as it is 20 times slower than what I achieved with `awk` on the mentioned URL. Since the database is huge, keeps growing, and I run this loop very frequently, is it possible to make this faster?


title: I need kernel headers for 2.6.21.5

text: Preferably in slackware module format(lzm). Can't seem to find it. Can anyone help me?


title: auditing of symlink/symlinkat syscalls doesn't work here

text: I'm trying to monitor symlink/symlinkat syscalls of files under a specific directory, so I added two rules:               auditctl -a exit,always -F arch=b64 -S symlinkat -F success=1 -F dir=/XX     auditctl -a exit,always -F arch=b64 -S symlink -F success=1 -F dir=/XX      But when I do `ln -s /XX/aa /tmp/bb` there're no logs. (I can confirm auditd is running correctly, because other rules I've added works fine.) So, is it impossible to monitor symlinks in this situation? **EDIT** Seems like a kernel bug, if the source of file to link resides in /XX, it doesn't work; But if the target location is within /XX, it works e.g               ln -s /XX/file /tmp/xx   # doesn't trigger alert     cd /XX; ln -s /bin/ls xx # triggers alert


title: Cannot Start KVM VM Because Missing BIOS

text: Whenever I attempt to start a KVM VM on Ubuntu 14.04 with the "kvm" command, I get the following error:               qemu: could not load PC BIOS 'bios-256k.bin'      I have searched for this file and found it exists in the /usr/share/qemu directory as a symlink to "../seabios/bios-256k.bin". When I attempt to view the contents of that directory with ls, the system says that there is no such file or directory. However, I can cd to that directory and view the BIOS file. When I type "ls .." from the qemu directory, the only item that is returned is "qemu". I'm logged in as root, so I should be able to see all of the folders in /usr/share. Does anyone know what is going on here?


title: Processing two files using awk

text: I read Comparing two files using Unix and Awk. It is really interesting. I read and tested it, but I can't understand it completely and use it in other cases. I have two files. `file1` has one field and the other one has 16 fields. I want to read elements of `file`1 and compare them with 3rd field of `file2`. If there was a match for each element, I sum value of field 5 in `file2`. As an example: ### file 1               1     2     3      ### file 2               2 2 2 1 2     3 6 1 2 4      4 1 1 2 3     6 3 3 3 4       For element 1 in `file1` I want to add values in field 5 of `file2` where value of field 3 is 1. And do the same for element 2 and 3 in `file1`. The output for 1 is (3+4=7) and for 2 is 2 and for 3 is 4. I don't know how I should write it with awk.


title: How to change the width of remote serial console?

text: I followed this tutorial and now I'm able to connect to serial line. Now I want to change the width of terminal. How can I do this by using screen or minicom or something else?


title: How to redirect logs to a fifo device?

text: I have the following line in the rsyslog config file:               *.*;auth,daemon,kern,user   -/dev/logi      and it does what it should, but I wanted to send some iptables logs to a different file, so I added the following content to the rsyslog.conf file:               :msg,contains,"IPTABLES:" /var/log/iptables     & stop      and I created /dev/fw device , but I have no idea how to send new content of the file to that device. Is there a way to do it?


title: mount.cifs is giving Permission Denied Error

text: Im trying to mount the Windows Share on one of Our Redhat 5.9 Server. I use this command               mount -t cifs //hostIP/Folder /share2 -o username=alpha,password=blahblahblah          And          mount.cifs //hostIP/sales /share2 -o username=alpha,password=blahblahblah,domain=ourdomain.corp      But whatever I do it always gives me permission denied error               mount error 13 = Permission denied     Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)      Kindly suggest whats wrong here. I did a lot of googling but no solution worked


title: How to fix weird vim polluting the terminal behaviour on arrow keys and on delete in insert mode?

text: My terminal gets polluted by `B`, `C`,`A`,`D` when I try to navigate within vim using arrow keys and on delete using backspace it only scrolls back without deleting the characters on screen while the characters are actually deleted. How do I fix this? I have installed vim using homebrew. Its version is:               $ vim --version     VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jul 16 2013 21:10:21)     MacOS X (unix) version     Included patches: 1-923


title: Can I configure error notifications on a specific cronjob entry to go to a different email address?

text: I have multiple cron job entries configured under a single account:               0 0 * * * /foo/foo.sh     0 2 * * * /foo/foo2.sh     0 4 * * * /foo/foo3.sh      Right now, if any of these encounter an error, an email is sent to the user account. Can I configure cron to send a notification to a different email address depending on which entry encounters the error? For example, if an error occurs while running `/foo/foo.sh` send to bob@bob.com. If an error occurs while running `/foo/foo2.sh` send to joe@joe.com. I know I can set `MAILTO=someaddress@example.com` but I think that's for ALL cron entries (for the account I'm logged in as)... I don't think that's a per- entry setting. Hopefully this makes sense. Thanks. :-)


title: How to retrieve lost aliases?

text: Let me start by saying I know this was dumb. Time and Linux make fools of us all. I made an echo command to my .bash_aliases file and erased all of my aliases, except the test alias. However, I still have a session open that has the aliases loaded (into the tcl?). Can I retrieve them from this session?


title: Chromium omnibar not showing search suggestions?

text: I am using chromium browser on my ubuntu 12.04 and it doesn't show any search suggestions when I type search terms in omnibar. I checked settings, everything fine there with checkbox ticked for predictions.


title: Scheduling cronjobs at specified time

text: I have scheduled some jobs in **crontab** which are to be run one by one, at some specific time. My script for crontab is :               15 10 * * * /Users/sri/files/BatchFF.sh     45 11 * * * /Users/sri/files/BatchGC.sh     15 13 * * * /Users/sri/files/Batch_GUI_FF.sh     45 14 * * * /Users/sri/files/Batch_GUI_GC.sh     15 16 * * * /Users/sri/files/Batch_Sim_FF.sh     45 17 * * * /Users/sri/files/Batch_Sim_GC.sh      These scripts ideally should start at 10:15, 11:45, 13:15, 14:45, and so on. But the scripts are not starting as expected, rather they start at 10:15, 10:15, 10:16, 10:16, 10:17, 10:17. These scripts are writing some log files also. _The scripts are executable, and also have logging support as the script gets completed a report is being generated. This script is calling a java application to run in a browser and log of which is stored in a folder. the folder is being created with the date and time when the process is started, thus, bcz of which I was able to detect the time they started._ I am running it in Apple McBook Air, with OS X 12.4.0 Darwin


title: Richard Stallman compares Linux with Windows

text: I'm posting this here, because I really don't know any other place that could answer this. I'm curious about switching to Linux. I'm referring to this video: https://www.youtube.com/watch?v=Kfli_e923o4 He discusses three points.   1. Designed around being able to have multiple users at the same time and to be isolated from each other.   2. _"Microsoft makes a [bad] decision where they run programs that arrive in files that you just happen to have on your computer"_   3. Market-share My question is can anyone explain his second point to me?


title: Setting up a RAID 1 in Funtoo

text: # In short Following the guide How to Set Up a RAID 1 Under GNU/Linux, I have setup a RAID 1. Checking the RAID Array for validity in various ways, appeared to be normal. However, after rebooting the system, the RAID Array was not working. The partition in question was not mounted as instructed in `/etc/fstab`. Assembling the Array manually worked and no data has been lost. Newly added internal/external disks, which lead to a change of the disk device names (such as a disk being "renamed" from `sdd` to `sde` by the system), lead me to accept that it was a problem related with this name-changing fact. This is irrelevant, however, as RAID Arrays are (also) built by using unique UUIDs. The actual question is _why does the Array fail to assemble during the boot process?_ Or else, _what is the boot-script of Funtoo, the operating system under which all of plot takes place, doing regarding the`mdadm -assemble` process?_ # The long story Following the above referenced step by step guide, I have set up a RAID 1 under Funtoo. Checking the RAID 1 Array for validity was done in several ways, mostly using functionalities of the `mdadm` tool itself. Specifically, the Array's details were retrieved by using the `mdadm` tool with the `-D` flag. The disks that pertain to the Array were examined by using the `-E` flag. The respective configuration file `mdadm.conf` can be simply read for if it contains the correct instruction (i.e which md device, what is its UUID and more). Finally, watching the file `/proc/mdadm` was important to ensure that both disks were active and "synced". Below follow even more detailed information about the confronted situation.               mdadm -D /dev/md0          /dev/md0:             Version : 1.2       Creation Time : Thu Jul 18 00:25:05 2013          Raid Level : raid1          Array Size : 1953382208 (1862.89 GiB 2000.26 GB)       Used Dev Size : 1953382208 (1862.89 GiB 2000.26 GB)        Raid Devices : 2       Total Devices : 2         Persistence : Superblock is persistent              Update Time : Thu Jul 18 10:33:37 2013               State : clean       Active Devices : 2     Working Devices : 2      Failed Devices : 0       Spare Devices : 0                     Name : Resilience:0  (local to host Resilience)                UUID : 73bf29ca:89bff887:79a26531:b9733d7a              Events : 6455              Number   Major   Minor   RaidDevice State            2       8       33        0      active sync   /dev/sdc1            1       8       49        1      active sync   /dev/sdd1      From the command history, I did the following               # trying to follow the guide -- various tests...           ...           979  18.Jul.13 [ 00:09:07 ] mdadm --zero-superblock /dev/sdd1           980  18.Jul.13 [ 00:09:17 ] mdadm --create /dev/md0 --level=1 --raid-disks=2 missing /dev/sdd1           990  18.Jul.13 [ 00:15:58 ] mdadm --examine --scan          # creating/checking the configuration file                992  18.Jul.13 [ 00:16:17 ] cat /etc/mdadm.conf            993  18.Jul.13 [ 00:16:33 ] mdadm --examine --scan | tee /etc/mdadm.conf           994  18.Jul.13 [ 00:16:35 ] cat /etc/mdadm.conf           # after some faulty attempts, finally it goes                997  18.Jul.13 [ 00:24:45 ] mdadm --stop /dev/md0           998  18.Jul.13 [ 00:24:54 ] mdadm --zero-superblock /dev/sdd1           999  18.Jul.13 [ 00:25:04 ] mdadm --create /dev/md0 --level=1 --raid-disks=2 missing /dev/sdd1          1005  18.Jul.13 [ 00:26:39 ] mdadm --examine --scan | sudo tee /etc/mdadm.conf          1046  18.Jul.13 [ 03:42:57 ] mdadm --add /dev/md0 /dev/sdc1      The configuration file `/etc/mdadm.conf` reads:               ARRAY /dev/md/0  metadata=1.2 UUID=73bf29ca:89bff887:79a26531:b9733d7a name=Resilience:0      All works fine as can be seen from `/proc/mdadm`:               Personalities : [raid6] [raid5] [raid4] [raid1] [raid0] [raid10] [linear] [multipath]      md0 : active raid1 sdc1[2] sdd1[1]           1953382208 blocks super 1.2 [2/2] [UU]          unused devices: <none>      Here after, the disks were synced, access was fine. Shutting down the system, adding another disk, external (via USB) or internal, and restarting the system, caused the RAID1 to stop working! The reason is, if I am not wrong, the change of disk device numbers. In this example, the former `sdd1` became `sde1` while `sdd1` was reserved by a "new" internal disk or an external USB HDD attached before starting the system and instructed to be automatically mounted. It was very easy to "recover" the "failed" ARRAY by removing all other disks, stopping the Array and re-assembling it. Some of the commands issued while trying and, finally, successfully getting back the ARRAY were:               # booting and unsuccessfully trying to add the "missing" disk               1091  18.Jul.13 [ 10:22:53 ] mdadm --add /dev/md0 /dev/sdc1          1092  18.Jul.13 [ 10:28:26 ] mdadm --assemble /dev/md0 --scan          1093  18.Jul.13 [ 10:28:39 ] mdadm --assemble /dev/md0 --scan --force          1095  18.Jul.13 [ 10:30:36 ] mdadm --detail /dev/md0          # reading about `mdadm`, trying to "stop", incomplete command though               1096  18.Jul.13 [ 10:30:45 ] mdadm stop          1097  18.Jul.13 [ 10:31:12 ] mdadm --examine /dev/sdd          1098  18.Jul.13 [ 10:31:16 ] mdadm --examine /dev/sdd1          1099  18.Jul.13 [ 10:31:20 ] mdadm --examine /dev/sdc          1100  18.Jul.13 [ 10:31:21 ] mdadm --examine /dev/sdc1          # reading again, stop it -- the right way               1101  18.Jul.13 [ 10:33:19 ] mdadm --stop /dev/md0          # assemble & check               1102  18.Jul.13 [ 10:33:25 ] mdadm --assemble /dev/md0 --scan          1111  18.Jul.13 [ 10:34:17 ] mdadm --examine /dev/sd[cd]1          # does the Array have a UUID?               1112  18.Jul.13 [ 10:37:36 ] UUID=$(mdadm -E /dev/sdd1|perl -ne '/Array UUID : (\S+)/ and print $1')          # below, learning how to report on the Array               1115  18.Jul.13 [ 10:42:26 ] mdadm -D /dev/md0          1116  18.Jul.13 [ 10:45:08 ] mdadm --examine /dev/sd[cd]1 >> raid.status          1197  18.Jul.13 [ 13:16:59 ] mdadm --detail /dev/md0          1198  18.Jul.13 [ 13:17:29 ] mdadm --examine /dev/sd[cd]1          1199  18.Jul.13 [ 13:17:41 ] mdadm --help          1200  18.Jul.13 [ 13:18:41 ] mdadm --monitor /dev/md0          1201  18.Jul.13 [ 13:18:53 ] mdadm --misc /dev/md0      However, I would expect this not to happen, and be able to play safe as with the rest of disks/partitions when mounting is based on UUIDs and/or LABELs. The corresponding entry in `/etc/fstab` reads ( **note** , I skipped the options `nosuid,nodev`)               /dev/md0        geo     xfs     defaults        0 2      Details for `sdc1`, output from `mdadm -E /dev/sdc1`               /dev/sdc1:               Magic : a92b4efc             Version : 1.2         Feature Map : 0x0          Array UUID : 73bf29ca:89bff887:79a26531:b9733d7a                Name : Resilience:0  (local to host Resilience)       Creation Time : Thu Jul 18 00:25:05 2013          Raid Level : raid1        Raid Devices : 2           Avail Dev Size : 3906764800 (1862.89 GiB 2000.26 GB)          Array Size : 1953382208 (1862.89 GiB 2000.26 GB)       Used Dev Size : 3906764416 (1862.89 GiB 2000.26 GB)         Data Offset : 262144 sectors        Super Offset : 8 sectors               State : clean         Device UUID : 5552ba2d:8d79c88f:c995d052:cef0aa03              Update Time : Fri Jul 19 11:14:19 2013            Checksum : 385183dd - correct              Events : 6455                  Device Role : Active device 0        Array State : AA ('A' == active, '.' == missing)      **Details for the partitions in question** Details for `sdd1`, output from `mdadm -E /dev/sdd1`               /dev/sdd1:               Magic : a92b4efc             Version : 1.2         Feature Map : 0x0          Array UUID : 73bf29ca:89bff887:79a26531:b9733d7a                Name : Resilience:0  (local to host Resilience)       Creation Time : Thu Jul 18 00:25:05 2013          Raid Level : raid1        Raid Devices : 2           Avail Dev Size : 3906764800 (1862.89 GiB 2000.26 GB)          Array Size : 1953382208 (1862.89 GiB 2000.26 GB)       Used Dev Size : 3906764416 (1862.89 GiB 2000.26 GB)         Data Offset : 262144 sectors        Super Offset : 8 sectors               State : clean         Device UUID : 076acfd8:af184e75:f83ce3ae:8e778ba0              Update Time : Fri Jul 19 11:14:19 2013            Checksum : c1df68a0 - correct              Events : 6455                  Device Role : Active device 1        Array State : AA ('A' == active, '.' == missing)      After adding, again, a "new" internal disk, and rebooting, I experience the same problem. `mdadm -E /dev/sdd1` reports               mdadm: No md superblock detected on /dev/sdd1.      while `mdadm -E /dev/sde1`               /dev/sde1:               Magic : a92b4efc             Version : 1.2         Feature Map : 0x0          Array UUID : 73bf29ca:89bff887:79a26531:b9733d7a                Name : Resilience:0  (local to host Resilience)       Creation Time : Thu Jul 18 00:25:05 2013          Raid Level : raid1        Raid Devices : 2           Avail Dev Size : 3906764800 (1862.89 GiB 2000.26 GB)          Array Size : 1953382208 (1862.89 GiB 2000.26 GB)       Used Dev Size : 3906764416 (1862.89 GiB 2000.26 GB)         Data Offset : 262144 sectors        Super Offset : 8 sectors               State : clean         Device UUID : 076acfd8:af184e75:f83ce3ae:8e778ba0              Update Time : Fri Jul 19 11:34:47 2013            Checksum : c1df6d6c - correct              Events : 6455                  Device Role : Active device 1        Array State : AA ('A' == active, '.' == missing)      and `mdadm --detail /dev/md0`               mdadm: md device /dev/md0 does not appear to be active.      while `cat /proc/mdstat` reads               Personalities : [raid6] [raid5] [raid4] [raid1] [raid0] [raid10] [linear] [multipath]      md0 : inactive sde1[1](S)           1953382400 blocks super 1.2          unused devices: <none>      Note, as per _Gilles'_ observation, at this point the reported blocks (1953382400) do not match the ones reported for the `Array Size : 1953382208`, as can be seen above (or below). Obviously, something went wrong here. The (partial) output of `mdadm -Evvvvs` is               /dev/sde1:               Magic : a92b4efc             Version : 1.2         Feature Map : 0x0          Array UUID : 73bf29ca:89bff887:79a26531:b9733d7a                Name : Resilience:0  (local to host Resilience)       Creation Time : Thu Jul 18 00:25:05 2013          Raid Level : raid1        Raid Devices : 2           Avail Dev Size : 3906764800 (1862.89 GiB 2000.26 GB)          Array Size : 1953382208 (1862.89 GiB 2000.26 GB)       Used Dev Size : 3906764416 (1862.89 GiB 2000.26 GB)         Data Offset : 262144 sectors        Super Offset : 8 sectors               State : clean         Device UUID : 076acfd8:af184e75:f83ce3ae:8e778ba0              Update Time : Fri Jul 19 11:34:47 2013            Checksum : c1df6d6c - correct              Events : 6455                  Device Role : Active device 1        Array State : AA ('A' == active, '.' == missing)     /dev/sde:        MBR Magic : aa55     Partition[0] :   3907026944 sectors at         2048 (type fd)          /dev/sdc1:               Magic : a92b4efc             Version : 1.2         Feature Map : 0x0          Array UUID : 73bf29ca:89bff887:79a26531:b9733d7a                Name : Resilience:0  (local to host Resilience)       Creation Time : Thu Jul 18 00:25:05 2013          Raid Level : raid1        Raid Devices : 2           Avail Dev Size : 3906764800 (1862.89 GiB 2000.26 GB)          Array Size : 1953382208 (1862.89 GiB 2000.26 GB)       Used Dev Size : 3906764416 (1862.89 GiB 2000.26 GB)         Data Offset : 262144 sectors        Super Offset : 8 sectors               State : clean         Device UUID : 5552ba2d:8d79c88f:c995d052:cef0aa03              Update Time : Fri Jul 19 11:34:47 2013            Checksum : 385188a9 - correct              Events : 6455                  Device Role : Active device 0        Array State : AA ('A' == active, '.' == missing)     /dev/sdc:        MBR Magic : aa55     Partition[0] :   3907026944 sectors at         2048 (type fd)      Checking with `fdisk -l`, the previous ~~`sdc` and~~ `sdd` disk ~~s~~ , ~~are~~ is now ~~`sdb` and ~~`sde` (recognise the ~~m~~ disks from the size among the rest of the drives). It seems that "it" is still looking at/for ~~`sdc1`~~`sdd1`? Following suggestions found in the comment section, I added more details. As per _derobert's_ suggestion in the comments, the ARRAY stopped and re- assembled successfully:               # stop it!     mdadm --stop /dev/md0     mdadm: stopped /dev/md0          # re-assemble -- looks good!     mdadm --assemble -v --scan          mdadm: looking for devices for /dev/md/0     mdadm: no RAID superblock on /dev/sdf1     mdadm: no RAID superblock on /dev/sdf     mdadm: no RAID superblock on /dev/sde     mdadm: no RAID superblock on /dev/sdd1     mdadm: no RAID superblock on /dev/sdd     mdadm: no RAID superblock on /dev/sdc     mdadm: no RAID superblock on /dev/sdb     mdadm: no RAID superblock on /dev/sda6     mdadm: no RAID superblock on /dev/sda5     mdadm: no RAID superblock on /dev/sda4     mdadm: no RAID superblock on /dev/sda3     mdadm: no RAID superblock on /dev/sda2     mdadm: no RAID superblock on /dev/sda1     mdadm: no RAID superblock on /dev/sda     mdadm: /dev/sde1 is identified as a member of /dev/md/0, slot 1.     mdadm: /dev/sdc1 is identified as a member of /dev/md/0, slot 0.     mdadm: added /dev/sde1 to /dev/md/0 as 1     mdadm: added /dev/sdc1 to /dev/md/0 as 0     mdadm: /dev/md/0 has been started with 2 drives.          # double-check     mdadm --detail --scan     ARRAY /dev/md/0 metadata=1.2 name=Resilience:0 UUID=73bf29ca:89bff887:79a26531:b9733d7a      **New question** , how is this to be fixed ~~that without loosing data~~? As per the discussion and recommendations in the comments, it is related with the boot process? ~~Permissions to the mount point in question perhaps?~~ `mdadm` was not registered as a boot service. Adding it and rebooting, did not fix the issue though. A few more, probably interesting, details from `dmesg` on where it fails:               [   25.356947] md: raid6 personality registered for level 6     [   25.356952] md: raid5 personality registered for level 5     [   25.356955] md: raid4 personality registered for level 4     [   25.383630] md: raid1 personality registered for level 1     [   25.677100] md: raid0 personality registered for level 0     [   26.134282] md: raid10 personality registered for level 10     [   26.257855] md: linear personality registered for level -1     [   26.382152] md: multipath personality registered for level -4     [   41.986222] md: bind<sde1>     [   44.274346] XFS (md0): SB buffer read failed     [   55.028598] ata7: sas eh calling libata cmd error handler     [   55.028615] ata7.00: cmd ef/05:fe:00:00:00/00:00:00:00:00/40 tag 0     [   55.046186] ata7: sas eh calling libata cmd error handler     [   55.046209] ata7.00: cmd ef/c2:00:00:00:00/00:00:00:00:00/40 tag 0     [   55.278378] ata8: sas eh calling libata cmd error handler     [   55.278406] ata8.00: cmd ef/05:fe:00:00:00/00:00:00:00:00/40 tag 0     [   55.349235] ata8: sas eh calling libata cmd error handler     [   55.349290] ata8.00: cmd ef/c2:00:00:00:00/00:00:00:00:00/40 tag 0     [  105.854112] XFS (md0): SB buffer read failed      ~~Further checking the XFS partition in question`sde1`               xfs_check /dev/sde1     xfs_check: /dev/sde1 is not a valid XFS filesystem (unexpected SB magic number 0x00000000)     xfs_check: WARNING - filesystem uses v1 dirs,limited functionality provided.     xfs_check: read failed: Invalid argument     cache_node_purge: refcount was 1, not zero (node=0x22a64a0)     xfs_check: cannot read root inode (22)     bad superblock magic number 0, giving up      It turns out that the XFS partition in question is not healthy. ~~ An XFS filesystem, although not impossible, is likely not the root of the problem here. Partitions that are part of an RAID Array, are according to Gilles' comment, _not an XFS filesystem! The filesystem starts at an offset, there's a RAID header first._ # Question(s) **In the beginning**   * Is it possible to "lock" the RAID 1 Array to only work with specific disks/partitions independently from disk device names?   * Would it be, for example, sufficient to use the Array's UUID in `/etc/fstab` so as to be immune against changes of the disk device names? **After re-searching the problem**   * At what stage of Funtoo's boot process is the assembmel of the RAID Array attempted? How exactly? Where can it be modified/adjusted?


title: Garbled text in tmux menus

text: I am trying to use the st terminal, but after starting tmux (or screen) in a remote ssh session, the text becomes all garbled. Exiting tmux/screen makes text normal again. Now, I have found that this is due to the alternate character set becoming active, and echoing ^N fixes things. In the shell. Inside tmux, though, apparently the alternate character set remains active. Since tmux uses a pseudo-terminal for itself, I tried echoing ^N to this particular device, hoping this would reset the character set for tmux too, but it didn't work. Any idea how to reset the character set for tmux itself?


title: Reverse grepping

text: Let's say, I have a really big text file (about 10.000.000 lines). I need to `grep` it from the end and save result to a file. What's the most efficient way to accomplish task?


title: Low-pass filter on LFE using Pulseaudio

text: I'd like to apply a low-pass filter on the subwoofer channel on my 5.1 sound system under SolydK (a Linux distro based on Debian Testing, PA is installed and configured by default just like under Linux Mint or Ubuntu). I've been trying to achieve this by doing the following. First, I applied the filter on the LFE channel and created a sink with it:               pacmd load-module module-ladspa-sink sink_name=ladspa_low_pass master=alsa_output.pci-0000_05_02.0.analog-surround-51 plugin=cmt label=lpf control=86          pacmd load-module module-remap-sink sink_name=remapLFE master=ladspa_low_pass channels=1 master_channel_map=lfe channel_map=lfe      Then, I created another sink with the rest of the channels, which I don't want to be filtered:               pacmd load-module module-remap-sink sink_name=remap50 master=alsa_output.pci-0000_05_02.0.analog-surround-51 channels=5 master_channel_map=front-left,center,front-right,rear-left,rear-right channel_map=front-left,center,front-right,rear-left,rear-right      And finally I combined the two sinks into a third one and set it as default:               pacmd load-module module-combine-sink sink_name=combine sink_properties=device.description=myCombine slaves=remap50,remapLFE channel_map=front-left,center,front-right,rear-left,rear-right,lfe channels=6          pacmd set-default-sink combine      The problem is that when I test it with `speaker-test -c 6 -t w` and sound is supposed to come out from the subwoofer, it is coming from all speakers, and the sample says, ‘rear-centre’. How can I fix this?


title: What is not accessible from userspace?

text: I read somewhere (3.1.3) that there's a high ring (supervisor mode) and a low ring (user mode) and that some "things" can be run only from the highest ring. What do they mean by "things"? I'd guess that includes what syscalls (read/write/open... ) do but is that it? Do they think of something lower level like the eventual ASM instruction(s)? Is there a list somewhere of what is authorized in user-mode and what is not?


title: How can I have a Trash/Recycle Bin for my Samba shares?

text: I have a couple of Samba shares on my NAS running Debian Squeeze which I access through Windows 7. Deleting any of the files from Windows will completely delete the files from the NAS server. Is there anyway to have a similar feature installed like the Trash/Recycle Bin? It would be nice if there even was a similar concept as `Delete`, file goes to trash and is deleted, `Shift``Delete`, file is deleted and no keep copy is kept anywhere. Is there such thing I could install?


title: What is the difference between a patch which reverts a commit and a "reversed patch"?

text: Before _May 6th, 2013_ , the `fs/eventpoll.c` file in the Linux kernel had the following line #1605:               if (!schedule_hrtimeout_range(to, slack, HRTIMER_MODE_ABS))      On _May 6th_ , a commit changes this to (patch):               From 1c441e921201d523b5a6036aea22b0b426bf1af2 Mon Sep 17 00:00:00 2001     From: Colin Cross <ccross@android.com>     Date: Mon, 06 May 2013 23:50:16 +0000     Subject: epoll: use freezable blocking call          Avoid waking up every thread sleeping in an epoll_wait call during     suspend and resume by calling a freezable blocking call.  Previous     patches modified the freezer to avoid sending wakeups to threads     that are blocked in freezable blocking calls.          This call was selected to be converted to a freezable call because     it doesn't hold any locks or release any resources when interrupted     that might be needed by another freezing task or a kernel driver     during suspend, and is a common site where idle userspace tasks are     blocked.          Acked-by: Tejun Heo <tj@kernel.org>     Signed-off-by: Colin Cross <ccross@android.com>     Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>     ---     (limited to 'fs/eventpoll.c')          diff --git a/fs/eventpoll.c b/fs/eventpoll.c     index deecc72..0cff443 100644     --- a/fs/eventpoll.c     +++ b/fs/eventpoll.c     @@ -34,6 +34,7 @@      #include <linux/mutex.h>      #include <linux/anon_inodes.h>      #include <linux/device.h>     +#include <linux/freezer.h>      #include <asm/uaccess.h>      #include <asm/io.h>      #include <asm/mman.h>     @@ -1602,7 +1603,8 @@ fetch_events:                 }                      spin_unlock_irqrestore(&ep->lock, flags);     -           if (!schedule_hrtimeout_range(to, slack, HRTIMER_MODE_ABS))     +           if (!freezable_schedule_hrtimeout_range(to, slack,     +                               HRTIMER_MODE_ABS))                     timed_out = 1;                      spin_lock_irqsave(&ep->lock, flags);     --     cgit v0.9.2      Then on _October 29, 2013_ , after some issues with that, it is decided to revert "epoll: use freezable blocking call" \- here's the patch:               From c511851de162e8ec03d62e7d7feecbdf590d881d Mon Sep 17 00:00:00 2001     From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>     Date: Tue, 29 Oct 2013 12:12:56 +0000     Subject: Revert "epoll: use freezable blocking call"          This reverts commit 1c441e921201 (epoll: use freezable blocking call)     which is reported to cause user space memory corruption to happen     after suspend to RAM.          Since it appears to be extremely difficult to root cause this     problem, it is best to revert the offending commit and try to address     the original issue in a better way later.          References: https://bugzilla.kernel.org/show_bug.cgi?id=61781     Reported-by: Natrio <natrio@list.ru>     Reported-by: Jeff Pohlmeyer <yetanothergeek@gmail.com>     Bisected-by: Leo Wolf <jclw@ymail.com>     Fixes: 1c441e921201 (epoll: use freezable blocking call)     Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>     Cc: 3.11+ <stable@vger.kernel.org> # 3.11+     ---     diff --git a/fs/eventpoll.c b/fs/eventpoll.c     index 473e09d..810c28f 100644     --- a/fs/eventpoll.c     +++ b/fs/eventpoll.c     @@ -34,7 +34,6 @@      #include <linux/mutex.h>      #include <linux/anon_inodes.h>      #include <linux/device.h>     -#include <linux/freezer.h>      #include <asm/uaccess.h>      #include <asm/io.h>      #include <asm/mman.h>     @@ -1605,8 +1604,7 @@ fetch_events:                 }                      spin_unlock_irqrestore(&ep->lock, flags);     -           if (!freezable_schedule_hrtimeout_range(to, slack,     -                               HRTIMER_MODE_ABS))     +           if (!schedule_hrtimeout_range(to, slack, HRTIMER_MODE_ABS))                     timed_out = 1;                      spin_lock_irqsave(&ep->lock, flags);     --     cgit v0.9.2      The commit is accompanied by the following description: > This reverts commit 1c441e921201 (epoll: use freezable blocking call) which > is reported to cause user space memory corruption to happen after suspend to > RAM. > > Since it appears to be extremely difficult to root cause this problem, it is > best to revert the offending commit and try to address the original issue in > a better way later. **Questions:**   1. Is this latest commit simply a patch that has the effect of reverting a prior patch OR is it a reversed patch?   2. Assuming this was not a reversed patch, then what is a reversed patch? Supplying the exact same prior commit(May) and relying on the patch utility behavior for suggesting reversing the patch (see below, and "note for patch senders" at the bottom of the `patch` manpages)?   3. Am I right in thinking that if I try to apply this latest patch to my kernel sources, and get the behavior shown below, that simply means the patch is already applied, and I can confirm this and indeed I have NO reference to `freezable` or the freeze include in my sources and that was the intent of the kernel maintainers here?   4. I'm using Gentoo sources 3.10.25 and the changelog indicates: `Linux patch 3.10.25 and the date is 21 Dec 2013`? Except by looking at the changed .c file itself, how can I know if this patch has already been applied to my distribution sources? Can I rely on the version intro date in the sources changelog being 21st of Dec. and conclude that this patch has been applied because it was added to the kernel tree on October which is before? Q3:               # patch -p1 < october29.patch     patching file fs/eventpoll.c     Reversed (or previously applied) patch detected!  Assume -R? [n]      * * * **Complement** A contributor explained: > A "reversed patch" is when someone accidentally makes a patch with diff -u > foo.c foo.c.orig (where foo.c is the newer file) instead of the correct diff > -u foo.c.orig foo.c I was asking this because of what I found in the Note to patch senders in the `patch` manpages: > Take care not to send out reversed patches, since it makes people wonder > whether they already applied the patch. This means that a _reversed patch_ can be the result of a mistake like explained or a "technique" to roll back a change, but one that is not advisable because it creates confusion. So indeed you can try `diff -u new.c old.c` (the mistake) here:               --- new.c   2014-02-01 21:37:55.616888434 -0500     +++ old.c   2014-02-01 21:37:41.430887944 -0500     @@ -34,6 +34,7 @@      #include <linux/mutex.h>      #include <linux/anon_inodes.h>      #include <linux/device.h>     +#include <linux/freezer.h>      #include <asm/uaccess.h>      #include <asm/io.h>      #include <asm/mman.h>     @@ -1604,7 +1605,8 @@                 }                      spin_unlock_irqrestore(&ep->lock, flags);     -           if (!schedule_hrtimeout_range(to, slack, HRTIMER_MODE_ABS))     +           if (!freezable_schedule_hrtimeout_range(to, slack,     +                               HRTIMER_MODE_ABS))                     timed_out = 1;                      spin_lock_irqsave(&ep->lock, flags);      ... and this is the original _May 6th_ commit. So a reversed patch is in effect _like submitting the original patch_ which would trigger the reversing behavior in the `patch` utility provided the patch is already applied, effectively rolling back to a state when the initial patch was not applied. Ultimately, there can be no doubt that the patch has been applied to my sources. This is the latest `eventpoll.c` file in the git kernel tree. It contains no reference to 'freezable'. My sources neither. And trying to apply the patch triggers the previously applied patch message. In doubt look at the latest code in the tree (and git logs if you have a clone of the repository) and compare with what you have in your distribution sources.


title: How to remove or shorten F1 Boot Prompt on NanoBSD 4G USB disk that fail with "fdisk: /boot/mbr: Device not configured"?

text: I have read the pfSense documentation Remove F1 Boot Prompt, however that doesn't seem to apply to our pfSense-2.1.1-PRERELEASE-4g-amd64-nanobsd_vga-20140131-1030.img installation. The `fdisk -B da0` command fails after `Do you want to change the boot code? [n] y` with `fdisk: /boot/mbr: Device not configured`. The console outputs:               GEOM_PART: integrity check failed (da0, MBR)     GEOM: da0s1: geometry does not match label (16h,63s != 255h,63s).     GEOM: da0s2: geometry does not match label (16h,63s != 255h,63s).      A workaround might be to shorten the "The boot0 Boot Manager" timeout value using   * `boot0cfg -t 1`   * `boot0cfg -t 1 da0`   * or `boot0cfg -t 1/dev/da0` results in: `/usr/sbin/boot0cfg: Device not configured.` and after a reboot these commands result in `/usr/sbin/boot0cfg: Input/output error.`. How to remove or shorten F1 Boot Prompt on Amd64 NanoBSD 4G USB disk?


title: How do I configure ssh tunneling past a firewall?

text: I have a NAS running Linux behind a firewall at home. I want to access it remotely using a few services such as a Transmission GUI (port 9091) and webmin (port 10000), but through an SSH tunnel on port 22. For simplicity, I wanted to leave as many net-facing ports closed and only opened up port 22 to the NAS. I tried configuring tunnelling in PuTTY (local port 10000, remote.ip.address:10000), but I believe I'm still hitting a firewall rule after a successful SSH login. Is this the correct use of SSH tunnelling?


title: How much text does grep/egrep consume each time?

text: I'm confused on `grep`/`egrep`. These tools match a single line I think? In some cases I have heard "logical" line. ### Questions   1. Is it correct to assume that essentially `grep`/`egrep` always processes a line at a time up to the new line character?   2. I'm not really sure what is the "logical line"?


title: In Linux, "Write" Permission Is Equivalent To "Execute" For Directories?

text: The Execute permission makes sense for files (which include scripts etc), but when it comes to directories, `write (w)` permission works the same way as `execute (x)`, right? Which means, if we are giving write permission to a directory we also normally check "x" (for execute) for that directory as well, right?


title: CLI filesystem benchmark for random read/write with specified block size

text: I'm in search of a filesystem benchmark utility. I basically want to run a test which should be able to do random reads/writes on a specified drive with a given block size. e.g. a 4K random write on a linux system.


title: DNS Issues on RHEL 6

text: I'm experiencing some DNS issues on a new RHEL 6 virtual machine. Ping is working fine to an IP, but the machine is unable to resolve any names. I've tried adding Google's DNS servers (8.8.8.8 and 8.8.4.4) to the bottom of /etc/resolv.conf but it's not having any affect. Even manually adding items to my /etc/hosts file doesn't seem to work. Does something need to be reset? Anything else I can try? This is the contents of my /etc/hosts file:               127.0.0.1      localhost localhost.localdomain localhost4 localhost4.localdomain4     ::1            localhost localhost.localdomain localhost6 localhost6.localdomain6     209.132.181.16 download.fedoraproject.org     74.125.236.8   google.com      However I still can't nslookup or ping to google.com. EDIT: Solved. Was a firewall issue blocking the DNS requests.


title: GTK+3 config Arch/LXDE

text: I use Arch + LXDE. I performed a full system upgrade and upgraded packages seems to have included GTK+3. Since the upgrade, my GTK+3 progs such as GEdit, Evince, etc. look somehow terrible (unusual padding between button texts and button boundaries, ...) and I don't have the `gtkrc` in home. `pacman -S gtk3` too, can't return the RC file. What should I do? Thanks for helps.


title: Why are backports called backports?

text: I'm reading about repositories in debian and i've found backports. But it sounds strange for me. I feel word `back` to be indicating older stable versions that are more compatible with less frequently updated programs. So why it's called backports?


title: What's a NM thread?

text: I am studying OCFS2 kernel source code and I found this comment of function `dlm_lanuch_thread` in file _fs/ocfs2/dlm/dlmthread.c_ : > >     /* Launch the NM thread for the mounted volume */ >   So what does the "NM thread" mean?


title: Customize the way stderr is appended to a file

text: I have an issue with a shell script that uses rsync to synchronize 2 directories. I'm storing the result of the rsync command (whether it's successful or not) to a file named status and in case there is a problem, the stderr output is appended to a file named error. However, I can't seem to find a way to enter a timestamp before the actual error in the error file. In the end, I need something like this:               if rsync source destination 2>> error # but I need to have the date before the actual error is appended!     then        echo "`date` - Success" >> status     else        echo "`date` - Failure" >> status     fi      I've also tried the following:               (rsync source destination && echo "`date` - Success" >> status || echo "`date` - Failure" >> status) 2>>error      The only way I've made this work is when I store the stderr output to a temporary file, so that I can append its contents to the error file after I have entered the timestamp.


title: Is it normal for a integrated intel video card to have such low fps?

text: Here's the output from `glxgears`: `300 frames in 5.0 seconds = 59.959 FPS` My video card: `00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09) ` I'm not sure if it's normal here ?


title: Getting 256 colors to work in tmux

text: I have 256 colors working just fine in `konsole,`. I thought I'd give `tmux` a try because, unlike screen, it seems to support `vi` mode. However I find that the colors of my prompt show up and this is most likely because I have a 256 color mode prompt. What do I need to do to get `tmux` to recognize all 256 colors?


title: vim and tmux are conflicting. How can I fix this?

text: I'm having a painful experience with `tmux`. I'm using `solarized` in `vim` but when I run `tmux` then my `vim` configuration does not work. It's as if `solarized` is not configured in my `.vimrc`. Out of `tmux` all is fine! Using `tmux` using `vim` hurts my sight.... What do I need to do?


title: SSH login from external authentication

text: Here is what I try to accomplish:   I have a server with a git repository.   I use ISPConfig as control panel for our websites and I want to integrate the ISPConfig API for email authentication as second authentication. Here is the authentication flow:   1. The user connects with ssh-rsa key (without password)   2. The ssh has to run a script which prompts the user for second authentication with email and password. These credentials are verified with the API and if correct the user is logged in through SSH, otherwise the user is disconnected. **EDIT** :   I've installed the **libpam_script** (`apt-get install libpam_script`) and tried to configure it, but with no luck.   I've tried several things by adding this line `auth required pam_script.so` to:   `/etc/pam.d/sshd`   `/etc/pam.d/login`   `/etc/pam.d/common-auth` None of them executed the script `/etc/security/onauth` nor `/usr/share/libpam-script/pam_script_auth`   In both scripts I have this code:               #!/bin/bash     echo "Logging" > /home/server/pam.log      The code is just for testing to see if it's even executed.


title: Can I Xmodmap only a specific device?

text: I'd like to reverse scroll direction, but only on my BCM5794 multitouch trackpad. Is this possible?


title: ReFS but for Linux

text: Microsoft is going to bring a "Resilient FileSystem" with Windows 8, but only for servers. I'd like that on a Linux desktop, but my search reveals no contender. There are so many filesystems for Linux, that maybe I've just missed it. What I expect from such a filesystem is that a bad block won't screw up either files or the journal. I'm no FS geek, so please explain if such error- resilience is unfit for a desktop/CPU intensive/memory intensive/lowers the HDD's lifespan/is already in some FS like Ext4/etc. **Is there something like this available for Linux?**


title: Defragmentation of LVM2 logical volumes

text: Question: Is there a tool supporting de-fragmentation of LVM2 logical volumes ? (Making their extents into consistent sequences) Preferably by defining desired order of extents (something like _"partition A on beginning of disk, B after A, but X on the end of PV"_ ) Of course there is a need of considering following cases:   * VG consists one PV   * VG consists many PV, but each LV sits on one PV   * VG consists many PV, LVs have their extents across many PV If partitions can be stripped or not, can be discussed. Know-how: It's possible to move ranges of extents with `pvmove` , e.g. : `pvmove --alloc anywhere /dev/sdb1:1000-1999 /dev/sdb1:0-999` . Reason: Because moving many ranges manually with `pvmove` is purely repeatable thing (questionable if brainless or not), I was curious if there exists tool for automatizing/supporting this process. If not... maybe doing one by myself - do you think such tool would be useful for other people?


title: Running both sudo and nohup on a command

text: There is a complex command that requires `sudo`:               sudo command par1 666 /home/me/...      I need to launch it so that it persists after I log off from terminal (SSH). I have discovered that `nohup` command is supposed to do this. First problem is, that `nohup` seems to need `sudo`:               nohup: failed to open `nohup.out': Permission denied     nohup: failed to open `/home/me/nohup.out': Permission denied      Second thing is, that the latter parameters seem to get lost. What's the proper syntax to run `command` with all it's parameters asynchronously with administrator rights?