Scheduling cronjobs at specified time

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


Richard Stallman compares Linux with Windows

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?


Setting up a RAID 1 in Funtoo

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


Garbled text in tmux menus

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?


Reverse grepping

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?


Low-pass filter on LFE using Pulseaudio

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?


What is not accessible from userspace?

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?


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

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?


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

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.


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

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?


How do I configure ssh tunneling past a firewall?

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?


How much text does grep/egrep consume each time?

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


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

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?


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

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.


DNS Issues on RHEL 6

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.


GTK+3 config Arch/LXDE

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.


Why are backports called backports?

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?


What's a NM thread?

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?


Customize the way stderr is appended to a file

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.


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

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 ?


Getting 256 colors to work in tmux

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?


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

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?


SSH login from external authentication

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.


Can I Xmodmap only a specific device?

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


ReFS but for Linux

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


Defragmentation of LVM2 logical volumes

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?


Running both sudo and nohup on a command

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?


How to reconfigure PHP

We have a new linux server CentOS 6.5 with Plesk. Default PHP is 5.3.3, I have installed PHP5.4 & 5.5 on the server. I am a beginner on linux. Actually, I don't know how to install software on the linux. I just search on the internet to find a solution. I have to install PHP by using this guide PHP installed successfully but some functions do not work, such as mysqli. Default PHP 5.3.3 configure command is: `--with-mysql=shared,/usr --with-mysqli=shared,/usr/lib64/mysql/mysql_config` but my installed PHP 5.4 configure command is: `--with-mysql=/usr --with-mysqli` I think something is missing. I want to know how to restore mysqli features? If possible, a step by step guide to teach me. Thank you very much.


AES-NI accelerated ZFS v31 encryption in Solaris 11

I'm not quite sure if this is the right place to ask this, if not, feel free to migrate it to wherever it fits in. I'm testing the encryption feature in ZFS v31 in a Solaris 11.11.11 VM under ESXi 5.0 on my lab box. I'm getting terrible results when benching my encrypted folder with `dd` on an 11-disk RAIDZ3. **dd benchmark:**               # time dd if=/dev/zero of=/mypool/storage/dd.tst bs=1024000 count=10000     10000+0 records in     10000+0 records out          real    1m52.604s     user    0m0.010s     sys     0m2.715s     # time dd if=/mypool/storage/dd.tst of=/dev/null bs=1024000     10000+0 records in     10000+0 records out          real    3m15.547s     user    0m0.015s     sys     0m4.768s      **Which translates to:**               Write: 90.94 MB/s     Read: 52.366 MB/s      While using 100% CPU. In contrast, with no encryption, I'm getting writes at almost 700 MB/s and reads at around 900 MB/s. **As`isainfo -v` shows, aes is passed through to the VM.**               # isainfo -v     64-bit amd64 applications             xsave pclmulqdq aes sse4.2 sse4.1 ssse3 popcnt tscp cx16 sse3 sse2 sse             fxsr mmx cmov amd_sysc cx8 tsc fpu     32-bit i386 applications             xsave pclmulqdq aes sse4.2 sse4.1 ssse3 popcnt tscp ahf cx16 sse3 sse2             sse fxsr mmx cmov sep cx8 tsc fpu      Yes, I know what you're thinking. I should try it bare metal - and I actually have. I'm getting the same results running bare metal. The reason I'm even mentioning that it's in a VM is because AES-NI actually works and is giving me almost full speed using TrueCrypt in my Windows 7 64-bit VM under ESXi 5.0 using the exact same specs for the virtual machine. **VM specs:**   * CPU: 2 cores (of Intel Xeon E3-1235 @ 3.2GHz)   * Memory: 8GB   * SAS-controller (via Vt-d & PCI-passthrough): 2x IBM M1015 (flashed with IT firmware)   * HDD: 11x 2TB Samsung F4EG (via IBM M1015) Where should I start troubleshooting? Has anyone successfully used AES-NI accelerated encryption in Solaris 11 - if so, how is your setup, and did you have to do anything special?


What does "position" mean in iconv error message?

I get error when converting a large file:               $ iconv -f GB2312 -t UTF-8 2001.txt -o 2001_u.txt     iconv: illegal input sequence at position 245256667      What does the position mean in this error? I tried it is not line number. How to get to the position in other tools or editors like emacs?


Help understanding `find` syntax on Solaris

Consider the following files:               $ find findtest                          findtest     findtest/test1     findtest/test1/start.ksh     findtest/test2     findtest/test2/start.ksh     findtest/test3     findtest/test3/start.ksh     findtest/test4     findtest/test4/start.ksh      My question is about the use of `{}` in the `-exec` call. It works as I would expect it when designating the result file:               $ find findtest -name test[1-4] -exec ls -d {} \;                findtest/test1     findtest/test2     findtest/test3     findtest/test4      However it doesn't seem to be expanded when used in a path:               $ find findtest -name test[1-4] -exec md5sum {}/start.ksh \;          md5sum: {}/start.ksh: No such file or directory     md5sum: {}/start.ksh: No such file or directory     md5sum: {}/start.ksh: No such file or directory     md5sum: {}/start.ksh: No such file or directory      How can I use `find -type d -exec` to access lower hierarchy files? I know I can use a `for` loop like this, but I am curious to know if it can be done in one `find` call:               $ for f in $(find findtest -name test[1-4]); do md5sum "$f"/start.ksh; done     d41d8cd98f00b204e9800998ecf8427e  findtest/test1/start.ksh     d41d8cd98f00b204e9800998ecf8427e  findtest/test2/start.ksh     d41d8cd98f00b204e9800998ecf8427e  findtest/test3/start.ksh     d41d8cd98f00b204e9800998ecf8427e  findtest/test4/start.ksh


Replacing one test string with another in particular column

I would like to replace "CC" with "C" and "AA" with A" in a particular column of Tab delimited file (using `awk` probably).


Upload & Download speed in Tmux status line

Is there a way to get upload and download speeds in Tmux's status line?


CentOS as an xterminal

I have recently built a new VM on my `CentOS 6.5 system`. The VM has `Ubuntu with ROS`, the robotic operating system on it. I just wanted to experiment with ROS and I've been running some of the tutorials. One of those tutorials has an `X windows based application` in it but I haven't figured out how to get it displayed on the host's desktop display. I'm sure it's easy, and I thought that `vncserver` would do what I needed, but I haven't gotten it to work. I have tested the network connection between the VM and underlying CentOS system and the VMWARE successfully can ping the host. Could anyone point me to an explanation or tell me how to get this working?


How to mount a Truecrypt container with a timeout from the command line?

I'm mounting a truecrypt container via the command line (i.e. `truecrypt file dir`). Is there any way to have truecrypt automatically unmount the container after a given amount of inactivity in `dir`?


How to Execute multiple command using nohup

I want to execute multiple command using nohup, And each command should execute after previous command, I used this command for example:               nohup wget $url && wget $url2 > /dev/null 2>&1 &      But this command didn't work. What is the command for this propose? Any help would be much appreciated.


Fastest way to open all files in a directory with multiple file extensions on commandline

If I want to open all `mp4` files in a directory, I can simply do something like `totem *.mp4`. But how can I open all `mp4` and all `flv` files in that directory with one command. I.e. I want to do something like this `totem (*.mp4 OR *.flv)`. What's the easiest way to do this? Perhaps it helps that I am using `zsh`.


Number lines according to their content

I would like to number lines according to their content: the first line gets number 1, the second line gets number 2 if it's identical to the first and number 1 if it's different, and so on. For example:               asdf     asdf     asdf     asdf     dfg     dfg     dfg     qwert     qwert     er     qwert     er     asdf      Should result in:               1   asdf     2   asdf     3   asdf     4   asdf     1   dfg     2   dfg     3   dfg     1   qwert     2   qwert     1   er     3   qwert     2   er     5   asdf


How to create a Emacs file that looks/feels likes the Emacs start up page?

The Emacs start up page has image, link, and fonts with different size all in one. How can I create a page like that?


Remotely access Linux box with no IP address

I have two *nix boxes that are connected via ethernet. However I only have physical access to one of them. In working on the "remote" computer I messed up the ifcfg-eth0 file and instead of typing IPADDR= I typed IPPADDR (note the extra P). So at this point I believe the network boot script is still correctly loading the device drivers but obviously it will fail trying to set the IP address of the device. So, knowing only the MAC address of the "remote" computer and that the network cable goes directly from my computer to the "remote" computer, is there any way I can connect to this system and correct the ifcfg-eth0 file without gaining physical access?


cp vs. cat to copy a file

`cp a b` and `cat a > b`, what's the difference? In x86 install script of linux kernel's source tree (`arch/x86/boot/install.sh`), both are used:               cat $2 > $4/vmlinuz     cp $3 $4/System.map      Why don't they just keep the same format if one is better than the other?


Java code to copy files from one linux machine to another linux machine

I'm looking for java code to copy files to a remote linux system. I have tried `Runtime.getRuntime().exec()` function by passing an `scp` command, but each time I run the program it is asking for the remote system password. I'd like to avoid that. I looked at the `Jsch` library -- using this I can login to a remote system -- but I can't copy the files to the remote system. Once I login I can do `scp` to my host but again it requires the host system username and password. However, I only have the remote system's information.


How to find every file that includes a given function?

I am trying to list all of the files that include a function, e.g., `matrixCal`. How can I to do this in linux?


Touchpad - Have to wait for the left click to work

I have a touchpad that worked right away after I installed Debian, but recently I've had a problem: If I try to select text, I have to stop moving my finger on the pad for one second of so after pressing the left click before starting to move again to actually select what I want. But that's not the strangest part of it. I have a second set of "mouse buttons" just above and the left button of the set works normally... It can't be that the computer needs some time so understand that the button got clicked because for simple clicks (not click and hold), it works instantly. Which means somewhere, in a configuration file, something tells gnome 3 or whatever gets the input that it should wait 1s before considering a "click and hold" as a "click and hold". Would someone know where this could be and how to fix it? I went through this but I couldn't find anything that looked like it could help...


iptables rules too restrictive; Drupal webserver cannot access repositories, ntp or even websites

This is a Drupal website running Ubuntu 12.04 LTS on Linode. Someone recently changed our iptables rules and a number of problems started. These include:   1. Our Mollom spam protection is not working on the Drupal site because the server cannot reach the external service. (more details below)   2. Drupal reports, "Your system or network configuration does not allow Drupal to access web pages, resulting in reduced functionality." (more details below)   3. the server cannot ping the Internet  ping google.com   ping: unknown host google.com   4. Other network services fail. For example: $ sudo ntpdate ntp.ubuntu.com Exiting, name server cannot be used: Temporary failure in name resolution (-3) 1 Jun 16:42:34 ntpdate[7420]: name server cannot be used: Temporary failure in name resolution (-3)   apt-get update Err http://us.archive.ubuntu.com precise Release.gpg   Temporary failure resolving 'us.archive.ubuntu.com' Err http://security.ubuntu.com precise-security Release.gpg   Temporary failure resolving 'security.ubuntu.com'   5. The server is running very poorly. Could errors like the following one be related to inability to access the Internet due to iptables rules? Out of memory: Kill process 2300 (mysqld) score 129 or sacrifice child Killed process 2300 (mysqld) total-vm:354780kB, anon-rss:53180kB, file-rss:0kB Out of memory: Kill process 5937 (mysqld) score 60 or sacrifice child Killed process 5937 (mysqld) total-vm:344040kB, anon-rss:78988kB, file-rss:0kB Here are the Drupal errors in more detail. Drupal configuration was not changed -- only iptables was changed afaik: 1\. HTTP request status Fails Your system or network configuration does not allow Drupal to access web pages, resulting in reduced functionality. This could be due to your webserver configuration or PHP settings, and should be resolved in order to download information about available updates, fetch aggregator feeds, sign in via OpenID, or use other network-dependent services. If you are certain that Drupal can access web pages but you are still seeing this message, you may add $conf['drupal_http_request_fails'] = FALSE; to the bottom of your settings.php file. 2\. Mollom API keys Service error The Mollom API keys could not be verified. Please try again later. This issue prevents members from registering for our site or posting comments. Here are the current (problematic) iptables rules. (BTW, port 2222 was originally the SSH port. Now someone changed SSH back to port 22, but apparently left port 2222 open in iptables, but that's a separate issue):               # iptables -nL     Chain INPUT (policy DROP)     target     prot opt source               destination              fail2ban-apache-overflows  tcp  --  0.0.0.0/0            0.0.0.0/0            multiport dports 80,443     fail2ban-apache  tcp  --  0.0.0.0/0            0.0.0.0/0            multiport dports 80,443     DROP       all  --  69.30.238.162        0.0.0.0/0                DROP       all  --  121.205.199.140      0.0.0.0/0                DROP       all  --  137.117.129.250      0.0.0.0/0                DROP       all  --  117.26.252.26        0.0.0.0/0                DROP       all  --  112.111.165.71       0.0.0.0/0                DROP       all  --  175.42.95.145        0.0.0.0/0                ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:80 state NEW,ESTABLISHED     ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:2222 state NEW,ESTABLISHED     ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:443 state NEW,ESTABLISHED     ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:22     ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:2222          Chain FORWARD (policy DROP)     target     prot opt source               destination                   Chain OUTPUT (policy ACCEPT)     target     prot opt source               destination              ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp spt:80 state ESTABLISHED     ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp spt:2222 state ESTABLISHED     ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp spt:443 state ESTABLISHED     ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp spt:22     ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp spt:2222          Chain fail2ban-apache (1 references)     target     prot opt source               destination              RETURN     all  --  0.0.0.0/0            0.0.0.0/0                     Chain fail2ban-apache-overflows (1 references)     target     prot opt source               destination              RETURN     all  --  0.0.0.0/0            0.0.0.0/0        My question: since I know nothing about fail2ban configuration, what are the minimal changes I can make that will restore basic functionality (especially for outgoing services as those appear to be the main problem)? UPDATE: based on answer from Michael Kjörling, here are the updated iptables rules. Is this correct?               # cat iptables.modified.rules      # Generated by iptables-save v1.4.12 on Sat Jun  1 21:26:17 2013     *security     :INPUT ACCEPT [60016:6837978]     :FORWARD ACCEPT [0:0]     :OUTPUT ACCEPT [60450:61970107]     COMMIT     # Completed on Sat Jun  1 21:26:17 2013     # Generated by iptables-save v1.4.12 on Sat Jun  1 21:26:17 2013     *raw     :PREROUTING ACCEPT [72450:7582406]     :OUTPUT ACCEPT [60450:61970107]     COMMIT     # Completed on Sat Jun  1 21:26:17 2013     # Generated by iptables-save v1.4.12 on Sat Jun  1 21:26:17 2013     *nat     :PREROUTING ACCEPT [7899:447793]     :INPUT ACCEPT [7787:439884]     :OUTPUT ACCEPT [5818:4357219]     :POSTROUTING ACCEPT [5818:4357219]     COMMIT     # Completed on Sat Jun  1 21:26:17 2013     # Generated by iptables-save v1.4.12 on Sat Jun  1 21:26:17 2013     *mangle     :PREROUTING ACCEPT [72450:7582406]     :INPUT ACCEPT [72450:7582406]     :FORWARD ACCEPT [0:0]     :OUTPUT ACCEPT [60450:61970107]     :POSTROUTING ACCEPT [60450:61970107]     COMMIT     # Completed on Sat Jun  1 21:26:17 2013     # Generated by iptables-save v1.4.12 on Sat Jun  1 21:26:17 2013     *filter     :INPUT DROP [44:2387]     :FORWARD DROP [0:0]     :OUTPUT ACCEPT [78:41503]     :fail2ban-apache - [0:0]     :fail2ban-apache-overflows - [0:0]     -A INPUT -s 69.30.238.162/32 -j DROP     -A INPUT -s 121.205.199.140/32 -j DROP     -A INPUT -s 137.117.129.250/32 -j DROP     -A INPUT -s 117.26.252.26/32 -j DROP     -A INPUT -s 112.111.165.71/32 -j DROP     -A INPUT -s 175.42.95.145/32 -j DROP     -A INPUT -p tcp -m multiport --dports 80,443 -j fail2ban-apache-overflows     -A INPUT -p tcp -m multiport --dports 80,443 -j fail2ban-apache     -A INPUT -i eth0 -p tcp -m state --state RELATED,ESTABLISHED -j ACCEPT     -A INPUT -i eth0 -p tcp -m tcp --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT     -A INPUT -i eth0 -p tcp -m tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT     -A INPUT -i eth0 -p tcp -m tcp --dport 22 -j ACCEPT     -A INPUT -p udp -m state --state RELATED -j ACCEPT     -A INPUT -p icmp -j ACCEPT     -A fail2ban-apache -j RETURN     -A fail2ban-apache-overflows -j RETURN     COMMIT     # Completed on Sat Jun  1 21:26:17 2013


Old HP nc4400 laptop on Debian, fan turns on for 10 secs, then off for 20 secs

I run Debian 7 on an HP nc4400 laptop. This is an old laptop with an Intel Centrino chipset. It runs fine except that the fan turns on for 10 seconds, then off for 20 seconds and then on for 10 seconds, and so on. The BIOS doesn't say anything on ACPI or APM. `dmesg | grep -i "acpi"` returns this:               0317)     [    0.229900] ACPI: Dynamic OEM Table Load:     [    0.229904] ACPI: SSDT   (null) 001FB (v01 HP      Cpu0Ist 00003000 INTL 20060317)     [    0.230045] ACPI: SSDT 7f7f629b 004CB (v01 HP      Cpu0Cst 00003001 INTL 20060317)     [    0.230435] ACPI: Dynamic OEM Table Load:     [    0.230439] ACPI: SSDT   (null) 004CB (v01 HP      Cpu0Cst 00003001 INTL 20060317)     [    0.230701] ACPI: SSDT 7f7f5f53 000C8 (v01 HP      Cpu1Ist 00003000 INTL 20060317)     [    0.231101] ACPI: Dynamic OEM Table Load:     [    0.231105] ACPI: SSDT   (null) 000C8 (v01 HP      Cpu1Ist 00003000 INTL 20060317)     [    0.231211] ACPI: SSDT 7f7f6216 00085 (v01 HP      Cpu1Cst 00003000 INTL 20060317)     [    0.231603] ACPI: Dynamic OEM Table Load:     [    0.231606] ACPI: SSDT   (null) 00085 (v01 HP      Cpu1Cst 00003000 INTL 20060317)     [    0.244084] ACPI: Interpreter enabled     [    0.244100] ACPI: (supports S0 S3 S4 S5)     [    0.244121] ACPI: Using IOAPIC for interrupt routing     [    0.244789] PCI: MMCONFIG at [mem 0xf8000000-0xfbffffff] reserved in ACPI motherboard resources     [    0.245206] [Firmware Bug]: ACPI: No _BQC method, cannot determine initial brightness     [    0.260264] ACPI: Power Resource [C220] (on)     [    0.262871] ACPI: Power Resource [C228] (on)     [    0.269881] ACPI: Power Resource [C329] (off)     [    0.269959] ACPI: Power Resource [C32A] (off)     [    0.270035] ACPI: Power Resource [C32B] (off)     [    0.270113] ACPI: Power Resource [C32C] (off)     [    0.270888] ACPI: EC: GPE = 0x16, I/O: command/status = 0x66, data = 0x62     [    0.271132] ACPI: No dock devices found.     [    0.271142] PCI: Ignoring host bridge windows from ACPI; if necessary, use "pci=use_crs" and report a bug     [    0.274594] ACPI: PCI Root Bridge [C002] (domain 0000 [bus 00-ff])     [    0.283058] pci 0000:00:1f.0: quirk: [io  0x1000-0x107f] claimed by ICH6 ACPI/GPIO/TCO     [    0.285079] ACPI: PCI Interrupt Routing Table [\_SB_.C002._PRT]     [    0.285255] ACPI: PCI Interrupt Routing Table [\_SB_.C002.C098._PRT]     [    0.285357] ACPI: PCI Interrupt Routing Table [\_SB_.C002.C101._PRT]     [    0.285421] ACPI: PCI Interrupt Routing Table [\_SB_.C002.C111._PRT]     [    0.285491]  pci0000:00: Requesting ACPI _OSC control (0x1d)     [    0.285495]  pci0000:00: ACPI _OSC request failed (AE_NOT_FOUND), returned control mask: 0x1d     [    0.285498] ACPI _OSC control for PCIe not granted, disabling ASPM     [    0.298542] ACPI: PCI Interrupt Link [C10D] (IRQs *10 11)     [    0.298640] ACPI: PCI Interrupt Link [C10E] (IRQs *10 11)     [    0.298735] ACPI: PCI Interrupt Link [C10F] (IRQs 10 *11)     [    0.298829] ACPI: PCI Interrupt Link [C110] (IRQs 10 11) *5     [    0.298923] ACPI: PCI Interrupt Link [C123] (IRQs *10 11)     [    0.299016] ACPI: PCI Interrupt Link [C124] (IRQs *10 11)     [    0.299110] ACPI: PCI Interrupt Link [C125] (IRQs 10 *11)     [    0.299152] ACPI Exception: AE_NOT_FOUND, Evaluating _PRS (20110623/pci_link-184)     [    0.299282] PCI: Using ACPI for IRQ routing     [    0.306278] pnp: PnP ACPI init     [    0.306293] ACPI: bus type pnp registered     [    0.306470] system 00:00: Plug and Play ACPI device, IDs PNP0c01 (active)     [    0.310002] pnp 00:01: Plug and Play ACPI device, IDs PNP0a08 PNP0a03 (active)     [    0.310352] pnp 00:02: Plug and Play ACPI device, IDs IFX0102 PNP0c31 (active)     [    0.310415] pnp 00:03: Plug and Play ACPI device, IDs PNP0c04 (active)     [    0.310472] pnp 00:04: Plug and Play ACPI device, IDs PNP0200 (active)     [    0.310520] pnp 00:05: Plug and Play ACPI device, IDs PNP0800 (active)     [    0.310576] pnp 00:06: Plug and Play ACPI device, IDs PNP0b00 (active)     [    0.310690] pnp 00:07: Plug and Play ACPI device, IDs PNP0103 (active)     [    0.310749] pnp 00:08: Plug and Play ACPI device, IDs PNP0303 (active)     [    0.310804] pnp 00:09: Plug and Play ACPI device, IDs SYN010f SYN0100 SYN0002 PNP0f13 (active)     [    0.311066] system 00:0a: Plug and Play ACPI device, IDs PNP0c02 (active)     [    0.311677] pnp 00:0b: Plug and Play ACPI device, IDs HPQ0004 (active)     [    0.311845] system 00:0c: Plug and Play ACPI device, IDs PNP0c02 (active)     [    0.312175] system 00:0d: Plug and Play ACPI device, IDs PNP0c02 (active)     [    0.312190] pnp: PnP ACPI: found 14 devices     [    0.312192] ACPI: ACPI bus type pnp unregistered     [    0.312197] PnPBIOS: Disabled by ACPI PNP     [    0.694522] acpiphp: ACPI Hot Plug PCI Controller Driver version: 0.5     [    0.694789] acpiphp: Slot [1] registered     [    1.209623] ACPI: Thermal Zone [TZ0] (43 C)     [    1.245239] ACPI: Thermal Zone [TZ1] (47 C)     [    1.245347] ACPI: Fan [C32D] (off)     [    1.245425] ACPI: Fan [C32E] (off)     [    1.245503] ACPI: Fan [C32F] (off)     [    1.245582] ACPI: Fan [C330] (off)     [    1.264245] ACPI: Thermal Zone [TZ2] (38 C)     [    1.274458] ACPI: Thermal Zone [TZ3] (27 C)     [    1.278192] ACPI: Thermal Zone [TZ4] (72 C)     [    1.770523] ata1.00: ACPI cmd f5/00:00:00:00:00:a0 (SECURITY FREEZE LOCK) filtered out     [    1.782791] ata1.00: ACPI cmd c6/00:10:00:00:00:a0 (SET MULTIPLE MODE) succeeded     [    1.782796] ata1.00: ACPI cmd ef/10:03:00:00:00:a0 (SET FEATURES) filtered out     [    1.830495] ata1.00: ACPI cmd f5/00:00:00:00:00:a0 (SECURITY FREEZE LOCK) filtered out     [    1.842790] ata1.00: ACPI cmd c6/00:10:00:00:00:a0 (SET MULTIPLE MODE) succeeded     [    1.842794] ata1.00: ACPI cmd ef/10:03:00:00:00:a0 (SET FEATURES) filtered out     [    2.559585] ACPI: Requesting acpi_cpufreq     [    2.573303] ACPI: Sleep Button [C249]     [    2.573433] ACPI: Lid Switch [C241]     [    2.578133] ACPI: acpi_idle registered with cpuidle     [    2.579241] ACPI: Power Button [PWRF]     [    2.608481] ACPI: AC Adapter [C1B2] (on-line)     [    2.619330] [Firmware Bug]: ACPI: No _BQC method, cannot determine initial brightness     [    2.620666] acpi device:01: registered as cooling_device6     [    2.620899] ACPI: Video Device [C085] (multi-head: yes  rom: no  post: no)     [    2.669097] ACPI: Battery Slot [C1B4] (battery present)     [    2.669211] ACPI: Battery Slot [C1B3] (battery absent)     [    3.865996] snd_hda_intel 0000:00:1b.0: power state changed by ACPI to D0     [    3.866008] snd_hda_intel 0000:00:1b.0: power state changed by ACPI to D0     [    7.577461] input: ACPI Virtual Keyboard Device as /devices/virtual/input/input11      I ran `lm_sensors` and had it add a line to a config file I don't really remember - but it didn't help. (Edit: it added 'loop' and 'coretemp' to /etc/modules and had me restart a service to effectuate it.) I can have the fan turned on permanently from the BIOS when running on AC power but I'd rather I would turn on or off when necessary, not constantly on and off every 10-20 seconds.


Webserver for Embedded Linux

I am building an ARM based embedded device running embedded linux having a web based interface and I need a webserver running on my device. At maximum it will get 50 requests at a time. I have on board 1 GB RAM. I will also need HTTPS. The webserver should not consume too much memory (of-course as its an embedded device). It should support dynamic contents (so I guess Boa is out). My website should also be able to support HTML5. Following are some of the options I have looked into but open to suggestions.   * lighttpd   * nginx   * Hiawatha   * thttpd   * Boa Any feedback / input / pointer is welcome


Include domain name or not in /etc/hosts?

I am setting up a VMWare cluster of CentOS nodes. Is it best practice to include a domain name after the machine? What are the potential problems of leaving it out? Does a domain complicate configuration or simplify it? For example, if my node is at `192.168.1.93`, should I change `/etc/hosts` from               127.0.0.1 localhost.localdomain localhost      to               127.0.0.1 localhost.cluster localhost     192.168.1.93 computernode1.cluster computenode1      or               127.0.0.1 localhost     192.168.1.93 computenode1      or               #127.0.0.1 localhost     192.168.1.93 computenode1      or               192.168.1.93 localhost     192.168.1.93 computenode1


What is meant by a shell is in "vi" mode or "emacs" mode?

This question follows directly from the answer to one of my previous questions here. I am newbie to unix world and this site has helped a lot to understand some core concepts. In this case I am specifically unable to understand the part which says: > In that regard, its behaviour is closer to emacs' than with > bash(readline)/ksh/zsh emacs mode, but departs from the terminal driver > embedded line editor (in canonical mode), where Ctrl-W deletes the previous > word (werase, also in vi). I dropped a comment to that answer but probably I was asking for too much information there. So I thought I would rather post a separate question. So here we are talking about shells and not editors which are two completely different programs. What does it mean to say shell is in some editor mode? P.S: You can base your answer on the premise that I understand what a shells is and how to use vim for basic editing. Also feel free to add more relevant tags.


Internet disappears regularly

About a month ago I installed the newest version of Linux Mint (14).   I use Linux the whole day on my laptop but every 1-2 hours my internet connection (Wi-Fi) magically disappears for about 10 minutes.   I get this error when I try to open a website in Chrome: > The server at google.com can't be found, because the DNS lookup failed. DNS > is the network service that translates a website's name to its Internet > address. This error is most often caused by having no connection to the > Internet or a misconfigured network. It can also be caused by an > unresponsive DNS server or a firewall preventing Google Chrome from > accessing the network. There is also no "ping" when I open the terminal. I also have Windows installed on the same machine, but I never experience issues like this while using Windows.   When the internet is gone on Linux, it's still available on my phone over the same Wi-Fi. So the internet connection itself works perfectly fine. Does anybody have an idea?


Torify in KDE on 12.04 - all connections through tor

http://freemarketlinux.com/2012/10/16/torify-your-ubuntu- linux-12-0412-10-operating-system/ There is no such option in my KDE4 settings. I squeezed google and the software center for missing packages but no useful result. So im here to find a solution. QUESTION: How to fully torify KDE4 on 12.04 as in the gnome tutorial stated above? EDIT: ![proxysetting missing?](http://i.stack.imgur.com/KHAyQ.png) ![proxy settings not working for me](http://i.stack.imgur.com/FOWYc.png) ![Foxyproxy is working](http://i.stack.imgur.com/r1jxo.png)


Cal no space delimiter

I am an OpenBSD user and I am writing an awk script which automatically generates TeX course calendars for all courses that I teach. To obtain actual calendar out of the system I use Unix cal command. The problem is that the output of the cal command uses spaces as a delimiters which creates all sorts of problems when I apply my nawk script to it. I looked the source code for cal and seems that nothing short of hacking the source code will force cal command to use delimiter other than the space. What would be the simplest way to get calendar to look like this                       June 2012     Su, Mo, Tu, We, Th, Fr, Sa       ,   ,   ,   ,   ,  1,  2      3,  4,  5,  6,  7,  8,  9     10, 11, 12, 13, 14, 15, 16     17, 18, 19, 20, 21, 22, 23     24, 25, 26, 27, 28, 29, 30


Resources to learn shell scripting

I have been using GNU/Linux for sometime now (Ubuntu and Fedora) and now I am trying to learn shell scripting from scratch. I would really appreciate if someone can guide me on choosing right documentation/links to start off with. **PS:** I can create simple scripts and can understand slightly complex ones. Any help in this regards will be highly appreciated!


How to stop appearance of ^T% in the first line when I open a new lxterminal tab with ^T in zsh?

Steps to reproduce:   1. Have zsh as default shell.   2. Open a new terminal. for example, with `Ctrl`+`Alt`+`T`.   3. Press `Ctrl`+`Shift`+`T` to open a new terminal tab.   4. `^T%` appears as the first line I'm running ubuntu 11.10 with lxde and zsh-4.3.11. Gnome-terminal doesn't have this problem. Contents of `/etc/zsh/zshrc`:               # /etc/zsh/zshrc: system-wide .zshrc file for zsh(1).     #     # This file is sourced only for interactive shells. It     # should contain commands to set up aliases, functions,     # options, key bindings, etc.     #     # Global Order: zshenv, zprofile, zshrc, zlogin          READNULLCMD=${PAGER:-/usr/bin/pager}          if [[ "$TERM" != emacs ]]; then     [[ -z "$terminfo[kdch1]" ]] || bindkey -M emacs "$terminfo[kdch1]" delete-char     [[ -z "$terminfo[khome]" ]] || bindkey -M emacs "$terminfo[khome]" beginning-of-line     [[ -z "$terminfo[kend]" ]] || bindkey -M emacs "$terminfo[kend]" end-of-line     [[ -z "$terminfo[kich1]" ]] || bindkey -M emacs "$terminfo[kich1]" overwrite-mode     [[ -z "$terminfo[kdch1]" ]] || bindkey -M vicmd "$terminfo[kdch1]" vi-delete-char     [[ -z "$terminfo[khome]" ]] || bindkey -M vicmd "$terminfo[khome]" vi-beginning-of-line     [[ -z "$terminfo[kend]" ]] || bindkey -M vicmd "$terminfo[kend]" vi-end-of-line     [[ -z "$terminfo[kich1]" ]] || bindkey -M vicmd "$terminfo[kich1]" overwrite-mode          [[ -z "$terminfo[cuu1]" ]] || bindkey -M viins "$terminfo[cuu1]" vi-up-line-or-history     [[ -z "$terminfo[cuf1]" ]] || bindkey -M viins "$terminfo[cuf1]" vi-forward-char     [[ -z "$terminfo[kcuu1]" ]] || bindkey -M viins "$terminfo[kcuu1]" vi-up-line-or-history     [[ -z "$terminfo[kcud1]" ]] || bindkey -M viins "$terminfo[kcud1]" vi-down-line-or-history     [[ -z "$terminfo[kcuf1]" ]] || bindkey -M viins "$terminfo[kcuf1]" vi-forward-char     [[ -z "$terminfo[kcub1]" ]] || bindkey -M viins "$terminfo[kcub1]" vi-backward-char          # ncurses fogyatekos     [[ "$terminfo[kcuu1]" == ""* ]] && bindkey -M viins "${terminfo[kcuu1]/O/[}" vi-up-line-or-history     [[ "$terminfo[kcud1]" == ""* ]] && bindkey -M viins "${terminfo[kcud1]/O/[}" vi-down-line-or-history     [[ "$terminfo[kcuf1]" == ""* ]] && bindkey -M viins "${terminfo[kcuf1]/O/[}" vi-forward-char     [[ "$terminfo[kcub1]" == ""* ]] && bindkey -M viins "${terminfo[kcub1]/O/[}" vi-backward-char     [[ "$terminfo[khome]" == ""* ]] && bindkey -M viins "${terminfo[khome]/O/[}" beginning-of-line     [[ "$terminfo[kend]" == ""* ]] && bindkey -M viins "${terminfo[kend]/O/[}" end-of-line     [[ "$terminfo[khome]" == ""* ]] && bindkey -M emacs "${terminfo[khome]/O/[}" beginning-of-line     [[ "$terminfo[kend]" == ""* ]] && bindkey -M emacs "${terminfo[kend]/O/[}" end-of-line     fi          zstyle ':completion:*:sudo:*' command-path /usr/local/sbin /usr/local/bin \                      /usr/sbin /usr/bin /sbin /bin /usr/X11R6/bin          unalias run-help     autoload run-help          # If you don't want compinit called here, place the line     # skip_global_compinit=1     # in your $ZDOTDIR/.zshenv or $ZDOTDIR/.zprofice     if [[ -z "$skip_global_compinit" ]]; then       autoload -U compinit       compinit     fi      Contents of `~/.zshrc`:               # The following lines were added by compinstall          zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate     zstyle ':completion:*' group-name ''     zstyle ':completion:*' list-colors ''     zstyle ':completion:*' matcher-list '' 'm:{[:lower:]}={[:upper:]} m:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'r:|[._-]=* r:|=*' '+l:|=* r:|=*'     zstyle :compinstall filename '/home/kirill/.zshrc'          autoload -Uz compinit promptinit zcalc zsh-mime-setup     compinit     promptinit     zsh-mime-setup     # End of lines added by compinstall     # Lines configured by zsh-newuser-install     HISTFILE=~/.histfile     HISTSIZE=10000     SAVEHIST=10000     setopt appendhistory autocd extendedglob notify sharehistory     setopt HIST_EXPIRE_DUPS_FIRST     #{{{ Shell Conveniences          # some more ls aliases     alias ls='ls --color'     alias lt='ls --color -ltr'     alias ll='ls -l'     alias lh='ls -l -h'     alias la='ls -A'     alias l='ls -CF'     alias vir='vim -R'     alias vimnw='vim -R +"set nowrap"'     alias tok='top -n1 -b -u kirill'     alias gt='gnome-terminal'     alias gts='gnome-terminal --window-with-profile=shnurov'          #alias tv='/usr/toolworks/totalview.8.6.2-2/bin/totalview'     #alias mpic='mpiCC.openmpi -o main -I/usr/local/include/boost-1_39/ main.cc -Llibdir -lboost_mpi-gcc43-mt-1_39 -lboost_serialization-gcc43-mt-1_39'     #alias mpir='mpirun.openmpi -np 7 ./main'     alias sage='~/progs/sage-4.8/sage'     #alias gmolden='/home/kirill/progs/molden/gmolden'     #alias molden='/home/kirill/progs/molden/molden'     #export LD_LIBRARY_PATH=/home/kirill/progs/molekel_5_4_0_linux_x86_64/lib:$LD_LIBRARY_PATH     #alias molekel='/home/kirill/progs/molekel_5_4_0_linux_x86_64/bin/Molekel'     #alias molekel='source /home/kirill/progs/molekel_5_4_0_linux_x86_64/launch_molekel.sh'     alias duh='du -s -h'     alias mam='make; time ./main'     alias mac='make clean;make;time ./main'     alias atdtool='~/progs/atdtool/atdtool'     alias acro='acroread -openInNewWindow'          #}}}     bindkey -e               bindkey "^[[A" history-beginning-search-backward     bindkey "^[[B" history-beginning-search-forward     # End of lines configured by zsh-newuser-install     # Customize to your needs...     export PATH=/opt/intel/composer_xe_2011_sp1.6.233/bin/intel64:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/intel/composer_xe_2011_sp1.6.233/mpirt/bin/intel64     #source /opt/intel/bin/compilervars.sh intel64          autoload -U colors && colors          PROMPT="%{$fg[red]%}%*%{$reset_color%}.%{$fg[cyan]%}%~%{$reset_color%}     %{$reset_color%}%{$fg[magenta]%}>%{$reset_color%}"     #PROMPT="${fg_red}%*${fg_white}${at_normal}.${fg_cyan}%~${fg_white}  ${bg_grey}     #${at_normal}${fg_white}>${at_normal}"


Allow non-admin users to install packages via apt or rpm?

Is it possible to allow non-root users to install packages system-wide using apt or rpm? The place where I work currently has an out of date setup on the linux boxes, and admins are sick of having to do all the installations for users on request, so they are thinking of giving full sudo rights to all users. This has obvious security disadvantages. So I'm wondering if there's a way to allow normal users to install software - and to upgrade and remove it?


Samba Share Folder reports that no space is avaiable even though disk is not full

I have a home server with a 2TB Harddisk wich I use to store data. To do so over the network, I use Samba and have two different samba shares I have Debian Wheezy as OS Currently, 42% (729GB) of 1.8GB are taken. If I now try to store data on one of the shared folders, the windows explorer reports that there is not enough space left. Interestingly enough, this error only occurs when I try to store data within a folder (e. g.: //share/folder) but not directly into the share (//share). I didn't set up any quote! Why is the space restricted when I store data in a folder (it does not matter which folder!)


can /boot be on a different drive than grub or lilo?

I just got a vizio CN15-A5 laptop, which has both a 1TB HDD and a 32G SDD. I am going to use the SSD with dm-cache, however, I would to make /boot a partition on the SSD, and the laptop's BIOS doesn't support booting off of the SSD. Before I make my system unbootable on accident...can GRUB or LILO be installed on on /dev/sda and fire up /boot from /dev/sdb? Do you think it would improve boot time much or at all?


How to make 1:52 to 01:52 with eg.: sed?

INPUT:               a|2013.06.13. 13:22|xx     b|2013.06.13. 1:52 |xx     c|2013.06.13. 2:26 |xx      OUTPUT:               a|2013.06.13. 13:22|xx     b|2013.06.13. 01:52 |xx     c|2013.06.13. 02:26 |xx      How can I make the 1:52 to 01:52 in this case? UPDATE: Thanks! These are working great, but how can I remove the space between the minutes and the "|" if 0 were added?               $ sed -e 's/ \([0-9]:\)/ 0\1/' b.txt      a|2013.06.13. 13:22|xx     b|2013.06.13. 01:52 |xx     c|2013.06.13. 02:26 |xx     $ perl -wpe 's/(\d+):/sprintf( "%02d:",$1)/e' b.txt      a|2013.06.13. 13:22|xx     b|2013.06.13. 01:52 |xx     c|2013.06.13. 02:26 |xx     $       wow.. :)


List of available services

Is there any command that would show all the **available services** in my wheezy Debian based OS? I know that in order to see all the **running services** you can use `service --status-all`.


Rsync after copy

Does Rsync after copy only send the differences between the folders, or does it copy the entire folder again since Rsync has never been implemented before on that folder?


Crontab Change location

I want to set a personal crontab in another folder and executed. For example I want it in /home/project/tasks/crontab Like that it's easier to add/delete tasks. Thank you for your answers.


Get PID of the application running in the active terminal emulator

My end goal is to be able to open a new terminal window (`urxvt`) directly in the current working directory of the program running in the window currently active. I'm currently using the shell (Bash), but I don't have anything against alternatives. So far, I've got the ID of the current active window using `xdotool`:               wid=$(xdotool getactivewindow)      and the PID of its process using `xprop`:               pid=$(xprop -id $wid _NET_WM_PID | awk '{print $NF}')      but this is not the PID I'm looking for. **I want the PID of the process running in the terminal displayed in that window.** For now, I mostly want the case of a `bash` shell running in that window, but I don't see why it would depend on that. I can already get CWD from a PID using `cwd="$(readlink /proc/$pid/cwd)"`.


How can I use command line telnet client to open a raw connection - like PuTTY?

I need to use telnet to talk with a socket server which is not a standard Telnet server. I do not want any Telnet negotioation or interference of any kind in the data. This is available as 'raw mode' in PuTTy and I need the same functionality in Linux.


Unstable network on integrated Debian environment

Good afternoon, I recently installed Debian Wheezy (7.0) on a freescale board ( _SABRE MCIMX6Q / iMX6Q_ ) and discovered some disturbing lags for all network communications. What I have tried so far was to set the network configuration in _/etc/network/interfaces_ to static values instead of DHCP and I checked the OS load as well: > 13:20:51 up 31 min, 2 users, load average: 4.75, 4.67, 3.89 The _top_ command may consume up to 15% CPU which seems very high as well. For the OS installation we used a pre-built u-boot.bin, uImage and a Wheezy RootFS (Hard-Float). Kernel which was compiled for wrong hardware by any chance? Whereas other network members have low response times, this one lags even when pinging a machine on the same network, here is a short excerpt of the output of a ping command: ![enter image description here](http://i.stack.imgur.com/uZQrx.jpg) And below is the board if it helps, perhaps it's a specific problem. ![enter image description here](http://i.stack.imgur.com/5lTld.jpg) **Full size image here:** http://i.stack.imgur.com/EWvR7.jpg


Reordering strings in linux

How can I change lines around using the command line?   e.g. I have these lines:                   Acct-Status-Type = Start         User-Name = "37XXXXXXX"         Event-Timestamp = "Apr 12 2013 15:56:55 AMT"      I need to change the order to this:                   Event-Timestamp = "Apr 12 2013 15:56:55 AMT"         User-Name = "37XXXXXXX"         Acct-Status-Type = Start      I need to do this by one command, sed, awk, perl or something like that.


How do I recover files from a single degraded mdadm raid1 drive? "not enough to start the array"

Given a single raid1 drive in degraded/rebuilding state, can it be force mounted? I'd like to recover all the files before undertaking the dangerous operation of pairing it and rebuilding. As far as I can tell the drive is in perfectly good shape, fully intact. The pair drive is partly failed. If the drive was not in rebuilding state I'd know exactly what to do. Here is what I have tried:               # mdadm --verbose --assemble /dev/md8 /dev/sdb1  --force     mdadm: looking for devices for /dev/md8     mdadm: /dev/sdb1 is identified as a member of /dev/md8, slot 1.     mdadm: no uptodate device for slot 0 of /dev/md8     mdadm: added /dev/sdb1 to /dev/md8 as 1     mdadm: /dev/md8 assembled from 0 drives and  1 rebuilding - not enough to start the array.          # cat /proc/mdstat                            md8 : inactive sdb1[1](S)           976759808 blocks super 1.2               md0 : active raid1 sdc1[0]           976759672 blocks super 1.2 [2/1] [U_]          # mdadm --stop /dev/md8     mdadm: stopped /dev/md8          # mount /dev/sdb1 /mnt/temp2     mount: unknown filesystem type 'linux_raid_member'          # mount -o ro -t ext3 -b 2048 /dev/sdb1 /mnt/temp1     mount: wrong fs type, bad option, bad superblock on /dev/sdb1.          # foremost -i /dev/sdb -o /tmp/foo    (this results in perfectly good files)      In this particular case the `foremost` command recovers files, so something is definitely on the drive, if I could only get the superblock offset correct. And in this particular case assembling both halves of the array crashes the kernel(!), so that's not a real option anyway (aside from the safety issues). * * * UPDATE: added output of mdadm               # mdadm --examine /dev/sdb1     /dev/sdb1:               Magic : a92b4efc             Version : 1.2         Feature Map : 0x2          Array UUID : e00a291e:016bbe47:09526c90:3be48df3                Name : ubuntu:0       Creation Time : Wed May 11 12:26:39 2011          Raid Level : raid1        Raid Devices : 2           Avail Dev Size : 1953519616 (931.51 GiB 1000.20 GB)          Array Size : 1953519344 (931.51 GiB 1000.20 GB)       Used Dev Size : 1953519344 (931.51 GiB 1000.20 GB)         Data Offset : 2048 sectors        Super Offset : 8 sectors     Recovery Offset : 0 sectors               State : clean         Device UUID : 41346f44:ccacbbf7:0c17c133:eb7b341f              Update Time : Sat Apr 13 00:02:08 2013            Checksum : 483a0a44 - correct              Events : 402833                  Device Role : Active device 1        Array State : AA ('A' == active, '.' == missing)


How to SSH apache user from a remote guest server on VirtualBox with host-only network?

I have two CentOS virtual machines on VirtualBox . one of them let's say CentOS-1 holds my Web application code. Second is CentOS2. I have two network connections between these two servers : Bridged & Host-only .               CentOS-1 : for Bridged connection the ip is : 192.168.0.137     for Host-only connection the ip is : 192.168.1.137          CentOS-2 : for Bridged connection the ip is : 192.168.0.101     for Host-only connection the ip is : 192.168.1.101      in my php web page when I try to ssh like this :                exec('ssh -p 22 root@192.168.0.101 2>&1 ',$output);      it's working, but when I'm trying to ssh to the host-only network ip :                exec('ssh -p 22 root@192.168.1.101 2>&1 ',$output);      I got this as an output :               ssh: connect to host 192.168.1.101 port 22: No route to host      I tried to re-generate public key for 192.168.0.137 and copy it to 192.168.0.101 but it didn't help. I also tried to give privileges to apache user : on CentOS-2 :               sudo -u apache ssh root@192.168.1.137 "pwd"     sudo -u apache ssh root@192.168.0.137 "pwd"      on CentOS-1 :               sudo -u apache ssh root@192.168.1.101 "pwd"          sudo -u apache ssh root@192.168.0.101 "pwd"      neither of the two ways worked. Is there any thing that I has missed? The output of `ifconfig -a` :               $ ifconfig -a                                                                                eth0      Link encap:Ethernet  HWaddr 08:00:27:0B:56:0E                                                                                inet addr:192.168.0.101  Bcast:192.168.0.255  Mask:255.255.255.0                                                                           inet6 addr: fe80::a00:27ff:fe0b:560e/64 Scope:Link                                                                                UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1                                                                                RX packets:5652 errors:0 dropped:0 overruns:0 frame:0                                                                                TX packets:4886 errors:0 dropped:0 overruns:0 carrier:0                                                                                collisions:0 txqueuelen:1000                                                                                RX bytes:833395 (813.8 KiB)  TX bytes:769122 (751.0 KiB)                                                                              eth1      Link encap:Ethernet  HWaddr 08:00:27:FA:C6:32                                                                                BROADCAST MULTICAST  MTU:1500  Metric:1                                                                                RX packets:0 errors:0 dropped:0 overruns:0 frame:0                                                                                TX packets:0 errors:0 dropped:0 overruns:0 carrier:0                                                                                collisions:0 txqueuelen:1000                                                                                RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)                                                                                lo        Link encap:Local Loopback                                                                                inet addr:127.0.0.1  Mask:255.0.0.0                                                                                inet6 addr: ::1/128 Scope:Host                                                                                UP LOOPBACK RUNNING  MTU:16436  Metric:1                                                                                RX packets:6315 errors:0 dropped:0 overruns:0 frame:0                                                                                TX packets:6315 errors:0 dropped:0 overruns:0 carrier:0                                                                                collisions:0 txqueuelen:0                                                                                RX bytes:878894 (858.2 KiB)  TX bytes:878894 (858.2 KiB)             and output of route :               $ sudo ifconfig eth1 inet 192.168.1.101 broadcast 192.168.1.255 netmask 255.255.255.0 up                               [sudo] password for safaa:                                                                                [safaa@AMeS101 ~]$ route                                                                                Kernel IP routing table                                                                                Destination     Gateway         Genmask         Flags Metric Ref    Use Iface                                                              192.168.1.0     *               255.255.255.0   U     0      0        0 eth1                                                               192.168.0.0     *               255.255.255.0   U     0      0        0 eth0                                                               link-local      *               255.255.0.0     U     1002   0        0 eth0                                                               default         mbox.kds.local  0.0.0.0         UG    0      0        0 eth0


How to restore desktop configs after an intallation

I have recently installed PgAdminIII and Geany via Ubuntu Software Center, but this changed my desktop configurations. It no longer looks like it did. I am using Pinguy OS 12.10 based on Ubuntu 12.10. How can I restore my configs?


grant permission in linux

I have a linux web server with 2 hard-drives. There are 2 users, one can access /home/user1 and the other user can access /home2/user2 I would like to grant user1 permissions to access /home2/users/ (recursively) without revoking user2 access to his home directory. What's the best way to do that?


How to find out all the files in other machines using bash shell script?

I am trying to find out which files are in `machineB` and which files are in `machineC`. And I need to run my shell script on `machineA` to figure out which files are in `machineB` and which files are in `machineC` I have around 300 files distributed in `machineB` and `machineC`. Now I would like to find out which file is in which machine `(machineB or machineC)`. Below is my shell script which I am running on `machineA` and `PRIMARY_PARTITION` has some file numbers and `SECONDARY_PARTITION` has some file numbers. And the files are present in this directory -               /data/snapshot/20140317      in `machineB` or `machineC` .. And the file path is like this -               t1_1980_0_200003_5.data     t1_1980_3_200003_5.data     t1_1980_5_200003_5.data     t1_1980_7_200003_5.data     t1_1980_9_200003_5.data      Here the file number is 0, 3, 5, 7, 9. Other names in the `filename` are always going to be same apart from the file numbers.               #!/bin/bash          readonly FILERS_LOCATION=(machineB machineC)     readonly MEMORY_MAPPED_LOCATION=/data/snapshot     PRIMARY_PARTITION=(0 3 5 7 9)     SECONDARY_PARTITION=(1 2 4 6 8)          dir1=20140317     dir2=20140317          echo $dir1     echo $dir2          if [ "$dir1" = "$dir2" ]     then         for el in "${PRIMARY_PARTITION[@]}"         do             # do something here may be?         done         for sl in "${SECONDARY_PARTITION[@]}"         do             # do something here may be?         done     fi      Now my question is how would I find out all the files in `machineB` and `machineC`. Meaning out of `(0 3 5 7 9)` and `(1 2 4 6 8)` which files are in `machineB` and which are in `machineC`. As an example I have shown very small set of files above. In general, I have lot of files which I am thinking its pretty difficult for me to login in machineB and machineC to find out the files.


Modifying one line in Iptables

How would one modify the following line in iptables file (debian)?               ACCEPT     all  --  XXX.XXX.XX.X         anywhere            PHYSDEV match --physdev-in vif3.1       TO               ACCEPT     all  --  YYY.YYY.YY.Y         anywhere            PHYSDEV match --physdev-in vif3.1       I looked up the https://wiki.debian.org/iptables and I'm having hard time figuring out how to exactly do this modification. Can it be done using one command, or there is a way to temporally "extract" the iptables file and modify it using nano or vi, and put it back in place?


rsync directory and contents to new location and owner

I have access to 2 group accounts: `ops_user` and `test_user`. Is it possible to copy a directory and all subdirectory owned by `ops_user` to a new directory owned by the test_user? I.e I want to copy everything from `/blah/Blah/ops` (owned by `ops-user`) to `/blah/Blah/test` (and have it owned by `test_user`). I've tried the following. Logged in as `test_user` in `/blah/Blah/test`:                rsync -avz */ ops_user@boco2:/blah/Blah/ops --owner=test_user --group=user       rsync -avzh ops_user@boco2:/blah/Blah/ops /blah/Blah/test/      rsync -avz */ ops_user@boco2:/blah/Blah/ops      rsync -avzhe ssh ops_user@boco2:/blah/Blah/ops /blah/Blah/test      Logged in as `ops_user` in `/blah/Blah/ops`:               'rsync -avz */ test_user@oco2:/blah/Blah/test'      None of these work. I read the man for rsync, but just can not figure this out. I do not have SA perms to change group owners, but thought I could copy and add test perms. Is rsync even what I should be using? Any suggestions would be greatly appreciated.


How do I find the offset of an ext4 filesystem?

I have a failing hard drive that is unable to write or read the first sectors of the disk. It just gives I/O errors and that is all there is. There are other areas on the disk that seem (mostly) fine. I am trying to mount a partition (ext4) and see if I can access some files I would like to recover. Since the `mount` command supports an `offset` option, I should be able to mount the filesystem even though the partition table is unreadable and unwriteable. The problem is how to find the offset. None of the ext4 tools seems to have this particular feature.


Update Oracle JDK

I know, there are several ways of installing ORACLE jdk7 on Debian. One way is to use the ppa from the web8updteam but i've read that installing software from ppa is not recommended on Debian. (is this true, btw??) So I decided to follow this guide to install oracle jdk. Here it's recommended to use java-package to generate a .deb package of the jdk binaries and then install it via dpkg:               $ make-jpkg jdk-7u45-linux-x64.tar.gz     $ su          $ dpkg -i oracle-j2sdk1.7_1.7.0+update45_amd64.deb      The problem with this approach is, that I will loose continuous updates of the jdk. So, my question is, how do I actually update to a newer jdk? Simply download the newer jdk, remove the current installed jdk with dpkg -r and repeat the instructions above again?


Why would someone want to run UserMode Linux (UML)

The Linux README states that: > Linux has also been ported to itself. You can now run the kernel as a > userspace application - this is called UserMode Linux (UML). Why would someone want to do this?


How can I tell how much my system is swapping?

Is there a good way to see how much my system (for example how frequently, how much swap space it is using each time/ on average) is using the swap space during various tasks?


Automated Clonezilla backup and GPG encryption

I have a desktop Linux system which I regularly create clones of to a local RAID-6 array using Clonezilla. It's proven to be quite a hassle to walk through the backup process, which takes quite a few steps:   1. Select Dvorak as the Keyboard Layout   2. Mount the RAID-6 array.   3. Select to backup the entire array and to check it.    4. Select compression options.    5. Confirm that everything is good and to proceed with the backup. I'd like to configure a distribution that does all of this without any user input at boot. How can I create a distribution for a thumb stick which automatically does all of this for me at boot without any prompts, then encrypts all of the backup files using GPG, then shuts down?


Pre-compiled Finale substitute for Fedora 20?

I recently lost my dual-booted HDD (with both Linux and Windows). It did some weird stuff and started changing all files to read-only on every start-up. So, I bought a new HDD and put Fedora 20 on it. Now, the only thing I'm looking to replace is Finale (I have found acceptable substitutes or Linux versions of everything else). I have found MusScore, NoteEdit, etc, but all of these programs need to be compiled (I can't find a suitable .rpm), and typing 'make' gives me errors. First I need `cmake`, then `qmake`, then a whole ton of things I don't recognize, and some of which I don't understand. Honestly, I've gotten to the point of saying it isn't worth it unless I can find an RPM of something, because compiling things is ridiculously difficult (I don't NEED a music writing program, just want one). Does anyone know of a suitable replacement already compiled and ready for distribution for Fedora 20? ### EDIT #1 For those who are unfamiliar with Finale, it is a music-composition software, similar to linux's NoteEdit or MusScore. It allows exportation of audio files, note annotations, and printing pages of musical scores. It also supports transposition and human playback features. Some of these things are not that important to me, and I can do some by hand (like transposition), but I would really like the audio file export and printing features. Here is the about page for Finale: http://www.finalemusic.com/products/finale/


gcc produces erroneous "No such file or directory" under Cygwin

For demo purposes, here is my one line program test.c :               #include <dbus/dbus.h>      This is my makefile :               INC     =   -I/usr/include/dbus-1.0         \                 -I/usr/lib/dbus-1.0/include          test    :   test.c                 gcc $(INC) -c -o test.o test.c      I have the dbus devel packages installed on both my Mer Linux (via zypper) and Cygwin (via the setup program). dbus/dbus.h are visible on both systems (ls /usr/include/dbus-1.0 shows the folder dbus containing the file dbus.h among many). This compiles successfully on Mer Linux, but when compiled on Cygwin (2.831 64-Bit running on Win 7), I get the follow error:               test.c:1:23: fatal error: dbus/dbus.h: No such file or directory      #include <dbus/dbus.h>                            ^     compilation terminated.     makefile:5: recipe for target 'test' failed     make: *** [test] Error 1      I've tried every simple variant I can think of to make Cygwin work - space between -I and path, extra slash on end of path, different orders of the gcc arguments. Nothing simple seems to remedy this problem which shouldn't exist. Help!