title: ttyO ports do not have the good port address on QEMU 1.4.0 running image for beagleboard-xm

text: I'm running an Linux Image (kernel 3.2.8) for beagleboard-xm on QEMU's 1.4.0 emulator Ubuntu distribution for 13.04. My image is created using Buildroot beagle_defconfig. I added some pkgs to be able to debug a little. QEMU call cmd:               `$ sudo qemu-system-arm -M beaglexm -m 1024 -sd ./test.img -clock unix -serial stdio -device usb-mouse -device usb-kbd -serial pty -serial pty`     [sudo] password for emperador:           char device redirected to /dev/pts/3 (label serial1)     char device redirected to /dev/pts/4 (label serial2)      What I want to do is to have a communication between guest and host across serial the 4 differents ttyO present on the guest. QEMU offer facilities to redirect the trafic to some device in the host side. My problem goes like this: At the guest kernel boot Im able to see that my UART where enabled               [    2.682040] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled     [    2.777947] omap_uart.0: ttyO0 at MMIO 0x4806a000 (irq = 72) is a OMAP UART0     [    2.794967] omap_uart.1: ttyO1 at MMIO 0x4806c000 (irq = 73) is a OMAP UART1     [    2.814942] omap_uart.2: ttyO2 at MMIO 0x49020000 (irq = 74) is a OMAP UART2     [    2.966825] console [ttyO2] enabled     [    2.984777] omap_uart.3: ttyO3 at MMIO 0x49042000 (irq = 80) is a OMAP UART3      In fact when I go see in to `/proc/tty/driver` and I do a cat on OMAP-SERIAL Im able to see this serinfo:1.0 driver revision:               0: uart:OMAP UART0 mmio:0x4806A000 irq:72 tx:0 rx:0 CTS|DSR|CD     1: uart:OMAP UART1 mmio:0x4806C000 irq:73 tx:0 rx:0 CTS|DSR|CD     2: uart:OMAP UART2 mmio:0x49020000 irq:74 tx:268 rx:37 RTS|CTS|DTR|DSR|CD     3: uart:OMAP UART3 mmio:0x49042000 irq:80 tx:0 rx:0 CTS|DSR|CD      I know that ttyO2 is working because my console is been redirected to it. The thing is that doing a set serial on any of the ttyO I get the following message:                [root@enu driver]# setserial -a /dev/ttyO0     /dev/ttyO0, Line 0, UART: undefined, Port: 0x0000, IRQ: 72         Baud_base: 3000000, close_delay: 50, divisor: 0         closing_wait: 3000         Flags: spd_normal      The same goes with ttyO2. I tried to set some settings to any of the ttyO with `setserial` but I always get the same message:               [root@enu ~]# setserial /dev/ttyO0 uart 8250                                   setserial: can't set serial info: Invalid argument     [root@enu ~]# setserial /dev/ttyO0 port 0x4806a000     setserial: can't set serial info: Invalid argument      While looking at guest `/proc/tty/drives` this is what we see               /dev/tty             /dev/tty        5       0 system:/dev/tty     /dev/console         /dev/console    5       1 system:console     /dev/ptmx            /dev/ptmx       5       2 system     /dev/vc/0            /dev/vc/0       4       0 system:vtmaster     sdio_uart            /dev/ttySDIO  249 0-7 serial     acm                  /dev/ttyACM   166 0-31 serial     ttyprintk            /dev/ttyprintk   5       3 console     OMAP-SERIAL          /dev/ttyO     253 0-3 serial     serial               /dev/ttyS       4 64-95 serial     pty_slave            /dev/pts      136 0-1048575 pty:slave     pty_master           /dev/ptm      128 0-1048575 pty:master     unknown              /dev/tty        4 1-63 console      Basically I want to establish a serial communication between a guest and a host, but the serial ports on the guest side aren't well configured. `/sys/class/tty` show that tty drivers had been linked to a serial device. has I showed up before, only omap uarts have been initialized and attached to ttyO*. notice that the console is been redirected ttyO2 by kernel configs. but because I added `-serial stdio`, console is been redirected to the terminal that invoked QEMU. If I redirect the console using at first `-serial pty` instead of `-serial stdio` , I'm able to prompt the console in minicom by opening the pty created on the host side. Still nothing happen on the others pty created on the host side to communicate across other ports. On host side I open `/dev/pts/3` and `/dev/pts/4` with minicom or by doing `cat` on them On guest side: Whent I do `echo "test" > /dev/ttyO0` or 1 or 3 nothing. but when I do it on ttyO2, "test" prompt on the console terminal (which is normal). now when using any of the ttyS:               echo "test" > /dev/ttyS0      I get               -bash: echo: write error: Input/output error      I made some research about this error and what I found is that is could be many things. But one thing that I noticed was that no device beside serial has been assigned to ttyS. and looking at /proc/tty/driver/serial we see this :               serinfo:1.0 driver revision:     0: uart:unknown port:00000000 irq:0     1: uart:unknown port:00000000 irq:0     2: uart:unknown port:00000000 irq:0     3: uart:unknown port:00000000 irq:0      also `setserial -a /dev/ttyS0` confrim this:               /dev/ttyS0, Line 0, UART: unknown, Port: 0x0000, IRQ: 0         Baud_base: 0, close_delay: 50, divisor: 0         closing_wait: 3000         Flags: spd_normal      I managed to do serial communication with muliples ports usig grml image on a x86 architecture. So its seems the host side is fine. If anyone have ever made something like this work before on QEMU -M beaglexm or any other ARM architecture, I would gladly take any details on the VM used, QEMU's version and distribution as well as the kernel details and image configs used.


title: Bash scripting - loop until return value is 0

text: I need to umount something in my script, but sometimes it unmount's before all of the data has finished being copied and causes the umount to fail. I looked for a way to do a "blocking" umount, but I didn't find anything. So, I tried to write a script to loop until it could be unmounted, but it doesn't work.               while [ `sudo umount mount` ]     do         sleep 0.1     done     rmdir mount      When run outputs:               umount: /home/evantandersen/mount: device is busy.             (In some cases useful info about processes that use              the device is found by lsof(8) or fuser(1))     rmdir: failed to remove `mount': Device or resource busy      Shouldn't it loop until the return value of `sudo umount mount` is 0, meaning it was successfully umounted?


title: Grub2 adding a new Linux distro

text: I installed Arch Linux on my computer, but I also installed Slackware on another partition (`/dev/sda5`). I would like to configure Grub2 from the Arch Linux installation through the `/etc/grub.d/40_custom` file to add Slackware to the menu list at boot. I searched for quite some time on the Internet but failed to find an answer to whether I need to install Grub in Slackware too and what exactly to write in the config file. Reading the full documentation of grub is too long. I tried the following but during loading of Slackware, I have a kernel panic event saying something like "unable to find block":               menuentry "Slackware 14.0" {             set root='hd0,msdos5'             echo 'Loading Linux Slackware 14.0 ...'             linux /boot/vmlinuz root=UUID=xxxXXxx-xx-XXX... ro acpi=off     }


title: How can I be notified about state changes to a VPN adapter

text: On Ubuntu 12.04 - actually Kubuntu, but I am using NetworkManager, so the configuration should be the same - I have configured a few VPN connections. Now, if I have a long-running up- or download, how can I ensure that all network traffic is stopped immediately and unconditionally if the VPN connection breaks off? What I am looking for is some method of getting notified (I don't want to poll!) of the change. The rest (e.g. inserting netfilter rules) I can handle myself. I just need to find out how to get notified about a change to an established connection. In case it matters, the configuration I am using is based on `tun0`. If other details are required, let me know in a comment and I'll add them to the question. * * * What I have tried so far:   * configure the main LAN connection (this is inside a VM, so there is only a LAN connection) to be manual   * configure the VPN to be automatic then I figured that this isn't the route I want to take anyway, because I want to start my script/program to get notified only whenever I activate the VPN. I am not running on VPN all the time, but most of the time. So basically I need to register for some notification as soon as a particular VPN connection is established and then get notified if something happens to it in order to tear down the main connection automatically in response.


title: how to stop Clementine playback on suspend using systemd

text: As the title says, I'm trying to stop Clementine playback using DBus before entering suspend mode. Here is my service file right now:               [Unit]     Description=Stop Clementine playback before suspend     Requires=dbus.service     Before=sleep.target     Before=dbus.service          [Service]     User=jo     Type=oneshot     ExecStart=-/bin/sh -c 'qdbus org.mpris.clementine /Player org.freedesktop.MediaPlayer.Stop'          [Install]     WantedBy=sleep.target      Now, this works, i.e. playback is stopped. However, systemd then proceeds to take a long time to actually enter suspend mode. Looking at the logs in journalctl, I see:               Jun 05 23:43:53 localhost.localdomain systemd[1]: Starting Suspend...     Jun 05 23:44:18 localhost.localdomain systemd-sleep[7052]: Error: org.freedesktop.DBus.Error.NoReply     Jun 05 23:44:18 localhost.localdomain systemd-sleep[7052]: Did not receive a reply. Possible causes include: the remote application did not send a reply, the      Jun 05 23:44:18 localhost.localdomain systemd-sleep[7052]: Suspending system...      My first thought is that the DBus system, or maybe Clementine itself is suspended before it has time to reply, thus causing a hang. This is why I tried adding a dependency to the dbus service in my service file above. However, that does not do the trick. Any ideas?


title: Common, accessible filesystem with very high filename size limit?

text: I need to extract an archive that contains files whose names are longer than 256 characters. Every common filesystem I have tried (ntfs, ext3, ext4) has a limitation on filename size at 255 or 256 bytes. Is there a filesystem I can easily use in a Debian system (mkfs, mount, etc) that helps me get around this limitation?


title: Postfix error: not yet authorized to deliver mail

text: I am running a private postfix server for my domain `mydomain.com`, on server `111.111.111.111` (IP and domain sanitized for privacy reasons) I have sent an email to `info@example.com` which is on server `222.222.222.222`. The message was deferred, and in my postfix logs, I could see following error:               postfix/smtp  9D055EA: host mail1.example.com[222.222.222.222] said:      451-111.111.111.111 is not yet authorized to deliver mail from 451      <martin@mydomain.com> to <info@example.com>. Please try later. (in      reply to RCPT TO command)      My domain has reverse DNS record set up, and I am using SPF record. Both are configured correctly, I can send emails all right, this is the first case when I have seen these errors. This leads me to believe, that this error is caused by misconfiguration on the destination server. But since I am not sure what these errors mean, I would like if somebody could explain it.


title: Splitting display among computers

text: If i have 17 system units (computers with monitors) that connected using network, is it possible to display image or video splitted into those computers without having split it manually?               1 2 3 4 --> slave PCs     5 6 7 8      9 A B C     D E F G     | | | |     [switch]      |     0 --> master PC      what is the software to display images and videos into those monitors?


title: Mark packets between machines (client and router)?

text: Can I mark a packet on the client's `OUTPUT` chain and add an iproute policy on the router to route them via a specific gateway? This what I tried to do, but it isn't working. My client's mangle table dump:               Chain OUTPUT (policy ACCEPT 13884 packets, 2327K bytes)      pkts bytes target     prot opt in     out     source               destination              13917 2330K MARK       all  --  *      *       0.0.0.0/0            0.0.0.0/0            MARK set 0x2          Chain POSTROUTING (policy ACCEPT 13889 packets, 2328K bytes)      pkts bytes target     prot opt in     out     source               destination              13889 2328K LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0            mark match 0x2 LOG flags 0 level 4      `iptables` mangle table's INPUT chain dump on the router:               Chain INPUT (policy DROP 0 packets, 0 bytes)      pkts bytes target     prot opt in     out     source               destination                  0     0 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0            mark match 0x2 LOG flags 0 level 4      2074  196K ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            state RELATED,ESTABLISHED        88 14890 ACCEPT     all  --  ethint *       0.0.0.0/0            0.0.0.0/0                    0     0 ACCEPT     all  --  eth0   *       0.0.0.0/0            0.0.0.0/0                 After some moments and sending test packets (pings from a client connected to the router via wifi, sent to a host outside the intranet), the LOG counter on the router remains equal to zero. ### Questions   * What's happened to my packets?   * Where my packets lose their marks?


title: What scripting language can I use to automate a concatenation & zipping process?

text: For a project I'm doing I need to concatenate and compress (with zip) many (midi) files and compare their sizes. I've thought there must be some language that allows me to do something like this:   1. create all pairwise concatenations (i.e. I need to merge files 01.mid and 02.mid and create file 0102.*, I don't care if it's a valid midi file or not, I just want it to have the information of both of them. Is .tar a good option?)   2. compress all files independently (original and concatenated)   3. check all file sizes and write them in some table which I can then import with Matlab or something Should I use bash scripting?


title: Command substitution - single quotes and spaces

text: How can I make command substitution pass a list of single-quoted POSIX paths separated by spaces?               command1 $(command2)     command1 '/path/to/file 1' '/path/to/file 2' '/path/to/file 3'      How can I trace the expansion?


title: Why does monitor stay on when DPMS is enabled?

text: I am running Mint 13 connected to a Dell U2711 monitor via displayport. When the GDM logon screen is displayed, DPMS does not ever shut down the monitor. If I logon and run               $ xset -q      I get               ...      Screen Saver:       prefer blanking:  yes    allow exposures:  yes       timeout:  0    cycle:  0     ...     DPMS (Energy Star):       Standby: 600    Suspend: 600    Off: 600       DPMS is Enabled       Monitor is On      If I run               $ xset dpms force off      The monitor blanks for about two seconds, and then it comes back on again. I have tried disabling my mouse as this post suggests with               $ xinput --set-prop [id] "Device Enabled" "0"      but no luck. The symptoms are a little different than this post's, and I am not running gnome-power-manager. Could someone please tell me what I am doing wrong? Here is my video card and driver information:               $ lspci -v | grep VGA     05:00.0 VGA compatible controller: NVIDIA Corporation GF106GL      [Quadro 2000] (rev a1) (prog-if 00 [VGA controller])     $ egrep -i " connected" /var/log/Xorg.0.log     [1743798.098] (II) NOUVEAU(0): Output DP-2 connected     $ egrep -i "drivers" /var/log/Xorg.0.log     [1743797.880] (II) Loading /usr/lib/xorg/modules/drivers/nouveau_drv.so     [1743797.882] (II) Loading /usr/lib/xorg/modules/drivers/vesa_drv.so     [1743797.882] (II) Loading /usr/lib/xorg/modules/drivers/fbdev_drv.so     ...      I also have:               $ grep DPMS /var/log/Xorg.0.log     [2246008.870] (II) Loading extension DPMS     [2246009.091] (II) NOUVEAU(0): DPMS capabilities: Off     [2246009.113] (==) NOUVEAU(0): DPMS enabled


title: Any tips for surviving Terminal.app?

text: I've recently switched to using a Mac full-time, and am having trouble getting used to Terminal.app after years of loving gnome-terminal. I miss having URLs show up underlined, using alt+arrow to move between words, and having screen+ssh behave the way I'm used to it. I'm trying to get used to the following key combinations to survive in Terminal.app:   * `Alt``B` to go back a word   * `Alt``F` to go forward a word   * `Alt``A` to go to the beginning of a line   * `Alt``E` to go to the end of a line   * you can still right-click on a URL to open it, it just doesn't look pretty like in gnome-terminal Does anyone have any other good tips or alternative terminal suggestions to retain command line efficiency on a Mac?


title: The 'less' command-line equivalent of 'tail -f'

text: I would like to open up a file using less, and have it automatically scroll the file similar to `tail -f`. I know that I can do `less file`, and then hit `Shift-F` to forward forever; like `tail -f`. I need `less` because it provides the `\--raw-control-chars` flag, which is necessary because my input is colorful.


title: How to trigger error using Trap command

text: I am using Ubuntu 12.04.2. I am trying to use "trap" command to capture abnormal or error in my shell script but I am also trying to manually trigger "Error" exit. I have tried exit 1, but it won't trigger "Error" signal.               #!/bin/bash          func()     {         exit 1     }          trap "echo hi" INT TERM ERR     func      Not sure how to manually trigger "Error" exit signal?


title: How to create strong passwords in Linux?

text: I wonder how I can create strong passwords on Linux (for both normal and admin users) and if there are specific programs to do that.


title: Fedora 20 on Macbook Pro Retina 11.1 (Late 2013)

text: I've got myself a new Macbook last week but I just can't get used to OSX and would like to use a Ubuntu, Debian or Fedora installation as Main OS. I have installed Fedora without a bootloader as the guide I followed required me to build my own grub2 bootloader. The SSD in the macbook looks is partitioned like this:   * /dev/sda1 - Apple EFI   * /dev/sda2 - Apple Data   * /dev/sda3 - Apple Boot   * /dev/sda4 - Fedora /boot/efi   * /dev/sda5 - Fedora /boot   * /dev/sda6 - Fedora LVM   * /dev/mapper/fedora-home - Fedora Home   * /dev/mapper/fedora-root - Fedora Root   * /dev/mapper/fedora-swap - Fedora Swap I've used the tool "boot-repair" in a ubuntu live disk to get debian to boot once before, however it didn't work for Fedora(I guess it's because of the LVM). A few questions regarding booting into Fedora on a Macbook Pro Retina (Late 2013):   1. Do I need to use REFInd?   2. Where do I need to place my `grub.cfg`?   3. Do I need to configure a .efi file from my `grub.cfg`?   4. Where do I need to place this EFI file? Could someone please help me out here, I've tried so many tutorials and solutions which were written so poorly I gave up halfway.


title: How to install ruby-devel and python-devel in SuSE Enterprise?

text: I've been trying to install some software in SuSE Enterprise (SLES 11 SP 2 64 bits), and keep getting errors about missing dependencies. In the past, I could work around them (in an Ubuntu system) by installing **python-devel** , but I couldn't find it in SLES repository. Now I need to install Ruby Gems, and also can't find either **ruby-devel** or **rubygems** using zypper. I should be able to install Gems manually, but I'm clueless about those two "devel" packages. When googling them, I keep getting OpenSuse results (which are pointless, since AFAIK OpenSuse comes with these packages already included in its repositories) regardless of searching for "suse", "suse enterprise" or "sles". Most searches for binaries also show only files targeting OpenSuse. How can I install these two packages? I'm fairly new to SuSE Enterprise (or SuSE in general), and not very familiar to its installation procedures. I've had no problems using zypper or YaST to install things which came included in the default repositories, but - while I could look up how to include other repos - I'm having trouble even _finding_ the right ones to include. P.S. I just found this thread about [the lack of] devel RPMs for SuSE Enterprise. I haven't tried following those instructions yet (will do later, if a more direct and/or simpler approach doesn't show up).


title: xkb - Keymaps at `/usr/share/X11/kbd/symbols` 2 values vs 4 values being specified

text: I am a noob when it comes to `linux` and `xkb`. Sorry if the question seems very obvious and stupid. I was checking the keymap found at `/usr/share/x11/kbd/symbols` and in particular, I was browsing the `us` keymap and I didn't understand how this works: > key `<TLDE>` { [dead_grave, dead_tilde, grave, asciitilde ] }; I understood that: > key `<TLDE>` { [ grave, asciitilde ] }; meant that for regular keypress of ```, I would get `grave` on the screen and pressing `Shift`+``` would result in `asciitilde (~)`. So, how can 4 values be represented?


title: Parse lines of output from bash loop

text: I'm trying to parse the output of commands run in a bash loop. Here is an example:               $ for i in `git log --format='%H'`; do echo $i ; git branch --contains $i; done | head -n 8     5f11ce7da2f9a4c4899dc2e47b02c2d936d0468e     * foobar     e1c3f6fabd45715b527a083bc797e9723c57ac89       dev1     * foobar     7053e08775d2c1da7480a988a235e445799cbca5       dev1     * foobar      The command `git log --format='%H'` prints out only the commit ID for each Git commit. The command `git branch --contains $i` prints out which Git branches contain the commit. I'm trying to find the latest git commit that is not on branch 'foobar'. I would like to echo `$i` for the first branch whose output of `git branch --contains $i` contains a line that does not start with the `*` character, which specifies "current branch". What Bash documentation should I be reading? Note that I am aware of other solutions to this problem. However, I plan on making additions that the other answers do not account for. Furthermore, this is how I improve my Bash scripting abilities.


title: LDAP: view DIT structure from terminal

text: Can I get list of existing entries using any console utilities? For example - I can get a tree of my filesystem with `tree`:               $ tree     .     ├── Catalina     │   └── localhost     │       ├── host-manager.xml     │       └── manager.xml     ├── catalina.policy     ├── catalina.properties      Can I get a similar view with `shelldap`, `ldapsctritps` or builded **OpenLDAP** utils?


title: Adding shortcuts to docky on Gnome 3

text: So I have been using `docky` on Linux for a while and really enjoy it. However, with the introduction of Gnome 3 I can still run docky but the ability to be able to drag shortcuts from the menu to the bar is now gone. Is there another way to add shortcuts to the docky bar to get this functionality?


title: postfix queue file write error only when sending emails from smartphone

text: This might sound weird, but the thing is, that I cannot send emails from my smartphone even though it works from my desktop email client. I double-checked that the smtp settings are correct. This is the status log I am getting as error messages:               Transcript of session follows.           Out: 220 ****.tld ESMTP Postfix (Debian/GNU)      In:  EHLO [IP ADDRESS]      Out: 250-****.tld      Out: 250-PIPELINING      Out: 250-SIZE 26214400      Out: 250-VRFY      Out: 250-ETRN      Out: 250-AUTH PLAIN LOGIN      Out: 250-ENHANCEDSTATUSCODES      Out: 250-8BITMIME      Out: 250 DSN      In:  AUTH PLAIN SOME_LONG_CODE      Out: 235 2.7.0 Authentication successful      In:  MAIL FROM:<xxx@***.tld>      Out: 250 2.1.0 Ok      In:  RCPT TO:<a@b.tld>      Out: 451 4.3.0 Error: queue file write error      In:  QUIT      Out: 221 2.0.0 Bye      What is this? Authentication seems to work fine, and I am not sending attachments. (That is mainly what I get when I google that error, that attachments are too big). As I said: It works from thunderbird but doesn't from my smartphone. (Android with K-9 Mail). What could be the problem here?


title: Generate a list of files from a file containing a series of globbing patterns

text: I am looking for a way to build a list of files by parsing a file that contains a sequence of `zsh` globbing patterns. The final goal is to pass this list of files to `hg add` in mercurial. For those interested in this specific part, my question is motived by this other question that I asked in StackOverflow:   * Mercurial “hginclude”? (globbing syntax to specify which files to track) A sample file (let's call it `.hginclude`) would look as follows:               .zshrc                                                                                .zprofile                                                                                .less*                                                                                .emacs*/**                                                                                src*/**                                                                                .hg*                                                                                .bash*                                                                                .inputrc                                                                                .ssh      and the output from the script should be a list of **files** obtained by collecting the output of `print globbing_pattern` on every line, where `globbing_pattern` refers to each line in the file `.hginclude` above. Ultimately, the list of files should be a list that I can pass to `hg add` to track those files in mercurial. The assumption for this part is that I have an `.hgignore` with the following:               syntax: glob     *      which means: don't track anything unless explicitly added via an `hg add` command.


title: Bash script to get ASCII values for alphabet

text: How do I get the ASCII value of the alphabet? For example, `97` for `a`?


title: Can't control brightness on HP Pav dv6t running Fedora 16

text: I installed FC 16 on my HP Pavilion dv6 with a 9-cell battery. I get approximately 7-8 hours on Windows 7, but at best 3 hours on Fedora. I cannot adjust the screen brightness using the fn keys, nor can I adjust it through software. `lspci | grep VGA` gives me: > 00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core > Processor Family Integrated Graphics Controller (rev 09)   >  01:00.0 VGA compatible controller: ATI Technologies Inc NI Seymour [AMD > Radeon HD 6470M] My kernel version is 3.1.5-1.fc16.x86_64


title: bash script check if variable is is [A-Z]

text: How do I check if a variable is in [A-Z] I want something like this:               read var          while [ $var in [A-Z] ]     do      #code here     done      How to achieve this?


title: Interesting numbers when apache benchmarking

text: [root@NOTEBOOK ~] time for i in 128 321; do sleep 302; ab -n $i -c $i https://EXAMPLE.COM/ 2>/dev/null | egrep '^Complete requests:|^Failed requests:|^Requests per second:|^Time taken for tests:'; echo '______________________'; done     Time taken for tests:   87.538 seconds     Complete requests:      128     Failed requests:        0     Requests per second:    1.46 [#/sec] (mean)     ______________________     Time taken for tests:   58.507 seconds     Complete requests:      321     Failed requests:        490     Requests per second:    5.49 [#/sec] (mean)     ______________________      **Q:** how could the Failed requests > Complete requests? p.s.: The "sleep 302" is needed, because somehow if I do too many ab's then the outputs will be 100% fails..


title: how to investigate Firewall blocked outbound TCP

text: CentOS webserver with CSF (Config Server Firewall) running. Blocking all outbound / Inbound traffic except listed ports 80 81 22 21 etc. for web, mail & FTP services etc. I'm use to seeing heaps of Inbound blocks from hackers etc. but seeing the below outbound block & appreciate suggestions on where to look to try & discover what is causing this traffic. > Sep 26 12:40:28 thor kernel: Firewall: *TCP_OUT Blocked* IN= OUT=eth0 > SRC=xx.xx.xx.xx DST=54.241.137.2 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=54974 > DF PROTO=TCP SPT=49907 DPT=31000 WINDOW=14600 RES=0x00 SYN URGP=0 UID=509 > GID=509 My server XX is the SRC source IP & destination IP seems to belong to Amazon web services.   The UID GID listed in log is that of user with hosted website but cant see anything obvious in site. I presume there must be some kind of script trying to contact AWS.


title: What's the difference between .local, .home, and .lan?

text: How can I reliably address different machines on my network? I've always used the `.local` suffix to talk to computers on my local network before. With a new router, though, `.local` rarely (though sometimes) works. I've found that `.home` and `.lan` both _usually_ work, but not always.               .-------.   .--------.                 .-----.     | modem |---| router |))))))(wifi))))))| foo |     .-------.   .--------.         v       .-----.        ||            |             v      /_^_^_\         |             \))))))).-----.     / cloud \        |                     | bar |      \-_-_-/      .-----.                  .-----.                   | baz |                   .-----.      So, from a terminal on `foo`, I can try:               ssh bar.local     ssh bar.home     ssh bar.lan          ssh baz.local     ssh baz.home     ssh baz.lan      and sometimes some of those suffixes work and some don't, but I don't know how to predict which or when. `foo`, `bar`, and `baz` are all modern Linux or Android systems and the Linux boxes all have (or can have) avahi-daemon, or other reasonably-available packages, installed (I don't want to set up static IP addresses: I'd like to keep using DHCP (from the router) for each machine, and even if I was okay with static addresses I'd want to be able to enter hostnames in the unrooted Android machines, where I can't edit the hosts file to map a chosen hostname to an IP address.)


title: Running MySQL in a Docker container

text: So my ultimate end goal is to run a MySQL Docker container (say `tutum/mysql` from the public registry) and then link a Gitlab Docker container (say `sameersbn/gitlab`) to it, where both containers use persistent storage. However, I am stuck on the MySQL part. Every time I try and run a pre-made MySQL Docker container (`mysql`, `tutum/mysql` and `sameersbn/mysql`) as outlined below, I get the below output. _Steps_ This is just one way of getting to the error message below.   1. `docker.io pull tutum/mysql:latest`   2. `docker.io run -it tutum/mysql bash`   3. Once attached to the new container run `/run.sh` (as per `tutum/mysql` Dockerfile)   4. At this point a `Waiting for confirmation of MySQL service startup` message constantly repeats.   5. At this point if I cancel the `/run.sh` command and start MySQL myself I get the error message below. _Output:_               root@1bbeb34f3491:/# mysqld     140730  4:49:04 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.     140730  4:49:04 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.      140730  4:49:04 [Note] Plugin 'FEDERATED' is disabled.     mysqld: Table 'mysql.plugin' doesn't exist     140730  4:49:04 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.     140730  4:49:04 InnoDB: The InnoDB memory heap is disabled     140730  4:49:04 InnoDB: Mutexes and rw_locks use GCC atomic builtins     140730  4:49:04 InnoDB: Compressed tables use zlib 1.2.8     140730  4:49:04 InnoDB: Using Linux native AIO     140730  4:49:04 InnoDB: Initializing buffer pool, size = 128.0M     140730 4:49:04 InnoDB: Completed initialization of buffer pool     140730 4:49:04 InnoDB: highest supported file format is Barracuda.     140730 4:49:04  InnoDB: Waiting for the background threads to start     140730 4:49:05 InnoDB: 5.5.37 started; log sequence number 1595675     140730 4:49:05 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306     140730  4:49:05 [Note]   - '0.0.0.0' resolves to '0.0.0.0';     140730  4:49:05 [Note] Server socket created on IP: '0.0.0.0'.     140730  4:49:05 [ERROR] Can't start server : Bind on unix socket: Permission denied     140730  4:49:05 [ERROR] Do you already have another mysqld server running on socket: /var/run/mysqld/mysqld.sock ?     140730  4:49:05 [ERROR] Aborting     140730  4:49:05  InnoDB: Starting shutdown...     140730  4:49:06  InnoDB: Shutdown completed; log sequence number 1595675     140730  4:49:06 [Note] mysqld: Shutdown complete      _Addressing the errors_   * "Please run mysql_upgrade to create it" => run `mysql_upgrade` command which outputs:              root@1bbeb34f3491:/# mysql_upgrade     Looking for 'mysql' as: mysql     Looking for 'mysqlcheck' as: mysqlcheck     FATAL ERROR: Upgrade failed        * "Do you already have another mysqld server running on socket" => Nope. Running `service mysql stop` does nothing and running `ps` doesn't show `mysqld`. Running `ls -a /var/run/mysqld/` suggests that the socket file doesn't exist. No matter which MySQL container I try, eventually when I start MySQL the same error message came up. This almost certainly means there is something wrong with my setup which confuses me because I thought a Docker container, with no exposed ports or persistent storage, would be isolated from the system Docker is installed on? I have also tried running a MySQL container with the `-d` flag then running a fresh Ubuntu 14.04 container (`docker.io run -it --link mysql:mysql ubuntu:14.04 bash`) linked to it. On the Ubuntu container I installed mysql- client through `apt-get` and tried to connect to the MySQL container on the IP address in `MYSQL_PORT_3306_TCP_ADDR` but that doesn't work either. Equally the problem might be that I do not understand how Docker works. If this is the case, can someone create a set of steps that uses one of the MySQL containers on the Docker index and then link a container to it that can connect. This will also help to see whether there is something wrong with my Docker installation (or some other unknown problem that is causing this issue). My host system is running Ubuntu 14.04 and Docker was installed through `apt- get` and is version 0.9.1. I wasn't quite sure what to put in this explanation because the problem seems quite weird to me. If there is anything I have missed please ask and I will add it for you. **Edit** I have since upgraded Docker from 0.9.1 to 1.1.2 by these instructions: http://askubuntu.com/a/473720/89270. It has not fixed the problem.


title: Immediately kill MySQL

text: I have a shared server that someone has compromised Wordpress. Is there an easy way to kill MySQL. I am stopping the service but it is just sitting and waiting.... to stop               Shutting down MySQL (Percona Server)...........................


title: How can I find out what's seeding in Vuze if it's not listed anywhere in the application?

text: I use Vuze (formally known as Azuereus) for downloading torrents. But for some time now it's been seeding something that I can't see or find anywhere. It's not listed in any of the lists that are within the application, but the upload is showing 100% upload used(to the limit) but the upload in the lists are only a fraction of that. ![enter image description here](http://i.stack.imgur.com/78XIP.png)


title: How many lines of code are in this file?

text: I'm trying to figure out how many lines of code I have for files that end in *.pp                find . -name *.pp -type f  | wc -l       39      I know that I have 39 files, how can I figure out how many lines of code those 39 files contain?


title: Accounting for /proc/net/dev reported traffic

text: I noticed that according to /proc/net/dev I am constantly receiving around 6Kb/s on my wireless usb interface. But I can't account for anything even close to that with the individual connections that I get with iptraf, iftop, and nethogs. Investigations with netstat, lsof, and tcpdump didn't help either. So, what else could contribute to /proc/net/dev values? I can speculate that, while only IP based traffic is reported by the applications I mentioned, /proc/net/dev probably accounts for other link-layer/internet-layer stuff too (arp? icmp? wireless management stuff?). Or maybe other transport/application protocols. Can anyone confirm this? How else would you proceed to find out: through what sockets are the 6Kb/s coming through? What processes are receiving the traffic? * * * [EDIT] The 2 consistent results across all the tools:   1. the totals of Rx are around a few Kb/s      * confirmed with /proc/net/dev, dstat, bmw-ng, cbm, iptraf, ifstat, gnome-system-monitor   2. no connection/packet stream justifies that      * confirmed with netstat, tcpdump, iftop, nethogs, iptraf All of this with a Netgear WDNA 4100 wireless usb adapter using a custom driver from some git (the only way I got it to work). I asked the devs about it here. This might be malware, but I suspect the driver is simply reporting wrong totals. Nevertheless, I cannot explain what's going on for sure.


title: Backup server users creation

text: I have a RHEL server which acts as the web server for all the users (around 1000 users). Now, I have a backup script which backs up the data (all data inside `/home` folder) into an external HDD. This back up script is also in the `cron.daily` so that the backup will happen on a daily basis. ## Hypothetical situation Let us assume the RHEL web server crashed. I will build a new machine as a RHEL web server. I can paste the users' data that is already backed up in the external HDD into the new machine's `/home` folder. But for the **1000 users'** to access their home directories in this new machine, I need to create the 1000 users again. Is there a way I can save that data too from the existing machine before crash? I know `/etc/passwd` and `/etc/groups` will contain user related information. But if I save them, won't there be password issues?


title: Do I just need to include a .netrc file to have UNIX pick it up?

text: I have a .netrc with the following format in a directory using a bash terminal on OSX:               machine m...         login l...         password p...      I have chowned and cmoded the file like this, as suggested in this help file               $ chown myusername .netrc     $ chmod +600 .netrc      When I am in the directory, I issue the following command:               $ftp m...      Based on this tutorial (see section "useage of the .netrc") it seems like unix should automatically detect that there is a .netrc file in the directory when I type `ftp m..`, see that the .netrc gives credentials for machine . and pass them along to ftp. This is not happening. Instead, I see this output               Connected to server.domain.com     220 Microsoft FTP Service     Name (file.server.domain.com:My_OSX_Username): #I would expect it would pull my username off the .netrc file      Am I using the .netrc file incorrectly?


title: Finding all kinds of extensions referenced in a html file

text: Here is my problem statement : There is a folder with many html and text files. I need to recursively go through each one of them and find all kinds of file extensions referenced in these html/text files like .jpg, .tif, .png etc The problem is I don't have a defined list of the extensions I want to search for. What would be the best way to achieve this using a shell script ? Coming up with a Reg-ex which would essentially search for all occurrences of a dot followed by 3 or 4 letters, and filtering out the ones which end with a space or a comma, or a quote etc ?? Any suggestions would be helpful.


title: Automating minisat solutions

text: I'm a unix noob and need a simple (bash) script. I am solving SAT instances using minisat. The syntax is `minisat inputfile outputfile`. However, it only returns one solution. To find all solutions I have to append the negation of the first solution to the original instance and solve again until it is unsolvable. The output file looks like this:               SAT     1 -2 3 -4 5 -6 -7 0       So each natural number from one to whatever is either negated or unnegated followed by a 0. I need to multiply each number by -1 and append that (last) line (including the 0) to the end of `inputfile` and loop it until the first line of `outputfile` is `UNSAT`. Thanks for your help!


title: Run expect inside a bash script as another user

text: I am writing a bash script to install some small software I'm developing. That script is run with `sudo` (as root), but some of the commands that are executed by the script need (or should be) run with a regular user whose name I keep in the `$userName` variable. Most of the commands are one liners and `su -c "/what/ever/command" $userName` works good enough. However, one of those commands I don't want to run as `root` is going to ask me things (actually, only one thing, but many times: whether it should overwrite an existing file or not). That command which I may call "`baaad_command`" doesn't have any option to provide a default answer (there's no "`\--assume-no`" or anything like that). The only option I see feasible is using the expect command, and reply "`n\r`" every time the command outputs and string witch starts with "`Overwrite`", I want my script to reply no (meaning "`n\r`") as many times as baaad_command asks `"Overwrite... ? [y/n]"` I've tried many different combinations of su, spawn, expect... without any luck. This is my last try so far:               #!/bin/bash     if [[ -d "$destinationFolder" ]] ; then         if [[ -n "$userName" ]] ; then             spawned=$(su -c expect -c "                 spawn baaad_command --user \"foo\" --passwd \"bar\" \"$destinationFolder\"                  expect {                      Overwrite: { send \"n\r\"; exp_continue }                      eof { exit }                  }             " )         else             echo "Don't have a non-root username to install baaad_command with. Skipping"             exit 3         fi     else             echo "$destinationFolder directory not found in $(pwd). Can't continue"             exit 2     fi      It doesn't have any remarkable thing over the other 200 tries... just happens to be the last. Any hint will be very appreciated. Thank you in advance.


title: What are good document organization utilities?

text: I'm a graduate student and I have to deal with reading a lot of academic papers. I was wondering if there were any good utilities for linux for organizing documents (pdfs mostly) for reading. Having utilities that are open-sourced would be a plus.


title: playing a sound/notification in finch over ssh on my local machine

text: So I have `finch`, a command line chat client (think pidgin) running on a remote machine that I `ssh` into. `finch` has notification sounds and can run a command when certain events occur, letting you pass the sound file in as `%s`. e.g. `mplayer %s` from the remote machine, when the notification occurs, what kind of command could I run to play whatever `%s` is on my local machine?


title: To what does the byte sequence in this kerneloops (syslogd@hostname) message refer?

text: Message from syslogd@ROOROO at Mar 22 19:36:12 ...      kernel:[13988.165672] Oops: 0000 [#1] SMP           Message from syslogd@ROOROO at Mar 22 19:36:12 ...      kernel:[13988.169607] Stack:          Message from syslogd@ROOROO at Mar 22 19:36:12 ...      kernel:[13988.169607] Call Trace:          Message from syslogd@ROOROO at Mar 22 19:36:12 ...      kernel:[13988.169607] Code: 55 53 48 81 ec 88 00 00 00 48 8b af 28 03 00 00 65 48 8b 04 25 28 00 00 00 48 89 44 24 78 31 c0 8b 05 00 bb 07 00 48 89 7c 24 48 <4c> 8b 7d 08 c1 e8 15 83 e0 07 83 f8 03 76 43 48 8b 8d 78 02 00           Message from syslogd@ROOROO at Mar 22 19:36:12 ...      kernel:[13988.169607] CR2: 0000000000000008      I've been running my latest Debian testing netbook for about 2 months. This is the first kernel failure that has flooded my always-open terminal emulator. I am asking about the bytes that come after `Code:` and am just curious about what they may mean, and why they have flooded my terminal emulator as a normal user.


title: Terminal - copy from CLI without using mouse

text: While firing commands in CLI, **I want to copy the command I just fired** or anything I wrote in terminal and **paste it somewhere else** without using mouse. Like in following picture, I want to copy the update command (completely or partially) without using mouse and paste it somewhere. ![copy from CLI without using mouse](http://i.stack.imgur.com/4y4Q3.png)


title: Live Distros: UBCD boot Deft, Caine, and Tails from Custom Menu

text: I'm building my own UBCD and I'm using dual layer to fit 7.5Gigs * * * Useful resources for UBCD customization:   * The SYSLINUX Project   * UBCD Customize   * Casper Man Page   * Live Boot Man Page * * * Here's my `custom.cfg` file.               MENU INCLUDE /ubcd/menus/syslinux/defaults.cfg     UI menu.c32          LABEL -     MENU LABEL ..     CONFIG /ubcd/menus/syslinux/main.cfg          LABEL -     MENU LABEL Caine 5.0 January 17th, 2014     TEXT HELP      Read only system forensics. 64bit system required.     ENDTEXT     LINUX /ubcd/custom/caine/casper/vmlinuz     INITRD /ubcd/custom/caine/casper/initrd.gz     APPEND boot=casper splash          LABEL -     MENU LABEL Deft 8.1 April 10th, 2014     TEXT HELP      Digital Evidence & Forensics Toolkit. 64bit system required.     ENDTEXT     LINUX /ubcd/custom/deft/casper/vmlinuz     INITRD /ubcd/custom/deft/casper/initrd.lz     APPEND file=/ubcd/custom/deft/preseed/lubuntu.seed boot=casper iso-scan/filename=/ubcd/custom/deft.iso splash --          LABEL -     MENU LABEL SpinRite     TEXT HELP      Repair damaged Hard Drives with Steve Gibson's SpinRite.     ENDTEXT     LINUX /boot/syslinux/memdisk     INITRD /ubcd/custom/spinrite.iso     APPEND iso raw           LABEL -     MENU LABEL Tails 1.0.1 June 10th, 2014     TEXT HELP      The Amnesic Incognito Live System. i386     ENDTEXT     LINUX /ubcd/custom/tails/live/vmlinuz     INITRD /ubcd/custom/tails/live/initrd.img     APPEND boot=live config live-media=removable nopersistent noprompt timezone=Etc/UTC block.events_dfl_poll_msecs=1000 splash noautologin module=Tails iso-scan/filename=/ubcd/custom/tails.iso          LABEL -     MENU LABEL Tails (failsafe) 1.0.1 June 10th, 2014     TEXT HELP      The Amnesic Incognito Live System. i386     ENDTEXT     LINUX /ubcd/custom/tails/live/vmlinuz     INITRD /ubcd/custom/tails/live/initrd.img     APPEND boot=live config live-media=removable nopersistent noprompt timezone=Etc/UTC block.events_dfl_poll_msecs=1000 splash noautologin module=Tails noapic noapm nodma nomce nolapic nomodeset nosmp vga=normal iso-scan/filename=/ubcd/custom/tails.iso          LABEL -     MENU LABEL Tails 1.0.1 64bit June 10th, 2014     TEXT HELP      The Amnesic Incognito Live System. amd64     ENDTEXT     LINUX /ubcd/custom/tails/live/vmlinuz2     INITRD /ubcd/custom/tails/live/initrd2.img     APPEND boot=live config live-media=removable nopersistent noprompt timezone=Etc/UTC block.events_dfl_poll_msecs=1000 splash noautologin module=Tails iso-scan/filename=/ubcd/custom/tails.iso          LABEL -     MENU LABEL Tails 1.0.1 64bit (failsafe) June 10th, 2014     TEXT HELP      The Amnesic Incognito Live System. amd64     ENDTEXT     LINUX /ubcd/custom/tails/live/vmlinuz2     INITRD /ubcd/custom/tails/live/initrd2.img     APPEND boot=live config live-media=removable nopersistent noprompt timezone=Etc/UTC block.events_dfl_poll_msecs=1000 splash noautologin module=Tails noapic noapm nodma nomce nolapic nomodeset nosmp vga=normal iso-scan/filename=/ubcd/custom/tails.iso          LABEL -     MENU LABEL Ubuntu Rescue Remix 12.04 April 26th, 2012     TEXT HELP      Ubuntu system rescue utility disc.     ENDTEXT     LINUX /ubcd/custom/urr/casper/vmlinuz     INITRD /ubcd/custom/urr/casper/initrd.gz     APPEND boot=casper iso-scan/filename=/ubcd/custom/urr.iso splash --      SpinRite works and Ubuntu Rescue works with some keyboard recognition error noise (but keyboard entry works fine.) Side note: Ubuntu Rescue also works with the options `APPEND iso raw`, but then it loads the entire iso image into memory before booting. Caine, Deft, and Tails all don't find a live image to boot. Caine gets to some sort of sys mem prompt but keyboard input does nothing. Deft and tails get to a similar prompt initramfs. Both without the live image found, one of them doesn't respond to the keyboard and the other doesn't recognize it. Basically I need help with getting these systems to boot with the live images. Here's a tree of the directory structure under /ubcd/custom (with the Caine windows files cut out)               .     ├── caine     │   ├── autorun.inf     │   ├── boot.catalog     │   ├── casper     │   │   ├── filesystem.squashfs     │   │   ├── initrd.gz     │   │   └── vmlinuz     │   ├── EFI     │   │   └── BOOT     │   │       ├── BOOTx64.EFI     │   │       └── grubx64.efi     │   ├── isolinux     │   │   ├── isolinux.bin     │   │   ├── isolinux.cfg     │   │   ├── splash.png     │   │   └── vesamenu.c32     │   ├── ldlinux.sys     │   ├── syslinux.cfg     │   └── UFO.dat     ├── custom.cfg     ├── custom.lst     ├── deft     │   ├── casper     │   │   ├── initrd.lz     │   │   └── vmlinuz     │   └── preseed     │       ├── cli.seed     │       └── lubuntu.seed     ├── deft.iso     ├── spinrite.iso     ├── tails     │   └── live     │       ├── initrd2.img     │       ├── initrd.img     │       ├── vmlinuz     │       └── vmlinuz2     ├── tails.iso     ├── urr     │   └── casper     │       ├── initrd.gz     │       └── vmlinuz     └── urr.iso      I extracted out the vmlinuz and initrd files from the ISOs but tried to keep and mount the existing ISOs just like the working Ubuntu example. So the lines in the config I need help with are the LINUX/INITRD/APPEND lines for Caine, Deft, and Tails. If I have to repackage the ISOs into something else that's fine. I just need to make them work. If you need more specific error states I can try booting into them again.


title: Debian Wheezy can not use LDOCE5

text: I have installed LDOCE5 (Longman Dictionary of Contemporary English Edition 5) on Debian Wheezy 7.6 adm64, and I have installed `libc6` by the following method:               dpkg --add-architecture i386 # enable multi-arch     apt-get update     apt-get install libc6:i386 # install base 32bit libraries      Then I ran the command `./ldoce5` which returned the following error:               ./ldoce5-bin: error while loading shared libraries: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory      So, I tried the following:               $ locate libgtk-x11-2.0.so.0     /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0     /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.10      Then I constructed a link by               $ sudo ln -s /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0  .      followed by:               $ ./ldoce5     ./ldoce5-bin: error while loading shared libraries: libgtk-x11-2.0.so.0: wrong ELF class: ELFCLASS64      I guessed that it maybe do the work if I have successed in installing `ia32-libs-gtk-i386:i386` and `ia32-libs-i386:i386`, for I have tried this method successfully on Linuxmint Qiana. But when I tried to install the two packages, the result is of great trouble, for there are many dependence problems:               $ sudo apt-get install ia32-libs-i386:i386 ia32-libs-gtk-i386:i386     The following packages have unmet dependencies:      ia32-libs-gtk-i386:i386 : Depends: gtk2-engines-pixbuf:i386 (>= 2.20.1-2) but it is not going to be installed                            Depends: gtk2-engines:i386 (>= 1:2.20.1-1) but it is not going to be installed                            Depends: libcanberra-gtk-module:i386 (>= 0.24-1) but it is not going to be installed                            Depends: libcanberra-gtk0:i386 (>= 0.24-1) but it is not going to be installed                            Depends: libgail-common:i386 (>= 2.20.1-2) but it is not going to be installed                            Depends: libgail18:i386 (>= 2.20.1-2) but it is not going to be installed                            Depends: libgtk2.0-0:i386 (>= 2.20.1-2) but it is not going to be installed                            Recommends: libbonobo2-0:i386 (>= 2.24.3-1) but it is not going to be installed                            Recommends: libglade2-0:i386 (>= 1:2.6.4-1) but it is not going to be installed                            Recommends: libgnomecanvas2-0:i386 (>= 2.30.1-1) but it is not going to be installed                            Recommends: libidl0:i386 (>= 0.8.14-0.1) but it is not going to be installed                            Recommends: liborbit2:i386 (>= 1:2.14.18-0.1) but it is not going to be installed      ia32-libs-i386:i386 : Depends: libcups2:i386 (>= 1.4.4-7+squeeze1) but it is not going to be installed                        Depends: libcurl3:i386 (>= 7.21.0-2) but it is not going to be installed                        Depends: libgnutls26:i386 (>= 2.8.6-1) but it is not going to be installed                        Depends: libpulse0:i386 (>= 0.9.21-3+squeeze1) but it is not going to be installed                        Depends: libsdl1.2debian:i386 (>= 1.2.15) but it is not going to be installed      libsmbclient : Depends: libtdb1 (>= 1.2.7+git20101214) but it is not going to be installed     E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.      How could I have LDOCE5 work right on Wheezy?


title: How to uninstall BOOST 1.49 and install BOOST 1.54 in ubuntu?

text: I have a boost 1.49 in my ubuntu system. And I am trying to uninstall boost 1.49 and completely remove it from my system. And after that install the `Boost 1.54.0` I did like this to uninstall 1.49 from my system -               sudo apt-get --purge remove libboost-dev     sudo apt-get --purge remove libboost-all-dev      And after that when I do below command to see the version, it still says I have 1.49               cat /usr/include/boost/version.hpp | grep "BOOST_LIB_VERSION"     //  BOOST_LIB_VERSION must be defined to be the same as BOOST_VERSION     #define BOOST_LIB_VERSION "1_49"      Not sure why? And I tried installing Boost 1.54.0 version like this -               wget http://sourceforge.net/projects/boost/files/boost/1.54.0/boost_1_54_0.tar.gz/download     tar -xvzf boost_1_54_0.tar.gz     cd boost_1_54_0/     ./bootstrap.sh --with-libraries=atomic,date_time,exception,filesystem,iostreams,locale,program_options,regex,signals,system,test,thread,timer,log     sudo ./b2 install      But still it is not showing me boost 1.54.0 version installed? Any pointers how to remove BOOST 1.49 from my system and install BOOST 1.54 in my machine?


title: Script to send mail if there has been no entry in a log file for a certain amount of time

text: I am new to shell scripting. How would I write a script which can send an alert mail if there is no entry in the log file for more than 3 hours.


title: `grep -l .. | xargs vim` generates a warning, why?

text: If I run a command like               grep -rl test . | xargs vim      I get a warning "Vim: Warning: Input is not from a terminal." But I am still able to edit the files. Why the warning?


title: Midnight Commander, using date in User menu

text: I would like to use MC (midnight commander) to compress the selected dir with date in its name, e.g: `dirname_20131231.tar.gz` The command in the User menu is :               tar -czf dirname_`date '+%Y%m%d'`.tar.gz %d      The archive is missing because `%m`, and `%d` has another meaning in MC. I made an alias for the date, but it also doesn't work. Does anybody solved this problem ever?


title: rrdtool 1.4.7 compilation fail : glib-2.0/glib.h

text: I am trying to compile rrdtool from the source package. I don't use RPM packages, so don't ask me to install packages ;) I compile all the required software before rrdtool according to http://oss.oetiker.ch/rrdtool/doc/rrdbuild.en.html ./configure of rrdtool is OK. But when I do make I got the following error :                     CC     rrdcached-rrd_daemon.o     rrd_daemon.c:108:27: erreur: glib-2.0/glib.h : Aucun fichier ou dossier de ce type     rrd_daemon.c:246: erreur: expected â=â, â,â, â;â, âasmâ or â__attribute__â before â*â token     rrd_daemon.c: In function âadd_response_infoâ:     rrd_daemon.c:540: attention : implicit declaration of function âva_startâ     rrd_daemon.c:540: attention : nested extern declaration of âva_startâ     rrd_daemon.c:546: attention : implicit declaration of function âva_endâ     rrd_daemon.c:546: attention : nested extern declaration of âva_endâ     [...]      glib-2.0/glib.h exist in my system, in /usr/local/glib-2.34.0/glib/glib.h I set up env variable PKG_CONFIG_PATH which contain glib's path. /usr/local/glib-2.34.0/lib/pkgconfig/ I saw some topic about it but nothing for my case. Looking in config.log everything seems Ok!


title: How to get grub Ubuntu 12.04 to boot from secondary boot partition and use new seperate root

text: On a remote Ubuntu server I performed a series of upgrades/changes to go from a desktop-install _Ubuntu 10.10 Maverick_ to a server-install of _12.04 LTS Precise_ This all went well except a few hickups I got around, all the while without physical access -so far-. The next goal is to create a XEN server using LVM as backend storage. The system didn't have LVM on it, which I added once I got to 12.04 LTS. I know how to create a XEN machine of it remotely, done it before. But I have an issue trying to boot into the new configuration. The original person that installed this box didn't pay attention to the partitioning, the machine was used as a server but installed as desktop (this I fixed), but left me with this kind of partitioning scheme:               Disk /dev/sda: 500.0 GB, 499999834112 bytes     ...      Device Boot      Start         End      Blocks   Id  System     /dev/sda1   *           1       58558   470361088   83  Linux     /dev/sda2           58558       60789    17916929    5  Extended     /dev/sda5           58558       60789    17916928   82  Linux swap / Solaris      So I took the huge 17G swap partition and reorganised it a bit into a fresh boot (now /dev/sda2), a small swap partition(/dev/sda3) and a new root (lvs). I got the diskusage down to about 3GB which is small enough and I copied that to a new root, which I created under LVM. Currently we have               Device Boot      Start         End      Blocks   Id  System     /dev/sda1            2048   940724223   470361088   83  Linux     /dev/sda2   *   940724224   941748223      512000   83  Linux     /dev/sda3       941748224   943845375     1048576   82  Linux swap / Solaris     /dev/sda4       943845376   976562175    16358400   8e  Linux LVM      /dev/sda1 is the _old boot partition_ and I want the machine to boot from /dev/sda2. The difference now is that I now want a seperate /boot and / partition. The root partions is know under LVM as :               # lvscan     ACTIVE            '/dev/server20/root' [10.00 GiB] inherit      The ultimate goal is that I want to bring /dev/sda1 under LVM control, but I have to boot the system in a way that it's not used. From there on, LVM will work. In addition to the whole filesystem changes above, I did: created logical volume:               pvcreate /dev/sda4      vgcreate server20 /dev/sda4     lvcreate -L 10G -n root server20     mkfs.ext4 /dev/server20/root      mounted it:               mount /dev/server20/root /mnt/root/     mount /dev/sda2 /mnt/root/boot/     (cd / ; find . -xdev -print0 | rsync -xavz . /mnt/root/)     for i in /dev /run /dev/pts /proc /sys; do sudo mount -B $i /mnt/root$i; done      update grub:               chroot /mnt/root     echo "dm-mod" >> /etc/initramfs-tools/modules     echo "dm-mod" >> /etc/modules     grub-mkconfig (verified config file visually)     update-grub (no errors/warnings)      Reviewed the created /boot/grub/grub.cfg I see most looks correct, especially stuff like:               insmod lvm     ...     set root='(server20-root)'     search --no-floppy --fs-uuid --set=root 0bb92c24-8c02-4fa3-8f75-970076261b2f     ...          menuentry 'Ubuntu, with Linux 3.2.0-38-generic' --class ubuntu --class gnu-linux --class gnu --class os {         recordfail         gfxmode $linux_gfx_mode         insmod gzio         insmod part_msdos         insmod ext2         set root='(hd0,msdos2)'         search --no-floppy --fs-uuid --set=root 891b3eaa-fb43-4a42-9789-a91c2a5ffb13         linux   /vmlinuz-3.2.0-38-generic root=/dev/mapper/server20-root ro quiet         initrd  /initrd.img-3.2.0-38-generic     }     ...      Then, checking blkid's:               /dev/sda2: UUID="891b3eaa-fb43-4a42-9789-a91c2a5ffb13" SEC_TYPE="ext2" TYPE="ext3"     /dev/sda4: UUID="IyDrfU-TOYT-rFXO-JknG-rwEK-Sm2A-mfKcIe" TYPE="LVM2_member"     /dev/mapper/server20-root: UUID="0bb92c24-8c02-4fa3-8f75-970076261b2f" TYPE="ext4"     /dev/sda1: UUID="888c061a-1d51-4516-aced-4bb21042d2f4" TYPE="ext4"     /dev/sda3: UUID="19efc041-eccd-42c9-94aa-5b6c88ffd5bb" TYPE="swap"      So, I understand from this is: my boot partition will be msdos2, that would be /dev/sda2 . Also referenced in the search line by uuid, even though it says root, I compaired it to other installs and that is meant as the boot uuid (correct assumption?) in case of a split root/boot. I really assumed this would work to reboot using the additional disk layout, but it didn't. I set both /dev/sda1 and /dev/sda2 bootable flag active using fdisk. It booted the same old way as before, without a hickup luckily. My deeper questions are probably sparked in misunderstanding using chroot + update-grub. I actually am not sure what I need to do on the root/boot /dev/sda1 . Do I have to copy the grub.cfg from the chrooted version to the /boot subdir or not ? Steps I took after the reboot now               switched off bootable flag on /dev/sda1     remounted everything again and performed all steps again plus an additional     grub-install /dev/sda  (from the chroot)      Will this be enough to disregard /dev/sda1 ? I read about everything on grub I could find but I fail to get answers on how the boot process goes in case of 2 boot partitions on the same disk. (lots of other cases). Can someone visualize the grub flow in regards to using a chroot vs using something alike _grub- install --boot-directory=/mnt/boot_ . How is this internally treated? Feel free to suggest better titles for this question, I'm very bad at that. Additionally , here's the MBR               dd if=/dev/sda of=mbr.bin bs=512 count=1     root@server20:/# file mbr.bin      mbr.bin: x86 boot sector;      partition 1: ID=0x83, starthead 32, startsector 2048, 940722176 sectors;      partition 2: ID=0x83, active, starthead 95, startsector 940724224, 1024000 sectors;      partition 3: ID=0x82, starthead 29, startsector 941748224, 2097152 sectors;      partition 4: ID=0x8e, starthead 167, startsector 943845376, 32716800 sectors, code offset 0x63


title: is it possible for DHCP to assign different IP addresses to the same machine?

text: I have install and configure a DHCP server on my centos6.5, it works properly and assign IPs to the clients Machines in my Network, and As I noticed when a client reconnect the dhcp reassign the IP that he already assign to this client my questions is:   1. Is it a possibility for DHCP to assign different IPs to the same machine   2. if it does that, how long he remember that he assigned this IP to this client(MAC)   3. if it doesn't, when the range is fully used, IS it a possibility for DHCP to assign an IP (that he remembered that it assign to a MAC) to another machine.   for example if client1 take 192.168.1.20 as an IP and then it disconnect and another client (client2) connect and the only IP left is 192.168.1.20, does the DHCP assign this IP to the new client(client2) or it keeps it to the old client(client1) and if it keeps it for How long ?


title: Dual boot Ubuntu with windows 8

text: I have Windows 8 and need to dual boot Ubuntu. I made a new partition from Windows Manager, but when I boot Ubuntu and select the new partition I get the error: > this partition is not rooted !! I'm trying to use Lucid Lynx. How do I dual boot Ubuntu with Windows 8 in a different partition?


title: Create a deb package from difference between two images

text: I am maintaining an Ubuntu server image as a development environment with several deployments. If my base image changes - install a package, modify conf files, etc - I am manually patching the new system, or selectively adding the deb files that I knew I added. It is a little tedious and I've missed some system files a couple times. Is there away to automate this? It seems like a common scenario but I can't find a solution. I was thinking something along the lines of taking the output of a rsync comparison and generating a deb install package based off these differences. I don't have any experience with either of these so I'd like to check to see if there is an 'off-the-shelf' solution first.


title: Is there a way to pass a variable from an awk statement to a bash function as an argument?

text: I am trying to look a for some specific values from (such as 1 or 4 and 2 or 3) a text file using an `awk` statement in a bash script. If this value is found in the file (within the `awk` statement), then I want to call a function from outside the `awk` statement and pass it the found value as an argument. My questions: (1) Is this possible? If so then how? (2) If it is not possible or there is a better way, then how? Note that I am skipping the first two lines of the text file when searching the file. I am using GNU AWK. Let me know if further explanation is required. **I apologize in advance for the cross-post but I did not get the answer I am looking for. file.txt               Name  Col1  Col2  Col3       -----------------------     row1  1     4     7             row2  2     5     8              row3  3     6     9       The actual `retrieve` functions are much more complex than in this simplified example. So I need to make a call to this function because I don't want to put this in the `awk` statement.               function retrieve {         if [[ "$1" == "1" ]]; then             echo "one beer on the wall"         elif [[ "$1" == "4" ]]; then             echo "four beers on the wall"         fi     }          function retrieve2 {         if [[ "$1" == "2" ]]; then             echo "two beers on the wall"         elif [[ "$1" == "3" ]]; then             echo "three beers on the wall"         fi     }          awk -F '\t' '         FNR < 2 {next}         FNR == NR {             for (i=2; i <= NF; i++)              {                 if (($i == 1) || ($i == 4))                     printf(%s, "'retrieve "$i" '")    # Here is the problem                      if (($i == 2) || ($i == 2))                     printf(%s, "'retrieve2 "$i" '")    # Here is the problem             }         }          ' file.txt


title: Linux: $SSH_CONNECTION is set even without SSHing to the server

text: I have a remote server and I am writing a script in the server and want it to fire only when I SSH. I thought of using the `$SSH_CONNECTION` and `$SSH_TTY` for this purpose. I found out that when I have not used ssh and instead used my VNC client to get into the server ( I have vnc running on my server), the terminals created within VNC still have these two environment variables set and `$SSH_CONNECTION` has same value in both cases. I found a workaround to do further filtering by `ps -o comm= -p $PPID` and see if parent process is sshd but I want to know why the variables are set


title: Find out if files in a folder exist under other name in other folder

text: _Possibly a little incorrect English ahead:_ There are at least 2 folders. For this, **A** contains files without extension, usually usernames, and **B** contains similar files, with '.yml' extension or possibly without extension, or even other extension, that's not always the case. How to find out if the files in the **A** folder exist in **B** , possibly under a different extension, without using scripting language such as Python ? It'd not be much of an issue for me to make a Python script, but for portability I'd prefer shell scripting, which I suck at. Not to mention I don't know all the commands. It's only good if this can be done in non-Linux systems too, particularly BSD. _**EDIT 0:_** The difference in name isn't always just the extension, the name could have characters before or after the same text. For example, if **A** had a file called `foobar`, it could be named `location_foobar` in **B**. Otherwise the name wouldn't be more different, like `foo1bar`, that's entirely different thing, so the script wouldn't be looking for such differences.


title: XMonad not launching xmobar

text: For some reason, my xmonad config won't launch xmobar, but it doesn't throw any errors, and the command `xmobar` launches it fine. Here is my `xmobar.hs`                import XMonad      import XMonad.Hooks.ManageDocks      import XMonad.Hooks.DynamicLog      import XMonad.Util.Run(spawnPipe)           main = do          xmproc <- spawnPipe "xmobar"          xmonad $ defaultConfig              { terminal    = "terminator"              , layoutHook = avoidStruts $ layoutHook defaultConfig              , manageHook=manageHook defaultConfig <+> manageDocks              , logHook = dynamicLogWithPP $ sjanssenPP { ppOrder = reverse }              , borderWidth = 1              }


title: Why does mencoder output still images if I try to encode them under 3 FPS, while mencoder outputs dynamic images if I output them at 3 FPS or over?

text: If I try...               mencoder mf://@NetSWLW12MA.txt -mf w=800:h=600:fps=1.5:type=png -ovc lavc     -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o NetSWLW12MA2.avi      I just get a bunch of still images of the first frame. if I try...               mencoder mf://@NetSWLW12MA.txt -mf w=800:h=600:fps=4:type=png -ovc lavc     -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o NetSWLW12MA2.avi      then I get mencoder to robustly play all the images. (there are 145 separate image frames contained in the txt file). Is there a way to put all 145 images as separate images in the mencoder file when I encode it at 1 FPS?


title: Changing the UID of files in /proc

text: In a follow up to this question about changing the `UID` of a user, it is recommended to change the ownership of **all files** on the system (this answer)               find / -uid 1000 -exec chown 5000 '{}' \+      where `1000` is the old `UID` and `5000` is the new one. I just listed all files (outside `/home/seb`) owned by `UID=1000` and found that most are in the `/proc` directory.               find / -uid 1000 \! -wholename '/home/seb/*'      Is it _save_ or _necessary_ to perform the suggested `UID` change? I'm not familiar with the purpose of these `/proc` files, but I assume they would be created as needed when I log in with the new user. Note: There are also some files in `/dev` owned by `UID=1000`, but those are just the terminals open by the user (e.g. `/dev/pts/23`)


title: How to save email sorted by date?

text: I seem to remember a patch to mutt that allowed to modify the path of the mailbox in mbox-hook in include the date. For example, you could have this:               mbox-hook Maildir +Archive/%y/%m/maildir      Which would save the emails in Archive/2011/12/maildir if they were send during December 2011. Anyone knows what it was called or if it still is supported? I seem to remember that there was an option in the BSD ports to enable it but cannot find it now. If not, does anyone know how I could achieve the same thing?


title: Debian 6 Squeeze - installing build-essentials - gcc / g++

text: The first thing to say is: "I am noob", so please be patient and don't laugh.. too much on me. I need to install c / c++ compiler and I heard that the best thing to do is to install gcc/g++ for that purpose (I think I don't have it on my machine).               maistora@maistora:~$ gcc --version     bash: gcc: command not found      I also read if I install build-essential the c/c++ compiler comes with it. So what I did is:               maistora@maistora:~$ sudo apt-get install build-essential     Reading package lists... Done     Building dependency tree            Reading state information... Done     Some packages could not be installed. This may mean that you have     requested an impossible situation or if you are using the unstable     distribution that some required packages have not yet been created     or been moved out of Incoming.     The following information may help to resolve the situation:          The following packages have unmet dependencies:      build-essential : Depends: libc6-dev but it is not going to be installed or                                 libc-dev                        Depends: gcc (>= 4:4.4.3) but it is not going to be installed                        Depends: g++ (>= 4:4.4.3) but it is not going to be installed     E: Broken packages      Then, I don't know why but I decided to install the dependencies one by one and started with the `libc6-dev` and this is the output:               maistora@maistora:~$ sudo apt-get install libc6-dev     Reading package lists... Done     Building dependency tree            Reading state information... Done     Some packages could not be installed. This may mean that you have     requested an impossible situation or if you are using the unstable     distribution that some required packages have not yet been created     or been moved out of Incoming.     The following information may help to resolve the situation:          The following packages have unmet dependencies:      libc6-dev : Depends: libc6 (= 2.11.2-10) but 2.13-21 is to be installed                  Depends: libc-dev-bin (= 2.11.2-10) but it is not going to be installed                  Recommends: gcc but it is not going to be installed or                              c-compiler     E: Broken packages      And the next thing I did is:               maistora@maistora:~$ sudo apt-get install libc6     Reading package lists... Done     Building dependency tree            Reading state information... Done     libc6 is already the newest version.     0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.      which seem very strange to me. But I'm sure that something basic for you. So, my question is - how can I install build-essentials on my Debian 6 Squeeze or any work-around to install gcc/g++. P.S. If I write `sudo apt-get install gcc` I will get to the beginning of my post and ending with `libc6 is already the newest version.` (hope I make my point clear). Thanks in advance.


title: Doing nmap on a network

text: I used nmap to scan all the ports in the hosts in a network by using the command:               $ nmap 172.31.100.0/24      What I found is that it showed the following in the result: > Nmap scan report for 172.31.100.0   >  Host is up (0.0039s latency).   >  Not shown: 998 closed ports   >  PORT STATE SERVICE   >  23/tcp open telnet   >  80/tcp filtered http What does `172.31.100.0` represent? Is it a specific interface or something else?


title: adjust zfs settings on freebsd 9

text: What's the proper way on FreeBSD 9 to tune ZFS parameters such as `vfs.zfs.arc_max` and `vfs.zfs.vdev.cache.size`? I've seen references to `/boot/loader.conf`, `/boot/kernel.conf` and `/etc/sysctl.conf` but I have none of those files.


title: Why does "wc -c" print a value of one more with echo?

text: When running               echo abcd | wc -c      it returns `5`.   But the word `abcd` is only 4 characters long. Is `echo` printing some special character after the word `abcd`? And can I prevent `echo` from printing that?


title: Swap appears to not be in use

text: (I am currently using Ubuntu 14.04 LTS, GNOME environment) **tl;dr** How can I force more memory swapping (swappiness already at 100)? I have recently been experiencing a lot of system freezes/crashes. Often when accessing busy websites. It has been happening so much I have htop loaded on my tty, so I can switch to it and terminate my browser (as GUI does not respond). However, sometimes I need to use REISUB. I thought GNOME might work better than Unity, as my Debian system has no problems, and it did to a point, but I am still running high on memory, and getting freezes. I looked at my `free -m` today, and noticed my swap was showing 0 used. Output:                            total       used       free     shared    buffers     cached     Mem:          1821       1673        148        221         40        643     -/+ buffers/cache:        989        832     Swap:         1933          0       1933      ` I did a temporary swappiness to 100 (`sudo sysctl vm.swappiness=100`). The results were still the same (0 being used even after running to near max system memory usage). I looked at this answer: How do I see if system is swapping? unfortunately as I am writing this, my system went into updates, and my packages are locked, so I cannot install this (`sar`) nor am I sure what package this is part of, in order to give another Output. I have looked in the fstab, and my swap partition is being used correctly.               # swap was on /dev/sda3 during installation      UUID=10fdfed2-1fde-4d9f-a8f1-3d2376b0ffcc none            swap    sw              0       0      I am using a shared swap partition with my Debian OS (dual boot, separate partition, shared swap). But the partition is not locked, and I did a quick `swapoff ...`, `swapon ...`, and `swapon -s` to see if it would possibly recognize my swap and start swapping. It appears to still be at low swapping (84 hooray), but my memory usage is at 90%+ usage. With around 13% memory usage by Chromium, 17% by GNOME. I don't care if I am forced into slowness, but I can't be forced into full system freeze (can't access TTY, can't do `Ctrl`+`Alt`+`Backspace`, only `Alt`+`SysReq` R,E,I,S,U,B) I had the same issue with 12.04 LTS (pre-packaged), but have recently gone to 14.04 LTS. Bottom Line: How can I force swapping further, and/or control processes before they cause system stability issues? (Side Note: Debian works fine, except for mouse touchpad issue) Output of `dmesg | grep error`:               [   26.646691] EXT4-fs (sda2): re-mounted. Opts: errors=remount-ro      This is Ubuntu Partition. Same error on Debian Partition except sda7.


title: enable networking inside a freebsd jail

text: So I'm mostly a linux newbie itself. Let alone freebsd, so please bear with me. I just need some very basic clues to get this to work. I use **FreeBSD 9.1 64-bit** from the list here. On my freebsd amazon instance, I have a jail running :               # jls      JID  IP Address      Hostname                      Path      1  192.168.1.101   01.gideon.com                /jails/01.gideon.com      If I goto that jails console I can't install perl on it. (If I do portsnap fetch **inside the jail** I get : `host: isc_socket_bind: address not available` and then it says _no mirrors, giving up._ ) I've looked at several articles and posts but I'm confused about what goes where, I just want you to tell me where I should put the right entries, this is a sample from this article, my system info is below:               rc.conf     hostname="" #what goes here?     defaultrouter=""#what goes here?     #I don't understand what this is for?     ifconfig_em0="inet 192.168.0.10 netmask 255.255.255.0"          #I'm guessing this should be like this:     ifconfig_xn0="inet 192.168.1.101 netmask 255.255.255.0"          # Should I use an alias?     # ifconfig_em0_alias0="inet 192.168.0.111 netmask 255.255.255.0"      This is what `ifconfig -a` gives me:               lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384             options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>             inet6 ::1 prefixlen 128             inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1             inet 127.0.0.1 netmask 0xff000000             nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>     xn0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500             options=503<RXCSUM,TXCSUM,TSO4,LRO>             ether 12:31:39:2a:dc:cc             inet 10.8.106.58 netmask 0xfffffe00 broadcast 10.8.107.255             nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>             media: Ethernet manual             status: active      This is my `/etc/resolve.conf`:               # Generated by resolvconf     search ec2.internal     nameserver 172.16.0.23      So how do I go about this?


title: How to execute script on logging out?

text: I'm reading The Unix Programming Environment. There is an exercise question to print how much CPU time you have consumed when you log off by editing `.profile`. I tried with this               trap 'times' 0 1 2 15      but it is not working.


title: What exactly does rmdir -p do?

text: > -p, --parents remove DIRECTORY and its ancestors; e.g., `rmdir -p a/b/c' is > similar to`rmdir a/b/c a/b a' Yeah - I'm definitely not going to risk testing that out myself. ;)


title: Ctrl+a+d exiting terminal?

text: I don't know what I have changed, but if I am on a terminal and I press `Ctrl+a+d` (that is, the three keys simultaneously) the terminal is killed. This is on `gnome-terminal` on `Ubuntu` and using `zsh` as the default login shell. I checked the keyboard shortcuts on `gnome-terminal` (on the GUI, under `Edit->Keyboard Shortcuts`) and searched for `bindkey` statements that may trigger this undesired shortcut in my home directory but found nothing. I am pretty sure that this is new behavior (last couple of days) since I frequently type `Ctrl-a` to go to the beginning of a line on my terminal and then `Ctr-d` to delete characters, and if I do this at the moment, it triggers this undesired keyboard shortcut. I recently installed some system updates, but I'd be surprised if these updates changed shortcuts. At the moment I have no clue why this is happening, so any help will be greatly appreciated. **Note:** This only happens on terminals. If I am on some other app, `Ctrl+a+d` does not trigger any exit commands.


title: Launch process as another user/group (in init.d script)

text: I am editing a init.d script. The init.d script runs a utility script which then runs an process. From either bash scripts how would I make it launch the main process as a specific user and group?


title: Dynamic wallpaper change on CentOS 6.3

text: Is there any possible way to change wallpaper (background) every five minutes on centos 6.3 with gnome 2.28.2 ? I found this Python script:               #!/usr/bin/env python          import gobject     gobject.threads_init()     import gtk     import os     import xml.dom.minidom     import gconf          class Wallpaper:         def __init__(self):             # Create GTK Window             self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)             self.window.set_title("Dynamic Wallpaper")             self.window.resize(350, 110)             self.window.set_resizable(False)                  # Create window objects             vbox = gtk.VBox()                  label = gtk.Label("Folder:")             label.set_alignment(0.0, 0.5)             self.folder_entry = gtk.Entry()             button = gtk.Button("Select...")             button.connect("clicked", self.button_clicked)             hbox = gtk.HBox()             hbox.pack_start(label, True)             hbox.pack_start(self.folder_entry, False)             hbox.pack_start(button, False)             vbox.pack_start(hbox, False)                  label = gtk.Label("Picture duration:")             label.set_alignment(0.0, 0.5)             adj = gtk.Adjustment(5.0, 1.0, 60.0, 1.0, 1.0, 0.0)             self.pdur_spinner = gtk.SpinButton(adj)             self.pdur_combo = gtk.combo_box_new_text()             self.pdur_combo.append_text("hr")             self.pdur_combo.append_text("min")             self.pdur_combo.append_text("sec")             self.pdur_combo.set_active(1)             hbox = gtk.HBox()             hbox.pack_start(label, True)             hbox.pack_start(self.pdur_spinner, False)             hbox.pack_start(self.pdur_combo, False)             vbox.pack_start(hbox, False)                  label = gtk.Label("Transition duration:")             label.set_alignment(0.0, 0.5)             adj = gtk.Adjustment(5.0, 0.0, 60.0, 1.0, 1.0, 0.0)             self.tdur_spinner = gtk.SpinButton(adj)             self.tdur_combo = gtk.combo_box_new_text()             self.tdur_combo.append_text("hr")             self.tdur_combo.append_text("min")             self.tdur_combo.append_text("sec")             self.tdur_combo.set_active(2)             hbox = gtk.HBox()             hbox.pack_start(label, True)             hbox.pack_start(self.tdur_spinner, False)             hbox.pack_start(self.tdur_combo, False)             vbox.pack_start(hbox, False)                  self.cancel_button = gtk.Button(stock=gtk.STOCK_CLOSE)             self.cancel_button.connect("clicked", self.destroy)             self.ok_button = gtk.Button(stock=gtk.STOCK_OK)             self.ok_button.set_sensitive(False)             self.ok_button.connect("clicked", self.ok_button_clicked)             hbox = gtk.HBox()             hbox.pack_end(self.ok_button, False)             hbox.pack_end(self.cancel_button, False)             vbox.pack_end(hbox, False, False, 10)                  # Connect signal handlers             self.window.connect("delete-event", self.delete_event)             self.window.connect("destroy", self.destroy)                  # Show entire window             self.window.add(vbox)             self.window.show_all()              def destroy(self, widget):             gtk.main_quit()              def button_clicked(self, button):             dialog = gtk.FileChooserDialog("Open..", None, gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,                                            (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,                                             gtk.STOCK_OK, gtk.RESPONSE_OK))             dialog.set_default_response(gtk.RESPONSE_OK)             dialog.set_filename(os.path.expanduser("~/Pictures/*"))             response = dialog.run()             filename = dialog.get_filename()             dialog.destroy()                  if response == gtk.RESPONSE_OK:                 self.folder_entry.set_text(filename)                 self.files = []                 accepted = ('.jpg', '.jpeg', '.gif', '.png')                 for file in os.listdir(filename):                     if os.path.splitext(file)[1] in accepted:                         self.files.append(os.path.join(filename, file))                      if len(self.files):                     self.ok_button.set_sensitive(True)                 else:                     dialog = gtk.MessageDialog(parent = None, flags = gtk.DIALOG_DESTROY_WITH_PARENT,                         type = gtk.MESSAGE_ERROR, buttons = gtk.BUTTONS_OK,                         message_format = "Folder contains no images")                     dialog.set_title('Error')                     dialog.connect('response', lambda dialog, response: dialog.destroy())                     dialog.run()              def ok_button_clicked(self, button):             nfiles = len(self.files)                  if nfiles <= 0:                 return False                  folder = self.folder_entry.get_text()                  picture_duration = int(self.pdur_spinner.get_text())             if self.pdur_combo.get_active_text() == "min":                 picture_duration = picture_duration * 60             elif self.pdur_combo.get_active_text() == "hr":                 picture_duration = picture_duration * 60 * 60                  transition_duration = int(self.tdur_spinner.get_text())             if self.tdur_combo.get_active_text() == "min":                 transition_duration = transition_duration * 60             elif self.tdur_combo.get_active_text() == "hr":                 transition_duration = transition_duration * 60 * 60                  document = """<background><starttime><year>2009</year><month>08</month><day>04</day><hour>00</hour><minute>00</minute><second>00</second></starttime></background>"""             dom = xml.dom.minidom.parseString(document)                  for i in range(0, nfiles):                 static = dom.createElement("static")                 duration = dom.createElement("duration")                 duration.appendChild(dom.createTextNode(str(picture_duration)))                 static.appendChild(duration)                 file = dom.createElement("file")                 file.appendChild(dom.createTextNode(self.files[i]))                 static.appendChild(file)                 dom.documentElement.appendChild(static)                      if transition_duration <= 0: continue                      transition = dom.createElement("transition")                 duration = dom.createElement("duration")                 duration.appendChild(dom.createTextNode(str(transition_duration)))                 transition.appendChild(duration)                 frm = dom.createElement("from")                 frm.appendChild(dom.createTextNode(self.files[i]))                 transition.appendChild(frm)                 to = dom.createElement("to")                 if i < nfiles-1:                     to.appendChild(dom.createTextNode(self.files[i+1]))                 else:                     to.appendChild(dom.createTextNode(self.files[0]))                 transition.appendChild(to)                 dom.documentElement.appendChild(transition)                  try:                 save_filename = os.path.join(folder, "background-1.xml")                 f = open(save_filename, 'w')                 f.write(dom.toxml("utf-8"))                 f.close()             except IOError as (errno, strerror):                 try:                     save_filename = os.path.join(os.path.expanduser("~"), ".dynamic-wallpaper.xml")                     f = open(save_filename, 'w')                     f.write(dom.toxml("utf-8"))                     f.close()                 except Error as (errno, strerror):                     dialog = gtk.MessageDialog(parent = None, flags = gtk.DIALOG_DESTROY_WITH_PARENT,                         type = gtk.MESSAGE_ERROR, buttons = gtk.BUTTONS_OK,                         message_format = strerror)                     dialog.set_title('Error')                     dialog.connect('response', lambda dialog, response: dialog.destroy())                     dialog.run()                     return False             except Error as (errno, strerror):                     dialog = gtk.MessageDialog(parent = None, flags = gtk.DIALOG_DESTROY_WITH_PARENT,                         type = gtk.MESSAGE_ERROR, buttons = gtk.BUTTONS_OK,                         message_format = strerror)                     dialog.set_title('Error')                     dialog.connect('response', lambda dialog, response: dialog.destroy())                     dialog.run()                     return False                  backgrounds_file = os.path.join(os.path.expanduser("~/.gnome2/"), "backgrounds.xml")             doc = xml.dom.minidom.parse(backgrounds_file)                  wallpaper = dom.createElement("wallpaper")             wallpaper.setAttribute("deleted", "false")             name = dom.createElement("name")             name.appendChild(dom.createTextNode("Dynamic Wallpaper"))             filename = dom.createElement("filename")             filename.appendChild(dom.createTextNode(save_filename))             options = dom.createElement("options")             options.appendChild(dom.createTextNode("stretched"))             shade_type = dom.createElement("shade_type")             shade_type.appendChild(dom.createTextNode("solid"))             pcolor = dom.createElement("pcolor")             pcolor.appendChild(dom.createTextNode("#2c2c00001e1e"))             scolor = dom.createElement("scolor")             scolor.appendChild(dom.createTextNode("#2c2c00001e1e"))             wallpaper.appendChild(name)             wallpaper.appendChild(filename)             wallpaper.appendChild(options)             wallpaper.appendChild(shade_type)             wallpaper.appendChild(pcolor)             wallpaper.appendChild(scolor)             doc.documentElement.appendChild(wallpaper)                  try:                 f = open(backgrounds_file, 'w')                 f.write(doc.toxml("utf-8"))                 f.close()             except Error as (errno, strerror):                     dialog = gtk.MessageDialog(parent = None, flags = gtk.DIALOG_DESTROY_WITH_PARENT,                         type = gtk.MESSAGE_ERROR, buttons = gtk.BUTTONS_OK,                         message_format = strerror)                     dialog.set_title('Error')                     dialog.connect('response', lambda dialog, response: dialog.destroy())                     dialog.run()                     return False                  conf_client = gconf.client_get_default()             conf_client.add_dir("/desktop/gnome/background", gconf.CLIENT_PRELOAD_NONE)             conf_client.set_string("/desktop/gnome/background/picture_filename", save_filename)             conf_client.set_string("/desktop/gnome/background/picture_options", "strecthed")             conf_client.set_string("/desktop/gnome/background/color_shading_type", "solid")             conf_client.set_string("/desktop/gnome/background/primary_color", "#2c2c00001e1e")             conf_client.set_string("/desktop/gnome/background/secondary_color", "#2c2c00001e1e")                  gtk.main_quit()              def delete_event(self, widget, event):             return False          if __name__ == "__main__":         wallpaper = Wallpaper()         gtk.main()      The script is for Ubuntu and when I ran it on my system and it generate a xml file but it doesn't work. Can anybody help me? Best regards, George! **Postscript** : And sorry for my awful English...


title: Change routes for VPN

text: I need to use for some things a cisco VPN connection, but I don't want to route all my trafic over the VPN but only that traffic, that is send to a specific network. How does a script look like, that sends all traffic to 10.10.3.1 or exchange.server.de through the VPN tunnel and the rest of the traffic uses the default route that existed before the VPN was established? Thanks for your help.


title: External Hard-Drive not visible in /media

text: I cannot seem to ssh into my external Hard-drive on "/media" it used to show up there, but now it doesn't. I have erased the Disk and verified it (on MAC OSX) and it still does not show. I have executed the command "lsusb" and got the following: > 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub > > Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. > > Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. > > Bus 001 Device 004: ID 0bc2:3312 Seagate RSS LLC This looks fine to me, as though it is picking it up, however, now showing the drive. Does anyone know what could be the problem? EDIT: fdisk -l output:               Disk /dev/sda: 2000.4 GB, 2000398933504 bytes     255 heads, 63 sectors/track, 243201 cylinders, total 3907029167 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x00000000     Device Boot      Start         End      Blocks   Id  System     /dev/sda1               1  3907029166  1953514583   ee  GPT      blkid output:               /dev/mmcblk0p1: SEC_TYPE="msdos" UUID="3312-932F" TYPE="vfat"      /dev/mmcblk0p2: UUID="b7b5ddff-ddb4-48dd-84d2-dd47bf00564a" TYPE="ext4"      /dev/sda1: LABEL="EFI" UUID="70D6-1701" TYPE="vfat"      /dev/sda2: UUID="ae48face-7d6e-3ce9-9f8c-77d8a605d00a" LABEL="Untitled" TYPE="hfsplus"


title: How do I cd up and down again with symlinks in bash?

text: Structure:               /base/        +- somedir/        +- symlink/  -> /some_other_dir      This command (in addition to my Makefiles) fails:               cd /base/symlink     ls ../somedir      Bash complains that ../somedir does not exist. Likewise, my makefiles in some_other_dir that reference ../somedir fail. However, cd .. works just as expected. Can I have my shell act with regards to the logical structure?


title: usermod -d /path user - User is currently logged in

text: good Day I want to make a change to a user on my CENTOS server. I want to change his default directory. When running the command:               usermod -d /path_to_new_dir david      terminal gives me the following               User david is currently logged in      I closed all ftp sessions which I was engaged into with that user, and I am logged into terminal as root. How do I run that command and how do I log out the user? As far as I am concerned he is not logged in...


title: lshw and lscpu disagree on caches - which is right?

text: I am trying to find out specifics about caches (in particular which caches are shared between cores and which are not) and have stumpled onto a inconsistency. `sudo lshw` says               *-cache:0          description: L1 cache          physical id: a          slot: Internal Cache          size: 64KiB          capacity: 64KiB          capabilities: synchronous internal write-back     *-cache:1          description: L2 cache          physical id: b          slot: External Cache          size: 8MiB          capabilities: synchronous internal write-back      but `lscpu` claims               L1d cache:   32K     L1i cache:   32K     L2 cache:   256K     L3 cache:  8192K      I do not worry too much about instruction and data cache being added together, but where did L2 go? Observed on a machine running Ubuntu 10.10, or to let `uname -a` speak:               Linux name 2.6.35-32-generic #66-Ubuntu SMP Mon Feb 13 21:04:32 UTC 2012 x86_64 GNU/Linux      This is a general question, but note that neither the most precise manufacturer spec I could find nor Wikipedia do have the necessary detail. Unrelated bonus question: does `External Cache` mean the cache is shared between the (four) cores (and `Internal Cache` the opposite)?