title: How to detect imminent MTD device failure

text: We write software that runs in third party devices. On one of the devices we support, the manufacture tells us not to write to the flash drive, or we risk using up the limited write operations it supports. Unfortunately, one of the requirements of our application is to persist some data across boots and we have no other alternative. I don't know exactly what the drive inside the device is, nor how it is configured, so one question is how can I go about finding this information? Some information I have managed to find: ` bash-3.2$ df | grep mtd /dev/mtdblock5 65536 7824 57712 12% /apps ` ` bash-3.2$ dmesg | grep -i mtd Kernel command line: root=/dev/mtdblock4 rootfstype=jffs2 rw ip=none console= mem=128M init=/sbin/init mtdparts=mtd:512k(bootloader),512k(env),2M(kernel_a),2M(kernel_b),59M(filesystem),64M(user) loglevel=3 panic=5 reboot=h 6 cmdlinepart partitions found on MTD device <NULL> Creating 6 MTD partitions on "<NULL>": ` I've had a look in proc and sysfs and didn't find anything useful. The device environment doesn't have any useful tools installed such as hdparam, lshw, etc that I can find. Another question is whether there are any heuristics software could use to detect whether the 'write limit' is approaching? Finally, is there any best practices that could be observed while writing to the disk to limit the negative effects? For example, are small bursts of writing better than sustained write operations? Is it data throughput that's the problem or is it a file-system thing? If I open a file without closing it and continue to stream data there, is it better than if I open, write and close for each new piece of data? Many thanks for any help you can provide, Dan.


title: How to install QGIS from source into user space?

text: I want to install QGIS from source on Ubuntu 13.10. (saucy). into `~/bin`. There is Python 2.7.5+ installed. Therefore, I cloned the repository to my machine and checked out the `master` branch. First I did what the QGIS documentation recommends:   1. `$ export CMAKE_INSTALL_PREFIX=$HOME/bin`   2. `$ cd QGIS`   3. `$ mkdir build-master`   4. `$ cd build-master`   5. `$ ccmake ..` CMake stops with the following error message: > CMake Error: The following variables are used in this project, but they are > set to NOTFOUND. Please set them or make sure they are set and tested > correctly in the CMake files: PYTHON_LIBRARY   >  linked by target "qgispython" in directory /home/jjd/QGIS/src/python   >  linked by target "python_module_qgis_analysis" in directory > /home/jjd/QGIS/python   >  linked by target "python_module_qgis_core" in directory > /home/jjd/QGIS/python   >  linked by target "python_module_qgis_gui" in directory > /home/jjd/QGIS/python   >  linked by target "python_module_qgis_networkanalysis" in directory > /home/jjd/QGIS/python Second try following the advise of Secagy ...   1. `$ export CMAKE_INSTALL_PREFIX=$HOME/bin`   2. `$ cd QGIS`   3. `$ mkdir build-master`   4. `$ cd build-master`   5. `$ ccmake -DPYTHON_LIBRARY=/usr/bin/python2 ..` This time CMake stops with: > BINDINGS_GLOBAL_INSTALL: Install bindings to global python directory? (might > need root) Running the above command with `sudo` does not make a difference. In the following I tried various build flags inspired by different posts **without success**. **References:**   * CMake error: PYTHON_LIBRARY-NOTFOUND while compiling QGIS [Solved]   * Building QGIS on Ubuntu 13.04 * * * ## Solution Actually, the message _"BINDINGS_GLOBAL_INSTALL: Install bindings to global python directory? (might need root)"_ shown at the bottom is **not an error** but a **help message**. So after supplying the include and library paths I could continue by pressing `g` in the ccmake wizard to start the generate task.   Here are the steps (customize the paths for your system!):   1. `$ cd QGIS`   2. `$ mkdir build-master`   3. `$ cd build-master`   4. `$ ccmake ..`   5. In the wizard set `CMAKE_INSTALL_PREFIX` to `/home/user/bin/qgis`. Make sure to append `qgis` here!   6. In the wizard set `PYTHON_INCLUDE_PATH` to `/usr/include/python2.7`. Should be already set.   7. In the wizard set `PYTHON_LIBRARY` to `/usr/lib/x86_64-linux-gnu/libpython2.7.so`.   8. Press `c`   9. Press `g`   10. `$ make -j2` The number should correspond to the number of processors in your machine.   11. `$ make install`   12. Add `export LD_LIBRARY_PATH=$HOME/bin/qgis/lib` to your `~/.bashrc` or `~/.zshrc` and re-source the shell.   13. Start QGIS from `~/bin/qgis/bin/qgis`.   14. You can also create a `.desktop` file as described here.


title: banshee audio player won't start?

text: When I try to run banshee, nothing happens and the only log in syslog is: > ptrace of non-child pid 29619 was attempted by: gdb (pid 29623) Also `ps aux | grep bansh` shows nothing. Maybe I'm in the wrong forum, cause I'm using Linux Mint 13 Maya LTS. Other hints may be that last week I used only PC suspend each day. From time to time (once in a day), the banshee player quits itself at the end of a song without any pattern. ### UPDATE #1 This comes out when running banshee from CLI:               Stacktrace:               Native stacktrace:              banshee() [0x4916ba]         banshee() [0x4e0d4f]         banshee() [0x41bc77]         /lib/x86_64-linux-gnu/libpthread.so.0(+0xfcb0) [0x7f03e283fcb0]         [0xa58670]          Debug info from gdb:          Could not attach to process.  If your uid matches the uid of the target     process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try     again as the root user.  For more details, see /etc/sysctl.d/10-ptrace.conf     ptrace: Operation not permitted.     No threads.          =================================================================     Got a SIGSEGV while executing native code. This usually indicates     a fatal error in the mono runtime or one of the native libraries      used by your application.     =================================================================          Aborted


title: How to Rescue Fullscreen Guake from Seahorse Modal Dialog

text: **Problem** I use guake to hide away my terminals when I'm not using them. When I am, they fullscreen an entire monitor. If I run a command requiring an unlock of a private key, Seahorse opens a modal dialog asking for the passphrase. Unfortunately, the dialog is drawn _behind_ guake. Perhaps I can simply blindly unlock the key, but the combination of invisibility and having mashed some keys before realising what's happened means this hasn't worked for me so far, and possibly just doesn't work at all. Certainly hammering `esc` and other "get me out of here" keys doesn't help. In case it needs mentioning, the shortcut to raise/hide guake obviously does not work either. I have several different keys with passphrases. Most of these keys are added to my ssh agent, but some are rarely used and I don't want to unlock every one of them on boot. It's these rarely used keys that cause the above problem. **Terrible Solution** So, I do have _a_ solution, but it feels horribly hacky. This relies on having `xdotool` installed. Ctrl+Alt+F1 to hop to another VT and run the following:               export DISPLAY=0:0     xdotool search 'guake.py' | while read W; do xdotool windowminimize "$W"; done      Now Ctrl+Alt+F7 back to the desktop environment, and guake has disappeared. I could simply switch to another VT and kill guake, but it's frustrating to reopen a dozen SSH sessions to various machines when I do. **Question** I'm looking for better ways to escape from the uninteractable modal dialog. Secret key combinations, ways to configure Seahorse to never ask me anything ever, WM tweaks to have it 'on top, no, really', etc. Any advice about how people manage their agent/key setups would peripherally be appreciated too.


title: git commit error - cannot run vim: No such file or directory

text: $ git commit       error: cannot run vim: No such file or directory     error: There was a problem with the editor 'vim'.     Please supply the message using either -m or -F option.      How can I overcome the error and define the editor?


title: Error while burning DVD

text: I'm working on Ubuntu 13.04. I purchased a few DVDs of Sony company from a few different shops but it failed to burn all these. Earlier I had used the Sony DVD only to burn the same date & it worked. I don't know why now none are working. But now the same data which didn't burn on Sony DVD was burned successfully on Amkette CD. I used Brasero disc burner. So, the problem seems to be of Sony DVD only. Below is the error log when I was burning Ubuntu 13.10 O.S. on Sony DVD.               Checking session consistency (brasero_burn_check_session_consistency brasero-burn.c:1739)     BraseroBurnURI called brasero_job_get_action     BraseroBurnURI called brasero_job_get_action     BraseroBurnURI called brasero_job_set_output_size_for_current_track     BraseroBurnURI stopping     BraseroBurnURI called brasero_job_get_action     BraseroBurnURI called brasero_job_get_session_output_size     BraseroBurnURI output set (IMAGE) image = /tmp/brasero_tmp_6MF87W.bin toc = none     BraseroBurnURI called brasero_job_get_session_output_size     BraseroBurnURI called brasero_job_get_action     BraseroBurnURI called brasero_job_get_current_track     BraseroBurnURI no burn:// URI found     BraseroBurnURI stopping     BraseroLocalTrack called brasero_job_get_action     BraseroLocalTrack called brasero_job_get_action     BraseroLocalTrack called brasero_job_set_output_size_for_current_track     BraseroLocalTrack stopping     BraseroLocalTrack called brasero_job_get_action     BraseroLocalTrack called brasero_job_get_session_output_size     BraseroLocalTrack output set (IMAGE) image = /tmp/brasero_tmp_OVE87W.bin toc = none     BraseroLocalTrack called brasero_job_get_session_output_size     BraseroLocalTrack called brasero_job_get_action     BraseroLocalTrack called brasero_job_get_current_track     BraseroLocalTrack no remote URIs     BraseroLocalTrack stopping     BraseroChecksumImage called brasero_job_get_current_track     BraseroChecksumImage called brasero_job_get_action     BraseroChecksumImage called brasero_job_get_flags     BraseroChecksumImage called brasero_job_get_action     BraseroChecksumImage called brasero_job_get_action     BraseroChecksumImage called brasero_job_get_fd_in     BraseroChecksumImage called brasero_job_set_output_size_for_current_track     BraseroChecksumImage stopping     BraseroChecksumImage called brasero_job_get_current_track     BraseroChecksumImage called brasero_job_get_action     BraseroChecksumImage called brasero_job_get_flags     BraseroChecksumImage called brasero_job_get_action     BraseroChecksumImage called brasero_job_get_session_output_size     BraseroChecksumImage output set (IMAGE) image = /tmp/brasero_tmp_U7D87W.bin toc = none     BraseroChecksumImage called brasero_job_get_session_output_size     BraseroChecksumImage called brasero_job_get_action     BraseroChecksumImage called brasero_job_get_action     BraseroChecksumImage called brasero_job_get_current_track     BraseroChecksumImage called brasero_job_get_input_type     BraseroChecksumImage called brasero_job_set_current_action     BraseroChecksumImage called brasero_job_get_fd_in     BraseroChecksumImage called brasero_job_get_current_track     BraseroChecksumImage called brasero_job_get_current_track     BraseroChecksumImage Starting checksuming file /home/ravbholua/Documents/Other/special/ubuntu-13.10-desktop-i386.iso (size = 938475520)     BraseroChecksumImage called brasero_job_get_fd_out     BraseroChecksumImage called brasero_job_get_current_track     BraseroChecksumImage Setting new checksum (type = 2) d0508f909c2c71d96aeac5efb0329b33 ((null) before)     BraseroChecksumImage Finished track successfully     BraseroChecksumImage stopping     BraseroLibburn called brasero_job_get_action     BraseroLibburn called brasero_job_get_action     BraseroLibburn unsupported operation     BraseroLibburn deactivating     BraseroLibburn called brasero_job_get_action     BraseroLibburn called brasero_job_get_action     BraseroLibburn called brasero_job_get_device     BraseroLibburn Drive (/dev/sr0) init result = 1     BraseroLibburn called brasero_job_get_flags     BraseroLibburn called brasero_job_get_media     BraseroLibburn called brasero_job_get_fd_in     BraseroLibburn called brasero_job_get_tracks     BraseroLibburn Setting multi 0     BraseroLibburn Setting burnproof 1     BraseroLibburn Setting dummy 0     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn burn_drive_convert_fs_adr( /dev/sr0 )     BraseroLibburn Writing     BraseroLibburn called brasero_job_set_dangerous     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn burn_drive_is_enumerable_adr( /dev/sr0 ) is true     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn Async START UNIT succeeded after 0.1 seconds     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn mmc_set_streaming: end_lba=2298495 ,  r=11080 ,  w=11080     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn Allocating buffer via mmap()     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn dvd/bd Profile= 11h , obs= 32768 , obs_pad= 1     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn DVD pre-track 01 : get_nwa(0), ret= 1 , d->nwa= 0     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn SCSI error condition on command 2Ah WRITE(10): See MMC specs: Sense Key 4 "Drive error", ASC 44 ASCQ D9.     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn Libburn reported an error SCSI error on write(784,16): See MMC specs: Sense Key 4 "Drive error", ASC 44 ASCQ D9.     BraseroLibburn called brasero_job_error     BraseroLibburn finished with an error     BraseroLibburn asked to stop because of an error         error       = 1         message = "SCSI error on write(784,16): See MMC specs: Sense Key 4 "Drive error", ASC 44 ASCQ D9."     BraseroLibburn stopping     Session error : SCSI error on write(784,16): See MMC specs: Sense Key 4 "Drive error", ASC 44 ASCQ D9. (brasero_burn_record brasero-burn.c:2856)


title: How can I edit symlinks?

text: My basic understanding of a symlink is as a special file, a file that contains a string path to another file. The kernel's VFS abstracts a lot of that away but is there any reason why symlinks seem to be impossible to edit? In other words: Can I edit a symlink? If not, why not? * * * I do understand that there are various ways of _replacing_ symlinks (two alternatives are currently in the answers section) but it would be interesting to get an explanation on why replacement seems to be the only way to deal with symlinks. Why can't you just change where they point?


title: how to change where a symlink points

text: ![enter image description here](http://i.stack.imgur.com/gJh91.png) Can you tell me what is this in red marker area. ? and if want to change /media/files/tb-prod/files to some other path, then how it will be .. ?


title: Creating multicast join for tcpdump captures

text: I want to write a linux shell script which will capture specific multicast traffic. Specific as in, I want to create a pcap file that has all the traffic for one specific multicast group/port. Here is the command line I am using to view traffic:               tcpdump -nnXs 0 -i eth1 udp port 22001 and dst 233.54.12.234      This works fine so long as I have a multicast subscription to that group already established. For example, if I run this in another console:               mdump 233.54.12.234 22001 10.13.252.51      `tcpdump` will see packets. If `mdump` is not running, `tcpdump` sees nothing. Is there a standard linux-y way to establish these multicast joins before starting the captures? I could use `mdump` to establish these joins, but that seems wasteful since `mdump` will process all that data on the group, bbut I'm just going to throw it away. Note that because my specific environment, I have been discouraged from putting the interface in to promiscuous mode. It may, in fact, be prohibited.


title: Should I install ibus-1.0 to build Webdriver?

text: In the process of building one library (Webdriver) I got the following error:               Package ibus-1.0 was not found in the pkg-config search path.     Perhaps you should add the directory containing `ibus-1.0.pc'     to the PKG_CONFIG_PATH environment variable     No package 'ibus-1.0' found      It seems to be because of the following line in source code of Webdriver:               pkg-config ibus-1.0 --libs      that produces the same output when I run it. So I installed `ibus` using installation instructions from its website:               sudo apt-get install ibus ibus-clutter ibus-gtk ibus-gtk3 ibus-qt4      But I still get the same output after invoking `pkg-config ibus-1.0 --libs`. Should I install ibus 1.0 to build that library? If yes, where can I find it? It doesn't seem to be present in ibus's downloads list? My OS is Ubuntu 13.04


title: Dumping multicast UDP stream with socat

text: I am setting up video streaming. In local network, there are two devices streaming video over UDP multicast. One is regular computer with Linux (streaming to 239.220.221.10, port 9200), second one is special DVB-S streamer (streaming to 239.220.220.32, port 9200). There are several IPTV set-top boxes in the network, which are able to play streams from either source. There are also some Cisco switches for multicast filtering, but I am not able to check their configuration. On different computer (running Ubuntu 12.04) I would like to capture the stream, preferably using VLC or FFMPEG. From the computer streamer (239.220.221.10) it works, but from special streamer (239.220.220.32) I get no stream. **What I tried** I tried to narrow down the problem and tried to capture raw UDP datagrams with socat and tcpdump. If I run following command, I get valid video in video.dump file:               > socat UDP4-RECVFROM:9200,ip-add-membership=239.220.221.10:0.0.0.0 - > video.dump      When I simultaneously run tcpdump, I see incoming datagrams:               > sudo tcpdump -i eth1      18:00:39.059824 IP 10.1.2.202.41852 > 239.220.221.10.9200: UDP, length 1316     18:00:39.060789 IP 10.1.2.202.41852 > 239.220.221.10.9200: UDP, length 1316     ...      When I try to run same commands for the special streamer (just change the IP membership address for socat to 239.220.220.32), tcpdump shows incoming datagrams from 239.220.220.32, but video.dump file is empty. What can be the reason that `socat` doesn't see the datagrams that are clearly coming? **Update on 4 March 2014:** I just found out that there are different IP ranges in the network:               Computer streamer: 10.1.2.202 / 255.0.0.0     "Special" streamer: 192.168.85.5 / 255.255.255.0     Computer on which I am trying to grab stream: 10.1.2.203 / 255.0.0.0      When I change IP adress of the last to 192.168.85.x / 255.255.255.0, I can catch streams from the "Special" streamer, but not from the computer streamer. So the question changes to: Is it possible to set socat, VLC or FFMPEG to accept also multicast streams that have source address outside the range of ethernet interface?


title: Subversion repository on NTFS drive

text: I am trying to use my repos that is located on an NTFS formatted drive. I am dual-booting Windows 8.1 and Arch Linux. I am running subversion 1.8.5 and apache 2.2.26 with SSL. The problem seems to be related to httpd not being able to open the files where the repos are located.   This is what is added to the **/var/log/httpd/error_log** :               [Sat Mar 01 17:54:58 2014] [notice] caught SIGWINCH, shutting down gracefully     [Sat Mar 01 17:54:59 2014] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)     [Sat Mar 01 17:54:59 2014] [warn] RSA server certificate CommonName (CN) `toi' does NOT match server name!?     [Sat Mar 01 17:54:59 2014] [notice] suEXEC mechanism enabled (wrapper: /usr/bin/suexec)     [Sat Mar 01 17:54:59 2014] [notice] Digest: generating secret for digest authentication ...     [Sat Mar 01 17:54:59 2014] [notice] Digest: done     [Sat Mar 01 17:55:00 2014] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)     [Sat Mar 01 17:55:00 2014] [warn] RSA server certificate CommonName (CN) `toi' does NOT match server name!?     [Sat Mar 01 17:55:00 2014] [notice] Apache/2.2.26 (Unix) mod_ssl/2.2.26 OpenSSL/1.0.1f DAV/2 SVN/1.8.5 configured -- resuming normal operations     [Sat Mar 01 17:55:03 2014] [error] [client 127.0.0.1] (13)Permission denied: Failed to load the mod_authz_svn config: Can't open file '/run/media/toi/StorageA/repos/.svn-policy-file': Permission denied     [Sat Mar 01 17:55:06 2014] [error] [client 127.0.0.1] (13)Permission denied: Could not open password file: /run/media/toi/StorageA/repos/.svn-auth-file      I have tried many different ways of mounting the ntfs drive without success. The automatic mount with nemo doesn't even allow me to create a file on the drive. I tried mounting it with the ntfs-3g driver and could now create files through nemo and the terminal. I could even set permissions for the folders on the drive (with -o permissions when mounting).   I tried `chown -R http:http /mnt/thedrive/repos` and it seemed to kick in. `ls -a -l` showed http as owner with `drw` permissions. However httpd still couldn't read any of the files. I even tried `chmod 777` on the repo folder but to no avail.      I just recently started using Arch Linux (been using ubuntu or mint before from time to time) so I may just be doing something wrong.   The server seemed to work fine on my ext4 partition. I used the subversion guide on the Arch wiki to set subversion up.      If i recall correctly i managed to setup a working subversion when i was running Mint on the NTFS drive, but i messed the installation up and decided to go for Arch to learn more.      Simply put what I am trying to achieve is to have subversion control on both Windows and Arch without having to copy repos every time i change OS. This may be quite unconventional but would be nice if it could be achieved.      So could it be related to permissions or am I just interpreting the error messages wrong? Any ideas what the problem could be?


title: Do processes in cgroups have to be set every boot? If so, how to persist them?

text: I was reading this answer to a question on setting limits for processes by using cgroups. The sample given sets limits for a process (in the example, `sshd`). In the answer, the PID of the process is set manually. This would be unacceptable for my purposes, I would like that processes started from a given application to always have the limits set, no matter when they are started nor limited by how many such processes are started. Perhaps it is unclear from the example how that would happen, so a clear explanation or link to one would also be welcome. The example in the kernel cgroups.txt seems to use the same model as already given above.


title: Can anything useful be done with a truncated core?

text: We have processes written in a mix of Python, Java and C++ that core dump from time to time. They allocate more memory in chunks as needed during runtime, and are known to crash when their allocation tips over 4G (I guess the return value of the `malloc()` isn't checked). However the core dumps produced are truncated, according to GDB - they are unlimited in size in the OS, and on-disk they vary between 2-3.8G in size. GDB observes that the size doesn't match what it expects (presumably including the failed alloc?) and gives up - but in 3.8G of data there surely must be _something_ of interest? Possibly even the entire stack I need for a backtrace! How can I persuade GDB to at least try, or is there an alternate tool that can extract something from a truncated core?


title: sed match pattern N times

text: I want to split a file into chunks with 2 words each.               $cat tmp     word1 word2 word3 word4 word5 word6 word7     $sed -e 's/word. word. /&\n/g' tmp     word1 word2      word3 word4      word5 word6      word7     $sed -e 's/word. \{2\}/&\n/g' tmp     word1 word2 word3 word4 word5 word6 word7      I expected the last command to give same result as the one before it. What is wrong?


title: I have submitted my first kernel patch, what next?

text: I have managed to submit my first kernel patch following these steps. I have also read this book so I have an idea of which subsystem I might get into. However, the details of where to go next seem a little unclear. Do I continue working on patches? Do I join a mailing list, if so then what? What is the conventional sequence of steps one must follow after that all important first patch? Edit: I am not looking for an opinion on what an individual thinks is best. I know I am going to contribute to a subsystem. I am merely asking if there is an official "step 2" in this process after the "step 1" I described above as I have not seen any written documentation to that effect.


title: Book on Linux kernel driver development

text: What good books are there out there for Linux kernel driver development? Preferably targeting a rather new kernel release. Which one is best in you opinion?   * Essential Linux Device Drivers   * Linux Device Drivers


title: Which kernel does reboot load?

text: I am using ssh to remotely access some machines. These machines have a custom kernel installed (based on the 2.6.28 source). However, whenever I try to reboot the machines using `sudo reboot`, the system uses kexec and loads the 2.6.28-19-generic kernel, which is also intalled on the machine. So how can I specify which kernel image to load after reboot? EDIT: I have ubuntu 9.04 installed on the machine, with grub 1.something. The custom kernel is based on the 2.6.28 source with the name being 2.6.28.10-custom-1.1. Two other kernels are installed on the machine 2.6.28-19-generic and 2.6.28-6-386. I have checked that after calling reboot, the machine does not actually reboot but uses kexec to load the 19-generic kernel, even if the current kernel was the custom one.


title: Using parallel on Ubuntu

text: I am having an issue trying to use parallel command on Ubuntu 10.04. I looked up the parallel documentation and few of the commands seem to run. In all cases I just get the command prompt back without any action being taken. e.g. I was trying to compress a bunch of files using bzip2                    17:32 farhat HarshaNaveen$ parallel bzip2 ::: *fastq      17:33 farhat HarshaNaveen$ ls *fastq|parallel bzip2 {}           Neither of these commands worked. Nor was there any error. The example given in the man file worked fine though.               18:58farhat HarshaNaveen$ parallel sh -c "echo hi; sleep 2; echo bye" -- 1 2 3     hi     hi     hi     bye     bye     bye     18:58farhat HarshaNaveen$       What am I doing wrong?


title: How can I set up smart card SSH authentication?

text: I would like to be able to SSH to my machine using a Gemalto .NET Smart Card as the authentication method. How could this be done on a Fedora 13 (or generic Red Hat style) machine? These are the rough steps I think are needed:   1. Provision certificate for the smart card (and possibly a CA to issue it?)   2. Get the certificate onto the smart card   3. Configure SSH server to allow smart card authentication and configure it to use a particular certificate/CA   4. An SSH client that has smart card support (extra points for a free Windows based one)


title: How do I rename lots of files on a directory without changing their extensions?

text: I have a problem! I have a bunch of image files with extensions. Jpg and. Png. I wrote a script that renames the files, changing their names in a pattern followed by a number like this: ... arquivo_1.jpg arquivo_2.jpg ... And following this sequence, but it needs to know the extension, in this case I used the extension. Jpg. I was wondering how do I optimize the script so that it renames but keeping the original extension of the file and keep doing the sequence I described above. Can someone help me?


title: Is it safe to disable OOM killer in a web server/reverse proxy?

text: I have Linux machine dedicated to serving static contents and PHP pages with Apache. Apache also work as a reverse proxy in a subdomain. I moved the PostgreSQL database to another Linux machine. Is it safe to disable the OOM killer in the kernel?


title: How to rotate all images in a directory with imagemagic?

text: I want to rotate all the images in a directory that match a pattern. So far I have:               for file in `ls /tmp/p/DSC*.JPG`; do       convert $file -rotate 90 file+'_rotated'.JPG     done      but that gives no output?


title: Type from right to left

text: Is there a command to make Vim type from right to left? If not us any one aware of this plugin?


title: Routing in OpenVPN between a private network and a client

text: I'm trying to setup OpenVPN between a private network and home clients that connect to it. (The clients don't need to connect to each other). The network topology is a little interesting. There is a public/University network on 10.7.42.0/24. We have some IPs on that network that have public ports forwarded to them, but we're limited on those so we're putting a lot on a private network at 192.168.203.0/24. All machines have at least a private IP and some have both public and private IPs (two adapters. This is all done in VMs but it's like there are two physically separate networks) The OpenVPN server is also the gateway between the public/private networks. It has a 10.7.42.x address, a default gateway of 10.7.42.1 (university gateway), it masquerades/IP forwards any-to-any, and it has an internal address of 192.168.203.1. It successfully works for NAT/gateway. My open VPN Server config looks like this:               local 10.42.7.226     port 443     proto tcp     dev tun     ca /etc/openvpn/easy-rsa-2.0/keys/ca.crt     cert /etc/openvpn/easy-rsa-2.0/keys/server.crt     key /etc/openvpn/easy-rsa-2.0/keys/server.key  # This file should be kept secret     dh /etc/openvpn/easy-rsa-2.0/keys/dh1024.pem     server 192.168.137.0 255.255.255.0          ifconfig-pool-persist /etc/openvpn/ipp.txt          route 192.168.203.0 255.255.255.0     push "route 192.168.203.0 255.255.255.0"          push "dhcp-option DNS 192.168.203.100"          keepalive 10 120          cipher BF-CBC        # Blowfish (default)               comp-lzo          plugin /usr/lib64/openvpn/plugin/lib/openvpn-auth-pam.so login     client-cert-not-required     username-as-common-name          max-clients 201          user nobody     group nobody          persist-key     persist-tun          status /var/log/openvpn-status.log          log-append  /var/log/openvpn.log      The ifconfig looks like this:               eth0      Link encap:Ethernet  HWaddr XX:XX:XX:XX:XX:XX                 inet addr:192.168.203.1  Bcast:192.168.203.255  Mask:255.255.255.0               inet6 addr: fe80::8c2c:6bff:fe5b:5406/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:183488 errors:0 dropped:4 overruns:0 frame:0               TX packets:198145 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:15024794 (14.3 Mb)  TX bytes:186885934 (178.2 Mb)               Interrupt:32 Base address:0xa000           eth1      Link encap:Ethernet  HWaddr XX:XX:XX:XX:XX:XX                 inet addr:10.42.7.226  Bcast:10.42.7.255  Mask:255.255.255.0               inet6 addr: fe80::a011:59ff:fe3e:c3aa/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:436236 errors:0 dropped:99041 overruns:0 frame:0               TX packets:202673 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:239838327 (228.7 Mb)  TX bytes:20537299 (19.5 Mb)               Interrupt:36 Base address:0xe100           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:2 errors:0 dropped:0 overruns:0 frame:0               TX packets:2 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0                RX bytes:100 (100.0 b)  TX bytes:100 (100.0 b)          tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00                 inet addr:192.168.137.1  P-t-P:192.168.173.2  Mask:255.255.255.255               UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1               RX packets:631 errors:0 dropped:0 overruns:0 frame:0               TX packets:88 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:100                RX bytes:48118 (46.9 Kb)  TX bytes:13725 (13.4 Kb)      My routes look like this:               192.168.137.2     *               255.255.255.255 UH    0      0        0 tun0     10.42.7.0       *               255.255.255.0   U     0      0        0 eth1     192.168.203.0   *               255.255.255.0   U     0      0        0 eth0     192.168.137.0     192.168.137.2     255.255.255.0   UG    0      0        0 tun0     link-local      *               255.255.0.0     U     0      0        0 eth0     loopback        *               255.0.0.0       U     0      0        0 lo     default         10.42.7.1       0.0.0.0         UG    0      0        0 eth1      The client looks like this:               dev tun     remote vpn.mydomain.com     ca ca.crt          client     port 443     proto tcp     tls-client     auth-user-pass          comp-lzo          ping 15     verb 9     log-append  /tmp/openvpn.log       The problem is I can only get to the OpenVPN server if I ssh to 192.168.137.1. I can't connect to any of the 192.168.203.0/24 addresses. If I do a trace route, it only goes one hop, and it takes 30 seconds to do that across the VPN to the remote tun adapter. The private machines use the 192.168.203.1 (OpenVPN server) as their gateway, so the packets should make their way back fine for at least those machines (really they would be NATed on their way out, so it should make it to machines with both public and private adapters too) I've set these OpenVPN networks up before and I know I've run into this exact problem before, but I can't remember the solution.


title: Does AIX really beat Red Hat Enterprise Linux?

text: Our company plan to upgrade our servers, and at the same, we would use AIX over Red Hat Enterprise Linux. I asked my boss the reason of choosing AIX, he said it is because AIX is more powerful. I wonder if it is true. Does AIX really out perform RHEL in terms of data processing? Only text data, no graphic processing. They are AIX 7.1 and RHEL is "Red Hat Enterprise Linux AS release 3 (Taroon Update 2)". Assume we would use the same machine for comparison.


title: Serial Over Lan redirection stops at OS boot

text: I'm trying to create a monitoring system for a remote machine using an IPMI Serial Over Lan (SOL) console. The remote OS is RHEL 6, the mobo manufacturer is Supermicro. I've successfully enabled SOL redirection in the BIOS. This allows me to see the BIOS and kernel parts of bootup through an attached SOL console over IPMI. Next, I followed the steps mentioned in many online articles to get my OS ( runlevel 3, just text terminal ) to redirect too. The result is almost always the same : After making the changes to /etc/grub.conf, /etc/inittab, and /etc/securetty, i can see the grub menu through the SOL console (yay!), but as soon as the OS starts booting, my SOL terminal receives 1 gibberish character, and nothing more. Some thoughts:   1. I'm not exaclty sure which serial port my BIOS are trying to redirect stuff into (ttyS0, ttyS1). Most of the examples use ttyS1, and since the grub menu gets redirected there, i'm pretty confident thats 'correct'   2. I know the 'terminal types' and baud rates have to match between the BIOS and OS settings. I am consistently using 115200 for baud, but i'm less confident I'm choosing the right terminal type. The terminal type in BIOS is "ANSI", and this gives the coloration i want for the BIOS over SOL. However, for the OS settings, most of the examples use 'linux'; i'm not sure if that's compatible with my ANSI setting. I've tried VT100 for both BIOS and OS, and I still never see anything past the Grub menu (plus, i lose color info for my BIOS over SOL). Any help is greatly appreciated.


title: Communication to device is lost when network starts on boot up?

text: I have an application that opens a socket on port 4444 to a device (/dev/linkToDevice). The "linkToDevice" is a link to ttyUSB0. The application is a c++ program of which is now a daemon and runs at boot up. The daemon runs regardless of network. So when the linux box is booted, and there is not network, the daemon starts immediately and while there is still no network, I can communicate just fine (telnet localhost 4444). But, when I plug in a network cable, or dhclient determines there is no DHCP and leases me a default ip address, or I just simply give it an ip interface, I can no longer communicate. I can, however, still open the telnet connection, I just get no response when I query for one. I use 0.0.0.0 as the ip to open the socket on (signifying any ip address). I dont feel like it is a code problem. The odd part to me is that after I can no longer communicate, if I restart the daemon, everything works great, which is expected. But, when I unplug the network, or unconfigure the interface, or do a sudo /etc/init.d/networking restart, or any sort of bringing the network down and back up again, through that entire process I never lose communication to the device. So the problem ONLY happens when I boot the machine with no network to begin with, and then I all of a sudden get a network. Any thoughts as to why this only happens at boot up?


title: ssh server: reasons for sudden "Connection closed by remote host"

text: One of my ec2 servers has stopped receiving ssh connections. The OS is Ubuntu server 8.04, and the ssh server is the standard `openssh-server`. After months of uptime, I tried to connet to it today, and got the following message:               ssh_exchange_identification: Connection closed by remote host      Any idea what could have went wrong? **Update:** After a reboot, the server started receiving new connections. Disks are below 50% usage.


title: scp transfers slow down and stop over local network

text: I'll often transfer items to and from my laptop on my local network using `scp`. Often, it seems, I'll see the transfer rate start out right (2.0MB/s), then slowly diminish until the transfer completely stalls. This seems to be fairly reproducible on larger files. Is there a network problem or a way for me to better configure SSH on my laptop? My desktop doesn't seem to have these problems when transferring files to remote servers, so I assume that my laptop's WiFi connection may be to blame. Both computers are running an Ubuntu 12.04 derivative.


title: Fail2ban for nginx post flood ignores time intervals

text: I'm trying to create a fail2ban filter that is going to ban the host when it sends over 100 POST requests over 30 seconds interval. jail.local:               [nginx-postflood]          enabled = false     filter = nginx-postflood     action = myaction     logpath = /var/log/nginx/access.log     findtime = 30     bantime = 100     maxretry = 100      nginx-postflood.conf               [Definition]     failregex = ^<HOST>.*"POST.*     ignoreregex =      Using GREP i was able to test the regular expressions and indeed it matches Host and POST requests. Problem is that it bans **any Host that performs at least one POST request**. This means likely that it's not taking _findttime_ or _maxretry_ options into consideration. In my opinion it's timestamp issue. Sample line of nginx log:               5.5.5.5 - user [05/Aug/2014:00:00:09 +0200] "POST /auth HTTP/1.1" 200 6714 "http://referer.com" "Mozilla/5.0 (Windows NT 6.2; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0"      Any help?


title: Best Linux for a small Web server

text: I'm currently planning my business servers and I would like to know what's the best Linux distro for these needs:   * Nginx + MySQL + PHP 5.4   * Zimbra Collaboration - Open Source   * Node.js w/ Forever I know it's a objective question but I asked a lot of people and they didn't answer me other thing than "It's your choice"... I have a 2 CPU, 1GB RAM, 30GB SSD server...


title: What software do all linux distributions have in common?

text: A little context: I recently installed Arch Linux on a chromebook through a bizarre hack in which I used an install script to install Ubuntu and then overwrote the Ubuntu rootfs with an Arch rootfs. I'm not sure what the mechanics are behind this (like this: https://wiki.archlinux.org/index.php/Acer_C7_Chromebook). Is the part of Linux that runs before chrooting into rootfs common to all Linux distros (and that's why the initial boot worked for both Arch and Ubuntu)? Or, to be more general, what pieces of software are common amongst all Linux distributions, i.e. define a Linux distribution?


title: SELinux: allow a process to create any file in a certain directory

text: I have a script that, when invoked, will cause the contents of `dmesg` to be written to a file, with the file's name basically being a timestamp. SELinux prevents this. Following the advice of Fedora's SELinux troubleshooting app, I tried: > grep dmesg /var/log/audit/audit.log | audit2allow -M mypol > > semodule -i mypol.pp However, this doesn't seem to work, probably because the name of the file it's creating is different every time. So how do I tell SELinux to allow `dmesg` to create (and write to) any file in a certain directory? Or tell it that the script in question (and all the processes it spawns) can do that?


title: Handling sed variables with paths in them?

text: I have an applescript for doing certain things, like search and replace.               set lol to quoted form of POSIX path of (choose file with prompt "VälJ Fil")      That chooses a file then im doing this               set script1 to "sed 's@id_Shops@ShopID@g'" & lol     do shell script script1      But sed tells me `bad flag in substitute command: '/'" number 1` I figured it was the slashes in the path, how can i fix that? I have tried to use `sed -i` but it gives me this error `sed: -i may not be used with stdin` How can i do to avoid the path conflict in sed?


title: How much disk space should be allocated for FreeBSD?

text: I have a Samsung N150 netbook with 160 GB hard disk. I want to install FreeBSD OS. There will be no other OSs, no dual booting or like that, just FreeBSD. So the manual says to have a separate partition for /var, /usr and /   Earlier I used Ubuntu where I created / with 30 GB and rest for /home. But what will be the optimal disk size for use in FreeBSD? How much can /var grow into? Also if I install applications from ports where will it go? Is it to /usr/local/bin or /opt? Which is recommended?   My usage will be as a development machine. i.e it will have all my personal stuffs like music plus development software, server etc. I think of having separate partitions for keeping development files and mounting when ever required. Also separate partition for other stuffs like music, docs etc. So that even if I reformat the OS, I will only have to wipe the OS files, and not my personal files. So which format (like ext4 or zfs) should those partitions have? Can those be on extended partition since FreeBSD need a primary partition.


title: Is there a port list migration command set for FreeBSD?

text: On debianized linux distros there is `dpkg --get-selections`, `dpkg --set- selections`, `dpkg -C` to respectively list installed packages, select a list of packages for installations, and list packages that are in a partially installed or broken state. I am wondering if something like this exists for FreeBSD (ports, not packages). I can get the list from `pkg_info`, but is there a simple way to apply it without `cut`, `for port in list`, `cd`, `make install`?


title: I am failing to build VirtualBox driver for Linux 2.6.38

text: I am running Debian 6, and decided to install 2.6.38 kernel from Unstable. I also installed the headers so that I can later on :               sudo apt-get install --target-release=unstable linux-image-2.6.38-2-686-bigmem linux-headers-2.6.38-2-686-bigmem      I then re-installed **`virtualbox-ose-dkms`** to that the VirtualBox drivers for 2.6.38 can be rebuilt (so that I can use VirtualBox under 2.6.38), but I get this error:               Building initial module for 2.6.38-2-686-bigmem          Error! Bad return status for module build on kernel: 2.6.38-2-686-bigmem (i686)     Consult the make.log in the build directory     /var/lib/dkms/virtualbox-ose/3.2.10/build/ for more information.     dpkg: error processing virtualbox-ose-dkms (--configure):      subprocess installed post-installation script returned error exit status 10     configured to not write apport reports                                           Errors were encountered while processing:      virtualbox-ose-dkms     E: Sub-process /usr/bin/dpkg returned an error code (1)      Here's the contents of the file they asked me to look at:               $ cat /var/lib/dkms/virtualbox-ose/3.2.10/build/make.log      DKMS make.log for virtualbox-ose-3.2.10 for kernel 2.6.38-2-686-bigmem (i686)     Sat Apr  9 14:11:57 SAST 2011     make: Entering directory `/usr/src/linux-headers-2.6.38-2-686-bigmem'       LD      /var/lib/dkms/virtualbox-ose/3.2.10/build/built-in.o       LD      /var/lib/dkms/virtualbox-ose/3.2.10/build/vboxdrv/built-in.o       CC [M]  /var/lib/dkms/virtualbox-ose/3.2.10/build/vboxdrv/linux/SUPDrv-linux.o     In file included from /var/lib/dkms/virtualbox-ose/3.2.10/build/include/VBox/types.h:30,                      from /var/lib/dkms/virtualbox-ose/3.2.10/build/vboxdrv/linux/../SUPDrvInternal.h:35,                      from /var/lib/dkms/virtualbox-ose/3.2.10/build/vboxdrv/linux/SUPDrv-linux.c:33:     /var/lib/dkms/virtualbox-ose/3.2.10/build/include/iprt/types.h:97:31: error: linux/autoconf.h: No such file or directory     /var/lib/dkms/virtualbox-ose/3.2.10/build/vboxdrv/linux/SUPDrv-linux.c: In function ‘VBoxDrvLinuxInit’:     /var/lib/dkms/virtualbox-ose/3.2.10/build/vboxdrv/linux/SUPDrv-linux.c:451: error: ‘nmi_watchdog’ undeclared (first use in this function)     /var/lib/dkms/virtualbox-ose/3.2.10/build/vboxdrv/linux/SUPDrv-linux.c:451: error: (Each undeclared identifier is reported only once     /var/lib/dkms/virtualbox-ose/3.2.10/build/vboxdrv/linux/SUPDrv-linux.c:451: error: for each function it appears in.)     /var/lib/dkms/virtualbox-ose/3.2.10/build/vboxdrv/linux/SUPDrv-linux.c:451: error: ‘NMI_IO_APIC’ undeclared (first use in this function)     /var/lib/dkms/virtualbox-ose/3.2.10/build/vboxdrv/linux/SUPDrv-linux.c:465: error: ‘nmi_active’ undeclared (first use in this function)     make[4]: *** [/var/lib/dkms/virtualbox-ose/3.2.10/build/vboxdrv/linux/SUPDrv-linux.o] Error 1     make[3]: *** [/var/lib/dkms/virtualbox-ose/3.2.10/build/vboxdrv] Error 2     make[2]: *** [_module_/var/lib/dkms/virtualbox-ose/3.2.10/build] Error 2     make[1]: *** [sub-make] Error 2     make: *** [all] Error 2     make: Leaving directory `/usr/src/linux-headers-2.6.38-2-686-bigmem'


title: How can I make the GNOME Shell Activities Bar small all the time?

text: When I have no apps running, or I'm in the activities screen in GNOME shell, the activities bar is maybe 20px high. When I am running an application, this expands to 70px, possibly to fit the 64x64 application icon it uses for the application. Can I make this bar smaller the whole time?


title: How linux installation process works

text: can anyone explain me how Linux installation process works? With Windows, installation process starts with Windows Setup. It's a program that installs Windows. Setup starts and restarts a computer, collects informations, copies files, and applies settings. What is for Linux like Setup for Windows, and are there any major differences between installation process of Linux and Windows? Thanks in advance!


title: Eval emacs init.el from CLI

text: I want to eval my ~/.emacs.d/init.el file periodically from CLI (cron) since it generates other files that I use in my projects according to some extra data. Something like "emacs -q -eval-file ~/.emacs.d/init.el", or something like this. How can I do it ? Thanks


title: Virtualbox 64bit image on 64bit computer without virtualization support

text: I have a 64 bit image for VirtualBox (.vmdk file), and I don't have a 32 bit version. My computer doesn't support hardware virtualization. Logically VirtualBox says: > This kernel requires an x86-64 CPU, but only detected an i686 CPU. Unable to > boot - please a kernel appropriate for your CPU. If I don't have a 32 bit version, does that simply mean I am screwed?


title: If I redirect logs using rsyslog, will dmesg be affected?

text: I am trying to get some logging in place and am trying to troubleshoot it and this question became relevant. I use rsyslog config files to redirect some of my logging. (Will use iptables logging since I am working with it but please assume the general case) Under my rsyslog.d config I have               :msg, startswith, "iptables: " /var/log/iptables.log     :msg, startswith, "iptables denied: " /var/log/iptables.log     & ~      I would assume if this was working that it would no longer log to kern.log. Since it is no longer going to kern.log does the redirect also effect the kernel ring buffer?


title: Bash vs ksh pipes

text: I am stuck with some problems with my scripts in ksh. FWIW the problem which I am unable to overcome is that when I use a structure such as this               command | while read VAR1      do        many.commands using $VAR1     done      I often get that my scripts do not perform the loop for every line piped to the while. To test this I then change the structure to               command > /tmp/tempfile     cat -n /tmp/tempfile >&2     cat /tmp/tempfile | while read VAR1     etc      This proves that there is many lines in the output. Further I then add an extra line immediately after the do, like               echo DEBUGGING: $VAR1  >&2      Which proves that the loop runs only once. I am really stumped. One workaround which is not always viable, is to do               for X in $(cat /tmp/tempfile )     do     ...     done      This then works correctly but besides the fact that I hate this for structure, It means you expand the entire input data on the command-line (which has hard limits) It appears that bash is better than ksh at handling this kind of thing. In particular it seems that this may be related to read calls failing but not retrying if the loop takes a long time to run. However it seems that bash does not have a built-in "read", which means much of my scripts will need to be re-written. I OFTEN use large structures like               command1 | command2 | while read SOMEVAR; do awk -F: "... long awk program" | sed "long sed program" ; done | sort -u | tail -1 | read FINAL_ANSWER      The problem is that bash uses /usr/bin/read which as expected throws away the result of FINAL_ANSWER as fast as it gets it. The obvious workaround is to replace               | read FINAL_ANSWER      with               > /tmp/final_answer && FINAL_ANSWER="$(cat /tmp/final_answer)"      So.... Any scripting gurus on here able to shed some more light on this? I deliberately did not post my real scripts here both because they are part of a sensitive solution developed for a customer, and because I don't want the actual detail of the scripts to confuse the issue. I use the "while read" format OFTEN. It usually works. I've in fact never had a problem with it in 25 years of shell scripting. Now I'm having problems. Very frustrating. Perplexing. Initially I thought the while read is only receiving, or passing along, the first line of input. But then I discovered a situation where, when I run the script over and over, it runs further and further into the input. Specifically I have something line this               command | while read NEXT_ONE DONEFLAG     do        if [ $DONEFLAG = "yes" ]        then            echo Already completed work for $NEXT_ONE        else            dowork $NEXT_ONE && set_flag $NEXT_ONE        fi     done      It turns out that on each run of the script, it performs `dowork` once. It doesn't really matter what `dowork` is, so long as it takes more than a few seconds. Some kind of shell pipe timeout occurs and the rest of the input then disappears. Google tells me that dtksh may solve this issue (Apparently it will retry the read/write or something, I didn't read enough) I see that dtksh exists in /usr/st/bin/dtksh Who is this? I don't like using shells that I don't know, but it might be worth while to split small portions of scripts into sub-scripts with /usr/dt/bin/dtksh as interpreter. Any advice? EDIT: Providing an example of why I can not use bash as a drop-in replacement for ksh as interpreter:               sol10-primary> # cat test.sh     #!/bin/ksh     echo hello| read VAR1     echo $VAR1     sol10-primary> # ./test.sh     hello     sol10-primary> # sed 's/ksh/bash/' <test.sh >test2.sh     sol10-primary> # chmod +x test2.sh     sol10-primary> # ./test2.sh          sol10-primary> #


title: Fedora Upgrade Error

text: I was trying to upgrade to Fedora 16 (I had f14) using _preupgrade_. However, it fails at the end (after saying: _preparing transaction from installation source_ ) and gives the following error: _A fatal error occurred when installing the file system package. This could indicate errors when reading the installation media.Installation cannot continue._


title: md5sum change after mount?

text: I have a ext3 filesystem on a .img file. After mounting and unmounting it, I noticed that the md5sum is changed, even if no file inside was changed!               md5sum myfilesystem.img     XXXX myfilesystem.img     mount -t ext3 myfilesystem.img temp/     umount temp/     md5sum myfilesystem.img     YYYY myfilesystem.img      Why does XXXX differs from YYYY? I clearly didn't touch anything inside myfilesystem.img.


I am new to unix command and I have got one scenario that, I want to create a zipped output file while keeping the original one. I want to do it from Informatica end by using command task or session task. Please advice. Below is the example which I am trying:   1. In session task: Command type='Command', Command=   `gzip -c /var/opt/powermart/pc8_dev/infa_shared/TgtFiles/test1/tgt_zip.out`   2. In case of using Command task:  `gzip -c /var/opt/powermart/pc8_dev/infa_shared/TgtFiles/test1/tgt_zip.out` I tried both things, but zip file is not at all created. Below is the screen shot: ![command in session task](http://i.stack.imgur.com/j1t8p.png)


title: Why did this command delete every package?

text: I was trying to get a Windows program to run on PlayOnLinux and after it didn't work I went to remove Wine with this command: `sudo apt-get remove --purge wine*` and without thinking I agreed to remove every package on the machine. Can someone tell me why it selected every package instead of all the ones starting with the string "wine"? I'm running Linux Mint 16


title: How do I move gnome-panel between monitors without gnome-settings-daemon in xmonad?

text: I'm running xmonad with gnome-panel, but not gnome-settings-daemon. I start up gnome-panel by spawning in xmonad.hs. How can I (on the command line) get gnome-panel to switch monitors? xmonad.hs:               myManageHook :: [ManageHook]     myManageHook =       [ resource =? "Skype" --> doFloat       , resource =? "Vncviewer" --> doFloat       , resource =? "gnome-panel" --> doIgnore       , isFullscreen --> doFullFloat       ]          startup :: X()     startup = do       spawn "gnome-panel"          main = xmonad $ ewmh defaultConfig         { modMask = mod4Mask         , terminal = "gnome-terminal"              -- avoidStruts prevents overlap with gnome-panel         -- smartBorders disables border in full screen (or single-window)         , layoutHook = avoidStruts $ smartBorders $ layoutHook defaultConfig         , manageHook = composeAll myManageHook <+> manageHook gnomeConfig              -- docksEventHook reworks windows whenever a dock gets in the way         , handleEventHook = docksEventHook         , startupHook = startup         }


title: Search commands in history with discontinuous keywords

text: I was wondering how to search commands in history without knowing the first few letters of the command? When searching using `Ctrl`-`R` in bash, ~~one has to give the first few letter of the command. What if I only know some characters in the middle, or some at the beginning and some in the middle? For example, to search`cat myfile`, I only know there is `at` in it, or `c` at the beginning and `my` in the middle somewhere.~~ keywords have to be continously positioned. For example, in `cat myfile`, I would like to search for both`c` and `my`, but Ctrl+R will not allow to specify both simultaneously. Thanks!


title: Pipe chain with devices

text: As far as I know, you can have the ability to make pipes between applications, such as this one:               $ step1 < input_file | step2 | step3 > result_file      And you can access devices such as `/dev/urandom`, `/dev/zero`. `/dev/null`, etc:               $ cat /dev/urandom > "output_file"     $ someprog > /dev/null      My question is, is it possible to make a pipe with a block device both input and output at the same time? For example, I want to read a `input_file`, send to `/dev/example` (which is `rw`), and then read its output into `output_file`. Can be achieved on a single command just like this:               $ cat input_file | /dev/example > output_file      or               $ /dev/example < input_file > output_file      or is it advised to do in two commands? PS: Maybe I'm misspelling the commands or making syntax errors, please let me know how to get it. I use `sh` or `bash`, I don't know how to use other consoles. If I'm not clear, let me know as English is not my mother tongue.


title: Best method for performing a HDD copy from a master to slave

text: We are running a Debian-based system in our product, out of which I need to create new drives from a master drive. ### Method 1: Install OS from debian live CD and copy the required custom software. Earlier, I stared my process with method 1, I various errors like operators missing dependencies, while installing the OS etc and it takes about 80 minutes to install OS and my software. So, I was not able to continue this mechanism. ### Method 2: Taking clone of the master drive and place it in a server. Running clonezilla and installing clone. This method was working out very well for me earlier. Nowadays, customers requires different HDD sizes. A single clone does not work out for me. So this makes me to maintaining multiple clones and it takes about 30 minutes to install the clone. ### Method 3: Just partition the drive copy all the OS files from master to slave. This method gives me the freedom of just copying the files from master to slave. Also, allows me to maintain a single master disk.Also, this method takes about 10 minutes for copying files. But, I feel there might be many CONS using this method. I want to maintain a single copy of my master and consume less time to create a new slave drive.


title: Problematic quotations

text: #!/bin/ksh     typeset FILE_SIZE1=$(stat -f '%z' test.txt);     typeset -r BK_STATARGS="-f '%z'"     typeset FILE_SIZE2=$(stat ${BK_STATARGS} test.txt);     echo without arg var ${FILE_SIZE1}     echo with arg var... ${FILE_SIZE2}      Yields....               without arg var 216     with arg var... '216'      Maybe I'm missing the obvious but I can't figure out a fix. I've tried all sorts of things.


title: How to get recordmydesktop to record application's audio on Debian/Squeeze?

text: I'm on an amd64 Debian/Squeeze install on an Intel DX58SO motherboard. I want to use recordmydesktop to record application's audiovisual output. It's important any **audio** generated by the applications is recorded along with the video. The app I _actually_ want to record is VirtualBox, but googling suggests that has it's own complications so for now I'm just trying to get recordmydesktop to even just record audacious playing mp3s. Video works great, but I just can't get _any_ sound recorded. `recordmydesktop --print-config` says:               recordMyDesktop was compiled with the following options:     Jack:                   Enabled     Default Audio Backend:  ALSA      When I started off trying to get this to work the machine had ALSA on it (audacious was outputting to it); along the way I've installed pulseaudio and pavucontrol (as suggested by question referenced below) and switched audacious to pulseaudio output - no improvement. Then I installed jackd, fired up qjackctl... and I'm completely out of my depth now. Is there any simple prescription for getting recordmydesktop to record application's audio ? (Preferably with the system restored to it's original ALSAness and the pulse/jack stuff removed if not necessary; I note VirtualBox, which is the intended target, seems to mention ALSA in its logs). I'm aware of this question but the solution is, I assume, Ubuntu specific as, for me, nothing ever appears in the PulseAudio volume control (it continues to display "No application is currently recording audio" on the recording tab, whereas that answer seems to imply recordmydesktop should appear there when running so a stream can be routed to it). I also tried the "instanbul" grabber but that didn't work any better. Also gtk-recordMyDesktop but that just seems to be a thin wrapper for the recordmydesktop commandline tool and just obfuscates problems. Thanks for any Debian-specific help


title: Force fsck check after reboot with single command

text: I'm looking for systemd's equivalent to the `shutdown -F` command. I know that I can force fsck by adding `fsck.mode=force` to kernel options or tweak mount count for disks. I have tried `touch /forcefsck` but it doesn't work with latest systemd versions.


title: How to delete a line containing pattern which is first found after a specific pattern

text: I am writting a shell script to delete an entry from a specific group. eg: file name is `dest.xml`               <domain id="1" group_name="group1">         <node id="ABC">         <node id="PQR">         <node id="XYZ">     </domain>     <domain id="2" group_name="group2">         <node id="PQR">         <node id="XYZ">     </domain>     <domain id="3" group_name="group3">         <node id="ABC">         <node id="PQR">      </domain>      I want to delete an entry from above file (filename is dest.xml) with `node id="PQR"` from `group_name="group1"` (it should not get deleted from group2 and group3). I can do it by reading a file sequentially n then delete it from a specific group. But if the file is to large (>10k lines) then it takes time. Is there any simple way to this this?


title: Prevent a second instance of my software from starting

text: I wrote a service script to run a specific software at boot time. How can I restrict this software so that it does not run manually again? I mean software has to have just one instance in the memory.. I don't want to change the source code of my software, I want init to this job for me.


title: Why does insert-mode map "<F4>" unpredictably inserts itself or executes intended key strokes?

text: In Vim 7.3.1-762, mintty 1.1.2 (xterm), cygwin, Windows XP, the insert-mode map `<F4>` executes the intended key strokes at one time but inserts itself at another time. This undeterministic behavior especially occurs if I hold the `<F4>` key depressed. How do I make the behavior predictable accross multiple Vim-, terminal- and operating system versions? This is the code I defined in my `~/.vimrc` file, that seems relevant to me:               set compatible     set timeout     set ttimeout     set timeoutlen=1000     set ttimeoutlen=100     imap <F4> <C-\><C-O>:set relativenumber! relativenumber?<CR>      If I assign the mapping to a function key above `<F4>`, e.g. `<F5>`, `<S-F7>` etc. I don't experience the behavior mentioned above. Also if I disable the `timeout` option with `set notimeout` it does seem to do the trick.


title: Wrongly set chmod / 777. Problems?

text: I was trying to run `chmod -R 777 ./` but ended up typing `chmod -R 777 /` and set `777` on my entire machine. What can go wrong? How can I fix it?


title: Wrong Permission to /etc folder

text: I have given the wrong permission to the `/etc` folder               chmod -R 777 /etc      When I want to login as root it gives me an error and the following output. How can I correct the permissions?               system13@motpl:~$ sudo su     sudo: /etc/sudoers is mode 0777, should be 0440     sudo: no valid sudoers sources found, quitting     sudo: unable to initialize policy plugin     system13@motpl:~$ su root     Password:      su: Authentication failure     system13@motpl:~$


title: Terminal is not opening in Linux after accidental permission overwrite

text: I am using Debian. I tried to give a permissions to /opt/folder by using               chmod -R 0755 / filename      Unfortunately it changed the permissions of a lot of folders in the root filesystem. So it leads into a lot of problem. Now I can't open any application (i.e) Terminal, Browser or even I get errors on restart. How to open a Terminal? (starting and stopping) How to resolve this whole problem?


title: Accidentaly changed the permissions in /

text: Accidentally did :               chmod -R 777 /      Now, RHEL 6 is not booting up. What do I do?   I have a DVD and can go into rescue mode. Can someone explain how do I reset all the permissions ? **Update** Actually it boots, and then reaches to a screen where it displays Redhat logo along with some text localhostXXX. But after that nothing happens. It is not going to the login screen.


title: What is the advantage of a network installation?

text: Looked into a network installation of fedora there. It seems you need to setup http & ftp servers on the host along with booting from a cd. So what are the advantages of installing linux over the network?


title: Ephemeral port : What is it and what does it do?

text: I suddenly came across the term "ephemeral port" in a Linux article that I was reading, but the author did not mention what it is. What is an ephemeral port in UNIX?


title: Library / program deployment

text: What is the best way to deploy a self compiled library, which already exists as an older version in the official repository, to multiple CentOS 6.5 workstations?   * Use the upstream `rpm` specification (from Fedora) to create a newer `rpm`   * Compile, install to separate folder and either:     * copy to `/usr/local/{lib,include,...}` on each workstation     * copy to `/usr/local/companyname/{lib,include,...}` on each workstation     * use a `nfs` share with a central lib location   * something else


title: LUKS change encryption key

text: To change encryption password I can use command:               cryptsetup luksChangeKey /dev/sda2      ... and that works. But how to encrypt /dev/sda2 partition again with new password? If my old password is compromised and I only change password, stored data is encrypted with old password not with new.


title: Give domain users permissions on cifs shares?

text: I am using CentOS 6.5 - users authenticate using winbind, all are domain users except for root. `/home` is mapped to a cifs share on a windows server in `/etc/fstab` with this line: `\\\server\home$ /home cifs credentials=/root/samba.txt,_netdev 0 0` Under the `home$` share there are folders corresponding to each username, that are their home directories in windows. Each user has full windows permissions to their individual folders. However, when on the linux system, users only have read and execute access to `/home/$username` Chmodding and chowning does not throw any errors, but neither have any effect on the subdirectories, which are all owned by root. Each user should ideally own, but at least have full access to read/write to their home directories, but they must not be able to read another users home dir.


title: How do I fix this strange behavior with ssh, gnome terminal and gnu screen where function keys F1 through F4 are not accepted?

text: Here is what I am trying to do:   * open Gnome terminal   * launches with my command prompt   * ssh into work via VPN   * launch screen   * create two screen windows   * try to use F3 and F4 as "prev" and "next" with no luck.   * try to use F6 and F7 as "prev" and "next" works fine. Here is my .screenrc                 hardstatus on       hardstatus alwayslastline       hardstatus string "%{.bW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} %m/%d %C%a "       defscrollback 5000       startup_message off            #bind uppercas x to remove region       bind X remove       bind ^X lockscreen            # Bind F3 and F4 (NOT F1 and F2) to previous and next screen window       bindkey -k k3 prev       bindkey -k k4 next            # Bind F5 to switch to next focus       bindkey -k k5 focus            bindkey -k k6 prev       bindkey -k k7 next            #split window       bindkey -k k8 split       bindkey -k k9 remove      What's strange is the following works: Works 1:   * Doing this via putty works fine Works 2:   * using the exact same .screenrc works fine if I am on my local machine Doesn't work:   * using lxterminal has the same issue My thoughts are that ssh may be causing this but not sure. **EDIT:** Here are the outputs of some terminal related commands: **Local Machine:**               $ echo $TERM     xterm          $ infocmp -1 | grep kf.=         kf1=\EOP,         kf2=\EOQ,         kf3=\EOR,         kf4=\EOS,         kf5=\E[15~,         kf6=\E[17~,         kf7=\E[18~,         kf8=\E[19~,         kf9=\E[20~,      **Work Machine:**               $ echo $TERM     xterm          $ infocmp -1 | grep kf.=         kf1=\EOP,         kf2=\EOQ,         kf3=\EOR,         kf4=\EOS,         kf5=\E[15~,         kf6=\E[17~,         kf7=\E[18~,         kf8=\E[19~,         kf9=\E[20~,      **Work Machine using screen:**               $ echo $TERM     screen          $ infocmp -1 | grep kf.=             kf1=\EOP,             kf2=\EOQ,             kf3=\EOR,             kf4=\EOS,             kf5=\E[15~,             kf6=\E[17~,             kf7=\E[18~,             kf8=\E[19~,             kf9=\E[20~,


title: unpack and patch source rpm (rpmbuild -bp) safely

text: I want to unpack source RPM and apply patches to the upstream source. What is _almost_ OK for me is               rpm -i mypkg-*.src.rpm     cd ~/rpmbuild     rpmbuild -bp SPECS/mypkg.spec     # frolic in BUILD/mypkg      My problem is that `rpm -i` always deploys the sources in ~/rpmbuild. And since I want to do it in a middle of automated test (which is running under root), I'd rather do this at least in my own temporary tree. I have tried `\--prefix=mypath` with RPM, but it seems that RPM ignored that ( _after_ hassling me about the path being relative ... nice job ;)). Other thing that came to my mind was creating a temporary user and `su` but that's ugly, adds overhead of creating/removing the user and is not non- intrusive anyway. So what are my other, way better options?


title: makehuman gives "ImportError: No module named numpy"

text: I installed 1.0.0 on slackware 14.1 makehuman 64bit slackbuilds through the site, but the makehuman does not open, the program appears in the KDE menu but does not open. I do not know why it happens, the only dependence was a PyOpenGL library and I installed this library. what may have caused this problem? error:               bash-4.2# exit     exit     bash-4.2# makehuman     Initialized logging     VERSION: 1.0.0     SHORT VERSION: v1.0.0     BASEMESH VERSION: hm08     IS BUILT (FROZEN): No     IS RELEASE VERSION: Yes     HOME LOCATION: /root     SYS.VERSION: 2.7.5 (default, May 29 2013, 02:28:51)  [GCC 4.8.0]     SYS.PLATFORM: linux2     PLATFORM.MACHINE: x86_64     PLATFORM.PROCESSOR: AMD Athlon(tm) 64 X2 Dual Core Processor 4000+     PLATFORM.UNAME.RELEASE: 3.10.17     PLATFORM.LINUX_DISTRIBUTION: Slackware  14.1      Could not create debug dump     Traceback (most recent call last):      File "/usr/share/makehuman/makehuman.py", line 284, in debug_dump     debugdump.dump.reset()       File "./lib/debugdump.py", line 98, in reset     import numpy     ImportError: No module named numpy     Traceback (most recent call last):       File "/usr/share/makehuman/makehuman.py", line 362, in <module>     main()     File "/usr/share/makehuman/makehuman.py", line 347, in main     import numpy     ImportError: No module named numpy


title: How to check whether a command such as curl completed without error?

text: I am using curl to upload a file to a server via an HTTP post.               curl -X POST -d@myfile.txt server-URL      When I manually execute this command on the command line, I get a response from the server like `"Upload successful"`. However, how if I want to execute this curl command via a script, how can I find out if my POST request was successful?


title: tail -f equivalent

text: I am seeing several seconds delay with the tail command. I found the cause for it has something to do with nfs services. I am using arch linux and yet to find out how to disable all these services I have searched and had some indication that other tools will not be effected such as cat so what can give equivalent results to tail -f


title: `$XAUTHORITY` appears from 'nowhere' on su+tmux

text: When I switched from `su+bash` to `su+tmux+zsh` I noticed that I get `$XAUTHORITY` variable defined as `/root/.xauthXXXXXX` where `XXXXXX` are 6 random alphanumeric characters. With previous configuration X worked with root flowlessly but now I need to copy `~username/.Xauthority` to `$XAUTHORITY`. Variable is nowhere defined (I checked `.zshrc`, `/etc/profile*`, `/etc/profile.d/*` etc.).               # env     TERM=screen     SHELL=/usr/bin/tmux     USER=toor     TMUX=/tmp//tmux-0/default,6495,3     PATH=/sbin:/bin:/usr/sbin:/usr/bin     PWD=/root     SHLVL=2     HOME=/root     LOGNAME=toor     DISPLAY=:0.0     XAUTHORITY=/root/.xauthUSzLl4     COLORTERM=gnome-terminal     _=/bin/env     OLDPWD=/root     EDITOR=vim     vcs_info_msg_0_=     vcs_info_msg_1_=      **Edit:**               % echo $XAUTHORITY      /home/mpiechotka/.Xauthority     % su      password:     # echo $XAUTHORITY      /root/.xauthUSzLl4     # ls $XAUTHORITY     ls: cannot access /root/.xauthUSzLl4: No such file or directory     # cat .tmux.conf      set -g default-command /bin/zsh     set -g default-shell /bin/zsh      `su` is aliased to `su - toor` and it opens `tmux` as shell. toor is an alias of root with different shell. PS. I just discovered that it appears on normal su as well. It did not some time ago... **Edit 2** `set-enviroment` didn't help either **Edit 3** `xhost +localhost` did not helped but `xhost +` (disabling all control) DID helped.


title: od emulation for directories

text: I was wondering why od(1) used to work in UNIX but doesn't work in GNU/Linux. There is a nice answer on serverfault. The next question is, are you aware of any tools that can emulate od behavior to support dumping directory data in GNU/Linux?


title: crontab, instance, memory issues+spamming

text: I have a cronjob that runs php5 wp-cron.php every minute to update my website. However something happened and i had 30+ instance of it (31 is marked on this one dump of `ps aux`). It ate up my ram, caused additional instance to terminate do to lack of memory and caused me not to be able to ssh into the box. I can't understand why instances were living >30mins, one usually takes a few seconds. The day it happened i had no jobs planned (although maybe wp cache usesd it? but i never had a problem before) What can i do to prevent a cronjob from spamming and destroying my memory? Is there a way i can say do not start if an instance is alive? and if an instance is alive for more then 5mins kill it? Is there a way i can protect myself from something similar from happening?


title: Why is almost every program complaining about my locale?

text: I'm using Arch Linux, and I've followed the directions on the wiki about setting my locale. Nearly every program that runs complains about the locale - even `locale`. It looks like this:               % locale     locale: Cannot set LC_ALL to default locale: No such file or directory     LANG=     LC_CTYPE=en_US.UTF-8     LC_NUMERIC=en-US     LC_TIME=en-US     LC_COLLATE="POSIX"     LC_MONETARY=en-US     LC_MESSAGES="POSIX"     LC_PAPER="POSIX"     LC_NAME="POSIX"     LC_ADDRESS="POSIX"     LC_TELEPHONE="POSIX"     LC_MEASUREMENT=en-US     LC_IDENTIFICATION="POSIX"     LC_ALL=      or:               % perl     perl: warning: Setting locale failed.     perl: warning: Please check that your locale settings:         LANGUAGE = (unset),         LC_ALL = (unset),         LC_TIME = "en-US",         LC_NUMERIC = "en-US",         LC_MONETARY = "en-US",         LC_MEASUREMENT = "en-US",         LC_CTYPE = "en_US.UTF-8",         LANG = (unset)     are supported and installed on your system.     perl: warning: Falling back to the standard locale ("C")      Something slightly confusing is that the `/etc/locale.gen` has several examples; all the UTF-8 lines have "something.UTF-8", and running `locale-gen` shows `en_US.UTF-8... done` while it's running, but `locale -a`, which is supposed to show you the available locales shows `en_US.utf8`. I've tried various combinations of both formats in `/etc/locale-gen` and `LOCALE=` in `/etc/rc.conf`, but nothing has fixed the problem. Additional information:               % locale -a     C     POSIX     en_US     en_US.iso88591     en_US.utf8      Bruce Ediger's suggestion of setting `LANG=C` and `LC_ALL=en_US.UTF-8` worked (in fact, setting `LC_ALL` fixed it, setting `LANG` didn't matter), but I'd like to know what's happening. According to SUS, LC_ALL will override all the other LC_* variables if it is set and not null. In my system, it is set, but it is null, so it should be ignored, and other values should be used instead. That's not what's happening, it seems that applications are calling `setlocale` with `LC_ALL`, getting a `NULL` back, and generating an error, even when other calls to `setlocale` return a good string. Here is the top of an `ltrace` of `locale` (scroll right to see function return values)               % ltrace locale     (0, 0, 0, -1, 0x7f5c1ae44510)                                                                      = 0x7f5c1ae47140     __libc_start_main(0x401d70, 1, 0x7fff7c8cfbf8, 0x404610, 0x4046a0 <unfinished ...>     setlocale(0, "")                                                                                = "en_US.UTF-8"     setlocale(5, "")                                                                                = "en_US.UTF-8"     textdomain("libc")                                                                                = "libc"     argp_parse(0x607280, 1, 0x7fff7c8cfbf8, 0, 0x7fff7c8cfad4)                                         = 0     setlocale(6, "")                                                                                = NULL     dcgettext(0, 0x405aa8, 5, 0, 0)                                                                    = 0x405aa8     error(0, 2, 0x405aa8, 1, 0locale: Cannot set LC_ALL to default locale: No such file or directory)


title: How to reset Linux root and grub passwords?

text: If we forget our Linux root password, we can change it by changing grub's boot options. But in this case, we also set a grub password and forgot both passwords. How can we recover both?


title: System("pause") in Unix?

text: I normally use a debugger such as `cgdb` so I thankfully hadn't needed to resort to `system` calls for debugging, until now. I have a binary that takes around 30 minutes to load in `gdb` and frequently crashes the debugger thereafter, probably due to the very large number of symbols. This makes my normal workflow (loading `gdb`, adding breakpoints, identifying problem variables, etc.) untenable. In windows I would at this point begin adding lots of `cout` and `system("pause")` (poor man's breakpoint) statements throughout my code; but how do I do this in a unix-like environment?


title: Is it possible to use pendrive as key for Linux system

text: I want to give high security for my linux box. So i planed to use my pen drive as key for my linux box. How can i do it ?


title: WinRAR installer.rar situation (automating expect install)

text: I'm writing a script that should set up a server with no user input. Whatsoever. In order to automate installation of some programs, I used expect. However, what can I use to automate `expect` instalation? During the instalation user is prompted               Do you want to continue? [Y/n]      and I want to automate the response (Y). Any ideas?


title: grep list of names and information from bigger file

text: I have two files: one with list of names (500 entries) and other having some more information for each entry in A.txt and extra entries too. File A.txt (each line is starting with `>` (fasta format) and has spaces, digits and special characters too, but in single line)               >xyz, B=123      >abc, B=231     >mnp, B=567      File B.txt (has some particular information for each entry in A.txt in next line and has extra entries than file A)               >xyz, B=123     01010101010100101     >abc, B=231     1011110000011100000000     >mnp, B=567     10101     >opq, B=678     101010101010101001     >lmn, B=123     101010100000011      Result               >xyz, B=123     01010101010100101     >abc, B=231     1011110000011100000000     >mnp, B=567     10101      I want to grep the entries in list A.txt from list B.txt thanks


title: How to strip multipe spaces to one using sed?

text: `sed` on AIX is not doing what I think it should. I'm trying to replace multiple spaces with a single space in the output of IOSTAT:               # iostat     System configuration: lcpu=4 drives=8 paths=2 vdisks=0          tty:      tin         tout    avg-cpu: % user % sys % idle % iowait               0.2         31.8                9.7   4.9   82.9      2.5          Disks:        % tm_act     Kbps      tps    Kb_read   Kb_wrtn     hdisk9           0.2      54.2       1.1   1073456960  436765896     hdisk7           0.2      54.1       1.1   1070600212  435678280     hdisk8           0.0       0.0       0.0          0         0     hdisk6           0.0       0.0       0.0          0         0     hdisk1           0.1       6.3       0.5   63344916  112429672     hdisk0           0.1       5.0       0.2   40967838  98574444     cd0              0.0       0.0       0.0          0         0     hdiskpower1      0.2     108.3       2.3   2144057172  872444176          # iostat | grep hdisk1     hdisk1           0.1       6.3       0.5   63345700  112431123          #iostat|grep "hdisk1"|sed -e"s/[ ]*/ /g"      h d i s k 1 0 . 1 6 . 3 0 . 5 6 3 3 4 5 8 8 0 1 1 2 4 3 2 3 5 4      sed should search & replace (s) multiple spaces (/[ ]*/) with a single space (/ /) for the entire group (/g)... but it's not only doing that... its spacing each character. What am I doing wrong? I know its got to be something simple... AIX 5300-06 **edit:** I have another computer that has 10+ hard drives. I'm using this as a parameter to another program for monitoring purposes. The problem I ran into was that "awk '{print $5}' didn't work because I'm using $1, etc in the secondary stage and gave errors with the Print command. I was looking for a grep/sed/cut version. What seems to work is:               iostat | grep "hdisk1 " | sed -e's/  */ /g' | cut -d" " -f 5      The []s were "0 or more" when I thought they meant "just one". Removing the brackets got it working. Three very good answers really quickly make it hard to choose the "answer".


title: Screen keeps dimming on Power (Dis-)Connect

text: I would like to disable the automatic screen dimming when I plug in our out my power adapter. Every time my laptop switches between battery/ac, my screen dims even though I have disabled it in every place I could think of. gnome-power-manager does not seem to be involved, as killing it makes no difference. However, here are some of my settings: In my gconf, under the key `/apps/gnome-power-manager/backlight`, I set:   * `battery_reduce`: false   * `enable`: false   * `brightness_ac`: 100   * `brightness_battery`: 100   * `brightness_dim_battery`: 100   * `idle_dim_time`: 3600 Even under `/apps/gnome-power-manager/lowpower`, I unticked all options. Where else can I control screen dimming?


title: apt and aptitude died after dist-upgrade

text: I followed the Debian Instructions for upgrading from Squeeze to Wheezy in Debian. I audited my packages, updated my `/etc/apt/sources.list` file to get Wheezy sources, I ran `apt-get update` and `apt-get upgrade`, and upgraded many packages. Everything was still working. Now, if I do anything with `apt-get` that involves installing or updating, I get the following error: `W: Failed to fetch http://ftp.ca.debian.org/debian/dists/wheezy/main/binary- amd64/Packages Something wicked happened resolving 'ftp.ca.debian.org:http' (-11 - System error)` (the URL may be different, but the error messages are all the same). Many threads online mention to try to ping those addresses. My ISP here blocks ping, but I can do an `nslookup` to the domain names, and get the right IP address. I can also use `wget` to download webpages by name (i.e. `wget www.google.com` works, and gives me the index.html file). So I know name resolution is NOT an issue. I checked the dpkg log, but it doesn't seem too helpful:               /var/log# tail dpkg.log     2014-04-21 09:55:35 status installed dictionaries-common:all 1.12.11     2014-04-21 09:55:35 trigproc menu:amd64 2.1.46 <none>     2014-04-21 09:55:35 status half-configured menu:amd64 2.1.46     2014-04-21 09:55:35 status installed menu:amd64 2.1.46     2014-04-21 09:55:35 trigproc sgml-base:all 1.26+nmu4 <none>     2014-04-21 09:55:35 status half-configured sgml-base:all 1.26+nmu4     2014-04-21 09:55:35 status installed xml-core:all 0.13+nmu2     2014-04-21 09:55:35 status installed sgml-base:all 1.26+nmu4     2014-04-21 11:23:38 startup packages purge     2014-04-21 11:39:37 startup packages purge      (This post is being made about 5 hours later. Apt and Aptitude are not writing here). The files in /var/log/apt haven't been written to since 09:55am today, so nothing is getting written there either. The `/` partition has 83 GB free (I didn't build this server, my predecessor did). Aptitude loads, but won't download anything. In it, if I hit the `u` key to bring up the Update screen, I'm greeted with all the same error messages, in red, and a dialog reading `Downloaded 0 B in 0s (0 B/s). Some files were not downloaded successfully.`. I have tried restarting, and nothing seems to change. My current services are still running OK on it (i.e. Samba, Apache2). What can I look into to try to figure this out?


title: Install GCC on OpenSUSE 11.4

text: I installed OpenSUSE 11.4 but I noticed that it don't have `gcc`… How I can install it?


title: Why does sshd accept local network inbound connections and refuse external inbound connection?

text: When I try to connect to my server from the internet, I always get:               debug2: ssh_connect: needpriv 0     debug1: connect to address XX.XX.XX.69 port 22: Connection refused     ssh: connect to host XX.XX.XX.69 port 22: Connection refused      But from the local area network with `192.168....` all works fine. Why this difference? _Note_ I tested with `telnet XX.XX.XX.69`. Port 22 is open.


title: Samba's "inherit permissions" does not inherit modes for other

text: I have a share with "inherit permissions = yes". I have a directory in the share with mode rwxrwsr-x. If I create a subdirectory, the modes are rwxrws---. The same happens with a parent directory with mode rwxrwxr-x (resulting in rwxrwx---). The permissions of the newly created subdirectory are independent of the OS used to create them and apparently independent of the umask when using smbfs (mount.cifs). The following is an excerpt from **smb.conf** and contains everything related to permissions, modes, etc. of the share.                   force group = +mi         inherit permissions = yes         inherit owner = yes         nt acl support = no      I added "nt acl support = no" for testing purposes and it does not seem to make a difference. Does "inherit permissions" not work for non-user, non-group modes?


title: Share files between RedHat and Mac

text: I have one RedHat 6 machine and three Mac OS machines. I want the RedHat one to be a file server, so that all files will be stored there. All Mac clients will access this server according to their rights. It seems that this will not use samba. Could you please let me know what should I do in this case?


title: How to re-enable the caps lock key?

text: I am currently setting up my default keyboard layout like this:               setxkbmap -layout us -variant dvorak -option ctrl:nocaps,[...]      It disables the caps lock key and makes it an additional ctrl key, along with a swarm of other options. I would like to do the following to switch keyboard layouts:               setxkbmap -layout us -variant dvorak-l -option ctrl:swapcaps      However, it does not re-enable the caps lock key; both the left control key and the caps lock stay as control keys as far as I can see. I know I can clear the whole options list, but in the interest of maintainability, I would rather not copypaste the options around. How do I re- enable caps lock? _Update:_ Looking at keypresses with xev(1), it appears ctrl:nocaps gives a `Control_L` for both keys, and ctrl:swapcaps "restores" the caps lock key (pressing the key gives `Caps_Lock`). However, the caps lock LED does not light up nor does it actually work. Looking at the `xkeyboard-config/symbols/ctrl` file in X.org sources does hint at the problem:               xkb_symbols "nocaps" {         replace key <CAPS>  {  [ Control_L, Control_L ] };         modifier_map  Control { <CAPS>, <LCTL> };     };     xkb_symbols "swapcaps" {         replace key <CAPS>  {  [ Control_L ] };         replace key <LCTL>  {  [ Caps_Lock ] };     };      The latter option lacks a modifier_map line, whatever that does


title: How to log if an environment variable is unset?

text: How can I write a shell script that checks for an environment variable and writes to a log file if the variable is unset? Also, if the file name pointed by env variable doesn't exist, how to create it?


title: How to set IP adress automatically in Arch Linux?

text: I am using latest Arch Linux. But whenever I start my PC, it sometimes gets an IP address but most of the time, it gives me stress. I am getting very confused, how can I make sure it is really setting DHCP IP? This is what I have: In `rc.conf`:               DAEMONS=( ... network dhcpcd ) On system boot I have in `~/.xinitrc`               ip link set dev eth0 up     ip link set dev eht1 up     dhcpcd -t 100 But now, I have rebooted 10 times, and I do not get any IP address. Follow up: Yesterday i had interfaces eth0, eth1, lo. After this strange problem of IP. Now i am successfully boot back to my same BOX, same configurations.   1. I do not have any eth1 anymore   2. Network cable was connected to eth1 (eth0 was not used because its in very messy place where i have lot of USB connected + Display cables connected) Why my eth1 completely disappeared? (i never saw this in CentOS, Fedora in my 1 years linux driving experience)


title: gnome-terminal comes up blank

text: I'm trying to get gnome-terminal to run on my system. I've tried various installation methods... Unfortunately all of them come up BLANK they also don't accept input very strange... here's a screenshot http://i.imgur.com/EhY4DRX.png wondering if anyone has any knowledge or ideas about this?


title: Ctrl-space not getting through ssh

text: I am on windows 8 using GIT bash to access a remote server via `ssh`. When I press `Ctrl`+`Space` in emacs running locally in console (`emacs -nw`), everything works as expected. However, when going over `ssh`, `Ctrl`+`Space` simply inserts a space, while other commands like `Ctrl`+`X` work fine. Why doesn't `Ctrl`+`Space` get through? I have considered switching to a different terminal, but I am also curios as to why this is happening.


title: How can I install Bastille on a recent version of Debian?

text: To the best of my ability, I have looked everywhere in order to find a `.deb` file however even on its own website (bastille-linux.org) it is recommended to use `aptitude` which no longer seem to contain Bastille in its repository. How can I download Bastille's installer?


title: Online administration tool

text: do you know any solutions like webmin for my ubuntu/debian box? I want to control some of my machines over network via HTTP. Is there any solution that will provide me with a dashboard? Even better if it will support multiple boxes. *EDIT: I got many debian/ubuntu boxes with the same configuration. So I need to a dashboard to overview/control that boxes.  Webmin is a option, but I want to know is there any alternatives like a ajenti, for example. Could our community help me to figure it out?


title: Who is file owner if the file is created using sudo command?

text: I logged in using my username `ravbholua`: ravbholua@ravbholua-Aspire-5315:~$ echo $LOGNAME ravbholua I create file named `a1`:               ravbholua@ravbholua-Aspire-5315:~$ echo>a1     ravbholua@ravbholua-Aspire-5315:~$ ll a1     -rw-rw-r-- 1 ravbholua ravbholua 1 Oct  8 09:57 a1      As expected the above file has me (`ravbholua`) as owner. Next I create a2 using sudo with `echo` command:               ravbholua@ravbholua-Aspire-5315:~$ sudo echo>a2     ravbholua@ravbholua-Aspire-5315:~$ ll a2     -rw-rw-r-- 1 ravbholua ravbholua 1 Oct  8 09:57 a2      The owner is me only, i.e. `ravbholua`. Now I create a3 using sudo again but with `vim` command:               ravbholua@ravbholua-Aspire-5315:~$ sudo vim a3     ravbholua@ravbholua-Aspire-5315:~$ ll a3     -rw-r--r-- 1 root root 10 Oct  8 09:57 a3      Oh! how come the owner changes now. It's not me but root. Why such variation with `echo` and `vim`! It's a surprise that with _change of commands_ how can the owner of the created file changes.


title: Java PATH issue when installing JDK7 on centos 32 bit

text: I have Installed JDK 7 on CentOS 32 bit virtual machine. I also have set the path for java. In one terminal it is showing java1.7 But when I open another terminal and look for, java -version It is showing java1.4 Need solution, Can anyone help me on this


title: How can we resize the LVM in Fedora 17?

text: I was trying to install Backtrack along with Fedora 17. While installing the BT I found there was no free space in my system. When I checked the FS in Fedora, all my space in HDD is used as LVM.


title: Get the PID of file creation

text: I am writing a bash script that creates 5 files with the extension ".P" and write a line of "something" into them. "P" represents a number and it's the PID of the process that creates the file. How can you do that? I am creating my file and writing into it like this: `echo "something" > file_name`


title: Virus 'caught' while using Linux lays dormant, becomes active when login into Windows, can it be?

text: Can I 'catch' a Windows virus, while using Linux - so it will be saved on my hard drive and start working when I log in to Windows? I know it wouldn't affect the Linux itself. I am using 'Dual boot', not operating both systems at the same time. Also, would a harming change, caused by, say - a spyware, to my browser (Chrome), while surfing when using 'Linux' appear again when I open my 'Chrome' on Windows ?