hda-codec and hda-intel issues

I use Arch Linux 3.5.6-1-ARCH and since ever I get a lot of those error messages in dmesg on my HP Pavilion dv6 (pure systemd):               [   72.137821] hda-intel: spurious response 0x0:0x0, last cmd=0x370100     [   72.137822] hda-intel: spurious response 0x0:0x0, last cmd=0x370100     [   72.137823] hda-intel: spurious response 0x0:0x0, last cmd=0x370100     [   72.137825] hda-intel: spurious response 0x0:0x0, last cmd=0x370100     [   74.143253] hda-intel: azx_get_response timeout, switching to polling mode: last cmd=0x00270d00     [   75.146190] hda-intel: No response from codec, disabling MSI: last cmd=0x00270d00     [   76.592168] hda-intel: spurious response 0x1002aa01:0x0, last cmd=0x170503      here is my complete dmesg output: https://gist.github.com/3857722 here is my journalctl output: https://gist.github.com/3857736 here is my lspci:               00:00.0 Host bridge: Intel Corporation Core Processor DRAM Controller (rev 02)     00:01.0 PCI bridge: Intel Corporation Core Processor PCI Express x16 Root Port (rev 02)     00:02.0 VGA compatible controller: Intel Corporation Core Processor Integrated Graphics Controller (rev 02)     00:16.0 Communication controller: Intel Corporation 5 Series/3400 Series Chipset HECI Controller (rev 06)     00:1a.0 USB controller: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller (rev 05)     00:1b.0 Audio device: Intel Corporation 5 Series/3400 Series Chipset High Definition Audio (rev 05)     00:1c.0 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 1 (rev 05)     00:1c.1 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 2 (rev 05)     00:1d.0 USB controller: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller (rev 05)     00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev a5)     00:1f.0 ISA bridge: Intel Corporation Mobile 5 Series Chipset LPC Interface Controller (rev 05)     00:1f.2 SATA controller: Intel Corporation 5 Series/3400 Series Chipset 4 port SATA AHCI Controller (rev 05)     00:1f.3 SMBus: Intel Corporation 5 Series/3400 Series Chipset SMBus Controller (rev 05)     00:1f.6 Signal processing controller: Intel Corporation 5 Series/3400 Series Chipset Thermal Subsystem (rev 05)     01:00.0 VGA compatible controller: Advanced Micro Devices [AMD] nee ATI Madison [Radeon HD 5000M Series]     01:00.1 Audio device: Advanced Micro Devices [AMD] nee ATI Redwood HDMI Audio [Radeon HD 5000 Series]     02:00.0 Network controller: Broadcom Corporation BCM4313 802.11b/g/n Wireless LAN Controller (rev 01)     03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 03)     7f:00.0 Host bridge: Intel Corporation Core Processor QuickPath Architecture Generic Non-core Registers (rev 02)     7f:00.1 Host bridge: Intel Corporation Core Processor QuickPath Architecture System Address Decoder (rev 02)     7f:02.0 Host bridge: Intel Corporation Core Processor QPI Link 0 (rev 02)     7f:02.1 Host bridge: Intel Corporation Core Processor QPI Physical 0 (rev 02)     7f:02.2 Host bridge: Intel Corporation Core Processor Reserved (rev 02)     7f:02.3 Host bridge: Intel Corporation Core Processor Reserved (rev 02)      I've noticed that when those errors appears my CPU temp grow up, but top and powertop doesn't detect any process "eating" lot of CPU... Here is my powertop "tunable":                Bad           Wireless Power Saving for interface wlan0                                                                    Bad           Enable SATA link power management for /dev/sda      Bad           NMI watchdog should be turned off      Bad           VM writeback timeout      Bad           Enable Audio codec power management      Bad           Autosuspend for USB device Optical USB Mouse [Logitech]      Bad           Autosuspend for USB device Broadcom 2070 Bluetooth [Broadcom Corp]      Bad           Runtime PM for PCI Device Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 2      Bad           Runtime PM for PCI Device Intel Corporation Core Processor DRAM Controller      Bad           Runtime PM for PCI Device Intel Corporation Core Processor PCI Express x16 Root Port      Bad           Runtime PM for PCI Device Intel Corporation Core Processor Integrated Graphics Controller      Bad           Runtime PM for PCI Device Intel Corporation 5 Series/3400 Series Chipset HECI Controller      Bad           Runtime PM for PCI Device Intel Corporation 5 Series/3400 Series Chipset High Definition Audio      Bad           Runtime PM for PCI Device Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 1      Bad           Runtime PM for PCI Device Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller      Bad           Runtime PM for PCI Device Intel Corporation Mobile 5 Series Chipset LPC Interface Controller      Bad           Runtime PM for PCI Device Intel Corporation 5 Series/3400 Series Chipset 4 port SATA AHCI Controller      Bad           Runtime PM for PCI Device Intel Corporation 5 Series/3400 Series Chipset Thermal Subsystem      Bad           Runtime PM for PCI Device Broadcom Corporation BCM4313 802.11b/g/n Wireless LAN Controller      Bad           Runtime PM for PCI Device Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet co      Bad           Runtime PM for PCI Device Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller      Bad           Wake-on-lan status for device eth0      Good          Bluetooth device interface status      Good          Autosuspend for USB device 2SF022 [DB04008LAZTM5B]      Good          Autosuspend for USB device EHCI Host Controller [usb1]      Any help is appreciated, many thanks.


Giving PHP permission to write to files and folders

**UPDATED FOR FURTHER CLARITY:** According to http://expressionengine.com/user_guide/installation/installation.html, it says: > For most Unix hosts the following is typical, but you may check with your > host to see if more restrictive permissions can be used to **allow PHP to > write to files (666) and folders (777)**. On Windows servers the following > will not apply, but you will need to ensure that the files and folders are > writable by ExpressionEngine. You may need to contact your host for this. Not sure what this means. I can change the specific files and folders to 666 and 777 respectively where I am the chown'er, but the above sounds like I need to allow PHP to do this too? **ORIGINAL QUESTION:** I need to ensure that PHP can write to specific files (666) and folders (777). How do I do this?


Restoring an open file

I have an interesting problem which may or may not have a solution but I'd love to have one if possible: On Solaris an open log file has been removed, which still continues to be populated while the process is running but is now inaccessible to all the other tools like `cat`, `tail`, etc. Is there any way to restore the entry in the directory to this file while everything keeps running?


Adding two default gateways in Debian interfaces file

This is my interfaces file:               auto eth0     iface eth0 inet static        address 192.168.1.10        netmask 255.255.255.0        gateway 192.168.1.1          auto eth1     iface eth1 inet static        address 192.168.2.10        netmask 255.255.255.0        gateway 192.168.2.1      If I restart networking daemon I get this error: `eth1 is not up`. I want two default gateways to achieve what is mentioned in the accepted answer to the question here. This is how my routing table should be:               Destination     Gateway         Genmask         Flags Metric Ref    Use Iface     default         192.168.1.1     0.0.0.0         UG    0      0        0 eth0     default         192.168.2.1     0.0.0.0         UG    0      0        0 eth1     192.168.1.0     *               255.255.255.0   U     0      0        0 eth0     192.168.2.0     *               255.255.255.0   U     0      0        0 eth1      I got the above table by using `ifconfig` and `route add default gw` commands. But I want to do it with the `/etc/network/interfaces` file. How can I do it? Update1:               iface eth0 inet static         address 192.168.1.10         netmask 255.255.255.0         up ip route del 192.168.1.0/24         post-up ip route add 192.168.1.0/24 dev eth0 metric 1         up route add default gw 192.168.1.1 metric 1


Removing file which doesn't have any permissions and attributes

I have a file on my external hard disk named ._Icon^M.I ended up with this after using my hard disk on old Mac platform machine. I want to delete this file but unable to. For the command 'ls -al' it shows as               dr-xr-xr-x 1 root root 8192 Mar 6 19:53 ..     -????????? ? ?    ?       ?           ? ._Icon?      Seeing this I tried to add ownership (using chown) and modify the permissions(using chmod) but the commands are not recognising ._Icon as file or a directory. I tried deleting the file using the command -               find . -name '._*' -exec rm '{}' ';'      rm is not able to remove as it is not interpreting it as a file or a directory The console after running the above command is               rm: cannot remove './._Icon\r': No such file or directory      How do I delete such a file?


Is SMTP over SSL possible in the Balsa email client?

In Balsa 2.5.1 is it possible to connect to SMTP with port 465 with SSL? The IMAP setup has an SSL option which disables the TLS choices, but I do not see anything similar when setting up SMTP. I know that SMTP port 587 with STARTTLS is the standard-compliant way to connect (and the same with IMAP port 143 STARTTLS vs IMAP port 993 SSL), but my mail service doesn't seem to support this yet. I have tried every combination I can come up with in the SMTP settings in Balsa, but nothing seems to work. I have been able to connect in every other email client I have used, so I don't think there is any problem with the server (other than supporting the latest standards, ha). Also, when using the compose window in Balsa and typing in the To field, after hitting tab it takes you to another To field and you have to hit tab once or twice more to get to the Subject field. Is there any way to have the tab press after typing the first To address take you directly to the Subject field (I didn't notice anything in the options, but perhaps I overlooked it)? Thank you.


Ctrl+W in vi[m] to erase to whitespace

I want to mimic the functionality of bash readline in `vim`. Is there an easy way to do that? Currently in `vim` `Ctrl`+`W` "cuts" from cursor back to special char or whitespace. ie. In bash `Ctrl`+`W` "cuts" from cursor back to whitespace (paste with `Ctrl`+`Y`).


fsck -cc /dev/sdb1 gives this result. Is everything okay?

root@host [/]# fsck -cc /dev/sdb1     fsck from util-linux-ng 2.17.2     e2fsck 1.41.12 (17-May-2010)     Checking for bad blocks (non-destructive read-write test)     Testing with random pattern: done     /dev/sdb1: Updating bad block inode.     Pass 1: Checking inodes, blocks, and sizes     Pass 2: Checking directory structure     Pass 3: Checking directory connectivity     Pass 4: Checking reference counts     Pass 5: Checking group summary information          /dev/sdb1: ***** FILE SYSTEM WAS MODIFIED *****     /dev/sdb1: 11/18317312 files (0.0% non-contiguous), 1198478/73258400 blocks      It said File System Was Modified. So what? I just format it. Anything wrong?


how does real and effective user ID works?

When a normal user wants to make change to the passwd file, the user will by setuid be given the effective user access. User becomes root temporarily and can edit passwd. However you can only edit your password right, and not everybody else? However your effective user access is root. So how come you're not allowed to change other passwords beside yours? When you run a program with setuid, what does it mean actually when effective user is root, but real user id is still your name?


Help understanding interfaces in Backtrack

I am fairly new in UNIX and have recently installed backtrack on a VMWare box on my machine and I am trying to use DHCLIENT command but am having trouble in understanding the interfaces. I am connected to the internet through wireless internet on my Mac but when I try and list all internet devices through backtrack, a WLAN doesn't show up,               # ip link show     1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN          link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00     2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000         link/ether 08:00:27:cd:c9:cf brd ff:ff:ff:ff:ff:f      I am curious to know why a WLAN isn't showing but an ethernet connection is? Is this because Backtrack think its connected through WLAN through my Mac's wireless? Secondly, what's the first device 'lo'? Thanks!


bash shell - ssh remote script capture output and exit code?

I wish to use shell to invoke a script on a remote server. I would like to capture the output of that script (its logging messages) and the exit code it returns. If I do this:               ssh user@server /usr/local/scripts/test_ping.sh     echo "$?"      I get the exit code but cant capture the remote logging messages . If I do this:               local RESULTS=$(ssh user@server /usr/local/scripts/test_ping.sh)     echo "$?"      LOG "${RESULTS}";      I get to log my output using my LOG function but cant seem to get a correct exit code, I assume the code I get is the code from the varianble assignment. I would like to continue to use my LOG function to capture all output as it formats and sends things to a file, syslog, and the screen for me. How can I capture results in a var AND get the correct exit code from the remote script?


On my laptop with Ubuntu I'm able to have just one instance of vim, launched with               vim --servername VIM      After this I'm able to open files from console with               vim --remote-silent filename      I use short aliases for both of them. Also I do some computation on another computer (I'll call it workhorse). It has Debian x64 (without gui) installed. I usually access it using multiple instances of Putty from a Windows PC. Actually workhorse is a virtual machine and I pay for resource usage, so I don't want to overload it too much. However after usual installation of vim (`apt-get install vim`) I'm unable to run vim with --servername option. It says               Unknown option argument: "--servername"     More info with: vim -h      Indeed, documentation says that vim should be compiled with +client-server option to run it as "a command server". I know two other options: `apt-get install vim-gtk` and `apt-get install vim-gnome`, but they ask for huge installation (136Mb and 245Mb respectively). As far as I understand this is somehow related with installation of graphical interface. I don't have any preferences for any particular workaround. Probably, I will be happy with any workable solution. But I do want to load files to vim from console, like I'm doing it from Ubuntu, or otherwise I do want to know any other way to effectively use vim for editing multiple files. So the question remains How to install light-weight vim and to be able to efficiently load files into one instance vim?


Generating a slideshow under linux

Under Windows, one is able to generate a nice slideshow (crossfading between images, applying the Ken Burns effect on each image) on Windows using (Windows) Movie Maker. When I create a slideshow using Movie Maker, for 10 images, it takes under 1 minute (without even using the GPU!). I have a machine with one quad-core: Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz On our servers, however, we want to use Debian, so we have been looking for a utility that is able to create such slideshows with the 2 effects (Ken Burns and crossfading). We found "dvd-slideshow" (http://dvd-slideshow.sourceforge.net/), however this takes 8~9 minutes on our servers (2x4-core: Intel(R) Xeon(R) CPU E5640 @ 2.67GHz) with the same set of images. Dvd-slideshow actually is a wrapper that calls ImageMagick and ffmpeg, so I tried compiling ImageMagick with OpenCL support (since the "convert" commands seem to take the longest), however OpenCL doesn't seem to be used by these kind of image-calculations. Our goal is to make this as fast as possible, preferably taking < 1 minute for a slideshow with 10 images. The resulting slideshow should be an H.264/MPEG-4-file, since this is compatible with many devices. Does anyone know a Unix utility to perform this task? Or should I somehow perform this task on a Windows machine? NB: I also tried Imagination (http://imagination.sourceforge.net/), but this program doesn't allow to have the Ken Burns effect and the crossfading simultaneously, unfortunately


What are the minimum requirements to run a graphical application?

This follows my previous question, where I installed Debian for the purpose of having a lightweight distro to run virtual machines on. I installed it with just the laptop and admin packages -- _not_ anything graphical. I've installed VirtualBox and xorg. I cloned a VM from another hard drive, and registered it successfully. When I try to start the device (still from the console) it complains about being unable to create frame buffers. Sorry I can't copy and paste the long error message, but it's not really feasible at this point. I figure this is because I don't have any window manager of any kind. If possible I would like to keep it that way. I will have no reason to minimize, resize, reposition, or close VirtualBox. I just need the VM to take up my entire screen as if the screen was a window. > ### What are the minimum requirements to run graphical applications on > Linux? > >   * What software do I need to install? > >   * What command would I need to run to get my desired result? > > All answers and links will be appreciated! * * * _Update:_ I wasn't very clear about my something earlier. I'm trying to run it via VBoxSDL. I think it'll lower the requirements. From that page it says... > VBoxSDL does indeed only provide a simple window that contains only the > “pure” virtual machine, without menus or other controls to click upon and no > additional indicators of virtual machine activity


Set a custom icon for gnome-terminal

Is it possible to set a custom icon for `gnome-terminal`, maybe dependent on the profile. I often have many terminal windows open and it gets a bit tricky to distinguish between them.


Tool to watch latest software releases from upstream?

Does anyone know of a program/framework to watch latest software releases from upstream? For example for wordpress, apache/nginx, and so on. The program should just retrieve respective software project's webpage (or FTP listing, whatever) and parse it to grab the version numbers and tarball URLs. Imagined invocation and output of such program:               % swwatch wordpress     branch: 3.4     status: release     version: 3.4.2     date: ...     tarball url: http://...          branch: 3.5     status: beta     version: 3.5.0-beta2     date: ...     tarball url: http://...      There is a related question: Keeping track of the latest releases , and I'm checking out debian/watch right now, but this requires downloading the package source. And it also means I have to wait until a Debian maintainer uploads a new version, which can be a while. I'd prefer something more lightweight that checks the upstream information directly.


tar --exclude doesn't exclude. Why?

I have this very simple line in a bash script which executes successfully (i.e. producing the `_data.tar` file), except that it **doesn't** exclude the sub-directories it is told exclude via the `--exclude` option:               /bin/tar -cf /home/_data.tar  --exclude='/data/sub1/*'  --exclude='/data/sub2/*' --exclude='/data/sub3/*'  --exclude='/data/sub4/*'  --exclude='/data/sub5/*'  /data      Instead, it produces a `_data.tar` file that contains everything under /data, including the files in the subdirectories I wanted to exclude. Any idea why? and how to fix this? **Update** I implemented my observations based on the link provided in the first answer below (top level dir first, no whitespace after last exclude):               /bin/tar -cf /home/_data.tar  /data  --exclude='/data/sub1/*'  --exclude='/data/sub2/*'  --exclude='/data/sub3/*'  --exclude='/data/sub4/*'  --exclude='/data/sub5/*'      But that didn't help. All "excluded" sub-directories are present in the resulting `_data.tar` file. This is puzzling. Whether this is a bug in current tar (GNU tar 1.23, on a CentOS 6.2, Linux 2.6.32) or "extreme sensitivity" of tar to whitespaces and other easy-to-miss typos, I consider this a bug. For now. **This is horrible** : I tried the insight suggested below (no trailing `/*`) and it still doesn't work in the production script:               /bin/tar -cf /home/_data.tar  /data  --exclude='/data/sub1'  --exclude='/data/sub2'  --exclude='/data/sub3'  --exclude='/data/sub4'      I can't see any difference between what I tried and what @Richard Perrin tried, except for the quotes and 2 spaces instead of 1. I am going to try this (must wait for the nightly script to run as the directory to be backed up is huge) and report back.               /bin/tar -cf /home/_data.tar  /data --exclude=/data/sub1 --exclude=/data/sub2 --exclude=/data/sub3 --exclude=/data/sub4      I am beginning to think that all these `tar --exclude` sensitivities aren't tar's but something in my environment, but then what could that be? **It worked!** The last variation tried (no single-quotes and single-space instead of double-space between the `--exclude`s) tested working. Weird but accepting. **Unbelievable!** It turns out that an older version of `tar` (1.15.1) would only exclude if the top-level dir is **last** on the command line. This is the exact opposite of how version 1.23 requires. FYI.


Remap bash vi keys?

I use Dvorak and vi, so when I found out about the vi mode in Bash, I was very excited. However, it would be even better if I could remap the movement keys to be the ones that I use in vi (I swap keys around until the movement keys are back on the home row in Dvorak). How can I do this?


xsel < /tmp/xselection not working in script

I'm trying to use the following script:               #!/usr/bin/env bash     # Edit xselection in gvim     xsel > /tmp/xselection     gvim /tmp/xselection     xsel < /tmp/xselection      But the final line does not seem to be correctly loading the file into xselection. If I run that line immediately after calling the script it succeeds. I can't understand why. What am I missing?


Remove lines based on pattern by keeping first n lines

I need to remove lines from a text file based on pattern but I need to keep the first n lines of that pattern. Input               % 1      % 2     % 3     % 4     % 5     text1     text2     text3      output               %1     %2     text1     text2     text3      I used `sed /^%/d` file but it deletes all the lines starting with %, `sed 3,/^%/d` doesn't help either. I need to keep first n lines of the pattern and delete the rest


sed replace - need help replacing text in bunch of files

How to parse bunch of files and replace each occurance of __esct function?               __esct('Full name')         convert to:               $this->escape($this->translate('Full name'))        I'm confused as to - how to add that second brace after replaced text?


How do I get a bulletproof wifi?

I have used several Linux distributions (Arch, Debian, Ubuntu) over the years and I would consider myself not an expert but certainly an experienced user. It happened now for the 3rd time that I was travelling and had major trouble getting my wifi to work whereas my girlfriend who is using Mac didn't even have the slightest trouble. For example, the most recent issue was that my laptop has a Intel Ultimate-N 6300 and the linux driver leads to trouble with some wifi connections (modprobe iwlwifi 11n_disable=1 did the job), however at home it works flawless! Since this was extremely inconvenient and I sometimes rely on internet access for my job I guess my question is: is there a way to ensure such things do not happen or have a at least a backup for the worst case scenario?


sendmail configuration to use CNAME domain as the from FQDN

Why are CNAME not valid for sendmail email from sendmail? I have domain "blabla.com" which is cnamed to "bla.bla.bla.uk." I sendmail it automatically picking up the correct domain name I want to send email from but once it hits a mail server like google the FQDN displayed is the A type record and not the CNAME. Has anyone come across this before? Thanks for you help in advance.               SU@sbank (nineveh-r2011_1.5.3) 156 > nslookup bla.bla.bla.uk 8.8.8.8     Server:         8.8.8.8     Address:        8.8.8.8#53      Non-authoritative answer:               bla.bla.bla.uk       canonical name = blabla.com.     Name:   blabla.com     Address: 217.112.157.7X               SU@ban (nineveh-r2011_1.5.3) 173 > sendmail -v user@gmail.com     test5      .               useru@gmail.com... Connecting to [127.0.0.1] via relay...     220 lispac.lsbu.ac.uk ESMTP Sendmail 8.13.8/8.12.11; Mon, 4 Aug 2014 09:10:42 +0100     >>> EHLO bla.bla.bla.uk     250-bla.bla.bla.uk Hello lispac.lsbu.ac.uk [127.0.0.1], pleased to meet you     250-ENHANCEDSTATUSCODES     250-PIPELINING     250-EXPN     250-VERB     250-8BITMIME     250-SIZE     250-DSN     250-ETRN     250-DELIVERBY     250 HELP     >>> VERB     250 2.0.0 Verbose mode     >>> MAIL From:<iii@bla.bla.bla.uk> SIZE=6     250 2.1.0 <iii@lbla.bla.bla.uk>... Sender ok     >>> RCPT To:<user@gmail.com>     >>> DATA     250 2.1.5 <user@gmail.com>... Recipient ok     354 Enter mail, end with "." on a line by itself     >>> .     050 <user@gmail.com>... Connecting to gmail-smtp-in.l.google.com. via esmtp...     050 220 ***********************************************     050 >>> EHLO bla.bla.bla.uk     050 250-mx.google.com at your service, [217.112.157.X]     050 250-SIZE 35882577     050 250-8BITMIME     050 250-XXXXXXXA     050 250-ENHANCEDSTATUSCODES     050 250 XXXXXXXB     050 >>> MAIL From:<iii@bla.com> SIZE=300     050 250 2.1.0 OK fo6si32099947wjc.83 - gsmtp     050 >>> RCPT To:<user@gmail.com>     050 250 2.1.5 OK fo6si32099947wjc.83 - gsmtp     050 >>> DATA     050 354  Go ahead fo6si32099947wjc.83 - gsmtp     050 >>> .     050 250 2.0.0 OK 1407139864 fo6si32099947wjc.83 - gsmtp     050 <user@gmail.com>... Sent (OK 1407139864 fo6si32099947wjc.83 - gsmtp)     250 2.0.0 s748AgvS017005 Message accepted for delivery     alexandru.tautu@gmail.com... Sent (s748AgvS017005 Message accepted for delivery)     Closing connection to [127.0.0.1]


udev rule for a USB device and ignoring others

Is it possible to create a udev rule for an USB device and ignore other USB devices? I want my system to support HID USB touchscreen (hid.ko) and ignore HID devices such as keyboards, mice, etc.


How does Gnome make the link between my music folder and the folder-music icon?

My music folder has a different icon from the other folders.   Gnome use the folder-music icon to personalize the music folder icon. I would like to know where (in which configuration file or where in GConf, DConf) this association is made.


how to merge two audio input source using avconv

I try to make screencast using avconv and I facing a problem. I finally succeed to record both pc output and microphone input , the problem is that they're not merged in the output file. (I saw they're an option filter_complex amix=inputs but its only in early release) Is there any other way i can merge them (even if it's post production i don't care) here the command line i use               avconv -f alsa -ac 2 -i pulse -f alsa -ac 2 -i hw:2,0 -filter_complex amix=inputs=2 -f x11grab -r 30 -s 1366x742 -i :0.0+1369,25 -map 0:0 -map 1:0 -map 2:0 -acodec flac -vcodec libx264 -preset:v superfast -crf 18 -threads 0 output.mkv


Observing a hard-disk write in kernel space (with drivers/modules)

Apologies in advance if this post is a bit dense/messy, but I'm having a hard time formulating it better... Basically, I would like to study what happens upon a hard disk write, and I'd like to know:   * Is my understanding below correct - and if not, where am I going wrong?   * Is there a better tool to "capture" log data, about all aspects happening on the PC, during a disk write? In more detail - first, the OS I'm using is:               $ uname -a     Linux mypc 2.6.38-16-generic #67-Ubuntu SMP Thu Sep 6 18:00:43 UTC 2012 i686 i686 i386 GNU/Linux      So, I have the following simple (e.g. the usual checks for failure of operations are skipped) user-space C program, `wtest.c`:               #include <stdio.h>     #include <fcntl.h>  // O_CREAT, O_WRONLY, S_IRUSR          int main(void) {       char filename[] = "/tmp/wtest.txt";       char buffer[] = "abcd";       int fd;       mode_t perms = S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH;            fd = open(filename, O_RDWR|O_CREAT, perms);       write(fd,buffer,4);       close(fd);            return 0;     }      I build this with `gcc -g -O0 -o wtest wtest.c`. Now, since I'm trying to write to `/tmp`, I note that it is a directory under the root `/` \- so I check `mount`:               $ mount     /dev/sda5 on / type ext4 (rw,errors=remount-ro,commit=0)     ...     /dev/sda6 on /media/disk1 type ext4 (rw,uhelper=hal,commit=0)     /dev/sda7 on /media/disk2 type ext3 (rw,nosuid,nodev,uhelper=udisks,commit=0,commit=0,commit=0,commit=0,commit=0,commit=0)     ...      So, my root filesystem `/` is one partition of the `/dev/sda` device (and I'm using other partitions as "standalone" disks/mounts, too). To find the driver for this device, I use `hwinfo`:               $ hwinfo --disk     ...     19: IDE 00.0: 10600 Disk     ...       SysFS ID: /class/block/sda       SysFS BusID: 0:0:0:0     ...       Hardware Class: disk       Model: "FUJITSU MHY225RB"     ...       Driver: "ata_piix", "sd"       Driver Modules: "ata_piix"       Device File: /dev/sda     ...       Device Number: block 8:0-8:15     ...      So, the `/dev/sda` hard disk is apparently handled by `ata_piix` (and `sd`) driver.               $ grep 'ata_piix\| sd' <(gunzip </var/log/syslog.2.gz)     Jan 20 09:28:31 mypc kernel: [    1.963846] ata_piix 0000:00:1f.2: version 2.13     Jan 20 09:28:31 mypc kernel: [    1.963901] ata_piix 0000:00:1f.2: PCI INT B -> GSI 19 (level, low) -> IRQ 19     Jan 20 09:28:31 mypc kernel: [    1.963912] ata_piix 0000:00:1f.2: MAP [ P0 P2 P1 P3 ]     Jan 20 09:28:31 mypc kernel: [    2.116038] ata_piix 0000:00:1f.2: setting latency timer to 64     Jan 20 09:28:31 mypc kernel: [    2.116817] scsi0 : ata_piix     Jan 20 09:28:31 mypc kernel: [    2.117068] scsi1 : ata_piix     Jan 20 09:28:31 mypc kernel: [    2.529065] sd 0:0:0:0: [sda] 488397168 512-byte logical blocks: (250 GB/232 GiB)     Jan 20 09:28:31 mypc kernel: [    2.529104] sd 0:0:0:0: Attached scsi generic sg0 type 0     Jan 20 09:28:31 mypc kernel: [    2.529309] sd 0:0:0:0: [sda] Write Protect is off     Jan 20 09:28:31 mypc kernel: [    2.529319] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00     Jan 20 09:28:31 mypc kernel: [    2.529423] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA     Jan 20 09:28:31 mypc kernel: [    2.674783]  sda: sda1 sda2 < sda5 sda6 sda7 sda8 sda9 sda10 >     Jan 20 09:28:31 mypc kernel: [    2.676075] sd 0:0:0:0: [sda] Attached SCSI disk     Jan 20 09:28:31 mypc kernel: [    4.145312] sd 2:0:0:0: Attached scsi generic sg1 type 0     Jan 20 09:28:31 mypc kernel: [    4.150596] sd 2:0:0:0: [sdb] Attached SCSI removable disk      I have to pull from older syslog as I suspend a lot, but the above seems like the proper snippet from the syslog at boot time, where the `ata_piix` (and `sd`) driver kicks in for the first time. My first point of confusion is that I cannot otherwise observe the `ata_piix` or `sd` drivers:               $ lsmod | grep 'ata_piix\| sd'     $     $ modinfo sd     ERROR: modinfo: could not find module sd     $ modinfo ata_piix     ERROR: modinfo: could not find module ata_piix      So my first question is - why cannot I observe the `ata_piix` module here, only in boot-time logs? Is it because `ata_piix` (and `sd`) are built as built-in drivers in the (monolithic) kernel, as opposed to being built as (loadable) `.ko` kernel modules? Right - so now, I'm trying to observe what happens upon running the program with `ftrace` Linux built-in function tracer.               sudo bash -c '     KDBGPATH="/sys/kernel/debug/tracing"     echo function_graph > $KDBGPATH/current_tracer     echo funcgraph-abstime > $KDBGPATH/trace_options     echo funcgraph-proc > $KDBGPATH/trace_options     echo 0 > $KDBGPATH/tracing_on     echo > $KDBGPATH/trace     echo 1 > $KDBGPATH/tracing_on ; ./wtest ; echo 0 > $KDBGPATH/tracing_on     cat $KDBGPATH/trace > wtest.ftrace     '      ... and here is a snippet of the `ftrace` log concerning the `write`:                4604.352690 |   0)  wtest-31632   |               |  sys_write() {      4604.352690 |   0)  wtest-31632   |   0.750 us    |    fget_light();      4604.352692 |   0)  wtest-31632   |               |    vfs_write() {      4604.352693 |   0)  wtest-31632   |               |      rw_verify_area() {      4604.352693 |   0)  wtest-31632   |               |        security_file_permission() {      4604.352694 |   0)  wtest-31632   |               |          apparmor_file_permission() {      4604.352695 |   0)  wtest-31632   |   0.811 us    |            common_file_perm();      4604.352696 |   0)  wtest-31632   |   2.198 us    |          }      4604.352697 |   0)  wtest-31632   |   3.573 us    |        }      4604.352697 |   0)  wtest-31632   |   4.979 us    |      }      4604.352698 |   0)  wtest-31632   |               |      do_sync_write() {      4604.352699 |   0)  wtest-31632   |               |        ext4_file_write() {      4604.352700 |   0)  wtest-31632   |               |          generic_file_aio_write() {      4604.352701 |   0)  wtest-31632   |               |            mutex_lock() {      4604.352701 |   0)  wtest-31632   |   0.666 us    |              _cond_resched();      4604.352703 |   0)  wtest-31632   |   1.994 us    |            }      4604.352704 |   0)  wtest-31632   |               |            __generic_file_aio_write() {     ...      4604.352728 |   0)  wtest-31632   |               |              file_update_time() {     ...      4604.352732 |   0)  wtest-31632   |   0.756 us    |                mnt_want_write_file();      4604.352734 |   0)  wtest-31632   |               |                __mark_inode_dirty() {     ...      4604.352750 |   0)  wtest-31632   |               |                    ext4_mark_inode_dirty() {      4604.352750 |   0)  wtest-31632   |   0.679 us    |                      _cond_resched();      4604.352752 |   0)  wtest-31632   |               |                      ext4_reserve_inode_write() {     ...      4604.352777 |   0)  wtest-31632   |               |                        __ext4_journal_get_write_access() {     ...      4604.352795 |   0)  wtest-31632   |               |                      ext4_mark_iloc_dirty() {     ...      4604.352806 |   0)  wtest-31632   |               |                    __ext4_journal_stop() {     ...      4604.352821 |   0)  wtest-31632   |   0.684 us    |                mnt_drop_write();      4604.352822 |   0)  wtest-31632   | + 93.541 us   |              }      4604.352823 |   0)  wtest-31632   |               |              generic_file_buffered_write() {      4604.352824 |   0)  wtest-31632   |   0.654 us    |                iov_iter_advance();      4604.352825 |   0)  wtest-31632   |               |                generic_perform_write() {      4604.352826 |   0)  wtest-31632   |   0.709 us    |                  iov_iter_fault_in_readable();      4604.352828 |   0)  wtest-31632   |               |                  ext4_da_write_begin() {      4604.352829 |   0)  wtest-31632   |               |                    ext4_journal_start_sb() {     ...      4604.352847 |   0)  wtest-31632   |   1.453 us    |                    __block_write_begin();      4604.352849 |   0)  wtest-31632   | + 21.128 us   |                  }      4604.352849 |   0)  wtest-31632   |               |                  iov_iter_copy_from_user_atomic() {      4604.352850 |   0)  wtest-31632   |               |                    __kmap_atomic() {     ...      4604.352863 |   0)  wtest-31632   |   0.672 us    |                  mark_page_accessed();      4604.352864 |   0)  wtest-31632   |               |                  ext4_da_write_end() {      4604.352865 |   0)  wtest-31632   |               |                    generic_write_end() {      4604.352866 |   0)  wtest-31632   |               |                      block_write_end() {     ...      4604.352893 |   0)  wtest-31632   |               |                    __ext4_journal_stop() {     ...      4604.352909 |   0)  wtest-31632   |   0.655 us    |            mutex_unlock();      4604.352911 |   0)  wtest-31632   |   0.727 us    |            generic_write_sync();      4604.352912 |   0)  wtest-31632   | ! 212.259 us  |          }      4604.352913 |   0)  wtest-31632   | ! 213.845 us  |        }      4604.352914 |   0)  wtest-31632   | ! 215.286 us  |      }      4604.352914 |   0)  wtest-31632   |   0.685 us    |      __fsnotify_parent();      4604.352916 |   0)  wtest-31632   |               |      fsnotify() {      4604.352916 |   0)  wtest-31632   |   0.907 us    |        __srcu_read_lock();      4604.352918 |   0)  wtest-31632   |   0.685 us    |        __srcu_read_unlock();      4604.352920 |   0)  wtest-31632   |   3.958 us    |      }      4604.352920 |   0)  wtest-31632   | ! 228.409 us  |    }      4604.352921 |   0)  wtest-31632   | ! 231.334 us  |  }      This is my second point of confusion - I can observe the user-space `write()` resulted with a kernel-space `sys_write()`, as expected; and within the `sys_write()`, I observe security-related functions (e.g. `apparmor_file_permission()`), "generic" write functions (e.g. `generic_file_aio_write()`), `ext4` filesystem related functions (e.g. `ext4_journal_start_sb()`) - but I do _not_ observe anything related to `ata_piix` (or `sd`) drivers ?! The page Tracing and Profiling - Yocto Project suggests using the `blk` tracer in `ftrace` to get more information about block device operation, but it reports nothing for me with this example. Also, Linux Filesystem Drivers - Annon Inglorion (tutorfs) suggests that filesystems are (can?) also (be) implemented as kernel modules/drivers, and I'm guessing that is the case for `ext4` as well. Finally, I could have sworn that I have earlier observed the driver name in square brackets next to the function shown by the `function_graph` tracer, but I guess I had mixed things up - it can probably appear like that in stack (back)traces, but not in the function graph. Furthermore, I can inspect `/proc/kallsyms`:               $ grep 'piix\| sd\|psmouse' /proc/kallsyms     ...     00000000 d sd_ctl_dir     00000000 d sd_ctl_root     00000000 d sdev_class     00000000 d sdev_attr_queue_depth_rw     00000000 d sdev_attr_queue_ramp_up_period     00000000 d sdev_attr_queue_type_rw     00000000 d sd_disk_class     ...     00000000 t piix_init_sata_map     00000000 t piix_init_sidpr     00000000 t piix_init_one     00000000 t pci_fixup_piix4_acpi     ...     00000000 t psmouse_show_int_attr        [psmouse]     00000000 t psmouse_protocol_by_type     [psmouse]     00000000 r psmouse_protocols    [psmouse]     00000000 t psmouse_get_maxproto [psmouse]     ...      ... and checking with source Linux/drivers/ata/ata_piix.c, confirm that e.g. `piix_init_sata_map` is indeed a function in `ata_piix`. Which should probably tell me that: modules that are compiled in the kernel (so they become a part of the monolithic kernel) "lose" the information about which module they come from; however, the loadable modules which are built as separate `.ko` kernel objects, preserve that information (e.g. `[psmouse]` shown above in square brackets). Thus, also `ftrace` could only show "originating module" information, only for those functions coming from loadable kernel modules. Is this correct? The above taken into consideration, this is the understanding that I have of the process currently:   * At boot time, the `ata_piix` driver establishes a DMA (?) memory mapping between `/dev/sda` and the hard disk      * because of this, all future accesses to `/dev/sda` via `ata_piix` will be transparent to the kernel (that is, not traceable) - since all the kernel would see, are just reads/writes to memory locations (not necessarily calls to specific traceable kernel functions), which are not reported by `function_graph` tracer   * At boot time, the `sd` driver will furthermore "parse" the partitions of `/dev/sda`, make them available, and possibly handle the memory mappings between partitions <-> disk device      * again, this should make the access operations via `sd` transparent to the kernel   * Since both `ata_piix` and `sd` are compiled in-kernel, even if some of their functions do end up being captured by `ftrace`, we cannot get an information of which module those functions would come from (apart from "manual" correlation with source files)   * Later on, `mount` establishes a relationship/binding between a partition, and the corresponding _filesystem_ driver (in this case `ext4`)      * from this point on, all of the accesses to the mounted filesystem would be handled by `ext4` functions - which are traceable by the kernel; but as `ext4` is compiled in-kernel, the tracer cannot give us the originating module information   * So, the observed "generic" writes, called via `ext4` functions, would ultimately access memory locations, whose mapping is established by `ata_piix` \- but other than that, `ata_piix` doesn't interfere directly with data transfers (it being probably handled by DMA (outside of the processor(s), and thus transparent to it). Is this understanding correct? Some related subquestions:   * In my setup above, I can identify a PCI device driver (`ata_piix`) and a filesystem driver (`ext4`); but are there character or block drivers used somewhere on the "write" execution path, and if so, which are they?   * Which of those drivers would handle caching (so unnecessary disk operations are skipped or optimized?)   * I know from before that `/dev/shm` is a filesystem in RAM; `mount | grep shm` for me reports: `none on /dev/shm type tmpfs (rw,nosuid,nodev)`. Does that mean that - in contrast to `/dev/sda` \- the `shm` filesystem simply lacks the (DMA) mapping from "its own" adrresses to bus addresses towards a device; and thus all accesses via the `tmpfs` filesystem driver end up in actual RAM?


Java update on Centos

I have a Centos 6.2 machine. It currently has JDK 1.6.0_26 installed. I would like to update that to 1.6.0_38, the current release version. I saw a comment somewhere about `sudo apt-get`; `apt-get` does not seem to be a command that this box knows. So I skipped that one. I saw some RPM stuff on the box, and RPM was a recognized command, so I downloaded the JDK RPM.bin file from Oracle, transferred it to the Linux machine, chmod'd it, and ran the bin file - this is apparently supposed to extract and install the RPM. It hits an error doing this (complaining about `./install.sfx.5513: /lib/ld-linux.so.2: bad ELF interpreter` as well as some issues about JavaDB which I don't know that that's important) and nothing appears to have changed. I tried to extract the RPM file (using the -x switch) and still nothing appears to have changed - if it extracted it I have no idea where it went, or what I would type in a relevant rpm command to get it to do something. Searching on that error led me to some suggestion that I needed to install glibc - but also started talking about Yum. I also have Yum - this looks like it might be an even more helpful tool. I can `yum list jdk` and it shows me that there is a package installed from yum ("jdk.x86_64") but `yum update` does nothing. I tried `yum install jdk` on a whim and it said "package jdk-1.6.0_26-fcs.x86_64 already installed and latest version" which is strange, since 26 is _not_ the latest version. Any newbie friendly suggestions on what I should try next?


Getting wrong $LINENO for a trapped function

I am writing a Bash script for myself to learn scripting. At some point, I need to add trap in order to clean unwanted directories and files if script is killed. However, for some reason I do not understand, trap calls the cleaning function - `clean_a()` \- when script killed but `$LINENO` points to a line in the cleaning function itself, not int the function - `archieve_it()` \- when script is killed. Expected behaviour:   1. run script   2. Press `Ctrl`+`C`   3. trap caches `Ctrl`+`C` and calls `clean_a()` function   4. `clean_a()` function echoes the line number, which `Ctrl`+`C` is pressed. Let it be line 10 in `archieve_it()`.  What actually happens:   1. run script   2. Press `Ctrl`+`C`   3. trap caches `Ctrl`+`C` and calls `clean_a()` function   4. `clean_a()` echoes an irrelevant line number. Say, line 25 in `clean_a()` function. Here is an example as a part of my script:               archieve_it () {       trap 'clean_a $LINENO $BASH_COMMAND'\                     SIGHUP SIGINT SIGTERM SIGQUIT       for src in ${sources}; do        mkdir -p "${dest}${today}${src}"        if [[ "$?" -ne 0 ]] ; then         error "Something!"         fi        rsync "${options}" \              --stats -i \              --log-file="${dest}${rsync_log}" \              "${excludes}" "${src}" "${dest}${today}${src}"       done     }     clean_a () {       error "something!       line: $LINENO       command: $BASH_COMMAND       removing ${dest}${today}..."       cd "${dest}"       rm -rdf "${today}"       exit "$1"     }      P.S.: Original script can be seen here . Definitions and variable names are in Turkish. If it is required, I can translate anything to English. **EDIT:** I change the script as best as I can do according to @mikeserv's explanation like this:               #!/bin/bash     PS4='DEBUG: $((LASTNO=$LINENO)) : '; set -x     archieve_it () {       trap 'clean_a $LASTNO $LINENO $BASH_COMMAND'\                     SIGHUP SIGINT SIGTERM SIGQUIT       ..     }     clean_a () {       error " ...       line: $LINENO $LASTNO       ..."     }      Now, if I run script with `set -x` and terminate it with `Ctrl`+`C`, it prints correct line number as can be seen below:                DDEBUG: 1 : clean_a 1 336 rsync '"${options}"' ...      However, in `clean_a()` function, value of `$LASTNO` is printed as 1.                line: 462 1      Does it have something to do with the bug that is shown by @Arkadiusz Drabczyk? **EDIT2** : I changed script just like the way @mikesrv recommended to me. But $LASTNO returned 1 as the value of the line when script was terminated (it should have been 337).               #!/bin/bash     PS4='^MDEBUG: $((LASTNO=$LINENO)) : '; set -x     archieve_it () {       trap 'clean_a $LASTNO $LINENO "$BASH_COMMAND"' \                     SIGHUP SIGINT SIGTERM SIGQUIT       ...     } 2>/dev/null     clean_a () {       error " ...       line: $LASTNO $LINENO       ..."     } 2>&1      If I run script and terminate it with `Ctrl`+`C` while rsync was running, I get this output:               ^^MDEBUG: 1 : clean_a '337 1 rsync "${options}" --delete-during ...     ...     line: 1 465      As you can see, $LASTNO's value is 1. While I was trying to figure out what the problem is, I wrote another function - `testing` \- using parameter substitution format `${parameter:-default}`. So script turned out like this:               #!/bin/bash     PS4='^MDEBUG: $((LASTNO=$LINENO)) : '; set -x     archieve_it () {       trap 'testing "$LASTNO $LINENO $BASH_COMMAND"'\                      SIGHUP SIGINT SIGTERM SIGQUIT       ...     } 2>/dev/null     testing() {       echo -e "${1:-Unknown error!}"       exit 1     } 2>&1      Now, if I run script and press `Ctrl`+`C`, I get this output:               ^^MDEBUG: 1 : testing '337 1 rsync "${options}" --delete-during ...     337 1 rsync "${options}" --delete-during ...       337 points out the line when I pressed `Ctrl`+`C`, while rsync was running. For another test, I tried writing `clear_a` funtion like this:               clear_a () {       echo -e " $LASTNO $LINENO"     }      and $LASTNO still returned 1. So, this means that we can get correct line number when script terminated if we use parameter substitution? **EDIT3** It seems that I wrongly applied @mikeserv's explanation in EDIT2. I corrected my mistake. Positional parameter `"$1` should be replaced with $LASTNO in `clear_a` funtion. **Here is the script which works how I want it to work:**               #!/bin/bash     PS4='^MDEBUG: $((LASTNO=$LINENO)) : '; set -x     archieve_it () {       trap 'clean_a $LASTNO $LINENO "$BASH_COMMAND"' \                     SIGHUP SIGINT SIGTERM SIGQUIT       ...     } 2>/dev/null     clean_a () {       error " ...       line: $1       ..."     } 2>&1      When the script is terminated, `trap` evaluates `$LASTNO` \- first argument -, `$LINENO` \- second argument - and `$BASH_COMMAND` -third argument -, then pass their values to the `clear_a` function. Finally, we print $LASTNO with `$1` as the line number which script is terminated.


Where does docky store it's configuration?

I need to apply different profile of docky, for different desktop sessions. But I couldn't find where docky stores it's config, I've tried `~/.docky ~/.config/docky` these folders doesn't even exists.


How can I have automatic snapshots with s3ql?

How can I make automatic snapshots with s3ql? I want to have a similar behaviour as in duplicity: Pushing the backup to the server creates a new incremental snapshot with the current timestamp. Then I want to be able to browse and restore a specific backup version for example the snapshot of a given date.


Virtualbox NAT + Host-Only Adapter

My host is Ubuntu 12.04 and guest is a Debian squeeze (LAMP server). I want to allow the host to connect the guest. and allow the guest to connect the internet. The guest should not be enabled from outside. That's the reason why I don't use network-bridge. I want to setup a static IP for the host. I followed this tutorial. So I took these steps but I can not connect via `ssh` from host to guest. I cannot call the server via browser. `ping` works however! I've created a virtual host-only network adapter (`vboxnet0`) with following settings:               IPv4-Adress: 192.168.56.1     IPv4-Netmask: 255.255.255.0      `ifconfig` in Ubuntu host shows this:               eth0      Link encap:Ethernet  Hardware Adresse XX:XX:XX:XX:XX:XX                 inet Adresse:192.168.2.100  Bcast:192.168.2.255  Maske:255.255.255.0               inet6-Adresse: XXXX:XXX:XXXX:XXXX:X:X/XX Gültigkeitsbereich:Global               vboxnet0  Link encap:Ethernet  Hardware Adresse XX:XX:XX:XX:XX:XX                 inet Adresse:192.168.56.1  Bcast:192.168.56.255  Maske:255.255.255.0               inet6-Adresse: XXXX:XXX:XXXX:XXXX:X:X/XX Gültigkeitsbereich:Verbindung               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metrik:1               RX packets:0 errors:0 dropped:0 overruns:0 frame:0               TX packets:10069 errors:0 dropped:0 overruns:0 carrier:0               Kollisionen:0 Sendewarteschlangenlänge:1000                RX-Bytes:0 (0.0 B)  TX-Bytes:1539501 (1.5 MB)      On the Debian squeeze guest, the `/etc/network/interfaces` looks like this:                # The host-only network interface        auto eth1        iface eth1 inet static        address 192.168.56.1        netmask 255.255.255.0        network 192.168.56.0        broadcast 192.168.56.255      I've already tried to change `eth1` to `eth0` without a result. In VirtualBox settings the promiscuous-mode allows VMs and Host to connect. I have reached the limits of my knowledge. the output of:               netstat --inet --inet6 -ln | grep :22      is nothing. the output of:               sudo iptables -L INPUT -nv      is:                Chain INPUT (policy ACCEPT 166 packets, 30786 bytes)       pkts bytes target     prot opt in     out     source               destination


sftp gives an error: "Received message too long" and what is the reason?

I was able to do `sftp` yesterday to a RHEL 5.4 box (RedHat) and today I can't. The message is `"Received message too long 778199411"`, and after some investigation, it was due to my RHEL box's `.bashrc` having a line `echo "running .bashrc"` \-- or echoing anything at all, I think. So why would printing out a line affect `sftp`? It felt a bit like a design issue as printing out a line in `.bashrc` works in other situations such as log in or `ssh` and it is kind of hard to track down when `sftp` fails for such a weird reason. So the question is, why printing out a line cause such error and what if we still like to print out something in `.bashrc`? (mainly to see when this file get sourced/executed).


Why is printf better than echo?

I have heard that `printf` is better than `echo` and I can recall only one instance from my experience where I had to use `printf` because `echo` didn't work for feeding some text into some program on RHEL 5.8 and `printf` did. But apparently, there are other differences and I would like to inquire what they are as well as if there are specific cases when to use one vs the other.


The relationship between execute permission on a directory and its inode structure

My question deals with the relationship between the read and execute bits on a directory. I'm going to give my assumptions, first, all according to my current knowledge, then ask **my question in bold** in the context of those assumptions. Please feel free to correct any incorrect assumptions:   1. Files and directories both are stored using inodes.   2. Files and directories both have permissions (let's just focus on the rwx bits, forgetting the sticky, setuid, setguid (unless they're relevant)).   3. The contents of a directory's inode's data blocks store a mapping of file names to inode numbers.   4. Read permission on a directory allows a user to obtain a list of the names of all files in that directory.   5. The user must know a file's inode number in order to access its contents. **UPDATE: The meaning of the original statement here doesn't reflect what I meant to express. What I meant is more along the lines of: _The user doesn't need to know a file's inode number, but the user must have permission to get an inode for a given filename in order to get the contents of the file_**.   6. Execute permission on a directory allows a user to "use" that directory, and I understand that specifically to mean obtaining the directory's inode number (I would like confirmation of my understanding of this). This will allow the user to do things like cd into that directory, which is the prototypical example given of what a user needs the execute permission for. Given that a user must be able to obtain the "contents" of a directory (really the contents of the directory's inode's data blocks) in order to gain access to the directory listing, and that the user must know the directory's inode number to gain access to its contents, **why is it that a user can still obtain a directory listing while not having execute permission on the directory?** It seems that obtaining a listing of the contents of a directory D requires _temporarily_ looking up its inode number in order to read the contents of the inode's data blocks. Furthermore, it would seem necessary that read permission would imply execute permission on a directory.


How to solve the issue that a Terminal screen is messed up? (usually after a resizing)

Sometimes, a terminal screen is messed up, and when we use `man ls` to read the manpages, or press the UP arrow to go to previous commands in history, the screen will show characters not as the right place. (for example, treat the end of screen as some where in the middle of the screen). The command `reset` is tried and it wouldn't work. One way that works is to log out or close the window, and resize the window first, and then do `ssh` (or close that tab, and resize the window, and then open a new tab to get a new shell). But this way, we will lose anything that we previously did, such as starting a virtual machine console, etc. So if we don't close the shell, is there a way to fix this problem? (this happened before right inside Fedora, and also for a Macbook `ssh` into a RHEL 5.4 box). **Update:** I remember now how it happened in Fedora: I opened up a Terminal, and did a FreeVM to use a console of a Virtual Machine (a shell). I think it was size 80 x 25 and then after a while, I resized the Terminal to 130 x 50 approximately, and then the "inner shell" (of the VM) started to behave weird).


FreeBSD and Linux shared partitions

Which directories, and how, can I share between FreeBSD and Linux? In particular, how can I deduplicate respectively /usr/home and /home? I guess directly sharing a partition between both systems could lead to conflicting dotfiles, so that may not be the right solution. Is union-mounting the shared partition reasonable? This way, I could move the dotfiles into the "/" partition of each OS, and share the rest of the files into the shared partition. Which filesystem should I use for the shared home partition itself? I have under 2GB RAM so I don't think ZFS will behave, from what I've read. Maybe ext2 will do? Any better options? EDIT: is write-to-UFS kernel support in Linux stable already?   * Linux distro is LMDE.   * Actually using PC-BSD but as far as I've read it should behave just as FreeBSD for this. Correct me if I'm wrong.   * Partitions would be:               OS      Mountpoint FS    Size (GiB; Total:~160GB)     Linux   /          ext4  16     FreeBSD /          ufs   16     Shared  /mnt/home/ ext2? ~124    # EDITED: See below     Shared         -   swap  4      Any other partitions I should make? It's a workstation without "persistent" servers, but I may fool around with jails in FreeBSD. Maybe I should have a partition for those? Disclaimer: I haven't actually used union filesystems before, and am new to BSD in general; feel free to propose better solutions :) EDIT: How about adding a "dotfiles" tree in each root partition and union- mount it?               Mount points in FreeBSD:     /     /mnt/home/     /usr/home/: /usr/dotfiles/ U /mnt/home/            # /usr/dotfiles/ has priority          Example contents:     /usr/dotfiles/fchurca/: .cache .kderc     /mnt/home/fchurca/: .vimrc development/ Documents/ # .vimrc isn't platform-specific     /usr/home/fchurca: .cache .kderc .vimrc development/ Documents/      This way, it could work for all the (two at most) users of the box.


how to tell rsync to preserve time stamp on files when source tree has a mounted point

> Related to this question **Short description of the problem:** When source tree has a mounted point inside it, then time stamps on files inside that mounted point when copied to target tree are not preserved even when using `-a` option **Detailed description:** Assume this is the source tree:                                      /home/                           /home/                              |                                |                             me/                             BACKUP/                              |                                |                         +----+----------+                +----+-------+                         |    |          |                |    |       |                      data/  foo.txt    boo.txt         data/ foo.txt boo.txt                         |                                |                        a.txt                           a.txt      where `data/` above is mounted external USB disk. Everything is `ext4` file system. Everything in source is owned my `me`. `BACKUP` also happened to be a mount point, the backup USB disk. After issuing this command `rsync -av --delete /home/me/ /home/BACKUP/`, I found that `/home/BACKUP/data/` and everything below it has the current time stamp, as if these files were created now, and not the time stamp on the files in `/home/me/data/`. Other files and folders outside `data` did have the time stamp preserved OK. Question is: How to use `rsync` in the above setting to tell it to preserve time stamps on all files and folders even on files and folders on a mounted point? I am using:               >uname -a     Linux 3.5.0-17-generic #28-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux          >rsync -v     rsync  version 3.0.9  protocol version 30


skill on your own session

So I kind of (read: did) run               skill -STOP -u <username>      on my own session... and I don't have root privileges on the machine. Short of getting the sysadmin to restore things (he's away), is there any possibility to resolve that?


What is this feature in Linux 'to highlight characters' with QT?

Recently I came across this site. It says, in Linux with QT, it is possible 'to highlight characters' by pressing `Shift``Ctrl` {`Left`,`Right`} or `Shift` {`Left`,`Right`}. Could somebody please explain this feature with a screenshot or something?


External HD: "Permission Denied" on file write

I have a 3TB external hard drive that I plan to use for backups. I originally tried formatting with **cfdisk** , until I learned that only GPT supports 2TB+ partitions. So I converted the drive to GPT and formatted the one partition I made to ext4, but I keep getting "Permission Denied" errors. Normally, **udiskie** is able to automount everything such that I don't see write errors such as this. I feel like my lack of knowledge about GPT might be contributing to some oversight, but I'm not sure what might be wrong.


Portable Firefox Linux

I've installed latest **firefox linux-x86_64** from ftp.mozilla.com on a usb device and created a new profile file with the `-P` command. Unfortunately, the application does not recognize the flash plugin that is already installed on the operating system. How can I **enable the flash plugin** on the portable version? ![enter image description here](http://i.stack.imgur.com/GiD4p.png)


Does mutt support saving to an mbox?

Is it possible to save messages in mbox format? I have `set mbox_type = Maildir`, because I use offlineimap to retrieve my mail. Unfortunately it seems to affect the global settings, and it will save in Maildir format as well, which breaks git patches.


grep directory names, filenames, and contents all at one?

I'm writing a module for drupal. Its functionality is contingent on the directory name, certain file names, and function names being identical. I'm troubleshooting now, and I wanted to to a search to see that I had an identical string in all the places I needed it to be, but I realized I would be missing the directory name and filename! Is there a way to do a grep or something that would search all that information? For example, if my module was named `string`, I would need               string/     string/string.module       function string_function1() {...}       function string_function2() {...}      If I did my `everythinggrep string .` and I saw               string/       function string_function1() {...}       function string_function2() {...}      I would know that I had misnamed my module file.


How to make Nautilus search useful outside of /home?

Nautilus search returns no results for anything outside of my home directory. I've had this problem with both Ubuntu 10.10 Nautilus and the new Nautilus in Gnome 3.2. I asked my friend using Fedora 15 if he had this limitation and he in fact did not. I can use the "Search for Files" dialog to perform the searches, but not Nautilus. What Gnome setting do I need to change? Update: It's slightly worse than I feared: Nautilus seems to be employing only Tracker to perform searches and Tracker is being a couch potato. I ran `tracker-control -S` and it reported that all the miners were idle.


How can I check to see if the /tmp directory on my CentOS 5.x system is mounted on tmpfs?

CentOS 5.x My understanding is that the contents of `/tmp/` in CentOS 5.x can/are automatically purged by the OS via one of two methods:   * A daily cron task running `tmpwatch`   * If `/tmp/`is mounted on a `tmpfs` (RAM), a system reboot/power cycle will clear everything. Is that correct? If so, how can I confirm if /tmp is mounted on tmpfs? I checked `/etc/fstab` and saw this:               LABEL=/                 /                       ext3    defaults        1 1     LABEL=/boot             /boot                   ext3    defaults        1 2     tmpfs                   /dev/shm                tmpfs   defaults        0 0     devpts                  /dev/pts                devpts  gid=5,mode=620  0 0     sysfs                   /sys                    sysfs   defaults        0 0     proc                    /proc                   proc    defaults        0 0     LABEL=SWAP-sda2         swap                    swap    defaults        0 0


Is it possible to create a bootable usb from a partition?

Is it possible? How hard would it be to do so?


Do any openldap tools support the Authorization Identity Response Control?

I have a fedora 389 directory server and cannot use ldapwhoami because it is not supported. However, 389-ds does support the following controls which are supposed to offer similar functionality: 2.16.840.1.113730.3.4.15 2.16.840.1.113730.3.4.16 Are there any openldap tools that support these controls and if so how do I use them? I googled this, but couldn't find anything on it.


How are file permissions applied to newly created files?

I have a directory that has the following permissions set:               drwxr-s---. user group folder      On the desktop, I access this folder and right click to create a new file call `foo.txt`. Then using the terminal, I created another file using the command `$ touch bar.txt`. When I check the permissions for these files, I have:               -rw-r--r--. user group foo.txt     -rw-rw-r--. user group bar.txt      I was expecting `-rw-r-----. user group`. How did the extra write permission for group and read permission for others come about?


How do I redirect only stderr?

I am having a bit of trouble doing this. I am required to run a compiled .java file and redirect only stderr to a file called error. So the .java file is named javaProgram.java. This is what I have tried:               java javaProgram 2> error      However when I               cat error      it appears that there is stuff in there, even when I know for a fact that the specific .java file has no errors. Am I doing something wrong? All I want this error file to display is errors, not anything else.


How to setup a conservative sync/journaling method for Flash/USB drives?

I regularly have the problem that my Linux (Ubuntu 12.04) writes some files to an USB drive that are afterwards missing or broken in Windows. Windows often also tells me that it found problems with the drive. The drive is FAT32 and yes, I always use the small eject icon in Nautilus or simply shutdown the system before removing the drive. To workaround the problem, I now use `sudo sync` to force any pending writes to execute, hoping that this will avoid these problems in the future. What I am actually looking for is an option that tells my Ubuntu/Linux to perform any pending writes as soon possible and afterwards doing a safety check if the data was really written correctly. Currently the default strategy looks rather like "do not write everything too soon and do not double check".


Can't compile kernel in gentoo

I installed gentoo by the handbook from official site. When I got into the step 7.b. _Installing the Sources_ , the book says: > Code Listing 2.2: Viewing the kernel source symlink > > When you take a look in `/usr/src` you should see a symlink called `linux` > pointing to your kernel source. But in my VirtualBox, there is no such file, only a `linux-3..3.38-gentoo` directory in `src`. When I tried to use               cd  linux-3.3.38-gentoo     make menuconfig      this error occurred:               init/Kconfig:389: can't open file "kernel/irq/Kconfig"       How can I solve the problem?


Why my encrypted LVM volume (LUKS device) won't mount at boot time?

I'm trying to setup an encrypted volume following this guide Everything is setup but mounting the encrypted volume fails at boot-time with the error: > fsck.ext4: No such file or directory while trying to open > /dev/mapper/safe_vault Possibly non-existent device? ## This is my setup: ### crypttab               $ sudo cat /etc/crypttab     safe_vault  /dev/disk/by-uuid/d266ae14-955e-4ee4-9612-326dd09a463b  none    luks      **NOTE:** The `uuid` comes from:               $ sudo blkid /dev/mapper/<my_logical_group>-safe_vault      /dev/mapper/<my_logical_group>-safe_vault: UUID="d266ae14-955e-4ee4-9612-326dd09a463b" TYPE="crypto_LUKS"       ### fstab               $ sudo cat /etc/fstab | grep safe_vault     /dev/mapper/safe_vault      /safe-vault     ext4    defaults    0 2      ## What I've done... So I went to the devoper's website and in the Common Problems FAQ they say: > Check that you have the device mapper and the crypt target in your kernel. > The output of "dmsetup targets" should list a "crypt" target. If it is not > there or the command fails, add device mapper and crypt-target to the > kernel. So I did, turns out I don't have a `crypt` target:               $ sudo dmsetup targets     striped          v1.4.1     linear           v1.1.1     error            v1.0.1      The problem is that I don't know how to add such a target. I think this (not having the `crypt` target) maybe causing the `crypttab` configuration to be ignored at boot-time and thus trying to mount the entry in `fstab` fails because `cryptsetup` has not mapped my encrypted volume to `/dev/mapper/safe_vault`. **NOTE:** The encrypted volume can successfully be manually mapped, mounted and written:               $ sudo cryptsetup luksOpen /dev/mapper/<my_logical_group>-safe_vault safe_vault     Enter passphrase for /dev/mapper/<my_logical_group>-safe_vault:           $ sudo mount /dev/mapper/safe_vault /safe_vault      This is how it looks after mapping and mounting it:               $ sudo lsblk -o name,uuid,mountpoint     NAME                                  UUID                                   MOUNTPOINT     sda                                                                               ├─sda1                                28920b00-58d3-4941-889f-6249357c56ee        ├─sda2                                                                            └─sda5                                uhBLE7-Kcfe-RMi6-wrlX-xgVh-JfAc-PiXmBe        ├─<my_logical_group>-root (dm-0)       1bed9027-3cf7-4f8d-abdb-28cf448fb426   /       ├─<my_logical_group>-swap_1 (dm-1)     a40c16c4-7d0c-46d7-afc8-99ab173c20bb   [SWAP]       ├─<my_logical_group>-home (dm-2)       e458abb7-b263-452d-8670-814fa737f464   /home       ├─<my_logical_group>-other (dm-3)      0a1eec42-6534-46e1-8eab-793d6f8e1003   /other       └─<my_logical_group>-safe_vault (dm-4) d266ae14-955e-4ee4-9612-326dd09a463b            └─safe_vault (dm-5)               9bbf9f47-8ad8-43d5-9c4c-dca033ba5925   /safe-vault     sr0        **UPDATE**   * It turns out that I do have the `crypt` target but for it to show up with `dmsetup targets` I had to first `cryptsetup luksOpen <my-device>`   * I've tried using `UUID`s instead according to @Mikhail Morfikov's answer but it still fails at boot-time. I still think the issue is that somehow the encrypted volume is not being mapped(opened with `cryptsetup luksOpen`) at boot-time thus no `/dev/mapper/<safe_vault or UUID>` exists, then trying to mount it (fstab) fails. **UPDATE 2** It turns out I didn't have the necessary scripts to mount at boot time. See the note in @MikhailMorfikov's answer.


serial data over ethernet on a linux box

I'm trying to connect a widget (192.168.1.214:20108) through Ethernet (serial to Ethernet) to a Linux box. Under Windows using a virtual device driver mapping I can see the serial data, so I know the widget serial to Ethernet is working. Now when I point to a Linux box all I am getting is a connection attempt when I use tcpdump: > 21:00:07.322019 IP 192.168.1.214.20108 > development.local.8234: Flags [R], > seq 4096, win 0, length 0 So the Ethernet packets are getting through but I can't find a way to map the serial data (over port 8234 Ethernet) to a device. Many variations of `socat` do not produce any data on the screen, for example:               $ sudo socat readline TCP-LISTEN:8234,bind=127.0.0.1      or attempting to bind it to a dev:               $ socat -d -d -d tcp-l:127.0.0.1:8234,reuseaddr,fork file:/dev/tty0,nonblock,waitlock=/var/run/tty0.lock      this gives an output of:               2013/11/11 21:19:41 socat[23757] I setting option "so-reuseaddr" to 1     2013/11/11 21:19:41 socat[23757] I setting option "fork" to 1     2013/11/11 21:19:41 socat[23757] I socket(2, 1, 6) -> 3     2013/11/11 21:19:41 socat[23757] I starting accept loop     2013/11/11 21:19:41 socat[23757] N listening on AF=2 0.0.0.0:8234      I'm completely stuck of how to read this serial data over Ethernet on a Linux box.


controlling priority of applications using cgroups

I would like to understand cgroups better and would like to understand the use-cases for applying cgroups. Are cgroups a good way for prioritizing different applications (i.e, giving higher priority to specific types of applications like web servers)?


Running fetchmail with Socks proxy

I checked the manual of fetchmail, all it mentioned was `SOCKS_CONF`, but what is the format of that config file? And how do I know if my fetchmail is configured with `--with-socks`, `fetchmail -V` doesn't say anything related.


Do best-practices indicate that usage of /var should be restricted to sudoers

I wrote a package, and would like to use `/var` to persist some data. The data I'm storing would perhaps even be thought of as an addition for `/var/db`. The pattern I observe is that files in `/var/db`, and the surrounds, are owned by `root`. The primary (intended) use of the package filters cron jobs - meaning you would need permissions to edit the crontab.   1. Should I presume a sudo install of the package?   2. Should I have the package gracefully degrade to a `/usr` subdir, and if so then which one?   3. If I 'opinionate' that any non-sudo install requires a `configrc` (with paths), where should the package look (presuming a shared-host environment) for that config file?   4. **Should I use`/usr/lib` as per the thoughts in this article?** Incidentally, this package is a ruby gem, and you can find it here.


How can you run a script triggered by a joystick input?

I'm using a Raspberry Pi running Raspbian to power my arcade cabinet. I want to shut the Pi down using the `sudo poweroff` command without using the keyboard. I'm thinking the best way would be to create a simple script that would somehow be triggered by a combination of controller button inputs. It seems easy to bind a keyboard to a script, but not so easy to use a joystick input instead. Does anyone have any ideas? ### EDIT #1 The joystick and controller buttons all work fine and show up using the `jstest` tool from the `jstest-gtk` package and all work fine in Mame4all. I haven't tried `xev` but will look into it.


How to add a string of numbers to multiple text files in a directory?

file.txt file2.txt file3.txt I want to add 99999 to the begining of the all the file names without changing anything else in the file name in solaris 10.


Print lines where first field has only four characters using regex in awk?

John Goldenrod:(916) 348-4278:250:100:175          Chet Main:(510) 548-5258:50:95:135          Tom Savage:(408) 926-3456:250:168:200          Elizabeth Stachelin:(916) 440-1763:175:75:300      output should contain the lines containing names with only four characters (john,chet) :               awk '$1 ~ /[a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9]" "/ {print}' file      this doesn't seem to work for me. can i do it without using any of the awk functions.


How to get fewer ttys with Systemd?

In the old days I just modified `/etc/inittab`. Now, with systemd, it seems to start tty[1-6] automatically, how should I disable tty[4-6]? Looks like there's only one systemd service file, and it use a `%I` to discern different tty sessions. I hope I don't need to remove that service, and create each `getty@ttyX.service` manually.


Is it necessary to reboot after a kernel upgrade (via APT)?

I have been wondering this for quite a while. Let's say that you have a Debian server that you keep updated via APT. Usually (every 1-2 months) there are some kernel updates, which will update the GRUB entries to boot from it next time. This is okay, but if you care about uptime and SLA, it would be difficult to reboot just to use the updated kernel. I guess this is the usual way to go, but is it actually how it works?


Problem Starting MySQL on new Centos 6 build

I have a VPS with ChicagoVPS that's running Centos 6. Official version of the build is: > Linux RedHat 6.5(Final 2.6.32-042stab078.26 x86_64) I followed this guide to add the repository and installed MySQL 5.6.15. It installed with no errors. The following error is the one that I get whenever I try to access the database:               [root@sacroiliac log]# mysql     ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)      These are the commands I'm running. (I'm also adding the mysql portion because I read somewhere the daemon was changed from mysqld to mysql, but it's not being found on my system.)               [root@sacroiliac log]# service mysqld start     MySQL Daemon failed to start.     Starting mysqld:                                           [FAILED]     [root@sacroiliac log]# service mysql start     mysql: unrecognized service     [root@sacroiliac log]# /etc/init.d/mysql start     -bash: /etc/init.d/mysql: No such file or directory     [root@sacroiliac log]# /etc/init.d/mysqld start     MySQL Daemon failed to start.     Starting mysqld:                                           [FAILED]      There is no error file in `/var/lib/mysql/` and `/var/log/mysqld.log` says the following:               131210 17:34:04 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql     131210 17:34:04 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended     131210 17:34:20 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql     131210 17:34:21 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended      There is MySQL 5.1 on the default repository, but I'd like 5.6 for full-text search of InnoDB databases, and the new(er) SHA2 algorithms. **Edit**   Also, I wanted to note that I have rebuilt the VM a few times (eliminate the issue of having a corrupt download), and Googled the issue. None of the results I've found have been helpful at all. Most of them were actually unanswered questions similarly to mine. **Edit 2**   `/var/log/messages` contains the following:               Dec 10 17:32:10 sacroiliac yum[1327]: Installed: mysql-community-release-el6-5.noarch     Dec 10 17:32:45 sacroiliac yum[1328]: Installed: mysql-community-common-5.6.15-1.el6.x86_64     Dec 10 17:32:46 sacroiliac yum[1328]: Installed: mysql-community-libs-5.6.15-1.el6.x86_64     Dec 10 17:32:51 sacroiliac yum[1328]: Installed: mysql-community-client-5.6.15-1.el6.x86_64     Dec 10 17:32:51 sacroiliac yum[1328]: Installed: libaio-0.3.107-10.el6.x86_64     Dec 10 17:33:04 sacroiliac yum[1328]: Installed: mysql-community-server-5.6.15-1.el6.x86_64     Dec 10 17:34:04 sacroiliac kernel: [627203.702793] OOM killed process 1657 (mysqld) vm:385760kB, rss:238984kB, swap:0kB     Dec 10 17:34:21 sacroiliac kernel: [627220.208520] OOM killed process 1919 (mysqld) vm:385760kB, rss:238300kB, swap:0kB     Dec 10 17:50:03 sacroiliac kernel: [628160.758387] OOM killed process 2228 (mysqld) vm:385760kB, rss:238988kB, swap:0kB     Dec 10 17:51:33 sacroiliac kernel: [628250.613146] OOM killed process 2486 (mysqld) vm:385760kB, rss:237220kB, swap:0kB     Dec 10 17:51:49 sacroiliac kernel: [628266.621825] OOM killed process 2744 (mysqld) vm:385760kB, rss:238412kB, swap:0kB      **Edit 3** This is the result of trying to run mysqld_safe               131210 21:59:17 mysqld_safe Logging to '/var/log/mysqld.log'.     131210 21:59:17 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql     /usr/bin/mysqld_safe: line 166:  2677 Killed                  nohup /usr/sbin/mysqld --     basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --  log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid -- socket=/var/lib/mysql/mysql.sock < /dev/null >> /var/log/mysqld.log 2>&1     131210 21:59:18 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended      **Edit 4** I never found a fix for my problem; I did get a solution. One of my issues was that I never had enough memory. A VM on my local machine was using 300MB or so, which was more than my VPS had. I tried a swap file, but my VPS runs on an OpenVZ kernel and they don't support swap files. The solution ended up being a KVM VPS. It ended up costing a few bucks more a month with double the memory, storage, and bandwidth. MySQL 5.6 on Centos 6.5 runs just fine now.


Shell script read separately columns from file

When we have file which is a kind of list like :               Mary 34     George 45     John 56     Josh 29      using the `awk` command `$1` refers to the first column and `$2` to the second column.But once we write a shell script we can use the `read line` to read the whole line or we can use `read number` to read the first word,am I right?So my question is in the above if I wanted to read the second column how would I do that without using `awk` command from a shell-script.


Find command: how to ignore case?

I am looking for file "WSFY321.c" in a huge directory hierarchy.   Usually I would use GNU find: `find . -name "WSFY321.c"`   But I do not know the case, it could be uppercase, lowercase, or a mix of both. What is the easiest way to find this file?   Is there something better than `find . | grep -i "WSFY321.c"` ?


Are autotools and cmake intended to be used by application users or developers?

If I am correct, `autotools` and `cmake` are different tools to automatically generate configure and Makefiles from source code. During installation, I often download the configure and Makefiles as a user, but I heard that some users (like users of VTK, ITK, ...) have to use `cmake` or `autoconfig` and `automake`. Are developers supposed to provide configure and Makefiles ready and available to users? If yes: Are `cmake` and `autoconfig` supposed to be used by developers during software distribution?


What is wrong with this shell script?

The service for a piece of software I just installed (from a provided `.deb` file) on a Ubuntu server won't start. When running the service I get the error:               /etc/init.d/matrixsa: 44: Syntax error: "}" unexpected (expecting "fi")      Here is the relevant part of the script. Not being versed in shell scripting I don't know if this is valid:               if [ -f /etc/rc.d/init.d/functions ]     then         . /etc/rc.d/init.d/functions     else         function action {             echo "$1"             shift             $@         } # <-- this is line 44         function success {             echo -n "Success"         }         function failure {             echo -n "Failed"         }     fi


Software for navigating a network diagram

I would like to visualize a large amount of data as a network diagram, such as the one seen in this graph drawing (but much more complex). Is there any software available that can import a huge database and allow one to navigate to different parts of the graph?


What is the kernel doing when I bring a TUN/TAP interface up

I'm playing around with the TUN/TAP device on Linux. I've created a simple program that creates a TAP interface and prints anything that is sent through it. When I bring the interface up with               ip link set tap1 up      six frames are sent through it. What are these frames? I've pasted them here


Xen domU fails to start with kernel panic

My dom0 is Gento 3.3.2, the kernel is compiled with Xen support. And I am planing to use the same kernel to boot my domU. This is my domU configuration file:                 1 vif = [ 'bridge=xenbr0' ]       2 vcpus = 1       3 uuid = "c1d751ba-e228-45e6-b7a8-01895e88a815"       4 root = "/dev/xvda ro"       5 name = "Gentoo"       6 memory = 512       7 kernel = "/boot/kernel-3.3.2-gentoo"       8 extra = "4 console=hvc0"       9 disk = [ 'phy:/dev/vg/gentoo,xvda,w' ]      the `/dev/vg/gentoo` is a LV. After I ran `xl create -c gentoo.cfg`, the guest started and stopped with the following error _(only the last few lines)_ :               [    0.122019] netconsole: network logging started     [    0.122180] Root-NFS: no NFS server address     [    0.122186] VFS: Unable to mount root fs via NFS, trying floppy.     [    0.122280] VFS: Cannot open root device "xvda" or unknown-block(2,0)     [    0.123056] Please append a correct "root=" boot option; here are the available partitions:     [    0.123056] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)


Terminal logging via putty on AIX (including smitty)

I use a terminal logging method on my Ubuntu Desktop for the GNOME-terminal (it's good when I use SSH in GNOME-terminal): ### Implementation   1. As root:              apt-get install bsdutils        2. As the normal user:              mkdir ~/logs        3. append this to your `~/.bashrc` \- must be the last line!              STARTTIME=`date +%F-%Hh-%Mm-%Ss-%N`; script -q -t 2>    \       /home/USERNAMEHERE/logs/$STARTTIME-timing.txt         \       -c 'bash --rcfile /home/USERNAMEHERE/.bashrc-cp'      \       -f /home/USERNAMEHERE/logs/$STARTTIME-log.txt; exit 0        4. make sure the 1) is the last line of bashrc, then [this is needed to avoid "fork bomb"..]:              sed -e '$d' /home/USERNAMEHERE/.bashrc > /home/USERNAMEHERE/.bashrc-cp      ### Replay Rename the filenames to you're needs! You can only play 1 file at one time.                   scriptreplay "/home/USERNAMEHERE/logs/$STARTTIME-timing.txt" \                      "/home/USERNAMEHERE/logs/$STARTTIME-log.txt"      With this method I can log steps in ncurses menu, great! It's working perfectly. ### Question I need this great terminal logging method in putty too. How can I do that? (so for ex.: I need to log smitty menus on AIX machines with putty too.) p.s.: Coul my logging method be better? (Can anyone update it?)


Using sed (?) to extract one instance of a string that is repeated in the original string

INPUT:               FOO      OUTPUT:               FOO      **Q:** how can I replace the INPUT with the OUTPUT? The FII and "./>" is CONSTANT. The FOO could vary to any english letter and "-" and "." UPDATE: (to clarify "FOO")               FOO=ASD     then:      ASD          FOO=XYZ     XYZ      UPDATE2: (this one doesn't works :O )               [user@notebook ~] echo 'FOO'     FOO     [user@notebook ~] echo 'FOO' | sed 's/>[ \t]*\([^ \t]\+\)[ \t]*</\1/'          [user@notebook ~]


Installing 14.04 from ubuntu-14.04-desktop-amd64.iso with pxe

We're trying to do an automated network installation using `pxe`. We installed netboot tools (14.04 LTS) and extracted the`ubuntu-14.04-desktop- amd64.iso` contents into an http server. We saw that we have to download a missing repository `"main/debian-installer"` (about 50MB) which is necessary for netboot installation, but it is not included within the iso distribution file. The installation process begins, but failed during "Download installer components" phase saying the installer failed to download a file from the mirror. Is it possible to add the `"main/debian-installer"` repository to the original `ubuntu-14.04-desktop-amd64.iso` contents and if so, how? We want to do automatic installation without Internet access.


Local Server not accessible on Linux

My Internet company set up a local server, where different files are hosted. I can download files at much higher speed from there. But for some reason, the server is not accessible from Ubuntu 13.10 I am using, or Fedora 19. So the problem should be Linux specific. N.B. It is perfectly accessible from windows. If it helps, it is not accessible via router too. Probably they are using some IP Address checking, which can't be done via router.


How can I uncompress gz files in random directories and store the decompressed files in those same directories?

CentOS 5.9 I've got a server with a foo.ext.gz file located in a variety of random directories. Example:   * /opt/fooapp/foosubdirectory/foo_randomnumber/blah/blah/foo.ext.gz   * /opt/fooapp/foosubdirectory/foo_differentrandomnumber/blah/blah/foo.ext.gz   * /opt/fooapp/foosubdirectory/foo_anotherdifferentrandomnumber/blah/blah/foo.ext.gz I'd like to run a bash command that will:   1. Locate foo.ext.gz files   2. Extract the contents of the gz file **in the same directory that its respective GZ file resides in**   3. Keep the original gz file intact.  If I was doing this manually, I'd start with `find / -iname foo.ext.gz`. After that, I'd copy the directory the file resides in and type something like:               gunzip -c /opt/fooapp/foosubdirectory/foo_12345/blah/blah/foo.ext.gz  > /opt/fooapp/foosubdirectory/foo_12345/blah/blah/foo.ext      The problem here is that I need to manually do this process for several dozen files/directories. Is there a way I can leverage xargs or a for loop?


How to recover a multiboot configuration after having installed Windows 7?

I've installed Windows 7 and XP on my laptop. After that, I installed RedHat 5. Now the problem is that I'm not able to load my RedHat. What should be done to fix this problem?


Libc-bin errors when trying to install php

I am trying to update and install php into my Ubuntu server 12. 04 using the command below:               apt-get upgrade php     apt-get install php5-curl php5-gd php5-mysql php5-pgsql      However I receive this error all the time:               gzip: stdout: No space left on device     E: mkinitramfs failure cpio 141 gzip 1     update-initramfs: failed for /boot/initrd.img-3.2.0-34-generic with 1.     run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1     Failed to process /etc/kernel/postinst.d at /var/lib/dpkg/info/linux-image-3.2.0-34-generic.postinst line 1010.     dpkg: error processing linux-image-3.2.0-34-generic (--configure):      subprocess installed post-installation script returned error exit status 2     dpkg: dependency problems prevent configuration of linux-image-server:      linux-image-server depends on linux-image-3.2.0-33-generic; however:       Package linux-image-3.2.0-33-generic is not configured yet.     dpkg: error processing linux-image-server (--configure):      dependency problems - leaving unconfigured     dpkg: dependency problems prevent configuration of linux-server:      linux-server depends on linux-image-server (= 3.2.0.33.36); however:       Package linux-image-server is not configured yet.     dpkg: error processing linux-server (--configure):      dependency problems - leaving unconfigured     Setting up libpq5 (9.1.10-0ubuntu12.04) ...     No apport report written because the error message indicates it's a follow-up error from a previous failure.                                                                                No apport report written because MaxReports has already been reached                                                                        Setting up php5-curl (5.3.10-1ubuntu3.8) ...     Setting up php5-pgsql (5.3.10-1ubuntu3.8) ...     Processing triggers for initramfs-tools ...     update-initramfs: Generating /boot/initrd.img-3.2.0-32-generic          gzip: stdout: No space left on device     E: mkinitramfs failure cpio 141 gzip 1     update-initramfs: failed for /boot/initrd.img-3.2.0-32-generic with 1.     dpkg: error processing initramfs-tools (--configure):      subprocess installed post-installation script returned error exit status 1     No apport report written because MaxReports has already been reached                                                                         Processing triggers for libc-bin ...     ldconfig deferred processing now taking place     Errors were encountered while processing:      linux-image-3.2.0-33-generic      linux-image-3.2.0-34-generic      linux-image-server      linux-server      initramfs-tools     E: Sub-process /usr/bin/dpkg returned an error code (1)      Not sure whats wrong and why it can't process the Linux-image files?


how browsers intelligent on OS detection?

I am using a Linux PC (Ubuntu). Recently I went to install Dropbox on my PC and it was successful. The only matter right now I am thinking is simply how my browser helped Dropbox to forward me directly to a Linux based dropbox installation? My browser directly took me to the Linux installation page, How? Thank you.


Why is wget skipping files while trying to mirror a site

I ran wget on this site: http://demo.codestag.com/geeklove/ but it only returns a single index.html               wget --recursive --no-clobber --page-requisites --html-extension --convert-links --restrict-file-names=windows --domains --no-parent http://demo.codestag.com/geeklove      I tried spoofing the useragent like here : http://www.askapache.com/linux/wget-header-trick.html#Testing_Wget_Trick but still no go. When I used the --debug option it showed that it skipped all the other pages.


scp to /home changes permissions?

This would be illustrated very nicely with an scheme. When I write "Test: OK" or "Test: FAIL" I am restarting apache server (httpd service). Basically, performing everything as root in the target_host:               scp user@source_host:/etc/httpd/conf.d/custom.conf /home     mv /home/custom.conf /etc/httpd/conf.d/      Test: FAIL               scp user@source_host:/etc/httpd/conf.d/custom.conf /etc/httpd/conf.d/      Test: OK               scp user@source_host:/etc/httpd/conf.d/custom.conf /     mv /custom.conf /etc/httpd/conf.d/      Test: OK The same behaviour when using:               scp root@source_host...      When Test: FAIL:               Iniciando httpd: httpd: Syntax error on line 221 of /etc/httpd/conf/httpd.conf: Could not open configuration file /etc/httpd/conf.d/custom.conf: Permission denied      _"Iniciando" is the Spanish word for Starting_ The permissions inside conf.d are always (ls -ln):               -r--r--r--. 1 0 0 311 Jun 18 14:19 custom.conf      Is scp changing something in these files so that apache can or not read them?


Is there a command line tool for analyzing audio frequency

I am planning to analyze audio via linux command line. There are a lot of analyzers out there which have a graphical interface, but since I want to make an automated input/output of this information I can't use a GUI. The optimal case would be to send an audiostream from an embedded device to powerful machine, which analyzes the audio and then generates a csv or db entries with the data and builds some graphs out of it for a website. If there so no such thing for audiostreams, an analyzer for audiofiles will also be a great step forward.


How do file permissions/attributes work? Kernel-level, FS-level or both?

A question that occurred to me earlier: are file permissions/attributes OS- (and therefore kernel-) dependent or are they filesystem-dependent? It seems to me that the second alternative is the more logical one, yet I never heard of `reiserfs` file permissions, for example: only "Unix file permissions". On the other hand, to quote from a Wikipedia article: > As new versions of Windows came out, Microsoft has added to the inventory of > **available attributes on the NTFS file system** which seems to suggest that Windows file attributes are somehow tied to the filesystem. Can someone please enlighten me?


Why Inotify is unable to add watch

I have been trying to install teamviewer on RHEL 6 machine. The installation went fine. When I try to run teamviewer, it terminates immediately after showing the GUI. I went to /var/log/teamviewer/TeamViewer9_Logfile.log and the last two lines of the log file says:               S0! INotify: unable to add watch for /tmp/.X11-unix     S0!! XSocketSessionObserver: caught exception 'add-watch' 2 Errorcode=2      I am not sure why INotify is unable to add watch for /tmp/.X11-unix. This file/directory does not exist, could that be the reason? In that case, how this gets created?


Reading a binary file as an array of bytes or 16 or 32 bits using shell script

I am working on ARM-based modem Linux host machine and I need to read a bin file as an 8-,16- or 32- bits array. I basically need to encrypt the file in question and was thinking of just XOR-ing the bits with a random bit sequence (I don't need a very complex system). The Linux host doesn't have C or PERL modules in it so I cannot use them and hence I need to do it using a shell script. Can anyone give me some pointers on how to proceed with this?


Correct location of initramfs.cpio file when compiling kernel

I am following this article and generated an initramfs.cpio file. Now the tutorial mentiones that I have to put this file in build directory:               Finally, you have to rebuild the kernel again:          # 0. Copy the CPIO archive to your kernel build directory:     cp initramfs.cpio .      But I dont see any folder build:               [root@xilinx linux-xlnx]# ls      arch     CREDITS        drivers   include  Kbuild   lib          mm              README          scripts   System.map  virt     block    crypto         firmware  init     Kconfig  MAINTAINERS  Module.symvers  REPORTING-BUGS  security  tools       vmlinux     COPYING  Documentation  fs        ipc      kernel   Makefile     net             samples         sound     usr         vmlinux.o      What is the correct place then? my board is xilinx Zynq based on ARM


How to update Puppy Linux?

A month or two ago, I installed the latest version of Puppy Linux to an old Eee PC which I hardly use any more. Well I'm on it now! But I can't figure out how to update it. It uses a weird Puppy package manager which only seems to have options for installing and uninstalling things. I found an option to update the database, but that didn't actually update any of the software on my system. I've looked through the menus several times and don't see anything that says update. How do I update Puppy Linux??


Audio recording does not work -- how to diagnose?

I used KRec to record some audio, but when I played it back I got nothing. What are the things I need to do to figure out where the problem is? My computer is a Dell OptiPlex DX620, Intel Pentium 4 3.00 GHz running Fedora 7 (Moonshine)