How to test UPSTART feature of ubuntu to see my script gets restarted automatically if it gets killed?

I am running my Python script using upstart feature of Ubuntu so that if for whatever reason my Python script dies or gets killed, it can be restarted automatically. So I decided to use UPSTART feature of Ubuntu to restart the Python script automatically. After creating the testing.conf file like this in `/etc/init/testing.conf` -               chdir /tekooz     exec python testing.py     respawn      I ran below sudo command to start it and I can see that process running using `ps ax` and my python script is also running fine.               root@bx13:/tekooz# sudo start testing     testing start/running, process 27794      This is my below python script -               #!/usr/bin/python     import time          while True:         print "Hello World"         time.sleep(5)      But how do I test it to see if my Python script gets killed, then it is getting restarted automatically? I cannot kill the `PID` as the PID keeps on changing if I do `ps ax` on my `testing.py`. Can anyone tell me how to test this scenario? I am just trying to make sure my script can be restarted automatically if it gets killed or dies.


Common flag designations and standards for shell scripts and functions

I have been adjusting to using GETOPT and GETOPTS in my shell scripts and custom functions to enable me to use the functions that I create more flexibly. After using a number of UNIX functions I have realized that a lot of them use a somewhat similar syntax. Examples being `-v` for verbose output and `-R/-r` for recursive functionality. I looked at the POSIX standard guide for utility conventions and the GNU's option tables for C based utilities. In an attempt to understand whether this was by design and if there are any rules that I should be following. **My questions are:**   1. Are there are any specific option flags that have designated meaning?   2. How much freedom do I have with my options and which rules shouldn't I break?   3. Should I stay way from giving options like `-t` and `-T` different meanings, or should I group them together for simplicity?   4. What situations should I use uppercase or lowercase letters?


NTFS Junctions and Unix Hard Links

I'm building an IO abstraction library for CIL code, and I have a very hard time understanding the differences between a junction between two folders in NTFS and hard links. Are they equivalent? Are there differences I should know about?


Remove unknown unicode character from textfiles - sed, other bash/shell methods

I need to search and replace all occurences of an unknown character in some files having the same name. Opening such files with vi, I read <91> code for that character. Opening them with nano, I read a "question mark" in a diamond (black rhumble). I would like to replace such unknown character with a quote ('). I'm trying many ways with no luck. I tried:               find ./ -name filename.txt -exec perl -i~ -pe "s/\x91/'/" {} \;                    find ./ -name filename.txt -exec sed -i "s/\x91/'/g" {} \;      **EDIT** More info on the character:               Hexadecimal: 91 68 74 74     Decimal: 145 104 116 116     Octal: 221 150 164 164     Binary: 10010001 01101000 01110100 01110100          LC_ALL=C sed -n l < file          \221      If you need more, ask!


How to get a persistent "history"-file even after a non-clean shutdown?

I am trying Ubuntu Server 10.10 in VirtualBox. I like that the commands I run is saved in a "history"-file that can be shown with the `history` command. But if I just turn off VirtualBox without the `shutdown` command, then next time when I boot, the commands from the last session is not saved in the history file. The commands are only saved if I shutdown the machine with the `shutdown` command. E.g. `shutdown -P 0`. Is there any way I can save the history file after every command so they are persistent even after a "non-clean" shutdown?


What is the key difference between grml zsh config and oh-my-zsh config

Now I'm on the oh-my-zsh, but I'm not sure that it is perfect choice. What is the key difference between grml zsh config (github repo) and oh-my-zsh config? In which case should I prefer grml or oh-my-zsh?


How do you use badblocks?

I need to do a destructive (rw) test on a new drive, and a read-only on a drive that fell out of my RAID array. I want to see if it finds problems and how far along it is.


How do I quit from Vi?

I started Vi on my Ubuntu machine. However I don't know Vi, and now I can not quit. I see the editor and I can write text, at the bottom line there is a label "recording". How do I quit from Vi?


jboss with s3ping in ec2

I'm trying to get `s3ping` discovery method working in JBoss AS 7. I have deployed a sample web app which is clustered. As of now I have a single node. But in the near future I'll be adding more nodes in the cluster.. I have modified the file `standalone-ha.xml` with the required s3 credentials and bucket details.                <stack name="s3ping">                     <transport type="TCP" socket-binding="jgroups-tcp" diagnostics-socket-binding="jgroups-diagnostics"/>                     <protocol type="S3_PING">                         <property name="access_key">                             XXXXXXXXXXXXXXX                         </property>                         <property name="secret_access_key">                             XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX                         </property>                         <property name="prefix">                             MyjbossBucket                         </property>                         <property name="timeout">                             6000                         </property>                     </protocol>                     <protocol type="MERGE2"/>                     <protocol type="FD_SOCK" socket-binding="jgroups-tcp-fd"/>                     <protocol type="FD"/>                     <protocol type="VERIFY_SUSPECT"/>                     <protocol type="BARRIER"/>                     <protocol type="pbcast.NAKACK"/>                     <protocol type="UNICAST2"/>                     <protocol type="pbcast.STABLE"/>                     <protocol type="pbcast.GMS"/>                     <protocol type="UFC"/>                     <protocol type="MFC"/>                     <protocol type="FRAG2"/>                 </stack>      And I start this JBoss instance by using the below command.               ./standalone.sh -b 10.1.137.250 -bmanagement=10.1.137.250 -c standalone-ha.xml -Djboss.default.jgroups.stack=s3ping -Djgroups.bind.address=10.1.137.250 -Djboss.node.name=node1      It's getting started successfully, but I'm unable to see any node information file created inside the s3 bucket. Kindly please guide me through the correct method to get this done...Or am I doing some mistake in the configs...


How to restore empathy windows on Gnome 3?

Somehow the main application window of my empathy application is gone and only shows me the contact list but not the account settings window so that I can no longer add instant messanger accounts or persons to an account. How can I restore that? I use GNOME Shell 3.6.2.


Extra % in output of awk script

I have the following script in awk that sums all columns in a file that I pipe to it:               #sum_all.awk     {   for (i=1; i<=NF; i++) { sum[i]+= $i }   }          END { for (i=1; i<=NF; i++ ) { printf "%d ", sum[i] } }      e.g.: `cat my_file.txt | awk -f sum_all.awk` with `my_file.txt`:               5 7 8     1 0 2      outputs:               6 7 10 %      How can I get rid of that last character `%`?


Difference between printf and echo in bash

What is the difference between the `printf` function in bash and the `echo` function? Specifically, running:               echo "blah" >/dev/udp/localhost/8125      did not send the "blah" command to the server listening on 8125, whereas               printf "blah" >/dev/udp/localhost/8125      sent the data. Does printf send an extra EOF at the end of its output?


Permissions to print directly to USB printer

I've a netbook with Linux. I've a usb/serial printer and I added the line `chmod 666 /dev/tty*` to `rc.local` and it prints straight after a reboot. When I close the lid of a netbook for a while and then try to print again, it doesn't want to, until I run a command `chmod 666 /dev/ttyUSB0`. How do I get this to recognize the command after hibernate without typing the command again?


Why restrict the number of inodes a user can access?

It appears that it is possible on a network mount to set a quota on how much space a user can consume.               # edquota ramesh          Disk quotas for user ramesh (uid 500):       Filesystem           blocks       soft       hard     inodes     soft     hard       /dev/sda3           1419352          0          0       1686        0        0      You also can set a soft and a hard limit on how many inodes a user has. Why would you ever need to limit how many inodes a user has access to? Wouldn't the user still be able to fill up the disk with 1 really large file?


Can I rely on binary packages (pkg) in FreeBSD

Since last October binary packages have been available for FreeBSD (http://lists.freebsd.org/pipermail/freebsd-pkg/2013-October/000107.html). Before that, they had some trouble, preventing binary packages from being published. At this moment, is there any reason not to rely on the binary packages mirrors? Is there any chance that a security breach would be found and the binary package disappearing again? For a new installation, does it still make sense to build things from the ports tree yourself, or is it stable enough to use only binary packages (provided you need everything with default compile flags)?


Why is it needed to erase the first MByte of an OpenBSD CRYPTO device?

from: http://www.openbsd.org/cgi-bin/man.cgi?query=bioctl               The following command, executed from the command line, would configure          the device softraid0 with one special device (/dev/sd2e) and an          encrypting volume:              # bioctl -c C -l /dev/sd2e softraid0               bioctl will ask for a passphrase, which will be needed to unlock the          encrypted disk.  After creating a newly encrypted disk, the first          megabyte of it should be zeroed, so tools like fdisk(8) or disklabel(8)          don't get confused by the random data that appears on the new disk.  This          can be done with the following command (assuming the new disk is sd3):              # dd if=/dev/zero of=/dev/rsd3c bs=1m count=1      **My question** : but exactly why is it needed to erase the first MByte of the CRYPTO device? Are there any disadvantages if I miss doing this?


What are the equivalent architecture of alphanumeric numbers in Debian?

On the Debian website, I found a list of the releases of Debian associate with alphanumerical architectures. Do you know to what those architectures numbers and letters stand for?   ![ss #1](http://i.stack.imgur.com/hQz8J.png)


What are the generic-pae directories in /lib/modules?

When listing the content of the dirctory `/lib/modules` I see a list of `generic-pae` directories (Ubuntu 12.04):               drwxr-xr-x 4 root root 4096 Apr 23  2012 3.2.0-23-generic-pae     drwxr-xr-x 5 root root 4096 Nov 20  2012 3.2.0-27-generic-pae     drwxr-xr-x 5 root root 4096 Nov 20  2012 3.2.0-29-generic-pae     drwxr-xr-x 5 root root 4096 Nov 20  2012 3.2.0-30-generic-pae     drwxr-xr-x 5 root root 4096 Nov 20  2012 3.2.0-31-generic-pae     drwxr-xr-x 5 root root 4096 May 16  2013 3.2.0-32-generic-pae     drwxr-xr-x 5 root root 4096 May 16  2013 3.2.0-33-generic-pae     drwxr-xr-x 5 root root 4096 May 16  2013 3.2.0-34-generic-pae     drwxr-xr-x 5 root root 4096 May 16  2013 3.2.0-35-generic-pae     drwxr-xr-x 5 root root 4096 May 16  2013 3.2.0-36-generic-pae     drwxr-xr-x 5 root root 4096 May 16  2013 3.2.0-37-generic-pae     drwxr-xr-x 5 root root 4096 May 16  2013 3.2.0-38-generic-pae     drwxr-xr-x 5 root root 4096 May 16  2013 3.2.0-39-generic-pae     drwxr-xr-x 5 root root 4096 May 16  2013 3.2.0-41-generic-pae     drwxr-xr-x 5 root root 4096 Jun 18 08:26 3.2.0-48-generic-pae     drwxr-xr-x 5 root root 4096 Oct  3 07:47 3.2.0-54-generic-pae      What are all of these directories? What is their content? Can I remove the ones with a lower number, because they take up quite a lot of space?


How is `vi` Aware of the Format of Configuration Files?

When I edit configuration files in `vi`, it seems like `vi` is aware of the syntax of the file. For example, `vi` will color tokens one way or another depending on whether its a key or a value. Furthermore, `vi` also seems to be aware of which values are valid keys. How does it do this? _Edit: Let me add that I'm running Ubuntu Server 12.04 LTS (Precise Pangolin)_


Segmentation fault (core dumped) when try to run iptables rhel6

Im currently trying to set up a mySQL replication and i dont have a /etc/sysconfig/iptables. So I tried to install it with yum install. It showed the following output.                 Installed Packages     Name        : iptables     Arch        : x86_64     Version     : 1.4.7     Release     : 11.el6     Size        : 836 k     Repo        : installed     From repo   : anaconda-RedHatEnterpriseLinux-201311111358.x86_64     Summary     : Tools for managing Linux kernel packet filtering capabilities     URL         : http://www.netfilter.org/     License     : GPLv2     Description : The iptables utility controls the network packet filtering code in                 : the Linux kernel. If you need to set up firewalls and/or IP                 : masquerading, you should install this package.          Available Packages     Name        : iptables     Arch        : i686     Version     : 1.4.7     Release     : 11.el6     Size        : 247 k     Repo        : rhel-x86_64-server-6     Summary     : Tools for managing Linux kernel packet filtering capabilities     License     : GPLv2     Description : The iptables utility controls the network packet filtering code in                 : the Linux kernel. If you need to set up firewalls and/or IP                 : masquerading, you should install this package.      So far so good but when I try to run iptables I get a _Segmentation fault_ Do I need a better hardware?               [root@wltwd1 sysconfig]# iptables     Segmentation fault (core dumped)      **This is my lscpu output:**               [root@wltwd1 sysconfig]# lscpu     Architecture:          x86_64     CPU op-mode(s):        32-bit, 64-bit     Byte Order:            Little Endian     CPU(s):                1     On-line CPU(s) list:   0     Thread(s) per core:    1     Core(s) per socket:    1     Socket(s):             1     NUMA node(s):          1     Vendor ID:             GenuineIntel     CPU family:            6     Model:                 47     Stepping:              2     CPU MHz:               1995.034     BogoMIPS:              3990.06     Hypervisor vendor:     VMware     Virtualization type:   full     L1d cache:             32K     L1i cache:             32K     L2 cache:              256K     L3 cache:              18432K     NUMA node0 CPU(s):     0


mpd to remote dlna

I currently use an `mpd` with 4 configured outputs, wired to speakers in the ceilings as home-made "multiroom" audio system. I would like to add wireless speakers, e.g. one like this. The question is: How can I tell `mpd` that there is an output which is in fact remote a dlna/upnp (even aiyplay would be fine) ip-device ? Is it possible at all ? **Edit 1:** I found a way, though through `pulseaudio` and not `dlna` (which could be a use for one of my `Raspberry Pi`s).


mdadm inconsistencies when run programmatically

### Update #1: I just gave an extra layer of testing, writing a shell script (.sh, #!/bin/bash) and a php script to be executed by php's cli. Bash works. It seems that it's not the Apache's HTTP context, but PHP itself that is causing the problems. Because a simple `php raider.php` run from root's shell has the same 2 problems mentioned originally. * * * I am building an appliance that has an WebOS on top of. WebOS is being hosted with Apache running as `http:http`. Since WebOS needs access to OS (root), sudoers are set up - to allow `http` ALL with NOPASSWD. Please don't educate about processes being run as root - the environment is controlled, and has been working for 2 years now with over 40 units shipped and no problems reported. Commands are run by `php` (mod_php5 for Apache) with `proc_open` from a HTTP request context. Every command seems to be working fine, except for `mdadm --create`. When I attempt to create an array there are random outcomes depending on the RAID level I have chosen to make. Previously I've had a namespacing problem, but that's not the case anymore. The problem started to appear after some OS updates (don't know when exactly, this is the old version of the WebOS that isn't working and had to be brought up as of recent and, apparently, needs to be fixed - there is also a new version which works ok (it has a different command execution cycle)). I am using `mdadm_udev` initramfs hook to assemble RAID's upon start. I have left `/etc/mdadm.conf` empty, because `mdadm_udev` seems to assemble the RAID's properly based on their metadata. The only catch, though, is that when it assembles them, it names the raid based on `<hostname>:<raidname>`. Due to the catch above, I am using `mdadm --create /dev/md/<hostname>:stoneshare ...`, which seems to be running fine from CLI no matter what's the user (non-root users run as sudo and succeed), the problems come when ran through HTTP context. ### Scenario #1, RAID0:               <?php          $command = sprintf('sudo mdadm --create /dev/md/%s:stoneshare --level 0 --raid-devices 2 /dev/sdb1 /dev/sdc1');     proc_open($command, /* ... */, /* ... */);      RAID gets created, but, where CLI makes the RAID on `/dev/md127` and symlinks to `/dev/md/<hostname>:<sharename>`, by running the above script, I end up with `/dev/md127` with no link:               [root@stone ~]# mdadm --detail --scan     ARRAY /dev/md127 metadata=1.2 name=stone:stoneshare UUID=7329e458:96be442a:84f616d8:fd4ba42e          [root@stone ~]# ls -la /dev/md*     brw-rw---- 1 root disk 9, 127 Jul 30 11:48 /dev/md127      ### Scenario #2, RAID1:               <?php          $command = sprintf('sudo mdadm --create /dev/md/%s:stoneshare --level 1 --assume-clean --raid-devices 2 /dev/sdb1 /dev/sdc1');     proc_open($command, /* ... */, /* ... */);      Check:               [root@stone ~]# mdadm --detail --scan     ARRAY /dev/md/stone:stoneshare metadata=1.2 name=stone:stoneshare UUID=7329e458:96be442a:84f616d8:fd4ba42e          [root@stone ~]# ls -la /dev/md*     brw-rw---- 1 root disk 9, 127 Jul 30 11:48 /dev/md127          /dev/md:     total 0     drwxr-xr-x  2 root root   60 Jul 30 12:17 .     drwxr-xr-x 19 root root 3080 Jul 30 12:17 ..     lrwxrwxrwx  1 root root   10 Jul 30 12:17 stone:stoneshare -> /dev/md127      Weirdly, but the symlink is created, there is a different problem though - upon RAID's creation, randomly either `/dev/sdb1` or `/dev/sdc1` is automatically marked as faulty. The RAID gets created and started, but is running with 1 drive. Sometimes neither of the drives is marked faulty and RAID is created with no problems at all. I have handpicked, what I found as relevant information for the device failure:               [root@stone ~]# journalctl -xb     Jul 30 11:39:43 stone kernel: md: bind<sdb1>     Jul 30 11:39:43 stone kernel: md: bind<sdc1>     Jul 30 11:39:43 stone kernel: md/raid1:md127: active with 2 out of 2 mirrors     Jul 30 11:39:43 stone kernel: created bitmap (8 pages) for device md127     Jul 30 11:39:43 stone kernel: md127: bitmap initialized from disk: read 1 pages, set 14903 of 14903 bits     Jul 30 11:39:43 stone kernel: md127: detected capacity change from 0 to 1000068874240     Jul 30 11:39:43 stone kernel:  md127: unknown partition table     Jul 30 11:39:43 stone systemd[1]: Starting MD array monitor...     Jul 30 11:39:43 stone systemd[1]: About to execute: /usr/lib/systemd/scripts/mdadm_env.sh     Jul 30 11:39:43 stone systemd[1]: Forked /usr/lib/systemd/scripts/mdadm_env.sh as 457     Jul 30 11:39:43 stone systemd[1]: mdmonitor.service changed failed -> start-pre     Jul 30 11:39:43 stone systemd[457]: Executing: /usr/lib/systemd/scripts/mdadm_env.sh     Jul 30 11:39:43 stone systemd[457]: Failed at step EXEC spawning /usr/lib/systemd/scripts/mdadm_env.sh: No such file or directory     Jul 30 11:39:43 stone systemd[1]: Received SIGCHLD from PID 457 ((m_env.sh)).     Jul 30 11:39:43 stone systemd[1]: Child 457 ((m_env.sh)) died (code=exited, status=203/EXEC)     Jul 30 11:39:43 stone systemd[1]: Child 457 belongs to mdmonitor.service     Jul 30 11:39:43 stone systemd[1]: mdmonitor.service: control process exited, code=exited status=203     Jul 30 11:39:43 stone systemd[1]: mdmonitor.service got final SIGCHLD for state start-pre     Jul 30 11:39:43 stone systemd[1]: About to execute: /sbin/mdadm --monitor $MDADM_MONITOR_ARGS     Jul 30 11:39:43 stone systemd[1]: Forked /sbin/mdadm as 460     Jul 30 11:39:43 stone systemd[1]: mdmonitor.service changed start-pre -> running     Jul 30 11:39:43 stone systemd[1]: Job mdmonitor.service/start finished, result=done     Jul 30 11:39:43 stone systemd[1]: Started MD array monitor.     Jul 30 11:39:43 stone kernel: md: md127 still in use.     Jul 30 11:39:43 stone kernel: md/raid1:md127: Disk failure on sdb1, disabling device.                                   md/raid1:md127: Operation continuing on 1 devices.     Jul 30 11:39:43 stone mdadm[460]: mdadm: No mail address or alert command - not monitoring.     Jul 30 11:39:43 stone systemd[460]: Executing: /sbin/mdadm --monitor --scan     Jul 30 11:39:43 stone systemd[1]: Received SIGCHLD from PID 460 (mdadm).     Jul 30 11:39:43 stone systemd[1]: Child 460 (mdadm) died (code=exited, status=1/FAILURE)     Jul 30 11:39:43 stone systemd[1]: Child 460 belongs to mdmonitor.service     Jul 30 11:39:43 stone systemd[1]: mdmonitor.service: main process exited, code=exited, status=1/FAILURE     Jul 30 11:39:43 stone systemd[1]: mdmonitor.service changed running -> failed     Jul 30 11:39:43 stone systemd[1]: Unit mdmonitor.service entered failed state.     Jul 30 11:39:43 stone systemd[1]: mdmonitor.service: cgroup is empty     Jul 30 11:39:43 stone kernel: RAID1 conf printout:     Jul 30 11:39:43 stone kernel:  --- wd:1 rd:2     Jul 30 11:39:43 stone kernel:  disk 0, wo:1, o:0, dev:sdb1     Jul 30 11:39:43 stone kernel:  disk 1, wo:0, o:1, dev:sdc1     Jul 30 11:39:43 stone systemd[1]: Got disconnect on private connection.     Jul 30 11:39:43 stone kernel: RAID1 conf printout:     Jul 30 11:39:43 stone kernel:  --- wd:1 rd:2     Jul 30 11:39:43 stone kernel:  disk 1, wo:0, o:1, dev:sdc1     Jul 30 11:39:43 stone kernel: md: unbind<sdb1>     Jul 30 11:39:43 stone kernel: md: export_rdev(sdb1)      Thought, I doubt that `mdmonitor` is essential for creating the RAID. * * * Both RAID's are perfectly assembled when ran from CLI, no problems encountered. Drives, per S.M.A.R.T. are healthy. The UUID's in reality are not equal, I just made the examples up out of a single RAID. * * * What am I doing wrong here, that is causing such inconsistencies?


Gtk theme won't apply in Fluxbox

I installed my Arch Linux with Gnome 3 and Fluxbox on top of it, and I use Fluxbox as the default, but I have this weird problem that I can't manage to fix. I set my theme for Fluxbox and that is working perfectly. I set the gtk2 theme and it is not working (well partially I right click in Chromium and I see the styling). However, when I open nautilus or gnome-terminal, or any other window that uses gtk for styling doesn't apply. Here is the screenshot (notice in the third picture, the menu looks like an X WM menu): ![styling doesn't apply : nautilus; terminal](http://i.stack.imgur.com/DSm7i.png) ![see the menu line where file, edit... can be found and also notice the button near the home button](http://i.stack.imgur.com/q0ERF.png) ![Screenshot of the unstyled menu](http://i.stack.imgur.com/2tsOq.png) I tried that in my gnome session and it works without a problem (in fallback mode). I tried one of those gtk-theme changer and it says that the theme, that i want, is set but it is only seen in chromium. It is all grey and old (Like win98 :D) **Note : I tried to run gnome-settings-daemon in my terminal and it says "command not found" but when i check this package with pacman : it says [installed]** ![enter image description here](http://i.stack.imgur.com/8l8Du.png)


How do I execute in background / return early?

For reference, I'm using `phpseclib` to control a remote SSH server using the 'root' account. I have to start/stop a java process which is ran in the background. Stopping works fine with `killall java` and this is all I need for now, although when I run the server, I'm using:               (cd ./serv/; nohup java -classpath bin:deps/poi.jar:deps/netty.jar:deps/mysql.jar:deps/slf4j.jar:deps/slf4j-nop.jar:deps/jython.jar:log4j-1.2.15.jar: server.Server &)      As you can see, I am using the & operator for the second command inside the brackets. The command would execute correctly though the page would keep loading waiting for a return value/exit code? And it would eventually use up all the memory on my webhost. The answer was that you need to manually direct the output of nohup: Edit: Answer!!               (cd ./serv/; java -classpath bin:deps/poi.jar:deps/netty.jar:deps/mysql.jar:deps/slf4j.jar:deps/slf4j-nop.jar:deps/jython.jar:log4j-1.2.15.jar: server.Server >/tmp/test.out 2>&1 &)      Thanks to Mikeserv for the help.


Fixing Lilo with uefi system and no optical drive

Recently I have been trying to boot into Slackware on a new laptop that came pre-installed with Windows 8. I have successfully installed Slackware and Lilo, but I have had great difficulty trying to boot into it as the laptop contains no optical drive. I have been attempting to boot into various systems I have on other USB drives. The only fully successful boot came from tinycore, and that is a pain to install grub (or any bootloader) from. My current situation is trying to get it to boot using EasyBCD, and I can get to the (Windows) boot menu and select the created Slackware option, but after that it shows a windows MBR error. Where would you recommend I go from here? Any help is appreciated.


By the error I can't install any packages. And also I can't update to the latest version. I don't know what to do now. Any help much appreciated. > Error: requested datatype primary not available ### OS Info   * Operating System: Fedora 18   * Architecture: X86_64 From the internet I've tried the following commands to rebuild the repository. But I'm still getting the same error. ### Commands run               # yum clean all     # rpm rebuilddb     # yum grouplist or yum list      ### More Info The following are my Repo files:               adobe-linux-x86_64.repo     epel.repo     fedora.repo     fedora-updates.repo     fedora-updates-testing.repo     livna.repo     mysql-community.repo     mysql-community-source.repo     pgdg-92-fedora.repo     rpmfusion-free-rawhide.repo     rpmfusion-free.repo     rpmfusion-free-updates.repo     rpmfusion-free-updates-testing.repo     rpmfusion-nonfree-rawhide.repo     rpmfusion-nonfree.repo     rpmfusion-nonfree-updates.repo     rpmfusion-nonfree-updates-testing.repo


openssl-1.0.1e compiling on Debian

I am compiling OpenSSL-1.0.1e on Debian Lenny (armv4 architecture). I have been following the instruction on http://www.linuxfromscratch.org/blfs/view/svn/postlfs/openssl.html to compile the source code. `make` and `make test` are successfully completed. I wonder how I should continue the compiling the file. Should I do `make install` or stick to the instruction and do               make MANDIR=/usr/share/man MANSUFFIX=ssl install &&     install -dv -m755 /usr/share/doc/openssl-1.0.1e  &&     cp -vfr doc/*     /usr/share/doc/openssl-1.0.1e      EDIT: I did both of the methods but I still have the old version of the openssl. do I need to copy the `openssl` binary and paste it to a specific directory (e.g., `/usr/bin`) to replace the new binary with the old one? How do I suppose to update the program? EDIT2: `make test` output: ALL TESTS SUCCESSFUL.               make[1]: Leaving directory `/home/openssl-1.0.1e/test'     OPENSSL_CONF=apps/openssl.cnf util/opensslwrap.sh version -a     OpenSSL 1.0.1e 11 Feb 2013     built on: Mon Jun 10 05:08:05 UTC 2013     platform: dist     options:  bn(32,32) rc4(ptr,int) des(idx,cisc,2,long) idea(int) blowfish(idx)      compiler: cc -O     OPENSSLDIR: "/usr/local/ssl"      `make install` output:               make[1]: Leaving directory `/home/openssl-1.0.1e/engines'     making install in apps...     make[1]: Entering directory `/home/openssl-1.0.1e/apps'     installing openssl     installing CA.sh     installing CA.pl     installing tsget     make[1]: Leaving directory `/home/openssl-1.0.1e/apps'     making install in test...     make[1]: Entering directory `/home/openssl-1.0.1e/test'     make[1]: Nothing to be done for `install'.     make[1]: Leaving directory `/home/openssl-1.0.1e/test'     making install in tools...     make[1]: Entering directory `/home/openssl-1.0.1e/tools'     make[1]: Leaving directory `/home/openssl-1.0.1e/tools'     installing libcrypto.a     installing libssl.a     cp libcrypto.pc /usr/local/ssl/lib/pkgconfig     chmod 644 /usr/local/ssl/lib/pkgconfig/libcrypto.pc     cp libssl.pc /usr/local/ssl/lib/pkgconfig     chmod 644 /usr/local/ssl/lib/pkgconfig/libssl.pc     cp openssl.pc /usr/local/ssl/lib/pkgconfig     chmod 644 /usr/local/ssl/lib/pkgconfig/openssl.pc


How to create a bootable Linux installation USB from an ISO in OS X?

I downloaded the ISO for Debian's net installation to a computer running OS X. I want to put the data from the ISO onto a USB, so that I can install Debian on another laptop (not an Apple laptop). That laptop currently has no system installed, so I must prepare the USB drive on the OS X computer. First, I tried installing UNetbootin on the OS X computer. When this bootable USB didn't boot, I found a bug report here suggesting that, although UNetbootin lists a version for OS X, it is actually not able to create bootable USBs. Next, I tried the instructions at DebianEeePC How-to:               dd if=debian-7.*-netinst.iso of=/dev/disk1s1      This took about 10 minutes, reported no errors, but the USB still is unbootable.   * In the past, USBs created with UNetbootin on Windows, and using the `dd` method in Linux worked successfully, but at this present time, only have OS X available to me. How can I create a bootable Linux installation USB from an ISO in OS X?


Command "I'm" on linux ubuntu

I'm new at linux, ubuntu, and I did type `I'm running` and then like if it was a program or something else, I was allowed to write more... nothing else... I just want to know more about this command or program. thank ya all.


Network file-sharing between Linux and Android

I want to share the contents of my external HDD with my Android phone. For the last two hours, I've been trying to correctly set up Samba - it was absolutely horrible. There must be another, simpler way to set up file sharing over a (W)LAN, because learning 200 new shell commands in a hostile and unknown environment definitely isn't something I want to waste my time on. Is something as FTP my solution?


Access Windows Share from local linux machine through remote ssh server

as you can read from the title, this question might sound tricky, but I believe it is feasible. I work from my Ubuntu laptop. I need to access a Windows share that is accessible only from within my university's LAN. But, I can ssh to a remote server which is right there in univ's LAN. I believe there must be a way to hop from my laptop to the remote server to the Windows share, but apparently I can't make it work. I tried to ssh the remote machine, and access the windows share with `smbclient`               smbclient //the.windows.share/my_group_share -U username      with NO success (got a `NT_STATUS_BAD_NETWORK_NAME` error ). I've searched and read on the web and found some solutions using VPN over SSH tunneling, but I'm not sure it fits for my needs. besides, a first attempt did not work, couldn't even connect. can somebody point me to a solution?


Ubuntu cannot start from terminal

Ubuntu 12.04 By a mistake, I stopped lightdm. Then switched to tty1, and rebooted. Now, After startup, It just came a black screen with a cursor, can type nothing. I tried `Ctrl`+`F1` to `F12` (and `Ctrl`+`Alt`+`F1` to `F12`), nothing works. There might be something wrong with X server (Because I cannot type in, there is no way to try `startx`)


capture output from command without interference

How can I test whether a command's output is an empty string without interfering with said output? Example:               command | ???     if [ $? = 0 ] && [ -n "$output_from_command"]; then        ...      I'd like that the output from the code above be the same as when running `command`.


dd primary partition slow transfer rate

Can someone explain me why if backup ,using `dd`, a primary partition to a primary partition on other disk the transfer rate (MB/s) is significantly slower compared to the the rate I have if the destination is a logical partition. Let's say that I have two disk `sda` and `sdb` and I want to backup `sda1` a primary partion of `sda`, on `sdb`. I create a new partition on `sdb` that has the same size of `sda1`. If the partion on sdb is primary When I run               dd  if=/dev/sda1 of=/dev/sdb1       the speed is 20 MB/s but if I launch using a logical partition as destination               dd if=/dev/sda1 of=/dev/sdb5      the speed is 3 MB/s. To copy at the same speed I need to set the `BS=4MB` . I run the test more the one time also after rebooting the machine.


Ubuntu 12.04 resolver setup

When investigating how the DNS setup of my os (Ubuntu 12.04) works, I came to some questions I could not really find on the web. So what I observed was, that ubuntu uses Dnsmasq as a DNS resolver. When loooking into /etc/resolv.con, 127.0.1.1 is listed as nameserver. So the question here is, if Dnsmasq is just used as a resolver and the resolver normally looks into /etc/resolv.conf to get the IP of the nameserver, how does this make sense? It would only make sense if Dnsmasq was used as a local DNS server, meaning that the actual OS's resolver would send all DNS queries to the local Dnsmasq listening on port 53.


LXC with both GUI apps and snapshots on unmodified Fedora kernel

I am looking for a tool or library to run LXC that supports:   * running X applications   * conveniently snapshotting root filesystems (using a Fedora system with an unmodified kernel), so that I don't have to use lots of disk/SSD space for each root filesystem. I don't care about security. The upstream `lxc` tools support snapshots using btrfs, but I don't think they support running X applications. I'm not sure if libvirt supports Btrfs snapshots yet for LXC - there has been some discussion of it. `virtenv` supports snapshots, but requires overlayfs, which is not in Fedora. I don't think Docker supports X applications. Correct me if I'm wrong on any of these...


Enabling 1366x768 resolution in Debian Wheezy on Atom D525 Board

For some reason, when I try to update to a modern version of Linux from Debian 6.0.7 or Ubuntu 10.0.4, I lose most of the resolutions that were available, including the native resolution of the panel I'm trying to run (1366x768). This is on an embedded Atom D525-based board that uses the GMA3150 intel integrated graphics (I think this CPU/Chipset is also used in some netbooks). Basically, everything works fine in either Debian 6.0.7 or Ubuntu 10.04. For reference, here is the relevant section of my Xorg.0.log file indicating that all the modes were detected on the LVDS1 output:               (II) intel(0): Printing probed modes for output LVDS1     (II) intel(0): Modeline "1366x768"x59.9   80.00  1366 1436 1577 1648  768 778 783 810 (48.5 kHz)     (II) intel(0): Modeline "1360x768"x59.8   84.75  1360 1432 1568 1776  768 771 781 798 -hsync +vsync (47.7 kHz)     (II) intel(0): Modeline "1360x768"x60.0   72.00  1360 1408 1440 1520  768 771 781 790 +hsync -vsync (47.4 kHz)     (II) intel(0): Modeline "1024x768"x85.0   94.50  1024 1072 1168 1376  768 769 772 808 +hsync +vsync (68.7 kHz)     (II) intel(0): Modeline "1024x768"x75.0   78.75  1024 1040 1136 1312  768 769 772 800 +hsync +vsync (60.0 kHz)     (II) intel(0): Modeline "1024x768"x70.1   75.00  1024 1048 1184 1328  768 771 777 806 -hsync -vsync (56.5 kHz)     (II) intel(0): Modeline "1024x768"x60.0   65.00  1024 1048 1184 1344  768 771 777 806 -hsync -vsync (48.4 kHz)     (II) intel(0): Modeline "1024x768"x87.0   44.90  1024 1032 1208 1264  768 768 776 817 interlace +hsync +vsync (35.5 kHz)     (II) intel(0): Modeline "832x624"x74.6   57.28  832 864 928 1152  624 625 628 667 -hsync -vsync (49.7 kHz)     (II) intel(0): Modeline "800x600"x85.1   56.30  800 832 896 1048  600 601 604 631 +hsync +vsync (53.7 kHz)     (II) intel(0): Modeline "800x600"x72.2   50.00  800 856 976 1040  600 637 643 666 +hsync +vsync (48.1 kHz)     (II) intel(0): Modeline "800x600"x75.0   49.50  800 816 896 1056  600 601 604 625 +hsync +vsync (46.9 kHz)     (II) intel(0): Modeline "800x600"x60.3   40.00  800 840 968 1056  600 601 605 628 +hsync +vsync (37.9 kHz)     (II) intel(0): Modeline "800x600"x56.2   36.00  800 824 896 1024  600 601 603 625 +hsync +vsync (35.2 kHz)     (II) intel(0): Modeline "640x480"x85.0   36.00  640 696 752 832  480 481 484 509 -hsync -vsync (43.3 kHz)     (II) intel(0): Modeline "640x480"x72.8   31.50  640 664 704 832  480 489 492 520 -hsync -vsync (37.9 kHz)     (II) intel(0): Modeline "640x480"x75.0   31.50  640 656 720 840  480 481 484 500 -hsync -vsync (37.5 kHz)     (II) intel(0): Modeline "640x480"x59.9   25.18  640 656 752 800  480 490 492 525 -hsync -vsync (31.5 kHz)     (II) intel(0): Modeline "720x400"x85.0   35.50  720 756 828 936  400 401 404 446 -hsync +vsync (37.9 kHz)     (II) intel(0): Modeline "640x400"x85.1   31.50  640 672 736 832  400 401 404 445 -hsync +vsync (37.9 kHz)     (II) intel(0): Modeline "640x350"x85.1   31.50  640 672 736 832  350 382 385 445 +hsync -vsync (37.9 kHz)      After upgrading to Debian 7.0.0 (wheezy), I no longer have most of these resolutions available. At startup, probing for modes looks like this in Xorg.0.log:               [    32.415] (II) intel(0): Printing probed modes for output LVDS1     [    32.415] (II) intel(0): Modeline "1024x768"x60.0   65.00  1024 1048 1184 1344  768 771 777 806 -hsync -vsync (48.4 kHz P)     [    32.415] (II) intel(0): Modeline "800x600"x60.3   40.00  800 840 968 1056  600 601 605 628 +hsync +vsync (37.9 kHz d)     [    32.415] (II) intel(0): Modeline "800x600"x56.2   36.00  800 824 896 1024  600 601 603 625 +hsync +vsync (35.2 kHz d)     [    32.415] (II) intel(0): Modeline "640x480"x59.9   25.18  640 656 752 800  480 490 492 525 -hsync -vsync (31.5 kHz d)      This isn't just a Debian issue either, since the exact same thing happens going from Ubuntu 10.04 to 12.04. Debian 6.0.7 includes version 2.13.0 of the intel graphics driver, while 7.0.0 includes version 2.19.0. Is it possible that there's a bug in the driver that causes these modes to not be detected, and if so, is it feasible to just run the old driver or would that break everything? Or has anyone else experienced a similar issue and found a work- around? Trying to manually set the modeline for 1366x768 in Debian 7 results in an error message as follows:               xrandr --newmode "1366x768_60" 80.0 1366 1436 1577 1648  768 778 783 810     xrandr --addmode LVDS1 1366x768_60     X Error of failed request:  BadMatch (invalid parameter attributes)        Major opcode of failed request:  140 (RANDR)        Minor opcode of failed request:  18 (RRAddOutputMode)        Serial number of failed request: 27        Current serial number in output stream:  28


mysqld dead but pid file exists

Webserver was running fine for weeks then suddenly:   1. I can access, but I am unable to log into Webmin   2. I can access Magento, a php-based storefront application, but I am no longer able to log in and it is throwing an exception error on the front end.   3. Proftpd service was stopped, but I was able to restart   4. Mysqld service was stopped and I have NOT been able to restart. When attempting to restart mysqlp I receive the following error: "mysqld dead but pid file exists". Any ideas on how I may resolve this matter? Please let me know if there is a specific log file you would need to see.


Git hanging while cloning source

I am cloning firmware source using `git clone` but during the operation my Internet connection went down. I immediately restored the connection, but now the git clone process is hanging. Can I kill this clone process and start it again? Since a lot of data has already been fetched, will the new `git clone` resume with the unfetched data? I don't want to lose my previously fetched data in the process of a new git clone.


How to show progress when loading initrd?

I have a complete root fs built into initrd, so it's almost 500MB. It takes a while to load to memory and during this time, the screen has no indication of the progress. I would like to know if there is a way show progress as initrd loaded to memory? (Such as PXE boot loading kernel will have '.' per 1MB.) I'm using GRUB Legacy, and I can patch the source if needed.


Acer Travelmate: what distro to choose?

No distro will work properly with my Acer TravelMate 5735. I have tried Ubuntu, Lubuntu, Backtrack, Mint, Fedora, Mageia. All of them at least had blank screen error, witch some of them I could temporary fix with nomodeset, some of them not. Mint wouldn't even load the GUI, and in Ubuntu, Wi-Fi was very slow. I understand similar graphics problems appeared only until something was changed. Has anyone had similar problems, what distro would you recommend?


how to add number of days to date's output?

I'd like something like:               $ date --date="05/02/2012" "+2 days"      would give me "4 may" as output.. how ?


CentOS how to update Ant Version to 1.8.x and higher?

I'm using CentOS v6.5 and installed `Ant` by using:               yum install ant      But it came with `Ant version 1.7.1`. And i need the latest `Ant version 1.8.0`.   * How to properly get the latest `Ant version 1.8.x` (or higher) from `YUM` or anyway please?


Change FreeBSD's fetch with aria2 or axel

FreeBSD uses `FETCH` command in order to download source codes or binary packages it needs to compile or install.   If you are on slow connection like café or shared band this process become painful. `FETCH` can't resume in most cases and fails so as the process trying to install or compile something. I want to know if it is possible to use `aria2` or `axel` instead of `fetch`.


How would you use the cpio command?

While studying for the lpic exam, I've run into the command `cpio`. The description of cpio states: > Cpio was originally designed to store backup file archives on a tape device > in a sequential, contiguous manner. Cpio does not compress any content, but > resulting archives are often compressed using gzip or other external > compressors. In looking at examples of how to use cpio, I can't find a single scenario where cpio would better than more common tools like `tar`. What is an example where using `cpio` would be used, (besides tape backups), or is it no longer relevant on todays systems?


How to modify source code of collection of programs of a GNU/Linux OS?

Basically the title says everything, Ubuntu/Fedora (to mention a few ones) is composed for several applications or programs dedicated each one to a specific task, but I've got a few questions:   1. How do I get the source code?   2. If I want to make my own GNU/Linux distro based on Ubuntu (such as Linux Mint), how should I start, which code can I modify at first?   3. Can you give an example of one of these programs (that composed Ubuntu) and its source code? How do I compile it?


SNMPV3 traps are not being captured correctly

I have configured master agent (`snmpd.conf`/`snmptrapd.conf`) of SNMPv5.5 on RHEL6.3 server to support SNMPV3 traps, but when I try to generate a snmptrap and capture the trace through `tcpdump`, I still see the traps are getting generated as V2C trap itself instead of showing up as V3 trap. What could cause this behaviour?


Weird "No such file" error with "xargs" and "file"

I'd like to get the MIME type of all files under the current directory. Why doesn't this work? I've tested bash on OSX or Linux. "file" complains that it can't find the file, but if I run it with the exact same path it works.               $ find . -type f | xargs -n 1 -I FILE echo $(file --mime-type -b FILE)     ERROR: cannot open './foo.txt' (No such file or directory)     ...     $ file --mime-type -b ./foo.txt     text/plain      Of course in the real world I don't just "echo" the response, I need to use the MIME type string in another command. This is the simplest I could make the problem. I guess I'm not understanding something about `xargs` filename substitution?


How do I know if a serial port is actually transmitting data, without opening the device?

I have a high-availability cluster (Heartbeat) connected via serial line and two ethernet NICs. I'd like to set up a monitoring script capable of recognizing disconnected serial line (basically the same question was answered at SO, however I am not satisfied with such a general answer). I cannot simply open the serial device and read the data myself, since the serial line is opened by Heartbeat. So I started to look for some indirect clues. The only difference I have found so far is in the contents of `/proc/tty/driver/serial`. This is how it looks like when it's connected:               # cat /proc/tty/driver/serial     serinfo:1.0 driver revision:     0: uart:16550A port:000003F8 irq:4 tx:2722759 rx:2718165 brk:1 RTS|CTS|DTR|DSR|CD      And when disconnected:               # cat /proc/tty/driver/serial     serinfo:1.0 driver revision:     0: uart:16550A port:000003F8 irq:4 tx:2725233 rx:2720703 brk:1 RTS|DTR      I'm not confident enough to decide that the signals listed at the end of the line have the very meaning of connected/disconnected cable as I have not found any documentation on the contents of the /proc/tty/driver/serial. I can only assume that the presence of the signal means the given signal is on "right now" (or was in recent past? or?). The Serial HOWTO says that additional signals present when the cable is connected (CTS flow control signal, DSR "I'm ready to communicate", CD "Modem connected to another") are all in the "input" direction. So there has to be somebody alive at the other end. Assuming that meaning of signals is as described in the Serial HOWTO, I can base my decision on the presence of, say CD signal. However I am not really sure. So the question is: _is my method "right", or do I have any better options I am not aware of?_ **EDIT:** I did some additional observations and had a talk with my colleague. Turns out the presence or absence of signals at the end of the line is quite good indicator of the serial port activity, on both ends. _However, it's not an indicator of physical presence of a cable._ Whenever there was a program writing to serial port outgoing signals were present (RTS|DTR). When the other side was writing incoming signals were present (CTS|DSR|CD). When none of the sides communicates there are no signals at all (that does not necessarily mean there is no cable present). Don't forget that the exact signals depend on the wiring of the cable (I have "null modem with partial handshaking").


IO utilization for /dev/null redirection?

I always use `nohup` to start my system. However, the output to `nohup` is so big that I'm thinking to redirect it to `/dev/null`. My concern is, will redirecting to `/dev/null` also incur some I/O operations like writing to a normal file? Or, should I go down to the code level and remove all those logging info? (But I might need them). My only concern is the I/O utilization & file size.


`expect`-like behaviour in bash script

I have a script (let's name it `parent.sh`) that calls some other scripts based on input parameters. Finally, it calls the script `child.sh`.   `child.sh` requests user's input in case it find that some files already exists:               "Would you like to replace the configuration file with a new one? (Yes/No/Abort): "      Now, what I want to do it to simulate the keystroke of **"Y"/"y"** inside the `parent.sh` script in order to always overwrite the files. I **cannot** use `expect`. How can I do that?


How do I upgrade OpenSSL?

According to these instructions: http://wiki.apache.org/httpd/NameBasedSSLVHostsWithSNI I need to use OpenSSL 0.9.8k or later (right now it's on 1.0.0c) to use name based virtual hosts in apache. Right now I have version 0.9.8e. I'm running CentOS with a 64 bit version of a Linux 2.6 build. I thought an upgrade like this would be simple but apparently it's not some package that rpm can install. Where should I start?


Best way of updating Openssl on Linux machine

I have a confusion to choose the best way for upgrading the OpenSSL on my Linux machine. **1* _Through the yum Update._ ***               # yum update      I know this will update the entire packages. But If I want to specifically update OpenSSL               Can I use # yum update OpenSSL      **2. Through the commands**               $ openssl version          $ wget http://www.openssl.org/source/openssl-1.0.0i.tar.gz          $ tar xzvf openssl-1.0.0i.tar.gz          $ cd openssl-1.0.0i          $ make clean          $ ./config --prefix=/usr/local --openssldir=/usr/local/openssl          $ make          $ make test          $ make install      Please suggest me the best approach. Thanks.


grep: invalid content of \{\}

Here's the command :               grep '\(2\)[[:digit:]]\{\1\}' numbers      What I want is to match exactly 2 digits after the digit '2', 3 digits if I change the digit '2' to '3' in my expression, 4 digits if ... I'm using back-referencing here but when I execute this command I have the following output :               grep: invalid content of \{\}      How could one change my expression ? **first solution :** _As serge answered :_               2[[:digit:]]\{1\}\|3[[:digit:]]\{2\}\|4[[:digit:]]\{3\}\|5[[:digit:]]\{4\}      That could actually work, but let's suppose I have `\\(34\\)` as the first sub-expression, I wish I could back-referencing that number so I don't have to implement the 34 cases (or more).


Huge page and performance improvemnt

How can using huge page improve performance? I have read that huge pages improve performance by reducing TLB lookups and reducing the size of the page table. Can someone tell me how this helps with performance? Is this like if I have an application that uses 4 pages of virtual memory (4*4kb=16kb) then each page is mapped directly to some physical memory location, but if we use huge pages of 16kb size then instead of mapping 4 pages it just needs to map one, thus reducing page table size, and chances of swapping this out to disk is less and hence longer TLB cache?


Command line printing with a Samba printer requiring authentication

Is there a way to print to a Samba printer requiring authentication by providing the credentials on the command line (e.g., with `lpr`)? I managed to store the credentials in GNOME Keyring and when I am logged with a desktop session I can print with `lpr`. Is there a way to either:   * supply the credentials to `lpr`   * authenticate the jobs in the queue when logging in remotely (SSH)? **Edit** I know that it is possible to store a set of credentials for all the users (directly in CUPS in the printer URI), but we need each user to authenticate with his/her own credentials.


Can anyone help me diagnose this crash output?

I've been using Linux Mint MATE edition for a while and suffering the odd freeze. Today, it switched to a terminal-style output and gave me some actual info before it died. I took a photo, see below (open it in a new tab to zoom in and read the text). ![enter image description here](http://i.stack.imgur.com/A1laZ.jpg) The only "lead" i can see is a line that says               BUG: scheduling while atomic: swapper/0/0/0x10010000      but, for all i know i'm only seeing the bottom of the stack trace here and the actual problem is much further up. Questions: a) can anyone see if there's anything in the photo that gives a clue as to what's going wrong? b) is the stuff in this trace liable to be in a log file somewhere so i can have a proper look at it?


Is there any disadvantage in using SSHFS instead of SSH alone?

I find it easier to use SSHFS to mount a remote file system on my local computer instead of plainly SSH'ing into the remote computer. This saves me from using all the complicated `scp` commmands for copy/paste. But on the internet, I find very few people talking about SSHFS. If SSHFS is more easier, then why isn't it more popular? Are there any disadvantages to it?


Configuring OpenSuSE's xinetd

I need to run approx, a package proxy for Debian / Ubuntu packages, on an OpenSuSE box. Until now, I converted the installation package from `.deb` to `.rpm` using `alien`. Installing the resulting `.rpm` gave me the `approx` binary in `/usr/sbin/approx`. Under Debian, `approx` is started using `inetd`. OpenSuSE seems to prefer `xinetd`. So, in YaST2's xinetd setup, I created a new entry using   * service name: "approx" (I also tried "9999", since I assume this is where the mapping from service names to port numbers takes place -- this name should match the port description in /etc/services, right?)   * type: `stream`   * protocol: `tcp`   * `nowait` option   * user: `root` and    * service: `/usr/sbin/approx`.  However, no matter what status I assign the entry, the xinetd configuration jumps to "deactivated" as soon as I click "OK", and I can't get any reaction from the system when contacting it on port 9999. So, at first, is my use of the xinetd configuration correct or do I understand something wrong there? Second, is the automatic deactivation of the xinetd config panel in YaST2 a software or user error?


Image viewer for multiple images

Is there any image viewer (like eog) for linux which can do the following: Show 2 (3 or 4) images of a directory with maximal possible sizes on one page at the same time. When I click "next", it should show me the next 2 (3 or 4) images of that directory and so on.


Why doesn't uname -a return a useful identifier

I typed the command `uname -a` into my college's server and got this:               2.6.18-274.3.1.el5 #1 SMP Tue Sep 6 20:14:03 EDT 2011 i686 i686 i386 GNU/Linux      Are they trying to hide the version of Linux that the server is running on? Or is the kernel that its showing mean that they aren't? Because when I type `uname -a` on my Linux box it shows I'm running Ubuntu. I'm just trying to figure if that's something they would want to keep secret for security reasons.


Port Mirroring using iptables - copy all traffic among nginx on :80 and apache on :8080

I have nginx running on port 80 and apache running on port 8080 I want to transfer all the traffic to both nginx and apache asynchronously i.e the performance of one server wont be dependent on the others. The reason being nginx will serve my website and apache will be used to run analytics on the traffic. I tried the solution mentioned in the question below iptables port-mirroring               sudo iptables -A PREROUTING -t mangle -p tcp ! -s 127.0.0.1/32 --dport 80 -j TEE --gateway 127.0.0.1      and               sudo iptables -A POSTROUTING -t nat -p tcp -s 127.0.0.1/32 --dport 8080 -j SNAT --to 127.0.0.1:8080      The solution mentions using DNAT with POSTROUTING on NAT table but it is not allowed to do that. DNAT is only allowed on PREROUTING/OUTPUT. I am using iptables v1.4.10 on ubuntu 11.04


Grep huge number of patterns from huge file

I have a file that's growing about 200,000 lines a day, and it is all formed with blocks of three lines as such:               1358726575123       # key         Joseph Brunner  # name         carpenter       # job     9973834728345         Andres Smith         student     7836472098652         Mariah Anthony         dentist      Now, I have another file from which I extract about 10,000 key patterns, such as `1358726575123`. Then I run a `for` loop with these patterns and have to check them against the first file. If the file doesn't contain such pattern, I save the pattern in a third file for further processing:               for number in $(grep -o '[0-9]\{12\}' file2); do  # finds about 10.000 keys          if ! grep -q ^$number$ file1; then           # file1 is a huge file              printf "$number\n" >>file3               # we'll process file3 later          fi     done      The example code greps a huge file 10,000 times, and I run this loop about **once a minute, during the whole day**. Since the huge file keeps growing, what can I do to make all this faster and save some CPU? I wonder whether sorting the file somehow by its key (if so, how?) or using a db instead of plain text would help...


How do I find installed packages that have no install candidate?

I'd like to retrieve a list of installed packages that have no install candidate (e.g., because I removed an apt source file entry). How would I do that on Debian-based systems?


filesystem for archiving

I have some complex read-only data in my file system. It contains thousands of snapshots of certain revisions of a svn repository, and the output of regression tests. Identical files between snapshots are already de-duplicated using hard links. This way, the storage capacity doesn't need to be large, but it still consumes a lot of inodes, and this makes fsck painfully long for my main file system. I'd like to move these data to another file system, so that it doesn't affect the main file system too much. Do you have suggestions? Squashfs seems to be a possible choice, but I'll have to check if it can handle hard links efficiently.


Fatal: Module ndiswrapper not found

Getting the following error message: > Fatal: Module ndiswrapper not found Problem is I did install the `ndiswrapper` module. I even uninstalled and re- installed it. Still nothing. Any reason? On Linux Mint 14 My network controller is a Realtek Semiconductor Co., Ltd. RTL8188CE and something about (rev 01) It is using module rtl8192ce. Not sure if it should be using _common or not.


add directory to shell profile

> **Possible Duplicate:**   >  How can I make a program executable from everywhere So, I'm new to Linux/Unix and am working in a corporate version of Red Hat at my company. Obviously I don't have full control over my computer (not sure if that matters). I have a bunch of executables located in some folder. I want to be able to run these programs from any other directory. How can I make this happen? Some sort of bash profile file maybe? If so, where would that be located?


Non-blocking buffered named pipe?

I'm looking for something I suspect doesn't exist: A non-blocking buffered named pipe (fifo) for use from the command line. Is there such a thing? Here's the use case: Suppose I have a process that's going to run a long time in the background and spew a lot of output to `stdout`. I don't really care about the output and don't want to store it (perhaps I don't have enough room to), but I'd like to "drop in" periodically and follow what it's doing, then drop out again and leave it to do its work. So I'd like to redirect its output to this theoretical buffered, non-blocking named pipe and then periodically tap into it. So basically I want to start like this (`10M` being the size of the buffer):               mkmagicfifo magicfifo 10M     spewingprocess > magicfifo &      ...and periodically drop in to see what's going on...               tail -f magicfifo      ... _without_ `magicfifo` storing all the output (so, not a normal file), and _without_ it blocking the spewing process when it fills up and isn't tapped (so, not quite a normal named pipe). I don't think solutions involving `tail` or `prune` will do it (well, I can think of a workaround involving `tail`), because `tail` would still require that I store all the data somewhere (if I want to drop in and drop out of looking at it), and `prune` has to rewrite the file, presumably (I'll admit I haven't tried/proven this) breaking the redirection of the process generating all the output. I expect I could write some utility to do this, but *nix has _so many_ cool aspects of files and pipes and such, I just can't help but think this exists and I just don't know about it. So: Is there such a thing, and if so what is it?


VIM: Create a function to generate several lines of buffer

I have about ninety configuration files that I need to add an almost identical block of additional code to, with only two instances of a single word differing each time. I would very much like to repeat as little effort as possible. Is it possible, in VIM, to write a function that generates a block of text depending on an argument and either feeds it into the buffer or pastes it after the current cursor position? And if so, what documentation should I be looking into?


Is there a way to redirect a file that is written

I have an application which I can not change, that writes to a big 250 GB plain text file. After compressing with GZ it is only 30 GB. This application has no option of compressing it's output, and it can only write to a file name (not to stdout). Is there a way that I can set up for the output to be compressed immediately, without first storing the 250 GB file on my disk? I also need the other way around, to fool the application so that it reads a plaintext file which in reality is compressed.


All but MPlayer and VLC unable to play MP4 video?

I have a specific MP4 video file that plays fine in MPlayer and VLC, but other programs on my Arch Linux box (Banshee, Gnome's Movie Player) are unable to play it. Most seem to treat it as having zero length. It also causes Gnome's Properties dialog to just display a dialog saying "Creating Properties Window" and never load. What is it about this file that causes it to do this?


messed up bottom panel - Fedora 14 KDE

I just started using Fedora 14 KDE (installed it yesterday). I'm coming from Windows, and the bottom "panel" was very convenient in its similarity to the Windows taskbar. Unfortunately, I clicked an option, and now I removed the portion of the bar which has my currently open programs. I managed to get it back on the top of the screen, but I want it back at the bottom. Basically, all the small icons in the right are now over by the application launcher icon on the left. I have played around with adding widgets, but I couldn't figure anything out. I just want the way it was by default after installation. How do I get it back? Thank you!


vi - how to join differents specific lines

I'm looking for a solution about a "paste" problem on vi/vim . How to join specific lines in a text file? I have a file like this:               15/10/2011 Revolution day     16/10/2011 About Rome      - differents newspapers       blogs an feeds      :) hp     17/10/2011 Yep, another day      and I want to paste everyline that does not start with a number. I've tried something like this... but does not work :-/               :[!^[0-9]]!paste -d ' ' -s      Can somebody help me? thanks gb


Concatenate specific files into one single file

In a folder containing X files, I need to concatenate Y files (where X > Y) together into a single text file. I have the filenames (of Y files) that I need to concatenate. Can anyone please help me out on how to concatenate these files?


Fresh install of Fedora 20 on a VM, seamless mode seems to be broken

Previously when I installed Fedora, maybe 16 or so, in my VM and did seamless mode on my windows 7 box, I got the gnome 3 bar to show up at the top of my windows machine (so I could use it from windows). After a fresh reinstall I can't seem to replicate this behavior. I have installed the Virtualbox Guest Additions in my VM and enabled 3D acceleration, as well as giving it more video memory (64mb). Also, bonus points if someone can tell me why I now have a blue border (aka, the default fedora desktop background - I haven't changed it) around my seamless windows: ![enter image description here](http://i.stack.imgur.com/ddLON.jpg)


resolv.conf + PXE server + kickstart files

I use PXE server in order to download kickstart and to install Linux. After installation I saw that `/etc/resolv.conf` was created with the IP of the PXE server. Why there is PXE server IP address in `resolv.conf`?


sort every field numerically, varying field counts

I'm trying to sort some data using `sort`. I noticed it was sorting by digit rather than number, so I added the `-n` flag. It then seemingly only numerically sorts on the first field though. Breaking it down by field is a problem as the lines have varying numbers of fields (and, frankly, I cannot understand its behaviour). Here's some close-enough sample data I was playing with: `echo -e "b b 1\n23 44\nb 3\na 7\nb b 2\na 1\nb a 10\nb b 10\nb 1\nb a 1\n18 2\nb 10\n18 15\nb a 2\n23 9\nb 2" | sort -n`               Input     Want      Expect?   sort      -n        -n -k1,1 -k2,2 -k3,3 -k4,4…          b b 1     8 2       a 1       23 44     a 1       b a 1     23 44     8 15      a 7       23 9      a 7       b a 10     b 3       23 9      b a 1     8 15      b 1       b a 2     a 7       23 44     b a 2     8 2       b 10      b b 1     b b 2     a 1       b a 10    a 1       b 2       b b 10     a 1       a 7       b b 1     a 7       b 3       b b 2     b a 10    b 1       b b 2     b 1       b a 1     a 1     b b 10    b 2       b b 10    b 10      b a 10    b 1     b 1       b 3       b 1       b 2       b a 2     b 2     b a 1     b 10      b 2       b 3       b b 1     b 3     8 2       b a 1     b 3       b a 1     b b 10    a 7     b 10      b a 2     b 10      b a 10    b b 2     b 10     8 15      b a 10    8 2       b a 2     8 15      8 2     b a 2     b b 1     8 15      b b 1     8 2       8 15     23 9      b b 2     23 9      b b 10    23 44     23 9     b 2       b b 10    23 44     b b 2     23 9      23 44      Ideally, I'd like to get it working on that very machine, which has GNU coreutils sort 5.93. I'd like to handle it with simple unix tools; I don't want to just hand the problem to perl, etc. I'm hoping for an equivalent of the [imaginary] `sort --numeric-sort --all-fields --actually-work`


Can the nouveau Xorg driver be used for a multihead workstation?

I'm trying a manual setup of Xorg 1.9.5, for two identical monitors connected to the VGA and DVI ports of an nVidia GeForce 6600. I get the X Server to run using a single screen, and it appears identical on both monitors. Started with `Xorg -configure`, and have tried to use two screens with the same device, but only one is recognized. It automatically recognized the "modesetting" driver, through the nouveau module in the kernel. I had this working OK with Xorg 1.7.7 and similar hardware, using the nv driver and the "DualHead" and "DynamicTwinView" Device options. I don't find these options documented for nouveau and wonder if it is still possible to use it, as it loads by default into the kernel on my newer system (Slackware 13.37.0). If the kernel driver needs to be removed, I have the nv and nouveau X drivers available. Any recomendations on which to use for DualHead would be appreciated.


Full DD copy from hdd to hdd

**UPDATE: 2** This seems a lot better than before (Thanks to Groxxda for the suggestions): sudo dd if=/dev/sdb bs=128K | pv -s 3000G | sudo dd of=/dev/sdc bs=128K ETA is about 9 hours for 3TB, whereas before it reached 430GB after 6 hours, so I am guessing it would have taken about 36 hours using the command below... * * * **UPDATE: 1** I can now see the progress, and it's been 6+ hours for copy 430GB. The HDD is 3TB... Is there no faster way of doing this? * * * **ORIGINAL QUESTION:** If I have 2 identical hard drives with the following characteristics:   * SATA 6.0 Gb/s   * 5400 rpm   * 3TB How long should a full dd copy take to complete? So far it's been running for 5 hours and still going... I am using Linux Ubuntu 12.04 64bit and the command I am using is:               dd if=/dev/sdb of=/dev/sdc


What is the difference in "yum search" and "yum search all"?


Why 32 bit OS has less requirement when compared to 64 bit

In my Organization for routing we are using 32 bit os rather than using 64 bit os on a host with 3GB RAM. Since 64 bit faster than 32 bit why do sometimes people use 32 bit OS rather than 64 bit. Does 32 bit OS require less resource than 64 bit. Also on 64 bit OS,is the size of page table entry 64 bit?


Installing openssh-server after Rescue Disk boot

I tried to help a friend with hard drive boot problems. I first asked her to make a rescue disk (Ubuntu 12.04.3), and boot from it. Then I asked her to open a console (`Alt`+`F1`) and use `sudo` to become root. All OK. Then I told her to install `openssh-server` - so I can remotely login and look at the system - but that does not work: openssh-client (and some other applications) are reported as "not going to be installed". But openssh-client is already installed: checking with `dpkg -l openssh- client` shows this to be the case. Why doesn't this work?


OpenSSL Package Rebuild CentOS 6.4

**Rebuilding openssl with Elliptic Curves on CentOS 6.4** The strategy is:               1) Download the "official" CentOS source package (.src.rpm)     2) Modify the .spec file to enable elliptic curves. (change no-EC to enable-EC)     3) Rebuild the package using mock.       The build is performed on a fresh Amazon Cloud server which allows anyone to precisely duplicate every step that is taken below.               # 1. Log into AWS (Amazon Web Services) and create a public key.      # 2. Download your public key and install into your local client e.g. putty or ssh.     # 3. Instantiate a CentOS 6.4 machine using AWS marketplace for machine images. (free)     # 4. Log into your new Centos 6.4 using ssh or putty, update and install a few packages:      Update the newly installed Centos and install development tools               yum -y update  # Update all packages on a new machine     yum -y groupinstall 'Development tools'      Install mock, a super package builder, from the Fedora EPEL repository. Mock is the secret weapon of CentOS (and many other distros) package builders.               yum -y localinstall --nogpgcheck http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm # Install EPEL (EL6 extra packages) repository      yum -y install fedora-packager  # Install mock from EPEL repository      Make a new user "abcd" added to group "mock". User abcd will be used for package rebuilding. Note: group "mock" was automatically created by yum when we installed fedora-packager.               userdel -rf abcd ; useradd -G mock abcd ; su abcd      Fetch the latest CentOS openssl source package and "unpack" it with mock               cd ~ ; curl -O http://vault.centos.org/6.4/os/Source/SPackages/openssl-1.0.0-27.el6.src.rpm     /usr/bin/mock --rebuild ~/openssl-1.0.0-27.el6.src.rpm      We see output lines like this               # INFO: mock.py version 1.1.32 starting...     # Start: build setup for openssl-1.0.0-27.el6.src.rpm     # Start: rpmbuild -bb openssl-1.0.0-27.el6.src.rpm     # Start: Outputting list of installed packages      Finally, after a long time, we see               # INFO: Results and/or logs in: /var/lib/mock/epel-6-x86_64/result      Move the mock build results to a safe place               rm -rf /home/abcd/build ; mv /var/lib/mock/epel-6-x86_64/root/builddir/build/ /home/abcd ; # Move to a safe place      Download a replacement source file (.tar.gz) and a patch file from openssl.org               cd /home/abcd/build/SOURCES     curl -O http://www.openssl.org/source/openssl-1.0.0.tar.gz # Download corresponding source tarball from openssl     curl -o patch300.patch http://cvs.openssl.org/patchset?cn=19998 # Download this patch to fix a test error      Edit the openssl.spec file to               # 1. Enable elliptic curves (enable-EC)     # 2. Disable the hobble-openssl script (which erases EC files)     # 3. Update the release mumber to .EC.1     # 4. Include the newly downloaded .tar.bz as source     # 5. Include the newly downloaded patch file          cd ../SPECS     sed -i -e "s/no-ec/enable-ec/; s/no-ecdh/enable-ecdh/; s/no-ecdsa/enable-ecdsa/" openssl.spec # Enable EC     sed -i -e "s/^Source1: hobble-openssl/#&/; s/^%.SOURCE1. /#&/" openssl.spec # Disable the "hobble" script     sed -i -e "s/^Release.*dist\}/&.EC.1/" openssl.spec # Also change release number by adding .EC.1     sed -i -e "s/-usa.tar.bz2/.tar.gz/" openssl.spec # Change the source tarball     sed -i -e "s/^Patch78.*/&\nPatch300: patch300.patch\n/" openssl.spec # Add the new patch     sed -i -e "s/^%patch78.*/&\n%patch300 -p1 \n/" openssl.spec # Add the new patch again      Ceate a new source package using the edited ("enable-EC") openssl.spec               /usr/bin/mock --buildsrpm --spec  ~/build/SPECS/openssl.spec --sources  ~/build/SOURCES # Do a source rebuild      Use the new source package to create a new openssl package               cp /var/lib/mock/epel-6-x86_64/root/builddir/build/SRPMS/openssl-1.0.0-27.el6.EC.1.src.rpm /home/abcd     cd ~ ; /usr/bin/mock --rebuild openssl-1.0.0-27.el6.EC.1.src.rpm      Summarized here http://pastebin.centos.org/3070 Thanks to **pj** on Freenode for all the help.


How to back up VPS

"It is highly recommended in the event a system is compromised that a backup of the VPS be taken and an operating system be performed." I have no idea what they meant by second part either. How is this done on linux Centos 6.5 i686 i686 i386 GNU/Linux in terminal please?


Why ssh -nq -t can't see my environment variable?

I am executing a command on remote machine with -t flag ( to prevent the command from 'blocking' ) the prompt (somehow it works that way). So I am using `ssh -nq -t root@ip` but with this, the script cannot find my environment variable that I use. Why is this happening and how can I avoid this ?


Scrot command - how to save only thumbnail

I'm using `scrot` to take screenshots from terminal. However when I want to generate thumbnailed version using parameter `-t`, I got two files: `screenshot.png` and `screenshot-thumbnail.png`. How can I get only thumbnailed version - `screenshot-thumbnail.png` because I have no need for `screenshot.png`.


Process owned by root can't write files

I'm running a program (syslog-ng) that must read and write several files in a given path. It was failing at start, claiming that it is unable to open a file in that path. Please, assume this directory structure:               /var/platform/program      The `platform` directory has the permission set to 0655 (not execute permission to the owner user). If I change that permissions to 0755, syslog-ng works fine. On the other hand, I have written a small program in C that try to open and write into a file in the same directory, and it works without problem when running as root, but syslog-ng is failing... What can be the problem in this case?


Have ssh resolve hostnames from config when using ProxyCommand and netcat mode

I'm attempting to set up some universal options for bouncing ssh connections. Here is my `~/.ssh/config` file, abbreviated:               Host *%via       ProxyCommand ssh gateway -W $(echo %h | cut -d%% -f1) %p          Host gateway       HostName gateway.example.com       User username       ForwardAgent yes       IdentityFile keypathg          Host target       User username       HostName target.example.com       IdentityFile keypatht      When I utilise `*%via` utilising the `Host` aliases, I get:               % ssh -vvv target%via     OpenSSH_5.9p1, OpenSSL 0.9.8y 5 Feb 2013     debug1: Reading configuration data /Users/myuser/.ssh/config     debug1: /Users/myuser/.ssh/config line 5: Applying options for *     debug1: /Users/myuser/.ssh/config line 12: Applying options for *%via     debug1: Reading configuration data /etc/ssh_config     debug1: /etc/ssh_config line 20: Applying options for *     debug1: auto-mux: Trying existing master     debug1: Control socket "/Users/myuser/.ssh/tmp/target%via_22_myuser" does not exist     debug2: ssh_connect: needpriv 0     debug1: Executing proxy command: exec ssh -A gateway -W $(echo target%via | cut -d% -f1):22     debug1: permanently_drop_suid: 501     debug1: identity file /Users/myuser/.ssh/id_rsa type -1     debug1: identity file /Users/myuser/.ssh/id_rsa-cert type -1     debug1: identity file /Users/myuser/.ssh/id_dsa type -1     debug1: identity file /Users/myuser/.ssh/id_dsa-cert type -1     ssh_exchange_identification: Connection closed by remote host      However, if I utilise               % ssh target.example.com%via      I hit the target server, but as the wrong user and with no pubkey authentication. I _think_ my question, at this point, is does this method of bouncing, when utilising `ForwardAgent`, pass through my ssh config/environment whole, or just keys. If just keys, can the former be utilised in some way? My ssh version is 5.9v1, gateway is 5.9v1, and target is 5.3p1. I believe `-W` was introduced in 5.4, but that should not matter for the final box in line? utilising the older school `nc` seems no different. I have verified that I can manually ssh to each box in the line. Doing so indicates that hostname alias information is not passed, as when on gateway, I cannot `ssh target` but I can `ssh target.example.com`. This works with pubkey auth. gateway and target incidentally have the same username, which is why this works if no config is pushed. If `ForwardAgent` or similar config can't push this information, whats the sanest way to get around it, keeping a .ssh/config on gateway with this information?


wlan number assignment

How or where does Linux determine the assignment of a network device? Specifically, `wlan0` or `wlan1` for wireless USB devices. I plugged in a TP USB wireless a while ago, and it was assigned `wlan0`. I removed it. This week I plugged in an Edimax USB wireless device and it comes up as `wlan1`. I removed it today to try a second Edimax USB wireless device (I bought two) and now it comes up `wlan2`. I know enough of Unix/Linux to know this is being configured somewhere, and if I delete the unused config file I can make the latest Edimax become `wlan0`. But how/where?


Will I have to dist-upgrade from wheezy to Jessie?

I am running Debian testing (my sources.list is `deb http://ftp.us.debian.org/debian testing main` ). When Wheezy comes out (testing becomes stable), will `testing` automatically point to the new Jessie distro (so to update all I need to do is aptitude update && aptitude upgrade) or will I still need to dist-upgrade?


Making a recovery partition in embedded Linux

I have an Atmel SAM9X system running Angstrom. I am trying to make a recovery partition so when a user holds a button during boot up the recovery partition boots up. I have modified the bootstrap so when a button is held on boot up, an alternate linux kernel is loaded. What I want is the alternate kernel to load linux from the recovery boot partition not the normal main partition. Is this even possible? Or can I load the recovery partition without using two kernels? The reason I want this is so if the main bootable partition gets corrupted the recovery partition will copy itself to the main partition (similar to those Dell or HP windows machines with the recovery partition) and the main bootable partition will be restored. **Edit** :   Giles suggestion did it. The bootstrap was setting the kernel command line argument, I just added `root=/dev/mmcblk0p3` (boot from 3rd sd partition) to that and it booted from the desired partition!


Bad wifi with MacBook Air mid 2012

I have a MacBook Air mid 2012 with i7 CPU. The one with Ivy Bridge. I have connectivity problems with wifi running Arch Linux which I keep updated regularily. Throughput and response time performance decrease a lot when I move away from the AP (tried several networks with similar results). Strangely I don't experience the same issues with OS X. I have tried switching between Mountain Lion and Arch Linux while staying in the exact same position. OS X performs perfectly while Linux can't even ping the router. Are there any settings that I am missing? Should I use some particular driver? I have tried to read up on and fiddle with iwconfig. Any suggestions are welcome, I'm quite new at this level of Linux configuration. lspci gives me               02:00.0 Network controller: Broadcom Corporation BCM43224 802.11a/b/g/n (rev 01)      Trying to change power with iwconfig gives me:               -> % sudo iwconfig wlan0 power off     Error for wireless request "Set Power Management" (8B2C) :     SET failed on device wlan0 ; Operation not supported.      _**Addition:_** I installed the broadcom-wl driver. The connection seams to be a little bit more stable. But there is still a long way to go compared to OS X. lspci now reports               02:00.0 Network controller: Broadcom Corporation BCM43224 802.11a/b/g/n (rev 01)     Subsystem: Apple Inc. Device 00e9     Kernel driver in use: wl


GeeXbox ls shows no date?

Recently, I tried connecting to my GeeXbox via WinSCP but got an error indicating the output of `ls` could not be parsed. Apparently, my `ls` does not include a time stamp! What might be the cause and how can I correct that? See a sample output below:               $ ls -la     total 96     drwxrwxr-x   17 root     root          4096 .     drwxrwxr-x   17 root     root          4096 ..     lrwxrwxrwx    1 root     root             7 bin -> usr/bin     -rw-rw-r--    1 root     root         39779 config     drwxr-xr-x   13 root     root          3980 dev     drwxrwxr-x   29 root     root          4096 etc      My particular `ls --help` offers this:               $ ls --help     BusyBox v1.23.0.git (2014-05-19 13:33:13 IDT) multi-call binary.          Usage: ls [-1AaCxdlinshrSXv] [-w WIDTH] [FILE]...          List directory contents              -1      One column output         -a      Include entries which start with .         -A      Like -a, but exclude . and ..         -C      List by columns         -x      List by lines         -d      List directory entries instead of contents         -l      Long listing format         -i      List inode numbers         -n      List numeric UIDs and GIDs instead of names         -s      List allocated blocks         -h      List sizes in human readable format (1K 243M 2G)         -r      Sort in reverse order         -S      Sort by size         -X      Sort by extension         -v      Sort by version         -w N    Assume the terminal is N columns wide         --color[={always,never,auto}]   Control coloring


How to start a process chain from the shell

Is it possible and if so how do I:   1. Start a `/bin/bash` process that is not bound to a terminal from a terminal? Hence, a shell process that shows up in the process tree as `init -- bash`. (Shells usually have the process tree structure `terminal-emulator-of-your-choosing -- bash`)   2. Start a `/bin/bash` process not bound to a terminal that has as its child another process e.g. a browser like `firefox` from a shell session in a terminal? Hence, a shell process with a child that shows up in the process tree as `init -- bash -- firefox`.   3. It is easy to get `init -- firefox` directly from the shell via something along the lines of `exec firefox & exit` or `/bin/bash -c firefox & exit`. (This question is part of a series of related questions that first enabled me to formulate these questions precisely (cf. How to "correctly" start an application from a shell and How to start a process from the shell and make it the child of another process). The three questions have been formulated and discussed partially in the comments of the two former questions but as I see it not been answered. Furthermore, they do seem more appropriate as short question in their own right not suited for discussion in comments.)


VirtualBox: modprobe can't find vboxguest, vboxsf, vboxvideo

I've been following these instrctions to install the guest packages for arch linux. Unfortunatelly `modprobe` returns:               [snooc@archfire ~]$ modprobe -a vboxguest vboxsf vboxvideo     modprobe: WARNING: Module vboxguest not found.     modprobe: WARNING: Module vboxsf not found.     modprobe: WARNING: Module vboxvideo not found.      `pacman -Ss virtualbox` is showing:               [snooc@archfire ~]$ pacman -Ss virtualbox     ...     community/virtualbox-guest-modules 4.3.12-1 [installed]         Guest kernel modules for VirtualBox     ...     community/virtualbox-guest-utils 4.3.12-1 [installed]         VirtualBox Guest userspace utilities     ...      How can I fix this? I have no idea where to begin. _Arch Linux is guest on VirtualBox which runs under Win7._


Letters from mail server comes as raw html (Outlook 2013)

I have two servers with **sendmail** (php, zf2) and I send mail (from both) to my outlook mail.   Message body in html format. From the first email server it comes normally.   But from second server letters shows as **raw html**. Only difference in these letters is: First letter:               Content-Type: text/html     Content-Transfer-Encoding: 8bit      Second:               Content-Type: =?utf-8?Q?text/html?=     Content-Transfer-Encoding: =?utf-8?Q?8bit?=      Q: This is the problem?


How to trigger mount/umount before/after hibernation? I use s2disk. **Note:** Debian


Any guides for dummies to setting up a VPN?

I am looking for a guide to setting up a VPN on a VPS, most of the guides don't explain certain elements and I've been left feeling clueless halfway through them. For example when I was installing openVPN the guide was talking about easy-rsa being in a folder in /usr/share/easyVPN but it simply was not present, so I had to manually get it and after everything I just didn't understand where I was supposed to get the IP's for the bridges etc, it was overall, very confusing. The guide needs to make no use of a GUI, as the VPN is manipulated solely over secure shell, the OS is CentOS 6 as well, as I can't seem to find one for CentOS 6 either. Any help is greatly appreciated, thanks.


create a debian installer with custom kernel

First what I need to do is install a debian on a 3300mx computer which is based on a vortex cpu. The problem is the debian installer always crash because the required drivers are in the kernel as modules only. So I tried to create a custom kernel with the required drivers as native instead of modules. After a few attemps I managed to get 3 files: >   * linux-headers-3.0.0_0.2_i386.deb >   * linux-image-3.0.0_0.2_i386.deb >   * linux-libc-dev_0.2_i386.deb > I'm not even sure that I compiled these files the right way. I tried to follow some tutorials that asked me to compile my kernel with the command line : > $>fakeroot make-kpkg --append-to-version "-custom" --revision "0.1" --us > --uc --initrd kernel_image kernel_headers The problem is that when I do that, I've got the following output: >   * /usr/bin/make EXTRAVERSION=-boxls ARCH=i386 -C Documentation/lguest >   * make: _*_ Documentation/lguest: No such file or directory. Stop. >   * make: _*_ [debian/stamp/build/kernel] Error 2 > To get the 3 .deb files I had to use a simpler command line without all the params like --append-to-version so I'm not sure they are good. Once I'll be sure my .deb files are ok I need to create a custom tftp debian installer to try it on the computers. I'm lost because I can't find out what to do with my .deb files as all the tutorials ends with a simple installation on the current system instead of the creation of a custom debian installer... Can you help me please? Thanks a lot for your help!


How to filter wvdial/pppd terminal output

I use wvdial to connect to the net with with my USB modem. It works correctly, and I am quite happy with it. When I start it in XFCE I have it set to output to a borderless, transparent terminal so the status displays on my desktop, life is good. Everything is great, I just want to tweak it. I'm hoping to filter the output with a 'grep -v' to remove unsightly non- information. Here is the output from a sample run. The output is consistantly the same, except for IP addresses..               --> WvDial: Internet dialer version 1.60     --> Cannot get information for serial port.     --> Initializing modem.     --> Sending: ATZ     ATZ     OK     --> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0     ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0     OK     --> Modem initialized.     --> Sending: ATDT#777     --> Waiting for carrier.     ATDT#777     CONNECT     --> Carrier detected.  Waiting for prompt.     ~[7f]}#@!}!}!} }9}"}&} } } } }#}%B#}%}%}&3za[02]}'}"}(}"J};~     --> PPP negotiation detected.     --> Starting pppd at Mon Nov 14 11:00:06 2011     --> Warning: Could not modify /etc/ppp/pap-secrets: Permission denied     --> --> PAP (Password Authentication Protocol) may be flaky.     --> Warning: Could not modify /etc/ppp/chap-secrets: Permission denied     --> --> CHAP (Challenge Handshake) may be flaky.     --> Pid of pppd: 17776     --> Using interface ppp0     --> pppd: >[7f]     --> pppd: >[7f]     --> pppd: >[7f]     --> pppd: >[7f]     --> local  IP address 10.81.25.50     --> pppd: >[7f]     --> remote IP address 10.133.28.10     --> pppd: >[7f]     --> primary   DNS address 10.133.20.11     --> pppd: >[7f]     --> secondary DNS address 10.132.20.11     --> pppd: >[7f]     ^CCaught signal 2:  Attempting to exit gracefully...     --> Terminating on signal 15     --> pppd: >[7f]     --> Connect time 0.2 minutes.     --> pppd: >[7f]     --> pppd: >[7f]     --> Disconnecting at Mon Nov 14 11:00:16 2011      Can someone please help me with a command line or script that would filter that output and remove the `\--> pppd: >[7f]` lines, and possibly the pap/chap warnings(they're bogus). I've tried several things, with pipes and redirection to grep but haven't hit on anything that seems to effect the output. As a note: in the pppd:/[7f] lines it appears the second '>' character could be just about anything(still don't know what pppd is trying to tell me. :) Thanks! EDIT: I got it. Simple stuff really, if you're not a knob. I'm a knob.. wvdial 2>&1 | grep -v -i -E "7f]|pap|chap" the output is on stderr and pipes are for stdout. the 2>&1 redirects so it will pipe properly. If you've read this far, thanks.


How to convert .doc to ODF with a command line?

I'd like to convert many Microsoft Word documents to ODF (the OO.org formata with a command line (because there are many of them). (I need them for reading afterwards on a device where reading OO.org format is possible, but not the .doc format -- actually, an Android with only free software, such as OpenDocument Reader, primarily from F-Droid packages repository.) What can I use as the commmand for such a conversion?


Controlling users' default printer as an administrator

What are the necessary steps to change the default printer for individual users on a reasonably recent Linux system using CUPS? (i.e. not the system- wide default) The CUPS `lpr` manpage indicates that setting the `PRINTER` environment variable is looked to first by the printing system. But does this also affect the default printer for GNOME & KDE applications? Does this also override whatever the user has changed by going to, for instance, the 'Printing' setup application in Ubuntu? Or the equivalent in RHED? How can I cover all my bases?


What's the difference between config fonts in /etc/fonts/conf.d and gnome-tweak-tool?

I can change the hinting and sub-pixel settings from `/etc/fonts/conf.d` or `gnome-tweak-tool`. What's the difference of those two methods? It seems to me that `google-chrome` and `gnome-terminal` changes more obviously from /etc/fonts/.


external variable in awk

> **Possible Duplicate:**   >  Use a script parameter in awk I have a script, in which a script snippet is               x=3     awk '$2=$x{print $1}' infile      the external variable is x, but it prompts an error in awk so in this situation,how to make awk run successfully? thanks!


Why is this variable not getting passed to awk?

> **Possible Duplicate:**   >  external variable in awk How do I pass this variable below? This doesn't work:               fname=testfile.txt     lsof | awk '/deleted/&&/$fname/ {print $4}'  *----no output*      While this works:               lsof | awk '/deleted/&&/testfile.txt/ {print $4}'     3r


Stress testing SD cards using linux

I got into a little debate with someone yesterday regarding the logic and/or veracity of my answer here, vis., that logging and maintaining fs meta-data on a decent (GB+) sized SD card could never be significant enough to wear the card out in a reasonable amount of time (years and years). The jist of the counter-argument seemed to be that I must be wrong since there are so many stories online of people wearing out SD cards. Since I do have devices with SD cards in them containing rw root filesystems that are left on 24/7, I had tested the premise before to my own satisfaction. I've tweaked this test a bit, repeated it (using the same card, in fact) and am presenting it here. The two central questions I have are:   1. Is the method I used to attempt to wreck the card viable, keeping in mind it's intended to reproduce the effects of continuously re-writing _small_ amounts of data?   2. Is the method I used to verify the card was still okay viable?  I'm putting the question here rather than S.O. or SuperUser because an objection to the first part would probably have to assert that my test didn't really write to the card the way I'm sure it does, and asserting that would require some special knowledge of linux. _[It could also be that SD cards use some kind of smart buffering or cache, such that repeated writes to the same place would be buffered/cached somewhere less prone to wear. I haven't found any indication of this anywhere, but I amasking about that on S.U.]_ The idea behind the test is to write to the same small block on the card millions of times. This is well beyond any claim of how many write cycles such devices can sustain, but presuming wear leveling is effective, if the card is of a decent size, millions of such writes still shouldn't matter much, as "the same block" would not literally be the same physical block. To do this, I needed to make sure every write was truly flushed to the hardware, and to the same _apparent_ place. For flushing to hardware, I relied on the POSIX library call `fdatasync()`:               #include <stdio.h>     #include <string.h>     #include <fcntl.h>     #include <errno.h>     #include <unistd.h>     #include <stdlib.h>          // Compile std=gnu99          #define BLOCK 1 << 16          int main (void) {         int in = open ("/dev/urandom", O_RDONLY);         if (in < 0) {             fprintf(stderr,"open in %s", strerror(errno));             exit(0);         }              int out = open("/dev/sdb1", O_WRONLY);         if (out < 0) {             fprintf(stderr,"open out %s", strerror(errno));             exit(0);         }              fprintf(stderr,"BEGIN\n");              char buffer[BLOCK];         unsigned int count = 0;         int thousands = 0;         for (unsigned int i = 1; i !=0; i++) {             ssize_t r = read(in, buffer, BLOCK);             ssize_t w = write(out, buffer, BLOCK);             if (r != w) {                 fprintf(stderr, "r %d w %d\n", r, w);                 if (errno) {                     fprintf(stderr,"%s\n", strerror(errno));                     break;                 }             }             if (fdatasync(out) != 0) {                 fprintf(stderr,"Sync failed: %s\n", strerror(errno));                 break;             }             count++;             if (!(count % 1000)) {                 thousands++;                 fprintf(stderr,"%d000...\n", thousands);             }             lseek(out, 0, SEEK_SET);         }         fprintf(stderr,"TOTAL %lu\n", count);         close(in);         close(out);              return 0;     }                                       I ran this for ~8 hours, until I had accumulated **2 million+ writes** to the beginning of the `/dev/sdb1` partition.1 I could just have easily used `/dev/sdb` (the raw device and not the partition) but I cannot see what difference this would make. I then checked the card by trying to create and mount a filesystem on `/dev/sdb1`. This worked, indicating the specific block I had been writing to all night was feasible. However, it does not mean that some regions of the card had not been worn out and displaced by wear levelling, but left accessible. To test that, I used `badblocks -v -w` on the partition. This is a _destructive_ read-write test, but wear levelling or not, it should be a strong indication of the feasibility of the card since it must still provide space for each rolling write. In other words, it is the literal equivalent of filling the card completely, then checking that all of that was okay. Several times, since I let badblocks work through a few patterns. _[Contra Jason C's comments below, there is nothing wrong or false about using badblocks this way. While it would not be useful for actually identifying bad blocks due to the nature of SD cards, it is fine for doing destructive read- write tests of an arbitrary size using the`-b` and `-c` switches, which is where the revised test went (see my own answer). No amount of magic or caching by the card's controller can fool a test whereby several megabytes of data can be written to hardware and read back again correctly. Jason's other comments seem based on a misreading -- IMO an **intentional** one, which is why I have not bothered to argue. With that head's up, I leave it to the reader to decide what makes sense and what **does not**.]_ 1 The card was an old 4 GB Sandisk card (it has no "class" number on it) which I've barely used. Once again, keep in mind that this is not 2 million writes to literally the same physical place; due to wear leveling the "first block" will have been moved constantly by the controller during the test to, as the term states, _level out the wear._


Deleting the starting 10 MB from a open file

I have a log file of size nearly 100 MB which is opened by some program and logging is continuously going on in that file. I want to delete the first 10MB from that file. Is there any way to do that without affecting the logging process into that file.