How do I tell I'm running in a chroot?

I have a unix installation that's supposed to be usable both as a chroot and as a standalone system. If it's running as a chroot, I don't want to run any service (cron, inetd, and so on), because they would conflict with the host system or be redundant. How do I write a shell script that behaves differently depending on whether it's running in a chroot? My immediate need is a modern Linux system, with `/proc` mounted in the chroot, and the script is running as root, but more portable answers are welcome as well. More generally, suggestions that work for other containment methods would be interesting. The practical question is, is this system supposed to be running any services? (The answer being no in a chroot, and yes in a full-fledged virtual machines; I don't know about intermediate cases such as jails or containers.)


Systemd: Timeout a service

Is there a way to have systemd stop a service after it has been running for X amount of seconds? I looked at just wrapping `ExecStart` with `timeout`, however I believe it might not work if my service is the `forking` type.


Is it possible to start administering a linux box via Ansible with just the root account and its password?

I recently rented a Linux box and I intend to provision it using Ansible. I'd like to use Ansible as early as possible in the process. At this stage I only have a root account and the corresponding password. ### Questions   * Given the fact that my target box as well as OpenSSH-Server is running, would it be possible to copy my public key to the server and configure it with Ansible at this early stage?   * Do I have to manually copy the pub key to the server and configure ssh for Ansible to be able to communicate with the server in the first place?  EDIT 1: I should've mentioned, that after reading the docs I used the following syntax:               ansible <nameoftargetbox> -m ping -u root -k      The command basically means use user root ( -u ) and ask for password ( -k ). I am correctly prompted for the password, but I keep getting this response:                <nameoftargetbox>| FAILED => to use -c ssh with passwords, you must install the sshpass program      Needless to say that a common `ssh root@<targetbox>` works flawlessly. After researching some more I found a solution in the Ansible github issue tracker. I'll post it as an answer to this question.


How can I give a permssion to all users for a path using the octal notation?

I'd like to give execute permissions on a path recursively so I can read a file in the directory. The `chmod` binary that I'm using on Android only supports the octal/numeric notation though. Normally I'd do `chmod -R a+x /this/file/is/here/filename.txt` but don't know how I'd do this numerically. I've Googled but haven't found an answer to this. * * * Looking at at the question "Is it possible to represent the +X symbolic permission with an octal value?", I don't think this is possible but what would the easiest recommended way.


How to check if NTPD updates Linux machine's time successfully using shell?

I'm trying to use NTPD to update my Linux machine's time to a specified NTP server.   Here is the scenario: Each time the Linux machine starts up, I want to update the time from NTP server and **if it's not successful, I want to try again every 5 minutes until successfully** (max is 2 hours). I searched around and find that I should(?) use NTPD and use some command like: `#ntpdate ntp.server.com` (before starting NTPD)   `#ntpd some_options_to_start` The questions are:   1. How can I know if the time was successfully updated by these commands?   2. Can I set the interval to update time from ntpd? (or I have to use something like `sleep` and loop with `do`..`while`/`for` in shell?) Note that I want to execute the above commands in a shell script and will put the shell in a web server. Then clients (with a web browser browser) will execute the script on the website. So I need to check if the update is successful or not to send result to the client (over the web).


Removing the last n characters from every line in an emacs buffer

Using Emacs built-in facilities, is there a good way to remove the last n characters (for n >= 1) from every line in an Emacs buffer? I suppose it is possible to define a keyboard macro to do this, but that is not what I have in mind here. There is an elegant solution on Stack Overflow to the corresponding question of how to append characters to every line in emacs, namely Appending characters to the end of each line in Emacs, but I could not find an answer to this question. NOTES:   1. Since XEmacs is mostly dead (RIP), the question can be assumed to be   exclusively about GNU Emacs.   2. There are easy solutions for this using Unix stream editors and the like.   Operating on an Emacs buffer is more flexible, though.   3. I could of course do this by hand, but I've made a sort-of New Year   resolution to make better use of Emacs capabilties. After all, I've been   using it a mere 20 years, and know almost nothing about it.


killall gives me `no process found ` but ps

Could somebody explain to me the difference between `kill` and `killall`? Why doesn't `killall` see what `ps` shows?               # ps aux |grep db2     root      1123  0.0  0.8 841300 33956 pts/1    Sl   11:48   0:00 db2wdog                                              db2inst1  1125  0.0  3.5 2879496 143616 pts/1  Sl   11:48   0:02 db2sysc                                             root      1126  0.0  0.6 579156 27840 pts/1    S    11:48   0:00 db2ckpwd                                             root      1127  0.0  0.6 579156 27828 pts/1    S    11:48   0:00 db2ckpwd                                             root      1128  0.0  0.6 579156 27828 pts/1    S    11:48   0:00 db2ckpwd           # killall db2ckpwd     db2ckpwd: no process found          # kill -9 1126     # kill -9 1127     # kill -9 1128      System is SuSe 11.3 (64 bit); kernel 2.6.34-12; procps version 3.2.8; killall from PSmisc 22.7; kill from GNU coreutils 7.1


Documentation of kernel parameters

Where can I find a technical description of the kernel parameters listed in `/proc/sys` (ob Linux)?


Why do some of my lvm partitions have "-real" appended to their names?

In the /dev/mapper directory I can see my lvm partitions, but then I'll see some other ones with the same names, but with "-real" appended to them. What's that about?


GUI input for shell script

I have a shell script which installs a program in RedHat. I need to add a GUI for entering some parameters so that it looks like an installation wizard . I tried Xdialog, Zenity, and Yad, but they each only support a single data input per window; I need to display all the steps in a single window. What can I use to do that?


finding the absolute directory

Here is the scenario:               foo/     > data/     > stuff/     > scripts/ -> /.../generic/scripts      When calling `foo/scripts/bar.sh` from any location (other folder or inside the folder), I would like to be able for the script to use `foo/data` and `foo/stuff` However, if I simply use `foo_dir='dirname $0'/..` then it'll go down the directory pointed by the symbolic link! (And obtain `generic` instead of `foo`!) If I use some pattern to eat up the end of `$0`, then it's not working either since you could also call the script from inside the directory. So, in the end... The only thing I have found is this extremely ugly stuff:               dir=`dirname $0`     cd $dir     dir=`pwd | sed -r 's_/[^/]+$__'`     cd -      ...but I'm sure there is a better way, isn't there? _**What I used:_**               dir=$( dirname $( cd `dirname $0`; pwd ) )      Dunno if it is perfect but it seems to behave as expected.


How to avoid apache reload when rotating logs?

I use logrotate to rotate Apache access-, error- and rewrite-logs. My config file looks like this:               /apache/*log {         compress         dateext         rotate 365         size=+300M         olddir /log/old/apache         notifempty         missingok         lastaction          /bin/apache reload         endscript     }      My problem is that whenever a rotation occurs Apache has to be reloaded because Apache doesn't write anymore in the just rotated logfile. Is there a way to avoid Apache reloads everytime logrotate does a rotation?


grep for n or more periods on a given line

I want to be able to arbitrarily match lines that contain a lot of periods, like this:               $ echo "there's. someone on the wing. some. thing." | grep -stuFF [[:idunno:]]{4,}     there's. someone on the wing. some. thing.      I tried, blindly gropingly:               grep -P [[.]]{\4,\} textfile     grep -P \.{\4,\} textfile      and then tried something I knew would work at some level               grep -P [[:punct:]]{\4,\} textfile      but `[[:punct:]]{\4,\\}` disappointingly just picked up a lot of the lines I wanted grep to miss so that I could turn the command around and do a `grep -v`. Even doing `grep -P '\\.{4,}'` does not return the lines I am trying to grep for, which look like:                   Sullivan, G.R. Tetrahedron Lett. 1971, 223; Pascal, Jr., R.A.; Winans, C.G.; Van Engen, D. J. Am. Chem.     compounds (i.e., shielding and deshielding of nuclei) can be measured by a simple     Plavic, D.; Babic, D.; Nikolic, S.; Trinajstic, N. Gazz. Chim. Ital., 1993, 123, 243.     Hess, Jr., B.A.; Schaad, L.J. J. Am. Chem. Soc. 1971, 93, 305.     as N-oxides or pyridinium ions are still aromatic. However, for nitrogen heterocycles there are more signiﬁcan$     given in Coulson, C.A.; Streitwieser, Jr., A. A Dictonary of p Electron Calculations, W.H. Freeman, San     Hydrocarbons, Elsevier, NY, 1987; Clar, E. Polycyclic Hydrocarbons, 2 vols., Academic Press, NY, 1964.     Zhang, J.; Ho, D.M.; Pascal Jr., R.A. J. Am. Chem. Soc. 2001, 123, 10919.     See Herndon, W.C.; Ellzey Jr., M.L. J. Am. Chem. Soc. 1974, 96, 6631.     Dauben Jr., H.J.; Riﬁ, M.R. J. Am. Chem. Soc. 1963, 85, 3041; also see Breslow, R.; Chang, H.W. J. Am     1973, 1, 29; Kolomnikova, G.D.; Parnes, Z.N. Russ. Chem. Rev. 1967, 36, 735; Harmon, K.H., in Olah,     Bertelli, D.J.; Andrews, Jr., T.G. J. Am. Chem. Soc. 1969, 91, 5280; Bertelli, D.J.; Andrews Jr., T.G.;     Nikitina, T.V. Organomet. React., 1972, 4, 163; Bublitz, D.E.; Rinehart Jr., K.L. Org. React., 1969, 17, 1;      Note that the first of those lines contains 10 periods.


stunnel - how to setup stunnel to handle ssl and attach http with it?

I am running Google App Engine which is a http web server with some redirecting and other real-time stuff. But it does not have SSL to include so its unable to make HTTPS. Therefore, i was trying `stunnel` to make SSL and connect the HTTP on it, but its not working when using Google App Engine and Stunnel.               $ cat /etc/stunnel/stunnel.conf     pid = /stunnel.pid     cert=/var/tmp/server.pem     socket = l:TCP_NODELAY=1     socket = r:TCP_NODELAY=1     client=yes     ; Some debugging stuff useful for troubleshooting     debug = 7     output = /var/log/stunnel.log     [SSL]     accept=0.0.0.0:443     connect=80      **See the logs:**               2014.02.06 09:13:34 LOG5[8293:140556325660608]: Threading:PTHREAD SSL:ENGINE Sockets:POLL,IPv6 Auth:LIBWRAP     2014.02.06 09:13:34 LOG6[8293:140556325660608]: file ulimit = 1024 (can be changed with 'ulimit -n')     2014.02.06 09:13:34 LOG6[8293:140556325660608]: poll() used - no FD_SETSIZE limit for file descriptors     2014.02.06 09:13:34 LOG5[8293:140556325660608]: 500 clients allowed     2014.02.06 09:13:34 LOG7[8293:140556325660608]: FD 9 in non-blocking mode     2014.02.06 09:13:34 LOG7[8293:140556325660608]: FD 10 in non-blocking mode     2014.02.06 09:13:34 LOG7[8293:140556325660608]: FD 11 in non-blocking mode     2014.02.06 09:13:34 LOG7[8293:140556325660608]: SO_REUSEADDR option set on accept socket     2014.02.06 09:13:34 LOG7[8293:140556325660608]: SSL bound to 0.0.0.0:443     2014.02.06 09:13:34 LOG7[8299:140556325660608]: Created pid file /stunnel.pid          2014.02.06 09:14:06 LOG7[8299:140556325660608]: SSL accepted FD=12 from 82.x.x.LocalPC:49651     2014.02.06 09:14:06 LOG7[8299:140556325660608]: SSL accepted FD=13 from 82.x.x.LocalPC:49652     2014.02.06 09:14:06 LOG7[8299:140556325656320]: SSL started     2014.02.06 09:14:06 LOG7[8299:140556325656320]: FD 12 in non-blocking mode     2014.02.06 09:14:06 LOG7[8299:140556325586688]: SSL started     2014.02.06 09:14:06 LOG7[8299:140556325656320]: TCP_NODELAY option set on local socket     2014.02.06 09:14:06 LOG7[8299:140556325586688]: FD 13 in non-blocking mode     2014.02.06 09:14:06 LOG7[8299:140556325656320]: Waiting for a libwrap process     2014.02.06 09:14:06 LOG7[8299:140556325586688]: TCP_NODELAY option set on local socket     2014.02.06 09:14:06 LOG7[8299:140556325586688]: Waiting for a libwrap process     2014.02.06 09:14:06 LOG7[8299:140556325656320]: Acquired libwrap process #0     2014.02.06 09:14:06 LOG7[8299:140556325586688]: Acquired libwrap process #1     2014.02.06 09:14:06 LOG7[8299:140556325656320]: Releasing libwrap process #0     2014.02.06 09:14:06 LOG7[8299:140556325586688]: Releasing libwrap process #1     2014.02.06 09:14:06 LOG7[8299:140556325656320]: Released libwrap process #0     2014.02.06 09:14:06 LOG7[8299:140556325586688]: Released libwrap process #1     2014.02.06 09:14:06 LOG7[8299:140556325656320]: SSL permitted by libwrap from 82.x.x.LocalPC:49651     2014.02.06 09:14:06 LOG7[8299:140556325586688]: SSL permitted by libwrap from 82.x.x.LocalPC:49652     2014.02.06 09:14:06 LOG5[8299:140556325656320]: SSL accepted connection from 82.x.x.LocalPC:49651     2014.02.06 09:14:06 LOG5[8299:140556325586688]: SSL accepted connection from 82.x.x.LocalPC:49652     2014.02.06 09:14:06 LOG7[8299:140556325656320]: FD 15 in non-blocking mode     2014.02.06 09:14:06 LOG7[8299:140556325586688]: FD 16 in non-blocking mode     2014.02.06 09:14:06 LOG6[8299:140556325656320]: connect_blocking: connecting 82.x.x.x:80     2014.02.06 09:14:06 LOG6[8299:140556325586688]: connect_blocking: connecting 82.x.x.x:80     2014.02.06 09:14:06 LOG7[8299:140556325656320]: connect_blocking: s_poll_wait 82.x.x.x:80: waiting 10 seconds     2014.02.06 09:14:06 LOG5[8299:140556325656320]: connect_blocking: connected 82.x.x.x:80     2014.02.06 09:14:06 LOG7[8299:140556325586688]: connect_blocking: s_poll_wait 82.x.x.x:80: waiting 10 seconds     2014.02.06 09:14:06 LOG5[8299:140556325656320]: SSL connected remote server from 82.x.x.x:36426     2014.02.06 09:14:06 LOG5[8299:140556325586688]: connect_blocking: connected 82.x.x.x:80     2014.02.06 09:14:06 LOG7[8299:140556325656320]: Remote FD=15 initialized     2014.02.06 09:14:06 LOG5[8299:140556325586688]: SSL connected remote server from 82.x.x.x:36427     2014.02.06 09:14:06 LOG7[8299:140556325656320]: TCP_NODELAY option set on remote socket     2014.02.06 09:14:06 LOG7[8299:140556325586688]: Remote FD=16 initialized     2014.02.06 09:14:06 LOG7[8299:140556325656320]: SSL state (connect): before/connect initialization     2014.02.06 09:14:06 LOG7[8299:140556325586688]: TCP_NODELAY option set on remote socket     2014.02.06 09:14:06 LOG7[8299:140556325656320]: SSL state (connect): SSLv3 write client hello A     2014.02.06 09:14:06 LOG7[8299:140556325656320]: SSL alert (write): fatal: handshake failure     2014.02.06 09:14:06 LOG3[8299:140556325656320]: SSL_connect: 1408F10B: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number     2014.02.06 09:14:06 LOG7[8299:140556325586688]: SSL state (connect): before/connect initialization     2014.02.06 09:14:06 LOG5[8299:140556325656320]: Connection reset: 0 bytes sent to SSL, 0 bytes sent to socket     2014.02.06 09:14:06 LOG7[8299:140556325586688]: SSL state (connect): SSLv3 write client hello A     2014.02.06 09:14:06 LOG7[8299:140556325656320]: SSL finished (1 left)     2014.02.06 09:14:06 LOG7[8299:140556325586688]: SSL alert (write): fatal: handshake failure     2014.02.06 09:14:06 LOG3[8299:140556325586688]: SSL_connect: 1408F10B: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number     2014.02.06 09:14:06 LOG5[8299:140556325586688]: Connection reset: 0 bytes sent to SSL, 0 bytes sent to socket     2014.02.06 09:14:06 LOG7[8299:140556325586688]: SSL finished (0 left)     2014.02.06 09:14:06 LOG7[8299:140556325660608]: SSL accepted FD=12 from 82.x.x.LocalPC:49653     2014.02.06 09:14:06 LOG7[8299:140556325586688]: SSL started     2014.02.06 09:14:06 LOG7[8299:140556325586688]: FD 12 in non-blocking mode     2014.02.06 09:14:06 LOG7[8299:140556325586688]: TCP_NODELAY option set on local socket     2014.02.06 09:14:06 LOG7[8299:140556325586688]: Waiting for a libwrap process     2014.02.06 09:14:06 LOG7[8299:140556325586688]: Acquired libwrap process #1     2014.02.06 09:14:06 LOG7[8299:140556325586688]: Releasing libwrap process #1     2014.02.06 09:14:06 LOG7[8299:140556325586688]: Released libwrap process #1     2014.02.06 09:14:06 LOG7[8299:140556325586688]: SSL permitted by libwrap from 82.x.x.LocalPC:49653     2014.02.06 09:14:06 LOG5[8299:140556325586688]: SSL accepted connection from 82.x.x.LocalPC:49653     2014.02.06 09:14:06 LOG7[8299:140556325586688]: FD 13 in non-blocking mode     2014.02.06 09:14:06 LOG6[8299:140556325586688]: connect_blocking: connecting 82.x.x.x:80     2014.02.06 09:14:06 LOG7[8299:140556325586688]: connect_blocking: s_poll_wait 82.x.x.x:80: waiting 10 seconds     2014.02.06 09:14:06 LOG5[8299:140556325586688]: connect_blocking: connected 82.x.x.x:80     2014.02.06 09:14:06 LOG5[8299:140556325586688]: SSL connected remote server from 82.x.x.x:36428     2014.02.06 09:14:06 LOG7[8299:140556325586688]: Remote FD=13 initialized     2014.02.06 09:14:06 LOG7[8299:140556325586688]: TCP_NODELAY option set on remote socket     2014.02.06 09:14:06 LOG7[8299:140556325586688]: SSL state (connect): before/connect initialization     2014.02.06 09:14:06 LOG7[8299:140556325586688]: SSL state (connect): SSLv3 write client hello A     2014.02.06 09:14:06 LOG7[8299:140556325586688]: SSL alert (write): fatal: handshake failure     2014.02.06 09:14:06 LOG3[8299:140556325586688]: SSL_connect: 1408F10B: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number     2014.02.06 09:14:06 LOG5[8299:140556325586688]: Connection reset: 0 bytes sent to SSL, 0 bytes sent to socket     2014.02.06 09:14:06 LOG7[8299:140556325586688]: SSL finished (0 left)     2014.02.06 09:14:06 LOG7[8299:140556325660608]: SSL accepted FD=12 from 82.x.x.LocalPC:49654     2014.02.06 09:14:06 LOG7[8299:140556325586688]: SSL started     2014.02.06 09:14:06 LOG7[8299:140556325586688]: FD 12 in non-blocking mode     2014.02.06 09:14:06 LOG7[8299:140556325586688]: TCP_NODELAY option set on local socket     2014.02.06 09:14:06 LOG7[8299:140556325586688]: Waiting for a libwrap process     2014.02.06 09:14:06 LOG7[8299:140556325586688]: Acquired libwrap process #1     2014.02.06 09:14:06 LOG7[8299:140556325586688]: Releasing libwrap process #1     2014.02.06 09:14:06 LOG7[8299:140556325586688]: Released libwrap process #1     2014.02.06 09:14:06 LOG7[8299:140556325586688]: SSL permitted by libwrap from 82.x.x.LocalPC:49654     2014.02.06 09:14:06 LOG5[8299:140556325586688]: SSL accepted connection from 82.x.x.LocalPC:49654     2014.02.06 09:14:06 LOG7[8299:140556325586688]: FD 13 in non-blocking mode     2014.02.06 09:14:06 LOG6[8299:140556325586688]: connect_blocking: connecting 82.x.x.x:80     2014.02.06 09:14:06 LOG7[8299:140556325586688]: connect_blocking: s_poll_wait 82.x.x.x:80: waiting 10 seconds     2014.02.06 09:14:06 LOG5[8299:140556325586688]: connect_blocking: connected 82.x.x.x:80     2014.02.06 09:14:06 LOG5[8299:140556325586688]: SSL connected remote server from 82.x.x.x:36429     2014.02.06 09:14:06 LOG7[8299:140556325586688]: Remote FD=13 initialized     2014.02.06 09:14:06 LOG7[8299:140556325586688]: TCP_NODELAY option set on remote socket     2014.02.06 09:14:06 LOG7[8299:140556325586688]: SSL state (connect): before/connect initialization     2014.02.06 09:14:06 LOG7[8299:140556325586688]: SSL state (connect): SSLv3 write client hello A     2014.02.06 09:14:06 LOG7[8299:140556325586688]: SSL alert (write): fatal: handshake failure     2014.02.06 09:14:06 LOG3[8299:140556325586688]: SSL_connect: 1408F10B: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number     2014.02.06 09:14:06 LOG5[8299:140556325586688]: Connection reset: 0 bytes sent to SSL, 0 bytes sent to socket     2014.02.06 09:14:06 LOG7[8299:140556325586688]: SSL finished (0 left)      EDIT: here to verify locally the ssL               $ openssl s_client -ssl3 -connect localhost:443     CONNECTED(00000003)     write:errno=104     ---     no peer certificate available     ---     No client certificate CA names sent     ---     SSL handshake has read 0 bytes and written 0 bytes     ---     New, (NONE), Cipher is (NONE)     Secure Renegotiation IS NOT supported     Compression: NONE     Expansion: NONE     SSL-Session:         Protocol  : SSLv3         Cipher    : 0000         Session-ID:          Session-ID-ctx:          Master-Key:          Key-Arg   : None         Krb5 Principal: None         PSK identity: None         PSK identity hint: None         Start Time: 1391675538         Timeout   : 7200 (sec)         Verify return code: 0 (ok)     ---      EDIT: Goal: visitor visits a valid address for example: https://www.yumyumyum.com (assume its valid and has CA, KEY, CERT files) and he is not forwarded to http://www.yumyumyum.com it should remain as https 1) when used Google App Engine it does not have HTTPS option as a result everything has to run as HTTP, now the service is running as HTTP, but when users use it as http, it causes other security problems 2) therefore, we needed a SSL Proxy to that HTTP so that the user always get https even behind the screen they are attached with http is this clear description?


Fencing VM nodes

I'm using VMware Workstation as my hypervisor. I want to create a cluster with two nodes and a sharing storage with FreeNAS. My questions are around fencing.   * Is it possible to do it in this case?   * If yes please how to it?


Edit really big files with vi

How can I edit a really big file with vi? e.g.: a 20 GByte log file. Are there any modifications for it to handle this size?


What are the virtues of multitasking with traditional job control vs Tmux/Screen?

tmux and screen let you run different processes (e.g. vim, a bash script, mysql, psql, etc) in different virtual windows. But traditional Unix job control (using CTRL-z, fg, bg, and jobs) seem to give you some of the same functionality. Are there any advantages of multitasking using traditional job control over the newer ways via tmux and screen?


Find server with small ping latency (my script, but can anyone write it in e.g.: Perl?)

I want to download OpenBSD with FTP with a script, and I want to download it from a server that is near me. So I want to choose a mirror that has low "ping latency". I wrote a little script, that works just fine (only tested under bash/Linux):               LATESTRELVER=`curl -s 'www.openbsd.org' | fgrep 'The current release is ' | sed 's/OpenBSD /\n/' | sed 's/<\/a>/\n/' | grep "^[0-9]" | head -1`     FASTESTSRV=`curl -s "http://www.openbsd.org/ftp.html#ftp" | fgrep '<a href="ftp://' | sed 's/"ftp:\/\//\n/' | cut -d "/" -f1 | fgrep -v '/dev/null | fgrep ' time=' | sed 's/ time=/\n/' | grep ' ms' | sed 's/ ms$/ /' | sed 's/\./ |/' | cut -d "|" -f1 | tr -d '\n'; if [ $? -eq 0 ]; then echo "$MIRRORSRVS"; fi; done | grep "^[0-9]" | sort -un | head -1 | awk '{print $2}'`     LATESTRELVERSHORT=`echo $LATESTRELVER | sed 's/\.//g'`          # NEEDEDARCH=i386     NEEDEDARCH=amd64          wget "$FASTESTSRV/pub/OpenBSD/$LATESTRELVER/$NEEDEDARCH/install$LATESTRELVERSHORT.iso" -O "install$LATESTRELVERSHORT-$NEEDEDARCH.iso"      Q: can someone write this script in Perl? :P (with a smaller, nicer code?) The main purpose of this script to e.g.: not use foreign country's bandwidth.


Problems with vuze plugins

I needed a torrent client that supports feeds and mailing me when stuff is finished. Vuze supports feeds and a plugin was supposed to do the trick about mailing me. But I have encountered great difficulties installing the plugin. I've selected it and then the application hangs when it tries to install it through the installation guide. I think I could just copy the files over to the vuze plugins folder and restart vuze. Would that work? And where does the vuze install the plugins folder when I installed it with `yum`?


Bash, curious about echo $variable

I was hacking at a small script earlier and noticed something I can't explain. Running this command               (time wget --spider http://www.google.co.uk/) 2>&1  | egrep 'real|response'      gives me this output (which I expect)               HTTP request sent, awaiting response... 200 OK     real    0m0.086s      I capture the output above in a variable               Result=$((time wget --spider http://www.google.co.uk/) 2>&1  | egrep 'real|response')      If I               echo "$Result"         I get the expected output               HTTP request sent, awaiting response... 200 OK     real    0m0.086s      However if I               echo $Result      I get               HTTP request sent, awaiting response... 200 OK real    0m0.086s      Why is that ?


/etc/rc*: Why does this command stop NFS services from starting at boot?

I recently found this home networking tutorial surprisingly enlightening. However, there is one thing I don't understand: > Disabling NFS Start On Boot: If you are not planning on regularly accessing > files via NFS, you should not leave the NFS server running and vulnerable to > outside attacks. The startup scripts for NFS are in the /etc/rc* directories > and you should rename them with the K prefix instead of the S prefix so they > do not start at boot time: the tutorial then gives the following command:               sudo rename s/S/K/ /etc/rc*/*nfs*      I have never really understood the way /etc/rc*/ works. But I assume there are certain directories in which the `service servicename start` scripts are always run, right? That's just a guess. So, in this case, why does renaming these have an effect? How does the naming of directories affect this particular instance? What does that rename command actually do? Why does the new directory name ensure that NFS is not started at boot time?


Packaging Google Chrome and Flash into a Linux Distro?

I've been working on a Linux distro based on Arch, and I want to include Google Chrome and Adobe's Flash Plugin. Can I get in trouble with Google or Adobe if I pre-install both of those pieces of software into a Linux distro which I plan to release within the upcoming month?


Wipe last 1MB of a Hard drive

Is there an easy command that I can use to zero out the last 1MB of a hard drive? For the start of the drive I would `dd if=/dev/zero of=/dev/sdx bs=1M count=1`. The `seek` option for dd looks promising, but does someone have an easy way to determine exactly how far I should seek? I have a hardware RAID appliance, that stores some of the RAID configuration at the end of the drive. I need the RAID appliance to see the drives as un- configured, so I want to remove the RAID configuration without having to spend the time to do a full wipe of the drives. I have a dozen 2TB drives, and a full erase of all of those drives would take a long time.


Storing Abbreviations in Vim

I frequently use `:ab` to save typing time during coding. For e.g. `:ab mat matrix` to replace mat by matrix every time I type mat. **Is there any way of storing and loading the abbreviations I create for a given file?** I want something to store my abbreviations as and when I declare them and also reload them when I open a file. I would prefer the abbreviations to be "local" to a file rather than global but I can work around this if necessary.


How to multiply two columns in awk?

I want to multiply column 1 with column 2 (till end of file) in input file and should output 1 column and multiplied 3 column in separate file. input.txt               1 677679866     2 121867616     3 49413198     4 40415982      output.txt               1 677679866     2 243735232     3 148239594     4 161663928


Where, in automysqlbackup, do I add mysqldump parameters?

How to stop automysqlbackup's cron.daily script -- as installed and configured from `apt-get install automysqlbackup` -- throwing the following error:                mysqldump: Got error: 1142: SELECT,LOCK TABL command denied to user      'debian-sys-maint'@'localhost' for table 'cond_instances' when using LOCK TABLES      This occurs after having upgraded to MySQL 5.5 as a side-effect of having upgraded to Ubuntu 12.04 LTS. The correct solution (thanks @sr_ for pointer to the appropriate bug report) is to exclude the 'performance_schema' database from mysqldump. So the question is: How to do this whilst respecting the Debian packages and configurations? The problem occurs daily after having upgraded to MySQL 5.5. **Background:** My aim is to stay with the Ubuntu Debian-installed packages and configurations in as standard a manner as possible. But actually, this is a bug with the way the packages are installed / upgraded, so it is necessary to update one of the supplied configuration files. `debian-sys-maint` has fullest privileges anyway, so already has sufficient to lock each table before dumping it. What's confusing is that `/usr/share/doc/automysqlbackup/README.Debian` says that > All parameters can be setup by editing the /etc/default/automysqlbackup file `/etc/default/automysqlbackup` invokes mysqlbackup with settings in `/etc/mysql/debian.cnf` which says: > Automatically generated for Debian scripts. DO NOT TOUCH!.


How to understand Hot plugin mechanism for a USB in an Android stack?

I want to know where I could get some material to study USB hot plug-in mechanism in Android Stack. I tried googling many a times, but din't find anything useful.


How to debug an inserted kernel module?

I would like to debug a loaded kernel module I don't have the source code to; I suspect it's a virus. Is there a way to feed it into GDB for analysis?


Why doesn't dzen2 work when invoked via at?

dzen2 is a notification utility of sorts. This command will make a notification that says "Hi" appear on the screen:               echo Hi | dzen2 -p      Debian's at is a utility that schedules events to occur in the future. This command will make the file "foo" appear in your user directory after 1 minute:               echo "touch ~/foo" | at now + 1 minute      So why is it that this command doesn't cause a `dzen2` notification to appear after 1 minute?               echo "echo Hi | dzen2 -p" | at now + 1 minute      I have been investigating for hours and cannot seem to find a reason why this doesn't work! I have a hunch that it has to do with the shell that is invoked by at, but I just don't understand why it fails. As a counterpoint example, this command works just fine:               echo "notify-send Hi" | at now + 1 minute


Who wrote the "Linux kernel" (Linus Torvalds and his team)?

Who are the authors of the pure Linux kernel from scratch, which was integrated with GNU tools and formed the full GNU/Linux Operating system in the 1990s? I have read some wiki articles but I haven't got any clear cut idea on the history.


startx error doesn't load from terminal

I have installed GNOME v2 in my freebsd but when I try to do `startx` it gives the following error. Please Help. ![ScreenShot](http://i.stack.imgur.com/qUv9g.jpg)


System.map file update

I found that System.map file contains addresses of symbols. Does it involve system calls? I read that it is only updated when a new kernel is newly compiled. So does that means that except for a new kernel compilation, these are always stored in the same address?


Running 64-bit Linux with 750 MB of RAM: worth it?

I have a Debian server VPS, and the provider installed 64-bit Debian 5. Should I ask for an 32-bit install, given that I have only 750 MB RAM and I have heard that variables take more RAM on 64-bit systems?


Why rsync attempts to copy file that is already up-to-date?

I have two same files, on local machine and on remote one. Their sizes are equal, and file on local machine is newer than on remote one - but rsync still attempts to copy the file. I invoke rsync as follows:               rsync -nv -e "ssh -p 2222" user@host:/data/file.fif data/file.fif      (if I don't use `-n` option, it initiates the copy operation) Rsync docs explicitly state that it shouldn't be happening:               Rsync  finds files that need to be transferred using a "quick check" algorithm (by default) that looks for files that have changed in size or in last-modified time.      Outputs from `stat`:               # remote file       File: `data/fif/Skovorodko_Olga_45_raw.fif'       Size: 1137551966  Blocks: 2221784    IO Block: 4096   regular file     Device: fd00h/64768d    Inode: 286338      Links: 1     Access: (0664/-rw-rw-r--)  Uid: ( 1037/  platon)   Gid: ( 1047/  platon)     Access: 2013-08-08 18:40:16.907581658 +0400     Modify: 2013-07-16 12:01:09.158763284 +0400     Change: 2013-07-16 12:01:09.158763284 +0400          # local file       File: `data/fif/Skovorodko_Olga_45_raw.fif'       Size: 1137551966  Blocks: 2221792    IO Block: 4096   regular file     Device: 801h/2049d  Inode: 12987232    Links: 1     Access: (0644/-rw-r--r--)  Uid: ( 1005/  platon)   Gid: ( 1003/  platon)     Access: 2013-08-08 19:02:57.146223369 +0400     Modify: 2013-08-08 19:02:57.146223369 +0400     Change: 2013-08-08 19:02:57.146223369 +0400      Why does this happen? **UPDATE:** Doing `rsync --size-only` results file not being copied:               delta-transmission enabled     Skovorodko_Olga_45_raw.fif is uptodate     total: matches=0  hash_hits=0  false_alarms=0 data=0          sent 14 bytes  received 114 bytes  85.33 bytes/sec     total size is 1137551966  speedup is 8887124.73 (DRY RUN)


Why is sort -o useful?

UNIX philosophy says: do one thing and do it well. Make programs that handle text, because that is a universal interface. The `sort` command, at least GNU sort, has an `-o` option to output to a file instead of `stdout`. Why is, say, `sort foobar -o whatever` useful when I could just `sort foobar > whatever`?


Access time is not being updated when i run ` ls a ` and then ` stat a`

On CentOS Linux desktop let's create a folder named `a`.               mkdir a      Then let's access it               ls a      and then let's get it's statistics               stat a            File: `a'       Size: 4096        Blocks: 8          IO Block: 4096   directory     Device: fd00h/64768d    Inode: 1183593     Links: 2     Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)     Access: 2013-08-30 21:35:55.089404752 -0400     Modify: 2013-08-30 21:35:54.077415503 -0400     Change: 2013-08-30 21:35:54.077415503 -0400      Okay let's access it again               ls a      and get it's access time again               stat a            File: `a'       Size: 4096        Blocks: 8          IO Block: 4096   directory     Device: fd00h/64768d    Inode: 1183593     Links: 2     Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)     Access: 2013-08-30 21:35:55.089404752 -0400     Modify: 2013-08-30 21:35:54.077415503 -0400     Change: 2013-08-30 21:35:54.077415503 -0400      As you can see there is no difference between the "ACCESS" times. Here are two access times right next to each other.               Access: 2013-08-30 21:35:55.089404752 -0400     Access: 2013-08-30 21:35:55.089404752 -0400      They look absolutely identical! What can i do about this? I'm simply using CentOS Linux desktop, which uses GNOME by default.


Finding out whether rsync modified target?

My program copies/synchronizes several directories from source to target, each using rsync. For each directory, if the version in target is not identical to source, and thus rsync modifies the target, I would like to notify the user with a message like "directory X has been synchronized to target". On the other hand, if target version is already identical to target, I can skip showing this message since there is no change in target. Exit status and -n option do not differentiate between the two condition. Aside from parsing the output of -v, is there any other way for me to get rsync to provide this information?


The command ` ls -ltu ` fails to list folders/files based on last accessed time

First on your linux desktop create 2 folders.               a     b      Now run this in the terminal               ls -ltu      the result is               drwxr-xr-x 2 root root 4096 Aug 30 20:33 b     drwxr-xr-x 2 root root 4096 Aug 30 20:33 a      Let's click on a and re-run it.   Same exact result as above. Let's click on b and re-run it.   Same exact result as above. I'm trying to arrange folders based on which one was last clicked on. They recommended `ls -ltu` but it's not working.


Add udev rule alias for input device

I am trying to add a udev alias rule for my xboxdrv (x-box controller) and I can't seem to figure it out.               dmesg | grep "input"      I see:               [    6.239955] input: Microsoft X-Box 360 pad as /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3:1.0/input/input2     [   27.057308] input: Xbox Gamepad (userspace driver) - Keyboard Emulation as /devices/virtual/input/input3     [   27.058307] input: Xbox Gamepad (userspace driver) as /devices/virtual/input/input4      It looks likes its input 3 and 4. So I check:               sudo udevadm info -a -p /devices/virtual/input/input3      which gives me:               looking at device '/devices/virtual/input/input3':         KERNEL=="input3"         SUBSYSTEM=="input"         DRIVER==""         ATTR{name}=="Xbox Gamepad (userspace driver) - Keyboard Emulation"         ATTR{phys}==""         ATTR{uniq}==""         ATTR{properties}=="0"      And input4                 looking at device '/devices/virtual/input/input4':         KERNEL=="input4"         SUBSYSTEM=="input"         DRIVER==""         ATTR{name}=="Xbox Gamepad (userspace driver)"         ATTR{phys}==""         ATTR{uniq}==""         ATTR{properties}=="0"      I think I have enough info to create my udev rule. I create a new file called `99-x-box.rules` in '/etc/udev/rules.d'. I added the following:               SUBSYSTEM=="input", ATTR{name}=="Xbox Gamepad (userspace driver) - Keyboard Emulation", ATTR{properties}=="0", SYMLINK+="xboxcontroller"      I reboot. I dont see the alias in `/dev/input'. I also tried:               SUBSYSTEM=="input", ATTR{name}=="Xbox Gamepad (userspace driver)", ATTR{properties}=="0", SYMLINK+="xboxcontroller"      thanks for the help.


How are directories managed in the filesystem?

On behalf of this particular question I would like to know how directories are managed in the file system. What does the author of the above question mean by telling > each directory has n+2 pointers to itself I would like to get more clarity and info on this.


Dynamic port forwarding using socat

I'm trying to replicate the functionality of `ssh -D <PORT> user@machineX` to tunnel all my traffic from my current machine via `machineX`. I do not need the ssh shell open at all, I simply wish to tunnel my HTTP/HTTPS traffic. Can this be achieved using `socat` ? So far I've only seen examples of forwarding one port to another. If not is there another alternative?


Switch user on terminal

I'm switching user using command:               sudo su - userName      On my terminal I always have:               user@user directory $ (some command)      But when I switch user I have only :               $ (some commands)      It is hard to explain what I mean but I'm new in linux and I have't found this in other questions. How to keep this whole data before $ sign after relogin? Edit: Ok It work for me I recreated user using command: adduser name But I have another question. This command create /home directory but It is empty. Is some command to initialize /home for new user?


Problems with YUM/Scientifix Linux 6.3 (inconsistent rpm database?..)

Recently I saw this:               [root@NOTEBOOK /etc/yum.repos.d] yum update     Loaded plugins: fastestmirror, presto, security     Loading mirror speeds from cached hostfile     epel/metalink                                                                                |  17 kB     00:00           * epel: mirror.pmf.kg.ac.rs      * rpmforge: ftp.lug.ro      * sl: ftp.scientificlinux.org      * sl-security: ftp.scientificlinux.org     Setting up Update Process     Resolving Dependencies     --> Running transaction check     ---> Package wine.x86_64 0:1.2.3-1.el6 will be updated     ---> Package wine.x86_64 0:1.4.1-1.el6 will be an update     --> Processing Dependency: wine-openal(x86-64) = 1.4.1-1.el6 for package: wine-1.4.1-1.el6.x86_64     --> Processing Dependency: wine-openal(x86-32) = 1.4.1-1.el6 for package: wine-1.4.1-1.el6.x86_64     ---> Package wine-capi.i686 0:1.2.3-1.el6 will be updated     ---> Package wine-capi.x86_64 0:1.2.3-1.el6 will be updated     ---> Package wine-capi.i686 0:1.4.1-1.el6 will be an update     ---> Package wine-capi.x86_64 0:1.4.1-1.el6 will be an update     ---> Package wine-cms.i686 0:1.2.3-1.el6 will be updated     ---> Package wine-cms.x86_64 0:1.2.3-1.el6 will be updated     ---> Package wine-cms.i686 0:1.4.1-1.el6 will be an update     ---> Package wine-cms.x86_64 0:1.4.1-1.el6 will be an update     ---> Package wine-common.noarch 0:1.2.3-1.el6 will be updated     ---> Package wine-common.noarch 0:1.4.1-1.el6 will be an update     ---> Package wine-core.i686 0:1.2.3-1.el6 will be updated     ---> Package wine-core.x86_64 0:1.2.3-1.el6 will be updated     ---> Package wine-core.i686 0:1.4.1-1.el6 will be an update     --> Processing Dependency: libgstreamer-0.10.so.0 for package: wine-core-1.4.1-1.el6.i686     --> Processing Dependency: libgstbase-0.10.so.0 for package: wine-core-1.4.1-1.el6.i686     --> Processing Dependency: libgstapp-0.10.so.0 for package: wine-core-1.4.1-1.el6.i686     ---> Package wine-core.x86_64 0:1.4.1-1.el6 will be an update     ---> Package wine-courier-fonts.noarch 0:1.2.3-1.el6 will be updated     ---> Package wine-courier-fonts.noarch 0:1.4.1-1.el6 will be an update     ---> Package wine-desktop.noarch 0:1.2.3-1.el6 will be updated     ---> Package wine-desktop.noarch 0:1.4.1-1.el6 will be an update     ---> Package wine-fonts.noarch 0:1.2.3-1.el6 will be updated     ---> Package wine-fonts.noarch 0:1.4.1-1.el6 will be an update     --> Processing Dependency: wine-tahoma-fonts = 1.4.1-1.el6 for package: wine-fonts-1.4.1-1.el6.noarch     --> Processing Dependency: wine-ms-sans-serif-fonts = 1.4.1-1.el6 for package: wine-fonts-1.4.1-1.el6.noarch     ---> Package wine-ldap.i686 0:1.2.3-1.el6 will be updated     ---> Package wine-ldap.x86_64 0:1.2.3-1.el6 will be updated     ---> Package wine-ldap.i686 0:1.4.1-1.el6 will be an update     ---> Package wine-ldap.x86_64 0:1.4.1-1.el6 will be an update     ---> Package wine-marlett-fonts.noarch 0:1.2.3-1.el6 will be updated     ---> Package wine-marlett-fonts.noarch 0:1.4.1-1.el6 will be an update     ---> Package wine-pulseaudio.i686 0:1.2.3-1.el6 will be updated     ---> Package wine-pulseaudio.x86_64 0:1.2.3-1.el6 will be updated     ---> Package wine-pulseaudio.i686 0:1.4.1-1.el6 will be an update     --> Processing Dependency: wine-alsa(x86-32) = 1.4.1-1.el6 for package: wine-pulseaudio-1.4.1-1.el6.i686     --> Processing Dependency: alsa-plugins-pulseaudio(x86-32) for package: wine-pulseaudio-1.4.1-1.el6.i686     ---> Package wine-pulseaudio.x86_64 0:1.4.1-1.el6 will be an update     --> Processing Dependency: wine-alsa(x86-64) = 1.4.1-1.el6 for package: wine-pulseaudio-1.4.1-1.el6.x86_64     ---> Package wine-small-fonts.noarch 0:1.2.3-1.el6 will be updated     ---> Package wine-small-fonts.noarch 0:1.4.1-1.el6 will be an update     ---> Package wine-symbol-fonts.noarch 0:1.2.3-1.el6 will be updated     ---> Package wine-symbol-fonts.noarch 0:1.4.1-1.el6 will be an update     ---> Package wine-system-fonts.noarch 0:1.2.3-1.el6 will be updated     ---> Package wine-system-fonts.noarch 0:1.4.1-1.el6 will be an update     ---> Package wine-twain.i686 0:1.2.3-1.el6 will be updated     ---> Package wine-twain.x86_64 0:1.2.3-1.el6 will be updated     ---> Package wine-twain.i686 0:1.4.1-1.el6 will be an update     ---> Package wine-twain.x86_64 0:1.4.1-1.el6 will be an update     ---> Package wine-wow.x86_64 0:1.2.3-1.el6 will be updated     ---> Package wine-wow.x86_64 0:1.4.1-1.el6 will be an update     --> Running transaction check     ---> Package alsa-plugins-pulseaudio.i686 0:1.0.21-3.el6 will be installed     ---> Package gstreamer.i686 0:0.10.29-1.el6 will be installed     ---> Package gstreamer-plugins-base.i686 0:0.10.29-1.el6 will be installed     --> Processing Dependency: libtheoraenc.so.1(libtheoraenc_1.0) for package: gstreamer-plugins-base-0.10.29-1.el6.i686     --> Processing Dependency: libcdda_interface.so.0 for package: gstreamer-plugins-base-0.10.29-1.el6.i686     --> Processing Dependency: liboil-0.3.so.0 for package: gstreamer-plugins-base-0.10.29-1.el6.i686     --> Processing Dependency: libtheoradec.so.1(libtheoradec_1.0) for package: gstreamer-plugins-base-0.10.29-1.el6.i686     --> Processing Dependency: libvisual-0.4.so.0 for package: gstreamer-plugins-base-0.10.29-1.el6.i686     --> Processing Dependency: libcdda_paranoia.so.0 for package: gstreamer-plugins-base-0.10.29-1.el6.i686     --> Processing Dependency: libtheoradec.so.1 for package: gstreamer-plugins-base-0.10.29-1.el6.i686     --> Processing Dependency: libgudev-1.0.so.0 for package: gstreamer-plugins-base-0.10.29-1.el6.i686     --> Processing Dependency: libtheoraenc.so.1 for package: gstreamer-plugins-base-0.10.29-1.el6.i686     ---> Package wine-alsa.i686 0:1.4.1-1.el6 will be installed     ---> Package wine-alsa.x86_64 0:1.4.1-1.el6 will be installed     ---> Package wine-ms-sans-serif-fonts.noarch 0:1.4.1-1.el6 will be installed     ---> Package wine-openal.i686 0:1.4.1-1.el6 will be installed     --> Processing Dependency: libopenal.so.1 for package: wine-openal-1.4.1-1.el6.i686     ---> Package wine-openal.x86_64 0:1.4.1-1.el6 will be installed     --> Processing Dependency: libopenal.so.1()(64bit) for package: wine-openal-1.4.1-1.el6.x86_64     ---> Package wine-tahoma-fonts.noarch 0:1.4.1-1.el6 will be installed     --> Running transaction check     ---> Package cdparanoia-libs.i686 0:10.2-5.1.el6 will be installed     ---> Package libgudev1.i686 0:147-2.40.el6 will be installed     --> Processing Dependency: libudev = 147-2.40.el6 for package: libgudev1-147-2.40.el6.i686     --> Processing Dependency: libudev.so.0 for package: libgudev1-147-2.40.el6.i686     ---> Package liboil.i686 0:0.3.16-4.1.el6 will be installed     ---> Package libtheora.i686 1:1.1.0-2.el6 will be installed     ---> Package libvisual.i686 0:0.4.0-9.1.el6 will be installed     ---> Package wine-openal.i686 0:1.4.1-1.el6 will be installed     --> Processing Dependency: libopenal.so.1 for package: wine-openal-1.4.1-1.el6.i686     ---> Package wine-openal.x86_64 0:1.4.1-1.el6 will be installed     --> Processing Dependency: libopenal.so.1()(64bit) for package: wine-openal-1.4.1-1.el6.x86_64     --> Running transaction check     ---> Package libudev.i686 0:147-2.40.el6 will be installed     ---> Package wine-openal.i686 0:1.4.1-1.el6 will be installed     --> Processing Dependency: libopenal.so.1 for package: wine-openal-1.4.1-1.el6.i686     ---> Package wine-openal.x86_64 0:1.4.1-1.el6 will be installed     --> Processing Dependency: libopenal.so.1()(64bit) for package: wine-openal-1.4.1-1.el6.x86_64     --> Finished Dependency Resolution     Error: Package: wine-openal-1.4.1-1.el6.i686 (epel)            Requires: libopenal.so.1     Error: Package: wine-openal-1.4.1-1.el6.x86_64 (epel)            Requires: libopenal.so.1()(64bit)      You could try using --skip-broken to work around the problem      You could try running: rpm -Va --nofiles --nodigest     [root@NOTEBOOK /etc/yum.repos.d] yum update --skip-broken     Loaded plugins: fastestmirror, presto, security     Loading mirror speeds from cached hostfile      * epel: mirror.pmf.kg.ac.rs      * rpmforge: ftp.lug.ro      * sl: ftp.scientificlinux.org      * sl-security: ftp.scientificlinux.org     Setting up Update Process     Resolving Dependencies     --> Running transaction check     ---> Package wine.x86_64 0:1.2.3-1.el6 will be updated     ---> Package wine.x86_64 0:1.4.1-1.el6 will be an update     --> Processing Dependency: wine-openal(x86-64) = 1.4.1-1.el6 for package: wine-1.4.1-1.el6.x86_64     --> Processing Dependency: wine-openal(x86-32) = 1.4.1-1.el6 for package: wine-1.4.1-1.el6.x86_64     ---> Package wine-capi.i686 0:1.2.3-1.el6 will be updated     ---> Package wine-capi.x86_64 0:1.2.3-1.el6 will be updated      ...bla-bla               --> Processing Dependency: wine-common = 1.2.3-1.el6 for package: wine-desktop-1.2.3-1.el6.noarch     --> Processing Dependency: wine-common = 1.2.3-1.el6 for package: wine-core-1.2.3-1.el6.i686     --> Processing Dependency: wine-common = 1.2.3-1.el6 for package: wine-core-1.2.3-1.el6.x86_64     --> Finished Dependency Resolution     Skip-broken could not solve problems     Error: Package: wine-openal-1.4.1-1.el6.i686 (epel)            Requires: libopenal.so.1     Error: Package: wine-openal-1.4.1-1.el6.x86_64 (epel)            Requires: libopenal.so.1()(64bit)      You could try running: rpm -Va --nofiles --nodigest     [root@NOTEBOOK /etc/yum.repos.d]      [root@NOTEBOOK /etc/yum.repos.d] rpm -Va --nofiles --nodigest     [root@NOTEBOOK /etc/yum.repos.d]      ..and the same starts again if I yum update.. I can't install the               wine-openal.i686 : Openal support for wine     wine-openal.x86_64 : Openal support for wine      why?? I tryied to yum remove wine*..ok it removed all the wine* packages from my system, but... when I tried to yum install wine... the same error message with "Requires: libopenal.so.1"...came up.. I tried to:               rm -f /var/lib/rpm/__db*     rpm -vv --rebuilddb      but it didn't helped..               [root@NOTEBOOK /etc/yum.repos.d] ls     epel.repo           linux_signing_key.pub    mirrors-rpmforge-testing  sl.repo           virtualbox.repo     epel-testing.repo   mirrors-rpmforge         rpmforge.repo             sl.repo;502df2db     google-chrome.repo  mirrors-rpmforge-extras  sl-other.repo             sl.repo;502e1e13     [root@NOTEBOOK /etc/yum.repos.d]       I primary use rpmforge, and epel is just this:               [root@NOTEBOOK /etc/yum.repos.d] cat epel.repo      [epel]     name=Extra Packages for Enterprise Linux 6 - $basearch     #baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch     mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch     failovermethod=priority     enabled=1     gpgcheck=1     gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6     includepkgs=nss-mdns wine* gparted cups-pdf       Q: How can I resolve this problem? =============================================== UPDATE: I tried to download the:               http://rpm.pbone.net/index.php3/stat/4/idpl/15175751/dir/scientific_linux_6/com/openal-soft-1.12.854-1.el6.x86_64.rpm.html     http://rpm.pbone.net/index.php3/stat/4/idpl/15174245/dir/scientific_linux_6/com/openal-soft-1.12.854-1.el6.i686.rpm.html      but it gives "Error 550" ... ... So... I tried:               http://pkgs.org/centos-6-rhel-6/atrpms-i386/openal-soft-1.12.854-1.el6.i686.rpm/download/     http://pkgs.org/centos-6-rhel-6/epel-x86_64/openal-soft-1.12.854-1.el6.x86_64.rpm/download/      "rpm -i"-ed the two rpm packages (these packages provided the libopenal.so.1's..), then:               [root@NOTEBOOK /etc/yum.repos.d] yum install wine     Loaded plugins: fastestmirror, presto, security     Loading mirror speeds from cached hostfile      * epel: mirror.pmf.kg.ac.rs      * rpmforge: ftp.lug.ro      * sl: ftp1.scientificlinux.org      * sl-security: ftp1.scientificlinux.org     Setting up Install Process     Resolving Dependencies     --> Running transaction check     ---> Package wine.x86_64 0:1.4.1-1.el6 will be installed     --> Processing Dependency: wine-wow(x86-64) = 1.4.1-1.el6 for package: wine-1.4.1-1.el6.x86_64     --> Processing Dependency: wine-twain(x86-64) = 1.4.1-1.el6 for package: wine-1.4.1-1.el6.x86_64     --> Processing Dependency: wine-twain(x86-32) = 1.4.1-1.el6 for package: wine-1.4.1-1.el6.x86_64     --> Processing Dependency: wine-pulseaudio(x86-64) = 1.4.1-1.el6 for package: wine-1.4.1-1.el6.x86_64     --> Processing Dependency: wine-pulseaudio(x86-32) = 1.4.1-1.el6 for package: wine-1.4.1-1.el6.x86_64     --> Processing Dependency: wine-openal(x86-64) = 1.4.1-1.el6 for package: wine-1.4.1-1.el6.x86_64     --> Processing Dependency: wine-openal(x86-32) = 1.4.1-1.el6 for package: wine-1.4.1-1.el6.x86_64     --> Processing Dependency: wine-ldap(x86-64) = 1.4.1-1.el6 for package: wine-1.4.1-1.el6.x86_64     --> Processing Dependency: wine-ldap(x86-32) = 1.4.1-1.el6 for package: wine-1.4.1-1.el6.x86_64     --> Processing Dependency: wine-fonts = 1.4.1-1.el6 for package: wine-1.4.1-1.el6.x86_64     --> Processing Dependency: wine-desktop = 1.4.1-1.el6 for package: wine-1.4.1-1.el6.x86_64     --> Processing Dependency: wine-core(x86-64) = 1.4.1-1.el6 for package: wine-1.4.1-1.el6.x86_64     --> Processing Dependency: wine-core(x86-32) = 1.4.1-1.el6 for package: wine-1.4.1-1.el6.x86_64     --> Processing Dependency: wine-cms(x86-64) = 1.4.1-1.el6 for package: wine-1.4.1-1.el6.x86_64     --> Processing Dependency: wine-cms(x86-32) = 1.4.1-1.el6 for package: wine-1.4.1-1.el6.x86_64     --> Processing Dependency: wine-capi(x86-64) = 1.4.1-1.el6 for package: wine-1.4.1-1.el6.x86_64     --> Processing Dependency: wine-capi(x86-32) = 1.4.1-1.el6 for package: wine-1.4.1-1.el6.x86_64     --> Running transaction check     ---> Package wine-capi.i686 0:1.4.1-1.el6 will be installed     ---> Package wine-capi.x86_64 0:1.4.1-1.el6 will be installed     ---> Package wine-cms.i686 0:1.4.1-1.el6 will be installed     ---> Package wine-cms.x86_64 0:1.4.1-1.el6 will be installed     ---> Package wine-core.i686 0:1.4.1-1.el6 will be installed     --> Processing Dependency: wine-common = 1.4.1-1.el6 for package: wine-core-1.4.1-1.el6.i686     --> Processing Dependency: libgstreamer-0.10.so.0 for package: wine-core-1.4.1-1.el6.i686     --> Processing Dependency: libgstbase-0.10.so.0 for package: wine-core-1.4.1-1.el6.i686     --> Processing Dependency: libgstapp-0.10.so.0 for package: wine-core-1.4.1-1.el6.i686     ---> Package wine-core.x86_64 0:1.4.1-1.el6 will be installed     ---> Package wine-desktop.noarch 0:1.4.1-1.el6 will be installed     ---> Package wine-fonts.noarch 0:1.4.1-1.el6 will be installed     --> Processing Dependency: wine-tahoma-fonts = 1.4.1-1.el6 for package: wine-fonts-1.4.1-1.el6.noarch     --> Processing Dependency: wine-system-fonts = 1.4.1-1.el6 for package: wine-fonts-1.4.1-1.el6.noarch     --> Processing Dependency: wine-symbol-fonts = 1.4.1-1.el6 for package: wine-fonts-1.4.1-1.el6.noarch     --> Processing Dependency: wine-small-fonts = 1.4.1-1.el6 for package: wine-fonts-1.4.1-1.el6.noarch     --> Processing Dependency: wine-ms-sans-serif-fonts = 1.4.1-1.el6 for package: wine-fonts-1.4.1-1.el6.noarch     --> Processing Dependency: wine-marlett-fonts = 1.4.1-1.el6 for package: wine-fonts-1.4.1-1.el6.noarch     --> Processing Dependency: wine-courier-fonts = 1.4.1-1.el6 for package: wine-fonts-1.4.1-1.el6.noarch     ---> Package wine-ldap.i686 0:1.4.1-1.el6 will be installed     ---> Package wine-ldap.x86_64 0:1.4.1-1.el6 will be installed     ---> Package wine-openal.i686 0:1.4.1-1.el6 will be installed     ---> Package wine-openal.x86_64 0:1.4.1-1.el6 will be installed     ---> Package wine-pulseaudio.i686 0:1.4.1-1.el6 will be installed     --> Processing Dependency: wine-alsa(x86-32) = 1.4.1-1.el6 for package: wine-pulseaudio-1.4.1-1.el6.i686     --> Processing Dependency: alsa-plugins-pulseaudio(x86-32) for package: wine-pulseaudio-1.4.1-1.el6.i686     ---> Package wine-pulseaudio.x86_64 0:1.4.1-1.el6 will be installed     --> Processing Dependency: wine-alsa(x86-64) = 1.4.1-1.el6 for package: wine-pulseaudio-1.4.1-1.el6.x86_64     ---> Package wine-twain.i686 0:1.4.1-1.el6 will be installed     ---> Package wine-twain.x86_64 0:1.4.1-1.el6 will be installed     ---> Package wine-wow.x86_64 0:1.4.1-1.el6 will be installed     --> Running transaction check     ---> Package alsa-plugins-pulseaudio.i686 0:1.0.21-3.el6 will be installed     ---> Package gstreamer.i686 0:0.10.29-1.el6 will be installed     ---> Package gstreamer-plugins-base.i686 0:0.10.29-1.el6 will be installed     --> Processing Dependency: libtheoraenc.so.1(libtheoraenc_1.0) for package: gstreamer-plugins-base-0.10.29-1.el6.i686     --> Processing Dependency: libcdda_interface.so.0 for package: gstreamer-plugins-base-0.10.29-1.el6.i686     --> Processing Dependency: liboil-0.3.so.0 for package: gstreamer-plugins-base-0.10.29-1.el6.i686     --> Processing Dependency: libtheoradec.so.1(libtheoradec_1.0) for package: gstreamer-plugins-base-0.10.29-1.el6.i686     --> Processing Dependency: libvisual-0.4.so.0 for package: gstreamer-plugins-base-0.10.29-1.el6.i686     --> Processing Dependency: libcdda_paranoia.so.0 for package: gstreamer-plugins-base-0.10.29-1.el6.i686     --> Processing Dependency: libtheoradec.so.1 for package: gstreamer-plugins-base-0.10.29-1.el6.i686     --> Processing Dependency: libgudev-1.0.so.0 for package: gstreamer-plugins-base-0.10.29-1.el6.i686     --> Processing Dependency: libtheoraenc.so.1 for package: gstreamer-plugins-base-0.10.29-1.el6.i686     ---> Package wine-alsa.i686 0:1.4.1-1.el6 will be installed     ---> Package wine-alsa.x86_64 0:1.4.1-1.el6 will be installed     ---> Package wine-common.noarch 0:1.4.1-1.el6 will be installed     ---> Package wine-courier-fonts.noarch 0:1.4.1-1.el6 will be installed     ---> Package wine-marlett-fonts.noarch 0:1.4.1-1.el6 will be installed     ---> Package wine-ms-sans-serif-fonts.noarch 0:1.4.1-1.el6 will be installed     ---> Package wine-small-fonts.noarch 0:1.4.1-1.el6 will be installed     ---> Package wine-symbol-fonts.noarch 0:1.4.1-1.el6 will be installed     ---> Package wine-system-fonts.noarch 0:1.4.1-1.el6 will be installed     ---> Package wine-tahoma-fonts.noarch 0:1.4.1-1.el6 will be installed     --> Running transaction check     ---> Package cdparanoia-libs.i686 0:10.2-5.1.el6 will be installed     ---> Package libgudev1.i686 0:147-2.40.el6 will be installed     --> Processing Dependency: libudev = 147-2.40.el6 for package: libgudev1-147-2.40.el6.i686     --> Processing Dependency: libudev.so.0 for package: libgudev1-147-2.40.el6.i686     ---> Package liboil.i686 0:0.3.16-4.1.el6 will be installed     ---> Package libtheora.i686 1:1.1.0-2.el6 will be installed     ---> Package libvisual.i686 0:0.4.0-9.1.el6 will be installed     --> Running transaction check     ---> Package libudev.i686 0:147-2.40.el6 will be installed     --> Finished Dependency Resolution     Error: Protected multilib versions: libudev-147-2.40.el6.i686 != libudev-147-2.41.el6.x86_64     Error: Protected multilib versions: libgudev1-147-2.40.el6.i686 != libgudev1-147-2.41.el6.x86_64      You could try using --skip-broken to work around the problem      You could try running: rpm -Va --nofiles --nodigest     [root@NOTEBOOK /etc/yum.repos.d]      [root@NOTEBOOK /etc/yum.repos.d] rpm -qa | grep -i libudev     libudev-147-2.41.el6.x86_64     [root@NOTEBOOK /etc/yum.repos.d]      ...so now I got a: Error: Protected multilib versions: libudev-147-2.40.el6.i686 != libudev-147-2.41.el6.x86_64 Error: Protected multilib versions: libgudev1-147-2.40.el6.i686 != libgudev1-147-2.41.el6.x86_64 error message... what to do next?? how can I fix this??


Moving /usr to its own filesystem/logical volume

My Fedora 17 (x64 - running on VMware Workstation 8) root filesystem is running out of space (this was an install using the default layout as suggested by the Fedora installer):               # df -h     Filesystem                    Size  Used Avail Use% Mounted on     rootfs                         18G   17G  937M  95% /     devtmpfs                      1.5G     0  1.5G   0% /dev     tmpfs                         1.5G  224K  1.5G   1% /dev/shm     tmpfs                         1.5G   51M  1.5G   4% /run     /dev/mapper/vg_bloss-lv_root   18G   17G  937M  95% /     tmpfs                         1.5G   51M  1.5G   4% /run     tmpfs                         1.5G     0  1.5G   0% /sys/fs/cgroup     tmpfs                         1.5G     0  1.5G   0% /media     /dev/sda2                     485M   85M  376M  19% /boot      The bulk of the space is taken up by the `/usr` directory. I have added a 40GB disk to the virtual machine (`/dev/sdb`) and wish to move `/usr` to its own logical volume. LVM is a bit new to me but I think I've worked out the steps to add this disk using LVM:               fdisk /dev/sdb      # (create a new 0x8e LVM partition type using all of the disk)          pvcreate /dev/sdb1     vgextend vg_bloss /dev/sdb1     lvcreate -l +100%FREE -n lv_usr vg_bloss /dev/sdb1     mkfs -t ext4 /dev/vg_bloss/lv_usr     # mount fs     mkdir /mnt/usr     mount -t ext4 /dev/vg_bloss/lv_usr /mnt/usr      I was then going to use the following steps to move `/usr` onto this new filesystem:               cp -aR /usr/* /mnt/usr     umount /mnt/usr     # add relevant mount entry in /etc/fstab:     # /dev/mapper/vg_bloss-lv_usr /usr    ext4    defaults    1 1     mv /usr /usr_old     mkdir /usr     mount -t ext4 /dev/vg_bloss/lv_usr /usr     reboot      Then when I'm happy that `/usr` seems intact and behaving normally I'll just delete it to free up space on `/`. Does this look sane?


Difference between “machine hardware”, "processor type" and “hardware platform”

My Linux machine reports "uname -a" outputs as below:               [root@tom i386]# uname -a     Linux tom 2.6.9-89.ELsmp #1 SMP Mon Apr 20 10:34:33 EDT 2009 i686 i686 i386 GNU/Linux     [root@tom i386]#      As per man page of uname, the entries "i686 i686 i386" denotes:   * machine hardware name (i686)   * processor type (i686)   * hardware platform (i386) Additional information:               [root@tom i386]# cat /proc/cpuinfo          <snip>     vendor_id    : GenuineIntel     CPU family   : 6     model        : 15     model name   : Intel(R) Xeon(R) CPU            5148  @ 2.33 GHz     stepping     : 6     CPU MHz      : 2328.038     cache size   : 4096 KB     </snip>      How to differentiate between these three entries ("i686 i686 i386") ?


Linux/Unix variant for training system administrators

Is there a Linux/Unix based operating system used for training sysadmins? Some bugs would be deliberately included in the system and the training candidate is supposed to solve all of them. It should be something similar to WebGoat.


Why does US International Keyboard break Alt_R

All adding the U.S. English International (with dead keys) keyboard layout breaks my Alt_R key. Any ideas why? I'm working on RHEL 5.5 using GNOME. The problem disappears if I remove the additional layout and reappears if I add it back. Specific problems include Alt-F2 not working to start the run application app if using Alt_R and CTRL-Alt-L not working for screen looking again if using Alt_R. I tried using xev to troubleshoot. Here's what I get with just the U.S. English layout:               KeyPress event, serial 29, synthetic NO, window 0x1e00001,         root 0x3a2, subw 0x0, time 1766794207, (169,-13), root:(2099,35),         state 0x0, keycode 113 (keysym 0xffea, Alt_R), same_screen YES,         XLookupString gives 0 bytes:          XmbLookupString gives 0 bytes:          XFilterEvent returns: False          KeyRelease event, serial 29, synthetic NO, window 0x1e00001,         root 0x3a2, subw 0x0, time 1766794447, (169,-13), root:(2099,35),         state 0x8, keycode 113 (keysym 0xffea, Alt_R), same_screen YES,         XLookupString gives 0 bytes:          XFilterEvent returns: False        Here's what I get with the U.S. English International (with dead keys) layout:               KeyPress event, serial 26, synthetic NO, window 0x1e00001,         root 0x3a2, subw 0x0, time 1766853750, (169,-13), root:(2099,35),         state 0x0, keycode 113 (keysym 0xffea, Alt_R), same_screen YES,         XLookupString gives 0 bytes:          XmbLookupString gives 0 bytes:          XFilterEvent returns: False          KeyRelease event, serial 29, synthetic NO, window 0x1e00001,         root 0x3a2, subw 0x0, time 1766853872, (169,-13), root:(2099,35),         state 0x80, keycode 113 (keysym 0xffea, Alt_R), same_screen YES,         XLookupString gives 0 bytes:          XFilterEvent returns: False      It makes no difference whether that layout is actually being used at the moment. Just having it in the selected list breaks things. If this is a bug, does anyone know where it should be filed (GNOME, Xorg, Redhat)? **EDIT** : I realized now that I can see my modifier mapping using xmodmap. Initially, mod5 was mapped to mod5 Mode_switch (0x5d) and ISO_Level3_Shift (0x7c). Adding the international layout, maps Alt_R (0x71) to mod5 as well, which why I'm having this problem. Based on Caleb's recommendation, I switched Alt_R to be an ISO_Level3_Shift such that mod5 is now mapped to "mod5 Mode_switch (0x5d), ISO_Level3_Shift (0x71), ISO_Level3_Shift (0x7c)". This still breaks Alt_R as an Alt_L alternative though.


Driver is sometimes loaded, sometimes not

I was assigned an Ubuntu desktop with some stuff already on it. I did not reformat it, but attached a mini-PCI wireless card over a PCI to mini-PCI adapter. I manually built the `madwifi` driver and installed its .ko files. Now `lshw -C network` always shows the card, but it sometimes shows it as 'unclaimed' and sometimes it shows with the `madwifi` (i.e. `ath_pci`) driver. Any idea what can cause this effect? EDIT: Snippet from `/var/log/kern.log`, on failed load.               Apr 19 11:47:21 manju-desktop kernel: [    9.935304] ath_hal: module license 'Proprietary' taints kernel.     Apr 19 11:47:21 manju-desktop kernel: [    9.936614] ath_hal: 0.9.18.0 (AR5210, AR5211, AR5212, RF5111, RF5112, RF2413, RF5413)     Apr 19 11:47:21 manju-desktop kernel: [    9.958671] wlan: svn r4133 (branch madwifi-0.9.4)     Apr 19 11:47:21 manju-desktop kernel: [    9.975867] ath_pci: svn r4133 (branch madwifi-0.9.4)     Apr 19 11:47:21 manju-desktop kernel: [    9.975940] ath_pci 0000:02:04.0: PCI INT A -> GSI 17 (level, low) -> IRQ 17     Apr 19 11:47:21 manju-desktop kernel: [    9.976024] ath_pci: HAL doesn't support MAC revision 0xffffffff     Apr 19 11:47:21 manju-desktop kernel: [    9.976037] ath_pci 0000:02:04.0: PCI INT A disabled      Output of `lshw -C network`                 *-network:1 UNCLAIMED            description: Ethernet controller            product: AR5413 802.11abg NIC            vendor: Atheros Communications Inc.            physical id: 4            bus info: pci@0000:02:04.0            version: 01            width: 32 bits            clock: 33MHz            capabilities: pm cap_list            configuration: latency=168 maxlatency=12 mingnt=10


Need to parse a double entry table with two pairs

I have this two-entry table resulting from a program output:               Variable1  : Value1       Variable2  : Value2       Variable3  : Value3       Variable4  : Value4       Variable5  : Value5       Variable6  : Value6       Variable7  : Value7       I need to extract both the first and the fifth pairr\s, something I do with grep:               $ {program command} | grep -e Variable1 -e Variable5      resulting in this output:               Variable1  : Value1       Variable5  : Value5        The problem here is that I need both pairs on the _same_ line but the grep -e command prints a LF/CR after every -e; I need the four pairs in the same line to make a final sort based on file size. I think I could make this in awk or perl from the same command line but alas I'm still somewhat green with them. Any ideas? Thanks in advance.


Sound doesn't work in x, but does in virtual terminal

I've just installed Fedora 19, bringing over my home directory. I've disabled graphical boot, instead I get dumped to a virtual terminal. I use xmonad instead of gnome3. # weird phenomenon #1 In a virtual terminal, I can run `alsamixer -c0` as my normal user without problem. When I launch X (`startx -- vt3`), I open a terminal, run `alsamixer -c0`, and it doesn't work, saying:               % alsamixer -c0     invalid card index: 0     try `alsamixer --help' for more information      So now I'm in an Xsession, as my normal user, and alsamixer is borked. If I run `sudo alsamixer -c0`, it works. Also, I can switch back to a virtual terminal and run it as my normal user. Pulse is installed and running. I can hear audio played from the virtual terminal. I've tried starting x, killing pulse, and manually starting pulse, but I still only see pulse's dummy device. `aplay -l` in a virtual terminal:               19:06:28 jake@localhost]~% aplay -l     **** List of PLAYBACK Hardware Devices ****     card 0: PCH [HDA Intel PCH], device 0: ALC262 Analog [ALC262 Analog]       Subdevices: 1/1       Subdevice #0: subdevice #0     card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]       Subdevices: 1/1       Subdevice #0: subdevice #0     card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]       Subdevices: 1/1       Subdevice #0: subdevice #0     card 1: NVidia [HDA NVidia], device 7: HDMI 0 [HDMI 0]       Subdevices: 1/1       Subdevice #0: subdevice #0     card 1: NVidia [HDA NVidia], device 8: HDMI 0 [HDMI 0]       Subdevices: 1/1       Subdevice #0: subdevice #0     card 1: NVidia [HDA NVidia], device 9: HDMI 0 [HDMI 0]       Subdevices: 1/1       Subdevice #0: subdevice #0      `aplay -l` in an xsession:               19:06:51 jake@localhost]~% aplay -l     aplay: device_list:268: no soundcards found...      # weird phenomenon #2 If I start playing some music in the virtual terminal, and switch over to an x session, `mplayer` pauses. Like, I hear music, note the play position, switch to x session, the music stops, I wait ten seconds, switch back to the vt, the music starts, play position is where it was when I switched to X. # permissions of `/dev/snd/*`               % ls -l /dev/snd*     total 0     drwxr-xr-x. 2 root root       80 Jul  9 13:00 by-path/     crw-rw----+ 1 root audio 116,  8 Jul  9 13:00 controlC0     crw-rw----+ 1 root audio 116, 17 Jul  9 13:00 controlC1     crw-rw----+ 1 root audio 116,  7 Jul  9 13:00 hwC0D0     crw-rw----+ 1 root audio 116,  6 Jul  9 13:00 hwC0D3     crw-rw----+ 1 root audio 116, 16 Jul  9 13:00 hwC1D0     crw-rw----+ 1 root audio 116, 15 Jul  9 13:00 hwC1D1     crw-rw----+ 1 root audio 116, 14 Jul  9 13:00 hwC1D2     crw-rw----+ 1 root audio 116, 13 Jul  9 13:00 hwC1D3     crw-rw----+ 1 root audio 116,  5 Jul 10 09:13 pcmC0D0c     crw-rw----+ 1 root audio 116,  4 Jul 10 09:13 pcmC0D0p     crw-rw----+ 1 root audio 116,  3 Jul  9 13:00 pcmC0D2c     crw-rw----+ 1 root audio 116,  2 Jul 10 09:13 pcmC0D3p     crw-rw----+ 1 root audio 116, 12 Jul 10 09:13 pcmC1D3p     crw-rw----+ 1 root audio 116, 11 Jul 10 09:13 pcmC1D7p     crw-rw----+ 1 root audio 116, 10 Jul 10 09:13 pcmC1D8p     crw-rw----+ 1 root audio 116,  9 Jul 10 09:13 pcmC1D9p     crw-rw----+ 1 root audio 116,  1 Jul  9 13:00 seq     crw-rw----+ 1 root audio 116, 33 Jul  9 13:00 timer      getfacl run in x:               % getfacl /dev/snd/controlC0      getfacl: Removing leading '/' from absolute path names     # file: dev/snd/controlC0     # owner: root     # group: audio     user::rw-     group::rw-     mask::rw-     other::---      getfacl run in virtual terminal:               # file: dev/snd/controlC0     # owner: root     # group: audio     user::rw-     user:jake:rw-     group::rw-     mask::rw-     other::---      Any idea what's going on?


Vim paste string with non-ASCII characters

I am trying to paste a string from a register in VIM which contains non-ASCII characters such as `Ctrl``r`, how can I paste this string into a file, but escape the non-ASCII characters automatically? Essentially, what I am trying to achieve is recording a macro which has some (non-ascii) characters, such as `Ctrl``W` which vim will show as ^W. I want to be able to take the macro (by examining the registers and taking the macro string (i.e @a=^W)) and copying it into a .vimrc file as a key-map, so that when I press the key it will run that macro. I want to do this automatically (or as fast as possible) without having to change ^W into `Ctrl``W` in the .vimrc file, or wherever I paste it too.


How to find the machine from which a user logged into current machine using ssh?

In a multi server architecture, is it possible to find out from which machine a user logged into current machine using `ssh`? For example, `user1` logged into `host1`. From there, the user logged into `host2` as `sruser` using `ssh`. In above example, would it be possible to trace the `sruser` session of `host2` back to `user1` session in `host1`? Would it be possible to get the hostname or terminal of `user1` session?


clamd randomly stops

I am using clamav in conjuction with c-icap to filter content with squid. I am also using the safebrowsing functionality of clamav to block access to bad domains. For some reason or another, clamav (clamd), suddenly stops running and I see that the c-icap service cannot connect to socket clamd socket. However, I don't see anything in the log files indicating why clamav suddenly stopped. I checked the following basics: 1. clamav logs (syslog output) 2. free space 3. dmesg [Unit] Description = clamd scanner (%i) daemon After = syslog.target nss- lookup.target network.target               [Service]     Type = simple     ExecStart = /usr/sbin/clamd -c /etc/clamd.d/%i.conf --nofork=yes     #Restart = on-failure     Restart = always     PrivateTmp = true     PIDFile=/var/run/clamav/%i.pid          [Install]     Also=clamd@.socket     WantedBy=multi-user.target      Any ideas what may be causing clamav to suddenly stop?


Hide lines based on multiple patterns

I'm using `less` to view log files quite a lot and every so often I'd like to filter the output by hiding lines which contains _some keywords_. In `less` it's possible to filter-out lines with `&!<keyword>` but that only works for one keyword at a time. I'd like to specify a list of keywords to filter-out. Is this at all possible?


Cannot install zone on Solaris 11

I am trying to install a _zone_ on Solaris 11. I am using these instructions. I get up to _Listing 2_ when the error occurs.                   # zoneadm -z testzone install         The following ZFS file system(s) have been created:             rpool/zones/testzone         Progress being logged to /var/log/zones/zoneadm.20140522T025544Z.testzone.install                Image: Preparing at /zones/testzone/root.             ERROR: an exception occurred.                  'NoneType' object has no attribute 'bind'                 Please check logs for further information.        ERROR: auto-install failed.      The install log is:               root@solaris-11:~# cat /var/log/zones/zoneadm.20140523T065105Z.testzone.install         [Fri May 23 16:51:05 EST 2014] ==== Starting: /usr/lib/brand/solaris/pkgcreatezone -z testzone -R /zones/testzone ====         [Fri May 23 16:51:05 EST 2014] Progress being logged to /var/log/zones/zoneadm.20140523T065105Z.testzone.install         [Fri May 23 16:51:08 EST 2014]        Image: Preparing at /zones/testzone/root.         [Fri May 23 16:51:12 EST 2014] Running auto-install: '/usr/bin/auto-install -z testzone -Z rpool/zones/testzone/rpool -m /tmp/manifest.xml.PCa4ad -c /usr/share/auto_install/sc_profiles/enable_sci.xml'         [Fri May 23 16:51:14 EST 2014] ERROR: auto-install failed.         [Fri May 23 16:51:14 EST 2014] Exiting with exit code 255         [Fri May 23 16:51:14 EST 2014] ==== Completed: /usr/lib/brand/solaris/pkgcreatezone -z testzone -R /zones/testzone  ==== Zonecfg results:                   root@solaris-11:~# zonecfg -z testzone export         create -b         set brand=solaris         set zonepath=/zones/testzone         set autoboot=true         set bootargs=-m verbose         set ip-type=exclusive         add anet         set linkname=net0         set lower-link=auto         set configure-allowed-address=true         set link-protection=mac-nospoof         set mac-address=random         end Zonecfg info:                   root@solaris-11:~# zonecfg -z testzone info         zonename: testzone         zonepath: /zones/testzone         brand: solaris         autoboot: true         bootargs: -m verbose         file-mac-profile:         pool:         limitpriv:         scheduling-class:         ip-type: exclusive         hostid:         fs-allowed:         anet:             linkname: net0             lower-link: auto             allowed-address not specified             configure-allowed-address: true             defrouter not specified             allowed-dhcp-cids not specified             link-protection: mac-nospoof             mac-address: random             mac-prefix not specified             mac-slot not specified             vlan-id not specified             priority not specified             rxrings not specified             txrings not specified             mtu not specified             maxbw not specified             rxfanout not specified             vsi-typeid not specified             vsi-vers not specified             vsi-mgrid not specified             etsbw-lcl not specified             cos not specified             pkey not specified             linkmode not specified         root@solaris-11:~#


How to set up Cron to run mysqlauditgrep command for 11AM on Friday

I am trying to set up cron to run the `mysqlauditgrep` command (its the MySQL 5.6 Utilities package). The `mysqlauditgrep` command is in bash. The command I am looking to run is:               mysqlauditgrep --format=GRID /var/lib/mysql/audit.log      This command will make my audit log that has been created by `mysql` to be viewed in a Grid format. It is not run in the `mysql` shell. So I just installed Cron and set up the crontab by setting this:               00 11 * * fri root usr/bin/mysqlauditgrep   mysqlauditgrep --format=GRID /var/lib/mysql/audit.log      I am new to cron so maybe I set it up wrong. I did run `/sbin/service crond start` after I changed the crontab file. I am unable to see if the action has taken place though.


What code should I use to download and install my script into a user-writable directory in the user's PATH (without requiring sudo)?

Edit: places where I said $HOME/.bin I should have written $HOME/bin or any equivalent is fine. I.E, any user-writable directory that is in the user's PATH. So I have a bash script which I am distributing as a client for my API. Current version installs like this `curl -s http://api.blah.com/install | sudo sh`. I may try to deal with six different package management systems so that they can just `apt-get` or `brew install` at some point, but for now I am going with the one-liner since I want this solution to work for multiple systems. However, apparently there are quite a few users on systems like cygwin or even Macs who don't have sudo at all or don't have it set up. The scenario is a user signs up for my API, enters their credit card information. I have a bash client for the API that doubles as a reference implementation and also a way to try out the API or deploy VMs and Docker containers using the command line. I want to create an easy way for users to install the API client. For example, there used to be a one-line install for npm `curl http://npmjs.org/install.sh | sh`. Also homebrew has a one-line installer `ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"` (see http://brew.sh). My install script just downloads the API client script and puts it in /usr/bin and makes it executable. But I am thinking based on the issues with sudo and the fact that this doesn't really need to be installed globally, I would like to just install it into the user's $HOME/.bin or $HOME/local/bin (create that if it there is no existing equivalent). This is my current install script:               #!/bin/bash     BASE="https://api.blah.com"          sudo bash -c "curl -s $BASE/mycmd > /usr/bin/mycmd"     sudo chmod uga+x /usr/bin/mycmd      First wrinkle that occurs to me is that many users are now in zsh. So if I add or modify a line in ~/.bashrc that updates the PATH to include $HOME/.bin, that won't work for those systems. So to restate the question, **what code should I use to download and install my script into a user-writable directory in that user's PATH ($HOME/local/bin, or whatever is available in PATH by default) directory and make sure that is in their PATH, with the requirement (or at least strong desire) that this will work on almost everyone's system (if they have something like a Unix prompt) (without requiring sudo)?** Since some people consider modifying the PATH to be evil, I would like to install in the default $HOME/whatever/bin for that system, that is already in the user's PATH, if possible, rather than automatically modifying their PATH to include some particular directory. Thanks very much!


How to create an executable bash script for these commands?

I wish to create an executable bash script that will run the following commands as root, that is, using sudo su               iptables-save | awk '/^[*]/ { print $1 }                           /^:[A-Z]+ [^-]/ { print $1 " ACCEPT" ; }                          /COMMIT/ { print $0; }' | iptables-restore      My first attempt at bash scripting is as follows:               #!/bin/bash     sudo su     iptables-save | awk '/^[*]/ { print $1 }                           /^:[A-Z]+ [^-]/ { print $1 " ACCEPT" ; }                          /COMMIT/ { print $0; }' | iptables-restore     sleep 3;     exit 0      Could someone correct the above and make it workable?


Microphone not working on Centos 6.5

I have installed CentOS 6.5 on a Dell Insperion with an Intel chip. I first noticed that my microphone is not working on Skype on CentOS although it was working fine with Windows 7 on the same box. The speakers work fine on both operating systems. I did the following test.               arecord -vv -d 10 test.wav     aplay -vv test.wav      and did not get any sound played back. I went to System:Preferences:Sound to get the Sound Preferences dialog. I went to the Input tab and "Microphone" was selected as the connector. I turned the input volume up to maximum and spoke into the microphone but the "Input level" boxes all remained a light grey like it was disabled. The only option for "Choose a device for sound input" is "Internal Audio Analog Stereo".


generate consistent machine unique ID

Can we generate a unique id for each PC, something like uuuidgen, but it will never change unless there are hardware changes? I was thinking about merging CPUID and MACADDR and hash them to generate a consistent ID, but I have no idea how to parse them using bash script, what I know is how can I get CPUID from               dmidecode -t 4 | grep ID      and               ifconfig | grep ether      then I need to combine those hex strings and hash them using sha1 or md5 to create fixed length hex string.   How can I parse that output?


What is the default behavior of %install?

I am attempting to build an RPM using the `-bb` flag (%prep %build %install %check package). This is the output of the %install step:               Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.2kgeNY     + umask 022     + cd /<redacted>/BUILD     + '[' /<redacted>/BUILDROOT/<redacted>.i386 '!=' / ']'     + rm -rf /<redacted>/BUILDROOT/<redacted>.i386     ++ dirname /<redacted>/BUILDROOT/<redacted>.i386     + mkdir -p /<redacted>/BUILDROOT     + mkdir /<redacted>/BUILDROOT/<redacted>.i386     + /usr/lib/rpm/check-buildroot     + /usr/lib/rpm/redhat/brp-compress     + /usr/lib/rpm/redhat/brp-strip /usr/bin/strip     + /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump     + /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip     + /usr/lib/rpm/brp-python-bytecompile /usr/bin/python 1     + /usr/lib/rpm/redhat/brp-python-hardlink     + /usr/lib/rpm/redhat/brp-java-repack-jars      Here are the contents of that tmp file:                 RPM_SOURCE_DIR="/<redacted>/SOURCES"       RPM_BUILD_DIR="/<redacted>/BUILD"       RPM_OPT_FLAGS="-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m32 -march=x86-64 -mtune=generic -mfpmath=sse -fasynchronous-unwind-tables"       RPM_LD_FLAGS="-Wl,-z,relro "       RPM_ARCH="i386"       RPM_OS="linux"       export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_LD_FLAGS RPM_ARCH RPM_OS       RPM_DOC_DIR="/usr/share/doc"       export RPM_DOC_DIR       RPM_PACKAGE_NAME="<redacted>"       RPM_PACKAGE_VERSION="<redacted>"       RPM_PACKAGE_RELEASE="<redacted>"       export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE       LANG=C       export LANG       unset CDPATH DISPLAY ||:       RPM_BUILD_ROOT="/<redacted>/BUILDROOT/<redacted>.i386"       export RPM_BUILD_ROOT            PKG_CONFIG_PATH="%{_PKG_CONFIG_PATH}:/usr/lib/pkgconfig:/usr/share/pkgconfig"       export PKG_CONFIG_PATH       set -x       umask 022       cd "/<redacted>/BUILD"         [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "${RPM_BUILD_ROOT}"         mkdir -p `dirname "$RPM_BUILD_ROOT"`         mkdir "$RPM_BUILD_ROOT"                             /usr/lib/rpm/check-buildroot              /usr/lib/rpm/redhat/brp-compress              /usr/lib/rpm/redhat/brp-strip /usr/bin/strip         /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump              /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip         /usr/lib/rpm/brp-python-bytecompile /usr/bin/python 1         /usr/lib/rpm/redhat/brp-python-hardlink         /usr/lib/rpm/redhat/brp-java-repack-jars      I have not overwritten the %install behavior in my spec file. My spec file looks like this:               <stuff>     %prep     %build     %install     %files     <more stuff>      Is the default %install behavior defined in the `rpm-builder` documentation anywhere? How do I know what it's going to execute?


How do I re-stream a filtered video stream using VLC?

I have an input RTSP stream that I want to apply the "cartoon" gradient filter to before streaming on http. I've managed to stream and apply the filter to the local playback, but the http stream does not have the filtering applied.               cvlc -vvv input_stream rtsp://10.217.12.20:554/axis-media/media.amp?videocodec=h264 --video-filter "gradient{type=1}" --sout '#duplicate{dst=http{vfilter=gradient{type=1},mux=ffmpeg{mux=flv},dst=:8080/coffeecam},dst=display}'


sssd: login problems with AD user

I've setup my samba4 DC to get account information from a central AD provider via sssd. What I'd like to do now is permit some subset of these users to login via ssh (to linux machines) or via RDP (to windows machines). I can get passwd information from the AD provider using `getent passwd <name>`. Unfortunately this is coming in with params that don't seem to work locally: > johndoe:*:53122:513:John Doe:\\nafs2\u204\johndoe:212578 The errors in `/var/log/secure` appear as follows:               Jul 16 03:42:46 beanbag sshd[3303]: User johndoe not allowed because shell 212578 does not exist       Jul 16 03:42:46 beanbag sshd[3304]: input_userauth_request: invalid user johndoe       Jul 16 03:42:50 beanbag sshd[3303]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=server.edu  user=johndoe       Jul 16 03:42:51 beanbag sshd[3303]: pam_sss(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=server.edu user=johndoe       Jul 16 03:42:51 beanbag sshd[3303]: pam_sss(sshd:auth): received for user johndoe: 6 (Permission denied)       Jul 16 03:42:53 beanbag sshd[3303]: Failed password for invalid user johndoe from 10.95.20.20 port 1714 ssh2      What step(s) have I missed in getting sssd (and it's kin) setup? CentOS 6.4 (x64) NOTE: I have run `authconfig --enablesssd --enablesssdauth --update`. * * * EDIT: Fixed the first part of this problem - 'shell does not exist'. FIX: in `/etc/sssd/sssd.conf` add these lines to the [nss] section:               allowed_shells = /bin/bash     shell_fallback = /bin/bash      Now it attempts to create the (invalid) home directory \\nafs2\u204\johndoe and then returns a 'This account is currently not available.' error. * * * EDIT: If you use the entry `override_shell = /bin/bash (or whatever)` in your domain listing it will fix the above problem.


Why are aliases missing inside of bash command?

When I run in my terminal:               alias      a list with all my aliases (defined in `~/bashrc` and `~/.bash_aliases` files) will be displayed on my terminal. That's nice and as expected! But when I run:               bash -c "alias"      there is no output, so no aliases. First I thought that `~/.bashrc` file is not sourced in the second case, so I ran:               bash -c ". ~/.bashrc && alias"      but, stupor, again there is no output... Strangely enough, when I run:               bash -c ". ~/.bash_aliases && alias"      only the aliases defined in `~/.bash_aliases` will be displayed. Can someone make some light and make me understand what exactly it is happening here?


Fluxbox shuts my screens off after some idle moment

I have fluxbox installed beside unity, my distro being ubuntu 13.04. Under unity I have configured my computer not to suspend, not to lock, and not to shut off screens after some idle moment. This works ok. However, I am using fluxbox 99% of the time, and under fluxbox, my screens shut off after something like 10 or 15 minutes. It's not a screensaver, my screens go into pause. I don't know the application that manage this, and how to configure it so as my screens won't shut off. This is a problem for me because when waking up, only the second screen will be restored, even if I run arandr scripts again and again, trying to get my main screen back. My main screen only comes back if I close then reopen my laptop. Maybe that's the issue I should worry about, but I have not the single idea which application manage that either. Any idea what's going on and where I should look at ? **Note** : I've found here a suggestion for modifying `~/.xinitrc` and adding `xset -dpms s off`. However I don't have such file in my ~ directory. I have found a file with a similar name /etc/X11/xinit/xinitrc. Should I modify this one ?


Is there a --parents option for mv like for cp?

`cp` has a useful feature `\--parents` that allows a file's directory structure to be copied to another directory:               $ cp -v --parents source/directory/from target/     ‘source/directory/from’ -> ‘target/source/directory/from’      How do I similarly _move_ a file?


No Login on created on tty2 to 6

On my Debian Linux no Login is possible on terminals 2 to 6. Login on 1 works fine, xorg-session with XDM and awesome wm works, too. The Error Message shown on these 5 screens is:               systemd-logind[...]: Failed to issue Method call: Launch Helper exited with unknown return code 1      I don't even know how to start solving this. How can I make these terminals working?