title: How to do a print screen or capture an area of the screen

text: Is there an equivalent of the Window's Print Screen + Paste (or better yet the Mac OS Cmd+Shift+4, Space) in gnome?


title: /etc/cron.daily/foo : Send email to a particular user instead of root?

text: I'm running CentOS 5.5. We have several cronjobs stored in /etc/cron.daily/ . We would like the email for some of these cronjobs to go to a particular email address, while the rest of the emails in /etc/cron.daily/ should go to the default email address (root@localhost). Cronjobs in /etc/cron.daily/ are run from the /etc/crontab file. /etc/crontab specifies a 'MAILTO' field. Can I override this by setting MAILTO in my /etc/cron.daily/foo cronjob? What's the best way to handle this?


title: Getting the number and names of windows in Xvfb

text: I am currently working with Xvfb to grab the screenshots of my programs. Is there a way to determine the number and the names of the windows that are currently "displayed" in Xvfb? Where can I find more documentation on this?


title: libvirt daemon doesn't start on Gentoo

text: I'm trying to use Xen with virt-manager on Gentoo system and I have some troubles with libvirt daemon. When it starts: > Starting libvirtd ... > > /usr/sbin/libvirtd: error: Unable to initialize network sockets. Check > /var/log/messages or run without --daemon for more info. > > start-stop-daemon: failed to start `/usr/sbin/libvirtd' [ !! ] > > ERROR: libvirtd failed to start But file ' _/var/log/messages_ ' doesn't exists! Libvirtd config file ( _/etc/libvirt/libvirtd.conf_ ): > listen_tls = 0 > > listen_tcp = 1 > > unix_sock_group = "libvirt" > > unix_sock_ro_perm = "0777" > > unix_sock_rw_perm = "0770" > > log_level = 3 > > log_filters = "3:remote 4:event" > > log_outputs = "3:syslog:libvirtd" Can anybody help me, what i'm doing wrong?) UPD: I'm so inattentive that I forgot install syslog-ng) I found in logs that daemon didn't start because there was no group with name libvirt - after this group was created libvirtd is ok


title: Leaking file descriptors

text: What does it mean if file descriptor leaking                File descriptor 6 (socket:[901758]) leaked on lvextend invocation. Parent PID 10035: /bin/zsh      File descriptor 9 (/dev/pts/1) leaked on lvextend invocation. Parent PID 10035: /bin/zsh      File descriptor 11 (/dev/pts/1) leaked on lvextend invocation. Parent PID 10035: /bin/zsh      File descriptor 12 (/dev/pts/1) leaked on lvextend invocation. Parent PID 10035: /bin/zsh      File descriptor 15 (/dev/pts/7) leaked on lvextend invocation. Parent PID 10035: /bin/zsh      File descriptor 17 (/dev/pts/7) leaked on lvextend invocation. Parent PID 10035: /bin/zsh      File descriptor 18 (/dev/pts/7) leaked on lvextend invocation. Parent PID 10035: /bin/zsh        Extending logical volume usr to 30.00 GiB        Logical volume usr successfully resized      What does it mean?


title: Cryptsetup not finding libgcrypt.so after upgrade

text: I am running a Fedora Core 13 with dm-crypt + luks, all standard with fedora distos. After upgrading libgcrypt.so, cryptsetup moans at boot up that it can not find the library where it expects it to be ( `/lib` ). So I booted with a live cd, decrypted the root partition of that drive, and mounted my old hard drive, then I chroot'ed in there. I ran cryptsetup and as expected it bombed out with the same error as when booting up... I fixed the symlinks, and tested cryptsetup. It worked. When I rebooted the same error was there again... I thought that somehow my changes was not being saved. So I booted back into the live OS, mounted the hdd & chroot'ed again, and to my amazement I found my symlink where I left it and cryptsetup working. Can someone tell me why this is happening? Why is cryptsetup still looking for the file in /lib and not finding it when its obviously there?! P.S. I have also tried making duplicates of the libgcrypt library files in /lib as well as tried recompling cryptsetup from source, it all works 100% untill I reboot and then that error again! I am thinkin' of just rebuilding that box, but I thought I'd ask you guys first? Anyone come across a similar issue?


title: How do you bulk move files up one directory safely?

text: How can I move files up a directory where there might be hundreds or thousands of files in the directory, and you might not be sure about whether there are dupes in `..`. What method would you use? How to handle dupes will vary, sometimes we'll overwrite, sometimes we need to be safer. IO can be important because these are production servers. But given quantity a prompt for non duplicate files isn't an option. Preservation of permissions, and timestamps, etc, is important. We usually won't know what the data is. Oh and it using `mv` isn't required, `rsync`, `cp` solutions welcome. _note: we're running CentOS 5.5 so let me know if it won't work there due to it being a more recent... feature_


title: How to mount an OpenBSD hard disk image on Linux?

text: First, I'll start by explaining how I got my problem, this will help me get across what I need. A few months ago, my laptop hard disk broke. I had no quick replacement, but I needed that laptop the next day, so all I could do was to rip the 2.5" drive out from my router. The router was actually an ATX PC, running OpenBSD 4.9. Now, since I needed that drive very quickly, I created an image with `dd` on my desktop computer, put the drive into the laptop and installed Fedora. OK, now I have a replacement hard drive for my laptop, and before I start installing stuff on the hard drive that is going back into the router, I was asking myself, how I could mount the image that I made when I started... The point is, I could make a fresh install of the latest OpenBSD and then just use things like config files from the image. The only thing I know of that I can do now, is simply write the image back to the disk with `dd`. This should work and all that, but I'd like to use the opportunity to upgrade the system as well. I tried mounting the OpenBSD partitions before making the image, but it didn't work, and I had very little time (only a couple of hours on this one evening). Should I write back the image to disk, then try to mount it, recover the files I need and then install the latest OpenBSD?


title: How to create CronJob for running commands on reboot?

text: Via my host I have SSH access and a control panel. I installed Rails via SSH on a light weight server. I want to reboot the server when it goes down. I think I need to start it manually since I want to start two servers which run on different versions of Ruby. I was wondering if I can use the "Cronjob" area on my control panel for this, and if so, what command I need. Via SSH I would start the server as follows:               cd [app1path]      bundle exec thin -C /etc/thin/app2.yml start          cd [app2path]     bundle exec thin -C /etc/thin/app2.yml start      It is important that the steps are executed in sequence, since they seem to conflict with each other (running them as a service from `init.d` only starts one, strangely enough placing a `sleep 60` in one of the two does not make a diffrence, but anyway). Placing the code below in my control panel does not seem to do anything:               @reboot [app1path; bundle exec thin -C /etc/thin/app1.yml start; cd [app2path]; bundle exec thin -C /etc/thin/app2.yml start      What would work? I would be grateful for some tips and guidance.


title: How is it possible to do a live update while a program is running?

text: I wonder how killer applications such as Thunderbird or Firefox can be updated via the system's package manager while they are still running. What happens with the old code while they are being updated? What do I have to do when I want to write a program a.out that updates itself while it is running?


title: Create directory in /var/run/ at startup

text: I'm using apache2 and postgres running on Ubuntu Server 10.04.   I have removed the startup scripts for both of these apps and I'm using supervisor to monitor and control them. The problem I have run into is that both of these need directories in /var/run (with the correct permissions for the users they run under) for pid files. How do I create these during startup as they need to be created as root and then chown'd to the correct user? **Edit**   It seems the best way to so this is to creat the directories with custom init scripts. As I have no shell scripting skills at all how do I go about this?


title: How to suspend and resume processes

text: In the bash terminal I can hit `Control`+`Z` to suspend any running process... then I can type `fg` to resume the process. Is it possible to suspend a process if I only have it's PID? And if so, what command should I use? I'm looking for something like:               suspend-process $PID_OF_PROCESS      and then to resume it with               resume-process $PID_OF_PROCESS


title: Applications that run on Mono in Ubuntu

text: I think Mono, and the C# language, are a great, nay, fantastic project. My question is: how prevalent is Mono in Ubuntu? How much of a penetration is it getting, and what applications run on it?


I want to put an error checking solution to my script, it looks like this:               ! [ `echo $?` != 0 ] || echo "omg, st went wrong, CTRL+C? `read`"      My goal is when this line runs it check the "$?" - if it's not 0 then it says "omg, st went wrong, CTRL+C?" then it waits for enter, or CTRL+C from the user. But my one-liner isn't working, because it waits for an enter before printing the "omg, st went wrong, CTRL+C?" text. Can someone help me what am I missing? Thanks. UPDATE: it would be better to do it after the command st like in: Check that there was an error one-liner in script the "bad command" is "uname -k" the good command is "echo hi" - the uname gives non zero exit code, the echo gives 0


title: Can someone sniff NFS over internet?

text: I want to connect to my home server from work using NFS. I tried sshfs but some people say it's not as reliable as NFS. I know sshfs traffic is encrypted. But what about NFS? Can someone sniff my traffic and view the files I'm copying? I'm using NFSv4 in my LAN and it works great.


title: Issues compiling Tanuki Java Service wrapper version 3.1.2 under armv5tel architecture

text: Basically I need this specific version of the Tanuki Java Service Wrapper to run a specific Java application. I downloaded the source from the Tanuki website and I'm trying to compile it from source. This is under a Debian Linux system `armv5tel` architecture. It uses Ant, and there is a `build.sh` script that invokes a copy of Ant provided in the source. However, the compilation fails with this message:               home/build/wrapper_3.1.2_src/build.xml:263: Error starting javah: java.lang.NoSuchMethodException: com.sun.tools.javah.Main.<init>([Ljava.lang.String;)


title: Debian wake up from suspend password

text: I am using Debian Squeeze. When I suspend my laptop and wake it up again later, it doesn't ask for the system password. How do I fix this?


title: Are partition tables always required?

text: So I have a home server with 4 hdds: hdd1: 60Gb (SSD - OS drive)   hdd2: 4TB (data drive)   hdd3: 2TB (data drive)   hdd4: 1TB (data drive) So I intend installing ubuntu server onto hdd1 (ssd drive) with other drives simply being a data drives. So now I'm thinking about partitioning those data drives.... Do I even need to partition data drives? Can I just format them to ext4 and mount them? Is partitioning always needed?


title: Can I use a disk without partitioning it?

text: If I have a disk (whether a physical disk or a virtual disk managed by a some VM hypervisor) that I want to use as a single big partition, do I need to actually create a partition table with one big partition, or can I just create the filesystem on the raw disk? I.e. instead of partitioning /dev/sdg into one big /dev/sdg1 partition, can I just do `mkfs /dev/sdg` to create the filesystem on the entire disk and then mount it with `mount /dev/sdg /mount- point`? I tried it and it seems to work, but is there any reason not to do it if I know that I'm never going to want more than one partition on the disk?


title: When and why do block devices need to be partitioned?

text: > **Possible Duplicate:**   >  The merits of a partitionless filesystem So I've got a block device, say `/dev/sda` or `/dev/loop0`. Clearly if I want to boot from the former, or I want to subdivide it into segments with separate filesystems, I need to partition it. But suppose I don't have those needs. Instead, I just plan to use my entire block device as storage. Maybe I'll make it part of a raid volume, or maybe I'll encrypt it with cryptsetup, or maybe I'll make it a PV for LVM. Or maybe I just want to install a filesystem on it directly. In at least some of these cases, there doesn't seem to be any technical obstacle to using the device unpartitioned. That's what we generally do with block devices generated by losetup, and one can do it too with regular hard disks. I know because I've done it. Now, there are dangers to this. For instance, if you ever go on to run `fdisk /dev/sda`, you won't see anything sensible. And you might accidentally write a partition table or something like that to your device, and then the data you had on the unpartitioned device would be hosed. Maybe if you even boot into Windows with the device attached, it will get hosed. People tell scary stories. But I'd just like to understand, if the device is only ever connected to your Unix setup (and to keep things simple, let's stick to Linux only), and you never try to write a partition table or MBR to it or anything like that, are there any other downsides to using a storage device unpartitioned? I'm not proposing to do it; I just want to understand what the genuine reasons for not doing it are. On the flip side, is there any obstacle or downside to partitioning the block device `/dev/loop0`? Perhaps there'd be no advantage to doing so. But I expect it would work, wouldn't it? Here, too, I'm only asking because I want to understand the reasons behind our standard practices.


title: How to mirror two screens / nvidia graphic pilot / LMDE / Macbook 2008

text: I'm using LMDE on a MacBook 2008; it works perfectly (and my MacBook runs much more faster than with Mac OS X) I have one problem: when I plug in an external display, I can't get the two displays to display the same thing (mirror) — I always have two different screens. When I go into the System Configuration Tool, and then Display Tools, I'm not able to choose the "same image on both screens" (I can't click it). I'm also using the NVIDIA X Server tools, nothing like a mirror option in it — or perhaps, I don't understand how to switch it. The graphics pilot I use is the nvidia-310 one — my graphics card is a GeForce 9400M.


title: Will my MySQL query continue to run even if my ssh connection drops?

text: I've connected to a server over SSH and logged in to mysql, and asked it to run a query (the results of which are dumped into a CSV) that could take well over an hour. Although I have instructed my client to send null packets every 60 seconds to keep the session active, I am still paranoid the mysql query / process could terminate, so my questions are:   1. Will a cancelled ssh session (due to inactivity) kill the mysql query process?   2. How can I ensure this doesn't happen - are the null packet sends every 60 seconds enough?


title: How to restore default crontab file

text: I have recently lost my cronjobs. now when i do               crontab -e      i am presented with an empty file. i would like to get the default file back with the nifty comments and explanaitions at the top!


title: What does the `set $variable` do?

text: I know that `set` is used to manipulate environment variables, but I want to make myself sure - these alterations are not permanent, right? I mean once I close shell and reopen it, no changes will be preserved, won't they? And they are not inherited by the child processes, lest `export` is used, am I correct? I mean expressions like               set IFS ':'


title: log rotate, why creating a fresh log is called log rotate instead of log delete or log refresh

text: Why creating a fresh log file is called log rotate instead of log refresh or log delete? What does the word rotate emphasis?


title: Why does Alt+SysRq+B not always trigger while REISU do?

text: On many different machines, when I come across a lockup, I often use `Alt`+`SysRq`+`REISUB` to reboot without too much losses. But I often noticed that although `REISU` commands work even when I just hold `Alt`+`SysRq` and enter them without releasing `Alt`+`SysRq`, the last one, `B`, seems to be very "lazy": I have to repeat it many times, and in fact it doesn't trigger until I do the cycle "press `Alt`+`SysRq`, type B, release `Alt`+`SysRq`" multiple times (and not always the same number of times). At first occurrences of this problem I thought it's the kernel which has locked too hard that it doesn't "see" my `B` command, but when I realized that multiple repetitions of it do allow me to trigger reboot, it now seems that it's something general. Even on a working system (be it Debian, Ubuntu, LFS etc.), I can easily reproduce this. In fact, I can even load the kernel with `init=/bin/bash` and reproduce this from this bash prompt. Looking at serial console output, I see all the feedback on `REISU`, but only one feedback print on multiple `B` commands — when the kernel finally is convinced to do a reboot. Why is this? Is it some kernel feature which prevents unintended reset, or maybe it's just a bug (quite strange one)? Note that I'm using plain keyboard with no `Fn` or multimedia keys, so this question isn't a duplicate of this one.


title: using "ifne" in Bash pipe

text: In my script, I am using the `ifne` utility from the `moreutils` package. The line can be simplified to the following:               printf "asdf\n" | ifne cat - && echo "stream not empty"      `ifne` only executes, if the stream is non-emty. But how can I make the second command (echo "stream not empty") also execute only if non empty? As it is now, in following case echo is executed (but I don't want it to be executed):               printf "" | ifne cat - && echo "stream not empty"      using parenthesis gives me syntax error:               printf "" | ifne (cat - && echo "stream not empty")      How can I execute the last command only if stream is non-empty?


title: i3-wm not resizing screen resolution on login

text: I'm using Parallels for the Mac, but this may be relevant to other VMs too. Using Ubuntu 14.04, when I login using Unity it resizes the screen and uses all available screens (2 in my case), perfect. However, I'd rather use i3wm, but when I login, it doesn't resize the screen (it's stuck on 1024x768), and doesn't use my extra monitor. Not sure if this is a i3 thing or a Parallels/VM thing, or both.


title: Does root not require a password to log in as a user?

text: Does root not require a password to log in as a user even though a password has been set for that user? When I am logged in as "root", `su user` logs me in as "user". There is no prompt for a password. From there `su user` requires a password. Is this normal? Debian 6 here.


title: Count total number of lines before/after a pattern match

text: I am having a long list of IP addresses, which are not in sequence. I need to find how many IP addresses are there before/after a particular IP address. How can I achieve this?


title: Are zombie processes something I should be concerned about?

text: I run a server. Should I be concerned about zombie processes? Do they consume any system resources (RAM, process table entry, etc.) that I should be concerned about?


title: Hide parent directory but allow to view dir

text: I would like the following result on my UNIX system: `ls -l /users/test` -> permission denied, or any other way so I can't see the content of it. `ls -l /users/test/testdir/` -> shows all files in the directory Do you have any solutions for this?


title: How many rings does OpenBSD use?

text: Usually a Windows/Linux operating system uses afaik max 2 rings But how many rings does OpenBSD use?


title: Debian checkinstall ignores install=no; how to have it build, but NOT autoinstall a package?

text: Ok, here is one thing that puzzles me... I'm trying to build a package from source, and then use `checkinstall` to generate a .deb package. Note that I want to just create the .deb package, but I do NOT want to _install_ it. So, here's an example - I'm on Ubuntu 11.04, and first I install it's `feh` package from the default repositories; which has a version number apparently being 1.3.4.dfsg.1-3 Then I'm trying to build `feh` from source; got `make` to pass, and can run the new `feh` from the command line; splendid. Now finally, to create a deb package, I use the following command line:               sudo checkinstall -D -y \       --install=no \       --fstrans=no \       --reset-uids=yes \       --pkgname=feh \       --pkgversion=2.7 \       --pkgrelease="tar.bz2" \       --arch=i386 \       --pkglicense=GPL \       --maintainer="Debian PhotoTools Maintainers <pkg-phototools-devel@lists.alioth.debian.org>" \       --pakdir=../.. \       --requires=libc6,libice6,libsm6,libx11-6,libxaw7,libxext6,libxmu6,libxt6,dpkg,install-info      OK, notice that I've used **`\--install=no`** there? Even `man checkinstall` says: > --install Toggle installation of the created package. Well, this is what this `checkinstall` command replies:               checkinstall 1.6.2, Copyright 2009 Felipe Eduardo Sanchez Diaz Duran                This software is released under the GNU GPL.          /usr/bin/checkinstall: eval: line 598: syntax error near unexpected token `newline'     /usr/bin/checkinstall: eval: line 598: `echo Debian PhotoTools Maintainers <pkg-phototools-devel@lists.alioth.debian.org>'          The package documentation directory ./doc-pak does not exist.      Should I create a default set of package docs?  [y]: y          Preparing package documentation...OK          *****************************************     **** Debian package creation selected ***     *****************************************          This package will be built according to these values:           0 -  Maintainer: [ root@mypc ]     1 -  Summary: [ Package created with checkinstall 1.6.2 ]     2 -  Name:    [ feh ]     3 -  Version: [ 2.7 ]     4 -  Release: [ tar.bz2 ]     5 -  License: [ GPL ]     6 -  Group:   [ checkinstall ]     7 -  Architecture: [ i386 ]     8 -  Source location: [ feh-2.7 ]     9 -  Alternate source location: [  ]     10 - Requires: [ libc6,libice6,libsm6,libx11-6,libxaw7,libxext6,libxmu6,libxt6,dpkg,install-info ]     11 - Provides: [ feh ]     12 - Conflicts: [  ]     13 - Replaces: [  ]          Enter a number to change any of them or press ENTER to continue:           Installing with make install...          ========================= Installation results ===========================     installing manuals to /usr/local/share/man     installing docs to /usr/local/share/doc/feh     installing executables to /usr/local/bin     installing fonts to /usr/local/share/feh/fonts     installing images to /usr/local/share/feh/images     installing examples to /usr/local/share/doc/feh/examples          ======================== Installation successful ==========================      NOOOOOOOOOOOOOOOOO!!!!!!!!!! I did NOT want the damn package to INSTALL -- THAT IS WHY I USED `\--install=no` FOR CRYIN OUT LOUD!!! And then, apparently in an attempt to be sarcastic, the log continues:               Copying documentation directory...     ./     ./TODO     ./AUTHORS     ./COPYING     ./ChangeLog     ./README          Copying files to the temporary directory...OK          Stripping ELF binaries and libraries...OK          Compressing man pages...OK          Building file list...OK          Building Debian package...OK          NOTE: The package will not be installed      You must be kidding with this " _NOTE: The package will not be installed_ ", right, Mr. `checkinstall`? Sure you are; after this is done, note what I get:               $ apt-cache show feh | grep Version     Version: 1.10-1          $ feh --version     feh version 2.7     Compile-time switches: curl xinerama           $ which feh     /usr/local/bin/feh      Not sure where that `1.10-1` came from (it should have been at least `1.3.4`, as per above?) - but its damn obvious that the 2.7 DID get installed, IN SPITE of my instruction NOT to install... Surely, I can try to remove afterwards:               $ sudo dpkg -r feh     (Reading database ... 202193 files and directories currently installed.)     Removing feh ...     $ sudo dpkg --purge feh     (Reading database ... 202163 files and directories currently installed.)     Removing feh ...     Purging configuration files for feh ...     $ feh --version     feh version 2.7     Compile-time switches: curl xinerama      $ which feh     /usr/local/bin/feh      ... but not even `dpkg --purge` works (`apt-get remove` wouldn't work to begin with, since it's a manually installed .deb package). And besides `dpkg -r` not giving a version (so I'm not really sure what it is that should have been removed) - it in fact did NOT remove the bloody executable ?! But can anyone explain what is going here - and how to get `checkinstall` to _only_ generate a .deb, and NOT install it at the same time? Bonus question - how to remove ALL files, _including_ executables in `/usr/local/bin/`, that got installed in this way - since apparently `dpkg -r` doesn't work?


title: ServeRAID error in syslog, is it important?

text: I was checking the logs in server when i came across this message.               Nov 4 12:52:05 SERVERNAME ServeRAID Manager Agent: [338] Periodic scan     found one or more critical logical drives: controller 1. Repair as soon as     possible to avoid data loss.        1. What does this mean?   2. Is it Critical or can be ignored?   3. If critical how to solve it?


title: Registering a Standalong app in the Application Launcher of KDE

text: First off, I am using Kubuntu 12.04. I've just downloaded and unpacked a standalone installation of some software (Intellij's Phpstorm IDE, but I don't think it matters). I've copied the unpacked directory to my `/opt` directory using sudo. I am able to launch the main shell script from the commandline without using `sudo` with no issues. * * * I would like to run the app from my `Application Launcher` so, I ran the `Edit Applications...` app from the Launcher icon and added the path to the main shell script in a new entry (`/opt/PhpStorm-111.344/bin/phpstorm.sh`) and saved it. Whenever I click the newly added entry... nothing happens, the application does not launch. I have seen this question about registering applications in kde, and I dont think it applies to this situation since that is what the `Edit Applications...` dialog is supposed to do (I think). So what am I missing? Do I need to specify another way of running the command in the dialog entry? Is this a `.desktop` file issue? Something else? **EDIT:**   I ran the command `/opt/PhpStorm-111.344/bin/phpstorm.sh` from the `ALT+F2` _run_ box , invoking a terminal. I was returned with a message complaining that the `$JAVA_HOME` variable cannot be found. Now, I do indeed have a `$JAVA_HOME` environment variable setup in my `.bashrc` file, and it can be seen from an `echo $JAVA_HOME` command. Again, I am able to run the application with no problems if I simply open a terminal and run the shell script from there, so the `$JAVA_HOME` variable is seen in that context. I have logged out and back in and run `source ~/.bashrc`, and neither seem to help. I am thinking now it is some sort of user permission issue to the `$JAVA_HOME` variable that is preventing it from running. Any suggestions?


title: How to configure mounted FTP connection

text: I'm using latest CentOS with Gnome, and using bookmarked FTP connection, that connects to my server, and mounts remote directory. The thing is, I see no way to configure that FTP client, whatever that is. I get timeout's too often, and annoying popup of that, makes me do submit changes twice. So, question: how to configure integrated filesystem FTP connection/mounting tool, to set up some sort of connection keep-alive.


title: How can I populate a file with random data?

text: How can I create a new file and fill it with 1 Gigabyte worth of random data? I need this to test some software. I would prefer to use `/dev/random` or `/dev/urandom`.


title: What happened to my ext3 partition

text: I had an ext3 partition. I ran a dd command like this:               dd if=/dev/urandom of=/dev/part2 bs=1024 count=15000 seek="various values"      Where `various values` are basically 0, 15000K, 30000K etc. The point is I ran the dd command on the entire partition. Now the partition won't mount. I get an error "Can't find ext3 partition on ..." Questions:   1. What exactly happened to the partition? I know it got corrupted, but what exactly happened? As a clue `fsck /dev/part2` gives "The superblock could not be read or does not describe a correct ext2 filesystem."   2. How do I format it back to ext3?


title: RTC clock time sync with the Linux time on Startup

text: The RTC remembers its time set, and how does the linux kernel gets this time from dev/rtc and set it as the linux time. In other words on boot up - when does kernel reads the rtc and updates its linux time.


title: How to disable clicking in Seagate ST3000DM001?

text: Recently I bought this disk and I cannot get rid of funny clicking -- funny because normally not configured disk make dry click. This one make click like a sweet chirp. But besides this, this click occurs every several seconds, and it is annoying. I tried as usual: `hdparm -B 254` but it changed nothing. So does anyone know how to disable that clicking?


title: How to show full names on desktop in XFCE?

text: I am new to XFCE so forgive me if I am missing something dead simple, but... Let's say I have an icon on desktop "personal folder". What I actually see is the icon and "perso..." -- so **the question is** how to display full name, no matter how long it is. No shortening, however line breaks are fine (so for example it would be displayed in two lines "personal" and second "folder").


title: strace got message --- SIGIO (I/O possible) @ 0 (0) ---

text: I'm trying to monitor serial port communication using `strace -s9999 -o serialtrace.log -eread,write,ioctl` command. After few normal logging messages I got guge amount of message `\--- SIGIO (I/O possible) @ 0 (0) ---`. What does it means? How to get normal information instead of these lines?


title: Port Mirroring in Fedora?

text: I have set up an application that listens constantly to a port for network packets, and I would like to create another one that receives the same network packets ( for use as a test bed). Getting the packets sent to 2 different ports on the machine is not an option, so I was wondering if there is a way to set up a "port-mirror". Basically, is there an easy way to make all traffic received on port XXXXX also copy to port XXXXX + 1? I know there is a similar question here, but I don't quite understand the suggested solution. Barring that, is there another easy way to simulate network data to test some code with that I am overlooking? Any tips would be appreciated. Thanks!


title: How to clone a read-only portion of /proc file system

text: The problem with reading /proc file system is that it is not atomic. I tried using a library (procfs in Python) that wishes to read it, but it has glitches about 5% of the time because the process that I am after is now gone. So, I wish to copy everything in /proc to another location, say `/proc_clone/<GUID>/`. A GUID can be generated using the `uuidgen` command. The naive approach would be trying to use `cp -r`, but I am getting a whole bunch of 'permission denied' errors and it is taking more than a second. I am only after a subset `/proc/<pid>` and even then, only the read-only stuff that can be turned into a string (ultimately I wish to build a single JSON file that contains all of this). I am looking for a script that would do that for me and is also short, simple, very fast, **can deal with processes dying mid-flight by skipping them** , however, I would like to avoid writing C code - I would much rather stick to bash, existing utilities and maybe Perl / Python. The goal here is just to take a snapshot of a subset of `/proc`, not produce the JSON file itself. I have heard opinions that "one should not ever try to copy `/proc` but just read from it". Well, the non-atomic nature of it means that one has to throw a bunch of `try/catch` all over the code when trying to do very simple operations. Using a high level language like Python (what I ultimately want to use) to iterate over `/proc` is a slow method, which involves both IO and CPU time. This increases the risk of seeing a process die on you (I certainly see it often; I have a script that interrogates /proc every minute and I run into plenty of exceptions). I would like to build a library that outputs a single JSON file that contains cpu and memory usage information about processes in a human-readable format (e.g. using seconds and not jiffies, bytes and not pages, have units in addition to values. I am not concerned that it would take some time to create that file out of a directory dump; I just want to make sure that the snapshot is as accurate as possible. So. if I should not just copy /proc over, then which other method should I use?


title: Self contained VirtualBox VM

text: I would like to create VirtualBox VMs which are entirely contained in a single directory (including various aspects that are normally kept in a configuration in the ~/ directory). The idea is to remotely mount the directory and run the VM on that machine, or carry a VM on a stick or SD card. I'm particularly bother because I notice that VirtualBox tends to spread these things around.


title: How can ubuntu/truecrypt be configured so users can mount volumes if-and-only-if they have proper permissions on the mount-point?

text: If I add the line: `ALL= /usr/bin/truecrypt` to the sudoers file this lets all users mount volumes at arbitrary mount-points. The problem is a user could create a truecrypt volume and then mount it at `/etc/apache2` or `/var/www` -- directories which they shouldn't be able to tamper with. If a user doesn't have sudo rights to run `/usr/bin/truecrypt` then truecrypt fails after prompting for the administrator/user password. What's the proper way to configure the system/truecrypt so users can mount volumes in a sane/safe way? **e.g. they can only mount volumes to mount-points which they own (or have write-access to)?**


title: Starting Qt Application On Startup for Embedded Linux

text: I'm trying to get a Qt application to launch immediately after booting up. When booted, the Linux image does nothing more than launch an X server and a terminal. It also has the cron daemon running in the background. Obviously, my Qt application needs the X server to be running to do anything. I've seen a similar question for Red Hat and SUSE linux. However, I don't see this working for my image. I'm wondering if there is a standard way in Linux/UNIX to make a GUI application start immediately after the X Server. * * * **_EDIT 1_**               [sj755@localhost X11]$ tree /etc/X11/     /etc/X11/     |-- functions     |-- Xdefaults     |-- Xinit     |-- Xinit.d     |   |-- 01xrandr     |   |-- 11zaurus     |   |-- 12keymap     |   |-- 40xmodmap     |   |-- 50setdpi     |   |-- 55xScreenSaver     |   |-- 60xXDefaults     |   |-- 89xTs_Calibrate     |   `-- 98keymap-fixup     |-- xmodmap     |   |-- a716.xmodmap     |   |-- collie.xmodmap     |   |-- default.xmodmap     |   |-- h1910.xmodmap     |   |-- h2200.xmodmap     |   |-- h6300.xmodmap     |   |-- hx4700.xmodmap     |   |-- keyboardless.xmodmap     |   |-- omap5912osk.xmodmap     |   |-- poodle.xmodmap     |   |-- shepherd.xmodmap     |   |-- simpad.xmodmap     |   |-- slcXXXX.xmodmap     |   |-- xmodmap-invert     |   |-- xmodmap-left     |   |-- xmodmap-portrait     |   `-- xmodmap-right     |-- xorg.conf     |-- Xserver     |-- xserver-common     |-- Xsession     `-- Xsession.d         |-- 60xXDefaults         |-- 89xdgautostart         `-- 90xXWindowManager          3 directories, 36 files      * * * **_EDIT 2_**               root@devboard:~# cat /etc/X11/Xsession.d/90xXWindowManager     if [ -x $HOME/.Xsession ]; then         exec $HOME/.Xsession     elif [ -x /usr/bin/x-session-manager ]; then         exec /usr/bin/x-session-manager     else         exec /usr/bin/x-window-manager     fi      * * * **_EDIT 3_**               #!/bin/sh     #     # Very simple session manager for Mini X     #          # Uncomment below to enable parsing of debian menu entrys     # export MB_USE_DEB_MENUS=1           if [ -e $HOME/.mini_x/session ]     then     exec $HOME/.mini_x/session     fi          if [ -e /etc/mini_x/session ]     then     exec /etc/mini_x/session     fi          MINI_X_SESSION_DIR=/etc/mini_x/session.d     if [ -d "$MINI_X_SESSION_DIR" ]; then         # Execute session file on behalf of file owner         find $MINI_X_SESSION_DIR -type f | while read SESSIONFILE; do             set +e             USERNAME=`stat -c %U $SESSIONFILE`             # Using su rather than sudo as latest 1.8.1 cause failure [YOCTO #1211]     #       su -l -c '$SESSIONFILE&' $USERNAME             sudo -b -i -u $USERNAME $SESSIONFILE&             set -e         done     fi          # This resolution is big enough for hob2's max window size.     xrandr -s 1024x768          # Default files to run if $HOME/.mini_x/session or /etc/mini_x/session     # dont exist.           matchbox-terminal&     exec matchbox-window-manager


title: How can I change a module kernel version to a custom version so that it gets loaded on an ARM board?

text: I'm hacking on an ARM926 based board, with a custom kernel based on 2.6.30. I've got a program that needs a specific kernel module but since I have no kernel source I can't compile the module I need specifically for the board. Is there any way I can compile the module for the generic kernel 2.6.30 and make it work (load it with modprobe or insmod) on the custom version I've got running on the board?


title: Problems with USB goflex 2 TB

text: I am using CentOS 5.5 and have been using cpio to write backups to a 2 TB GoFlex USB drive. This drive worked great for over a year, but am now running into a problem and not sure what to do. When cpio is executing, I see files it's writing flying by on the screen and eventually, it end up with a Read-only file system error at different spots during the backup. CPIO error: 'cpio: write error: Read-only file system' Result code = 256 Copying a large file results in a 'Read-only file error' For example: cp: writing `/goflex/d1/ssi/daily/tophat_bkup_201307172000.cpio': Read-only file system After receiving the error, I run '/sbin/fsck.ext3 -y /dev/sda1' on the drive and it recovers the journal and cleans the file system. Sometimes I can copy a large file to it without problems, other times it dies with the error above within minutes. Any ideas?? Bad drive?? Something else I should try?? Tried reformatting the hard drive with fdisk (delete old partition) and formatting it again with '/sbin/mkfs -t ext3 /dev/sda1' but...As soon as I tried backing up to it again, I receive the error above.. Arggg!!! Thx!!! UPDATED: smartctl -H /dev/sda smartctl 5.42 2011-10-20 r3458 [i686-linux-2.6.18-348.4.1.el5PAE] (local build) Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net === START OF READ SMART DATA SECTION === SMART overall-health self-assessment test result: PASSED Please note the following marginal Attributes: ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE 190 Airflow_Temperature_Cel 0x0022 056 042 045 Old_age Always In_the_past 44 (0 14 48 28 0) smartctl -t short /dev/sda - complete without any errors Running 'smartctl -t long /dev/sda' now but this should take a while.. Results: Extended offline always aborts. No sure what aborted by host means but my guess is that it found something it didn't like on the disk. Not a very detailed report. smartctl -l selftest /dev/sda smartctl 5.42 2011-10-20 r3458 [i686-linux-2.6.18-348.4.1.el5PAE] (local build) Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net === START OF READ SMART DATA SECTION === SMART Self-test log structure revision number 1 Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error 1 Extended offline Aborted by host 90% 15189 2 Extended offline Aborted by host 90% 15189 3 Extended offline Aborted by host 90% 15188 4 Short offline Completed without error 00% 15186 5 Extended offline Aborted by host 90% 15186 6 Extended offline Aborted by host 90% 15186 7 Short offline Completed without error 00% 15186


title: Install OpenBSD on running Linux machine

text: I just found my old IBM ThinkPad 240 where I installed ArchLinux some years ago. The machine still works as intended but the package manager (pacman) does not work anymore at all. I tried to fix it without luck. What I would like to do is to install OpenBSD on this machine, but I don't find the external floppy hard drive anymore. So I can not install from floppy, cd-rom, network etc. But is it somehow possible to install OpenBSD within my running linux system ?


title: How to start java application after machine reboot?

text: I'm wondering if there is easier way to start java application (just tomcat server) after machine has been rebooted? Possible answers:   * Add the application as a service and then add it using `chkconfig <service> on`   * Link in runlevel 5 (e.g `/etc/rc.d/rc5.d` ) script that just starts the application server? And make it executable.   * ? Edit: I didn't notice that I put it in runlevel 6 - reboot... ;)


title: no menu entry for /dev/ttyusb0 failing to upload

text: I'm using Ubuntu 13.04 Gnome edition. I have a problem with my Arduino Duemilanove Board. Previously I was using kernel 3.9.2-030902-generic. After I installed kernel 3.10rc6 and I start my arduino IDE I didn't see a serial port /dev/ttyusb0 as before for uploading my code onto the board, Now there is only one /dev/ttyS0. I tried plugging my board in all the usb port but none of them helped in uploading via /dev/ttyS0. I don't know it's actually because of kernel 3.10 but previously everything was working fine. This is the link to lsusb and dmesg command output after plugging the board. I finally removed the kernel 3.10 and made the kernel 3.9.2 default. The dmesg remains teh same and does show some error in the last lines I tried google out the error but didn't find solution.


title: Can't swap between two bootable drives

text: I'm attempting to setup a 2-drive (sda, sdb) RAID 1 in my PC, using Raider to convert from my old single drive (sda) system to the new RAID 1. From sda, on sdb I ran:               # raider -R1      # raider --run      and it finished ok setting up the empty drive into the RAID array and copied all data. Now I have to swap the disks, but I can't make my PC boot from sdb, it always boot from sda. I've tried to modify the BIOS boot settings but nothing changed, I can only choose HD as boot device and change mount order, but not boot order between them. I'm using Debian Squeeze and Grub as boot loader. **EDITED** Motherboard: ASROCK N68C-S UCC HD: 2x 1Tb WD SATA2


title: if statement in .bashrc not working correctly

text: I set up `.bashrc` to show a long prompt if the terminal is at least 80 characters wide. Otherwise it shows a degraded, smaller prompt. I use an `if` statement to achieve this:               dp_smaller_than=80     if [ $COLUMNS -lt $dp_smaller_than ]     then         PROMPT_COMMAND="degr_prompt"     else         PROMPT_COMMAND="full_prompt"     fi      It only works correctly if I put a `sleep 0` or other command before this statement, otherwise it shows the following error:               [: -lt: unary operator expected      **Note:** I have the `degr_prompt` and `full_prompt` functions defined in the beginning of the file.


title: Linux Distro for use as Wireless Infrastructure Basestation

text: I am looking for some input on how to get a linux distro rolling that will be suitable for use as a wireless basestation. Now, there are the router firmware projects OpenWRT and DDWRT which are both Linux-based and offer the functionality I need, to an extent. The issue is that I wish to put this on an x86 machine and use it, not only as a basestation but, also for other, more general purposes. Now OpenWRT and DDWRT have the router functionality, but because they are meant for limited hardware they are stripped of much other functionality. So I would be looking for a solution that would allow my machine to run as a wireless infrastructure basestation while also doing the following:   * Bringing in video from an external framegrabber.   * Encoding this video with x264. I am looking for any input on what you might think is the most appropriate way to go about something like this.


title: "Split I/O"s on a Linux VM, disk alignment

text: I'm trying to figure out if there's some way I can tell if a system is being adversely affected by disk misalignment -- i.e. when I do a disk I/O operation, it actually needs to request extra blocks from the back end storage (we're using a SAN) because the requested block of data actually lives on multiple blocks on the actual disk. This problem allegedly affects VMs even more, as the disks are abstracted so that blocks don't align because of improper sector offsets, causing additional IOPS to be used when accessing the backend storage from the VM. Anyway, I've been looking at iostat output, and it seems like there's data there that might give me a clue to this, but I seem to be slow at reasoning through it. Is there some clue to indicate with iostat (or something else) that the machine might be performing more disk I/Os that optimal? (I'm not convinced that disk alignment is worth the effort to investigate/worry about, but I would love some opinions on the matter!)


title: Saving alsa settings

text: After a new update, there is no sound by default in my Debian Squeeze box until running `alsactl init`, but whenever rebooting the computer I have to run the command again to gain sound. How can I solve this problem?


title: WD 'elements' disk spins down, disappears

text: I have a 1TB Western Digital Elements USB drive connected to a _sheeva plug_ with Debian installed. I use autofs for auto mounting USB drives. Here are the options I currently use.               usb1 -fstype=auto,umask=000,user,rw,async :/dev/sda1      The drive spins down every now and then and when that happens, the mount point `/mnt/usb1` seems like it disappears. Running `dir /mnt` displays nothing when the drive spin down; however the drive can still be accessed by `dir /mnt/usb1`. Is there a way to setup autofs so that usb1 can always be visible and still allow the drive to spin down?


title: On executable files in Linux

text: It is said that in linux, unlike Windows, there's not a clear border between executables and other files. Well, in Windows, I write a C++ program, then it is precompiled, compiled and then linked to become a distinguished file: executable. The changes are so much that they are not reversible. But in Linux a simple text file containing a code is executed. So what do compilation and linkage do? If a code is executed, why is it compiled? What's good in this process and what is the main difference between the code and the final (so called) executable file in Linux? Why portability of programs is limited in Linux and needs a lot of (version specific) dependency requirements, if they are codes?


title: 1:1 copy with dd

text: I need to get a copy of an HDD that is a real 1:1, I mean not just the filesystem but also the geometry and the partition table and everything in between. if I'll just use               dd if=/dev/sdb of=/tmp/file      this will generate what I'm looking for ?


title: ssh login after changed IP

text: I have server running Ubuntu 12.04.2 LTS (`GNU/Linux 2.6.32-042stab078.28 i686`) Had no problem logging in to the server via ssh until my Internet Provider changed my IP. Now, the server keeps adding my IP to `/etc/hosts.deny` blacklist. Even when I delete it by hand and gives me `ssh_exchange_identification: Connection closed by remote host`. As I login with root (not secure, I know...) I removed my pub key from `/root/.ssh/known_hosts`, but it didn't help, so clearly there are other security mechanisms which I'm not aware of. Could somebody please give me some directions where I should look for the problem?


title: Start terminal on Debian login

text: I am able to login automatically into Debian. I changed the `/etc/gdm3daemon.conf` file to do so. What I'm having trouble doing now is getting the terminal window to appear after the login. I need to launch a terminal window and run a command to change the directory and then execute a shell file. I have a hacky work around where I save the state of the desktop, and in the `/etc/bash.bashrc` file, I added `cd` and `./` commands I want a cleaner way of doing these operations because next I will need to have a sort of splash screen cover up the GRUB initialization and have my program launch from the CLI as opposed to a GUI.


title: Adjusting constrast when scanning using SANE

text: I just did a scan with my new Brother multifunction CP-7065DN printer using the SANE frontend gscan2pdf. The paper in question was handwritten, and the scan was too light. When I reprinted the scan, it was significantly lighter than the original; too light. I'm interested in ways to fix this problem. Two different approaches come to mind:   1. Fix the problem by adjusting the settings in SANE (or it's frontends).   2. Post process the scan to improve the contrast, using only free software that runs on Unix-like platforms, naturally. The other possible option that comes to mind, namely adjust the hardware settings, don't seem to be an option with this Brother printer, and would be off-topic on this site anyway. As far as 1 goes, maybe there are settings even in gscan2pdf that would fix this problem, but I could not make sense of them. I quite like gscan2pdf. It is nice and simple and does what I need, which is to scan to PDF for A4 sized paper. However, I'd consider using another SANE frontend. As for 2, I came across the unpaper project whose purpose is to post-process scans, but I could not figure out if improving contrast was something it would do. If someone knows how to do this, I'd appreciate a pointer, preferably with a little detail. A mini-tutorial, as it were.


title: Using root account to give sudo priviledges for a wordpress install

text: I'm quite new to Linux but I need to install Wordpress on a Debian Wheezy machine. I have been reading tens of websites to prepare for this and they seem to say that Wordpress should NOT be installed as the root user. I created a normal user called Myname and I will try to do the installation with that user. But in all the tutorials the SUDO-command seems to be used. So my questions are these:   1. How do I, acting as root user, give the Myname user SUDO priviledges?   2. How can I know which SUDO priviledges I should be giving Myname? Do I need to be specific or can I give a broad range of them?


title: How to recursively list all hidden files and directories?

text: I want to list all hidden files and directories and then save result to file. Is there any command for this?


title: Check outgoing network traffic

text: In Ubuntu, how can I check what information is being sent through the network connection, what programs are doing it, and what sites is my computer connecting to? I am not paranoid about security, but who knows?


title: How can I output "temporarily" to the shell, like zsh tab completion does?

text: In `zsh` shell, when you hit Tab twice to get tab completion, your options are displayed below your prompt. But when you make a selection, the options disappear. I have a little script that outputs passwords to stdout based on keyword search. The only problem is, after I've copied and pasted and I'm done, the passwords stay in the terminal. I would really like to implement this "temporary" output for my passwords script. Is this possible?


title: How to read Word .doc files?

text: How can we read Microsoft Word (`.doc`) files in a Linux system? It doesn't support `.doc` files. I tried > `strings filename.doc | less` but it gives ugly output. Any other option? I would prefer a GUI based tool.


title: CPU governor settings

text: What are CPU governor settings? How can I get their values, if they're set? I have 24 vCPUs on my machine.


title: How to fix mpt2sas "port enable: FAILED with timeout (timeout=300s)"?

text: Since having set the drives attached to an LSI SAS 2008 controller to "Power up in standby", these drives are no longer being detected. Power up in standby is also known as PUIS, POIS or "ATA6 power up in standby mode". In the Super Micro X8SI6-F BIOS "Load onboard SAS Option Rom" is set to "Disabled'. Loading of kernel module mpt2sas during boot is disabled using: `echo 'blacklist mpt2sas' >> /etc/modprobe.d/mpt2sas.conf; depmod; update-initramfs -u -k $(uname -r)` `modprobe mpt2sas` is done in /etc/rc.local PUIS on the drives was set using "`/sbin/hdparm -s1 --yes-i-know-what-i-am- doing /dev/sdX`"               # tail /var/log/messages     Dec 19 21:07:21 debian kernel: [   14.503509] mpt2sas0: Scatter Gather Elements per IO(128)     Dec 19 21:07:22 debian kernel: [   14.735785] mpt2sas0: LSISAS2008: FWVersion(14.00.01.00), ChipRevision(0x03), BiosVersion(07.27.00.00)     Dec 19 21:07:22 debian kernel: [   14.735878] mpt2sas0: Protocol=(Initiator), Capabilities=(Raid,TLR,EEDP,Snapshot Buffer,Diag Trace Buffer,Task Set Full,NCQ)     Dec 19 21:07:22 debian kernel: [   14.736748] mpt2sas0: sending port enable !!     Dec 19 21:07:22 debian kernel: [   15.294663] e1000e: eth0 NIC Link is Up 100 Mbps Full Duplex, Flow Control: None     Dec 19 21:07:22 debian kernel: [   15.294759] e1000e 0000:03:00.0: eth0: 10/100 speed: disabling TSO     Dec 19 21:07:22 debian kernel: [   15.296146] ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready     Dec 19 21:07:23 debian kernel: [   16.257786] mpt2sas0: host_add: handle(0x0001), sas_addr(0x5003048007abbc00), phys(8)     Dec 19 21:12:22 debian kernel: [  314.234004] mpt2sas0: port enable: FAILED with timeout (timeout=300s)     Dec 19 21:12:54 debian kernel: [  346.439736] mpt2sas0: expander_add: handle(0x0009), parent(0x0001), sas_addr(0x50014380182cf0e6), phys(37)          # tail -n40 /var/log/syslog     Dec 19 21:41:11 debian kernel: [  240.376096] INFO: task modprobe:1341 blocked for more than 120 seconds.     Dec 19 21:41:11 debian kernel: [  240.376171] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.     Dec 19 21:41:11 debian kernel: [  240.376263] modprobe      D 0000000000000000     0  1341   1287 0x00000000     Dec 19 21:41:11 debian kernel: [  240.376414]  ffff88023f06b880 0000000000000082 0000000000000000 000000000000bfc5     Dec 19 21:41:11 debian kernel: [  240.376656]  0000000000000096 ffffffff8104e54b 000000000000f9e0 ffff88023d681fd8     Dec 19 21:41:11 debian kernel: [  240.376895]  0000000000015780 0000000000015780 ffff88023bc80000 ffff88023bc802f8     Dec 19 21:41:11 debian kernel: [  240.377134] Call Trace:     Dec 19 21:41:11 debian kernel: [  240.377204]  [<ffffffff8104e54b>] ? release_console_sem+0x17e/0x1af     Dec 19 21:41:11 debian kernel: [  240.377278]  [<ffffffff8105aeba>] ? __mod_timer+0x141/0x153     Dec 19 21:41:11 debian kernel: [  240.377350]  [<ffffffff812fbec4>] ? schedule_timeout+0xa5/0xdd     Dec 19 21:41:11 debian kernel: [  240.377422]  [<ffffffff8105aa34>] ? process_timeout+0x0/0x5     Dec 19 21:41:11 debian kernel: [  240.377492]  [<ffffffff812fbd04>] ? wait_for_common+0xde/0x15b     Dec 19 21:41:11 debian kernel: [  240.377566]  [<ffffffff8104a461>] ? default_wake_function+0x0/0x9     Dec 19 21:41:11 debian kernel: [  240.377647]  [<ffffffffa021d6e1>] ? _base_make_ioc_operational+0x929/0xa6f [mpt2sas]     Dec 19 21:41:11 debian kernel: [  240.377743]  [<ffffffffa021fa85>] ? mpt2sas_base_attach+0xb73/0xc61 [mpt2sas]     Dec 19 21:41:11 debian kernel: [  240.377817]  [<ffffffff810412ee>] ? enqueue_task_fair+0x3e/0x82     Dec 19 21:41:11 debian kernel: [  240.377889]  [<ffffffff8103a311>] ? enqueue_task+0x5f/0x68     Dec 19 21:41:11 debian kernel: [  240.377956]  [<ffffffff8103a403>] ? activate_task+0x22/0x28     Dec 19 21:41:11 debian kernel: [  240.378037]  [<ffffffffa0222e21>] ? _scsih_probe+0x32c/0x501 [mpt2sas]     Dec 19 21:41:11 debian kernel: [  240.378115]  [<ffffffff811a2d46>] ? local_pci_probe+0x12/0x16     Dec 19 21:41:11 debian kernel: [  240.378188]  [<ffffffff811a3996>] ? pci_device_probe+0xc0/0xe9     Dec 19 21:41:11 debian kernel: [  240.378263]  [<ffffffff81221520>] ? driver_probe_device+0xa3/0x14b     Dec 19 21:41:11 debian kernel: [  240.378333]  [<ffffffff81221617>] ? __driver_attach+0x4f/0x6f     Dec 19 21:41:11 debian kernel: [  240.378404]  [<ffffffff812215c8>] ? __driver_attach+0x0/0x6f     Dec 19 21:41:11 debian kernel: [  240.378477]  [<ffffffff81220def>] ? bus_for_each_dev+0x43/0x74     Dec 19 21:41:11 debian kernel: [  240.378549]  [<ffffffff812207af>] ? bus_add_driver+0xaf/0x1f8     Dec 19 21:41:11 debian kernel: [  240.378621]  [<ffffffff812218cf>] ? driver_register+0xa7/0x111     Dec 19 21:41:11 debian kernel: [  240.378698]  [<ffffffffa015f000>] ? _scsih_init+0x0/0x112 [mpt2sas]     Dec 19 21:41:11 debian kernel: [  240.378772]  [<ffffffff811a3bdc>] ? __pci_register_driver+0x50/0xb8     Dec 19 21:41:11 debian kernel: [  240.378849]  [<ffffffffa015f000>] ? _scsih_init+0x0/0x112 [mpt2sas]     Dec 19 21:41:11 debian kernel: [  240.378928]  [<ffffffffa015f0fc>] ? _scsih_init+0xfc/0x112 [mpt2sas]     Dec 19 21:41:11 debian kernel: [  240.379002]  [<ffffffff8100a065>] ? do_one_initcall+0x64/0x174     Dec 19 21:41:11 debian kernel: [  240.379072]  [<ffffffff8107ab54>] ? sys_init_module+0xc5/0x21a     Dec 19 21:41:11 debian kernel: [  240.379144]  [<ffffffff81010b42>] ? system_call_fastpath+0x16/0x1b     Dec 19 21:42:18 debian kernel: [  307.313037] mpt2sas0: _base_send_port_enable: timeout     Dec 19 21:42:18 debian kernel: [  307.313106] mpt2sas0: port enable: FAILED     Dec 19 21:42:18 debian kernel: [  307.313171] mpt2sas0: sending diag reset !!     Dec 19 21:42:19 debian kernel: [  308.430890] mpt2sas0: diag reset: SUCCESS     Dec 19 21:42:19 debian kernel: [  308.431001] mpt2sas 0000:01:00.0: PCI INT A disabled     Dec 19 21:42:19 debian kernel: [  308.431102] mpt2sas0: failure at /build/buildd-linux-2.6_2.6.32-46-amd64-_ApuPc/linux-2.6-2.6.32/debian/build/source_amd64_none/drivers/scsi/mpt2sas/mpt2sas_scsih.c:6021/_scsih_probe()!      # Regression Tested with Debian Linux kernels:   1. Linux debian 2.6.32-5-amd64 #1 SMP Sun Sep 23 10:07:46 UTC 2012 x86_64   2. BPO.3 (Linux debian 3.2.0-0.bpo.3-amd64 #1 SMP Thu Aug 23 07:41:30 UTC 2012 x86_64)   3. BPO.4 (Linux debian 3.2.0-0.bpo.4-amd64 #1 SMP Debian 3.2.32-1~bpo60+1 x86_64) Tested with SAS BIOS enabled = no change. After the timeout, bpo.3 and bpo4. do freeze. Even the PgUp/PgDown keys don't work at the console.               modinfo /lib/modules/2.6.32-5-amd64/kernel/drivers/scsi/mpt2sas/mpt2sas.ko | grep ^version:     version:        02.100.03.00      **Update #1** : Tested with LSI driver version 15.00.00.00 on BIOS and firmware upgraded adapter:               mpt2sas0: LSISAS2008: FWVersion(15.00.00.00), ChipRevision(0x03), BiosVersion(07.29.00.00)     mpt2sas0: port enable: FAILED with timeout (timeout=300s)      ~~And the system freezes 3492 seconds after boot with mpt2sas driver version 15.~~ Freezes are solved by flashing to IT firmware. **Update #2** : Some more detailed SMP reporting               # smp_rep_phy_err_log /dev/bsg/expander-0\:0 -vvv         Report phy error log request: 40 11 06 02 00 00 00 00 00 00 00 00 00 00 00 00      Report phy error log response:       Expander change count: 303       phy identifier: 0       invalid dword count: 18518       running disparity error count: 18492       loss of dword synchronization count: 2       phy reset problem count: 0          # smp_rep_phy_err_log /dev/bsg/expander-0\:1 -vvv         Report phy error log request: 40 11 06 02 00 00 00 00 00 00 00 00 00 00 00 00      Report phy error log response:       Expander change count: 715       phy identifier: 0       invalid dword count: 36103       running disparity error count: 35004       loss of dword synchronization count: 4       phy reset problem count: 0          # smp_rep_phy_sata --phy=5 /dev/bsg/expander-0\:0 -vvv         Report phy SATA request: 40 12 10 02 00 00 00 00 00 05 00 00 00 00 00 00      Report phy SATA response:       expander change count: 303       phy identifier: 5       STP I_T nexus loss occurred: 0       affiliations supported: 1       affiliation valid: 1       STP SAS address: 0x50014380182cf0c5       register device to host FIS:         34 00 50 01 01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00        affiliated STP initiator SAS address: 0x5003048007abbc00       STP I_T nexus loss SAS address: 0x0       affiliation context: 0       current affiliation contexts: 1       maximum affiliation contexts: 1          # smp_rep_exp_route_tbl /dev/bsg/expander-0\:0 -vvv         Report expander route table request:            40 22 ff 06 00 00 00 00  00 3e 00 00 00 00 00 00            00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00      Report expander route table response header:       expander change count: 303       expander route table change count: 1       self configuring: 0       zone configuring: 0       configuring: 0       zone enabled: 0       expander route table descriptor length: 4 dwords       number of expander route table descriptors: 0       first routed SAS address index: 0       last routed SAS address index: 0       starting phy id: 0      **Update #3** : Verbose logging enabled in mpt2sas.ko and scsi logging increased using `dev.scsi.logging_level = 0x180000F1` in `/etc/sysctl.conf`. Resulting /var/log/messages output:               debian kernel: [    0.927392] setting logging_level(0x00080000)     debian kernel: [    1.591808] mpt2sas0: sending port enable !!     debian kernel: [    3.113480] mpt2sas0: host_add: handle(0x0001), sas_addr(0x5003048007abbc00), phys(8)     debian kernel: [    3.124224] mpt2sas0: expander_add: handle(0x0009), parent(0x0001), sas_addr(0x50014380182cf0e6), phys(37)     debian kernel: [    3.137436] mpt2sas0: detecting: handle(0x000a), sas_address(0x50014380182cf0c0), phy(0)     debian kernel: [    3.137520] mpt2sas0: REPORT_LUNS: handle(0x000a), retries(0)     debian kernel: [    8.127417] mf:     debian kernel: [    8.127417]   0000000a 00000000 00000000 3a580000 00600000 00000018 00000000 000007f8      debian kernel: [    8.127842]   00000000 0000000c 00000000 00000000 00000000 00000000 00000000 02000000      debian kernel: [    8.128261]   000000a0 00000000 0000f807 00000000 00000000 00000000 00000000 00000000      debian kernel: [    8.128679]   d30007f8 3c3a7000 00000002 00000000      debian kernel: [    8.128980] mpt2sas0: issue target reset: handle(0x000a)     debian kernel: [    8.352363] mpt2sas0: log_info(0x31111000): originator(PL), code(0x11), sub_code(0x1000)     debian kernel: [    8.352500] mpt2sas0: target reset completed: handle(0x000a)     debian kernel: [    8.352563] mpt2sas0: issue retry: handle (0x000a)     debian kernel: [   11.347175] mpt2sas0: log_info(0x31111000): originator(PL), code(0x11), sub_code(0x1000)     debian kernel: [   11.347276] mpt2sas0: TEST_UNIT_READY: handle(0x000a), lun(0)     debian kernel: [   14.591621] mpt2sas0: log_info(0x31111000): originator(PL), code(0x11), sub_code(0x1000)     debian kernel: [   14.591720] mpt2sas0: SATA Initialization Timeout,sending a retry     debian kernel: [   14.591785] mpt2sas0: TEST_UNIT_READY: handle(0x000a), lun(0)     debian kernel: [   17.586480] mpt2sas0: log_info(0x31111000): originator(PL), code(0x11), sub_code(0x1000)     debian kernel: [   17.586836] mpt2sas0: detecting: handle(0x000b), sas_address(0x50014380182cf0c1), phy(1)      **Update #4** : No timeouts and correct drive initialization when PUIS = disabled. The BIOSes of other adapters, like the HP Smart Array P410/256MB controller (462862-B21) and Highpoint Rocket 2720SGL, are also not able to detect any PUIS/POIS Hitachi drives. The Highpoint controller BIOS says that it is spinning up Group #1, but is still not able to detect any drives behind the expander. How to detect drives in POIS/PUIS mode behind a HP SAS expander using the LSISAS2008 controller?


title: suspicious/phantom usb "Mass Storage Device"?

text: [solved, see last comments] I have `/dev/sdd` that doesn't seem to be a physical device. I'm trying to determine what hardware it is, or track what application created it. With this answer, I managed to gather this info: It is not on `mount` or `fstab`: _dmesg_               $ dmesg |grep sdd     sd 6:0:0:0: [sdd] Attached SCSI removable disk            $ dmesg |grep " 6:0:0:0"     scsi 6:0:0:0: Direct-Access     Mass     Storage Device        PQ: 0 ANSI: 0 CCS       sd 6:0:0:0: Attached scsi generic sg3 type 0       sd 6:0:0:0: [sdd] Attached SCSI removable disk        _readlink_               $ readlink /sys/block/sdd     ../devices/pci0000:00/0000:00:16.2/usb3/3-2/3-2:1.0/host6/target6:0:0/6:0:0:0/block/sdd        _/sys_               $ cat /sys/block/sdd/device/{vendor,model}     Mass          Storage Device        _fdisk_               $ fdisk /dev/sdd     fdisk: unable to open /dev/sdd: No medium found        ### Questions   * Any more tips where to gather info?   * Any idea what is going on?   * Could it be something virtualized?


title: How to sed a range of lines?

text: I have this:               sed -i '/^$/d' temp_spec.rb      which is stripping blank lines and works well. How can I make it only do this for lines 5-999 (or ideally 5 to end-of-file). I tried:               sed -n5,999 -i '/^$/d' temp_spec.rb     sed '5,999!d/^$/d' temp_spec.rb      but neither worked (no errors).


title: backspace in insert mode not erasing characters

text: I am new to **vi** , actually I have started learning vi from today and I have got stuck at the behavior of the **backspace** key. Actually when I fired up vi on my Ubuntu 12.04 for the first time my backspace key was working normally but after that it has started behaving strangely. Whenever I press the backspace in the insert mode it just moves one place to the left instead of erasing the character. How can I get back the default backspace functionality? Please note that I don't want to install vim or set nocompatibilty.


title: extending a partition by resize2fs

text: I have a 4 GB SD card. Before the image load               root@ubuntu# fdisk -l     Disk /dev/sdb: 3965 MB, 3965190144 bytes     49 heads, 48 sectors/track, 3292 cylinders, total 7744512 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x00000000             Device Boot      Start         End      Blocks   Id  System     /dev/sdb1            8192     7744511     3868160    b  W95 FAT32      I loaded a 2gb SD image to the card by `dd if=2gbsd-noeclipse-latest.dd of=/dev/sdb bs=4M conv=fsync`. The `fdisk -l` outputs:               root@ubuntu# fdisk -l     Disk /dev/sdb: 3965 MB, 3965190144 bytes     122 heads, 62 sectors/track, 1023 cylinders, total 7744512 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x00000000             Device Boot      Start         End      Blocks   Id  System     /dev/sdb1               1       16063        8031+   b  W95 FAT32     /dev/sdb2           16064       20158        2047+  da  Non-FS data     /dev/sdb3           20162       24257        2048   da  Non-FS data     /dev/sdb4           24260     3678207     1826974   83  Linux      so I have 2GB that is not used. I want to extend `sdb4` so that I can use the 2GB space that is not included. So I calculate the unused space as `(7744512-3678207)*512= 2081948160 byte` and `2081948160 / 1048576 = 1985.50048828 MB`. So roughly I will extend 1900 MB. I use `resize2fs` to do that:               resize2fs /dev/sdb4 1900M      However, it outputs               resize2fs 1.42.5 (29-Jul-2012)     open: No such file or directory while opening /dev/sdb4      **Could anyone tell me how I should use the command above or how else I can extend the`sdb4`?**


title: Change one typed key for another

text: I have LUbuntu 13.04. Is it possible to change the keyboard on the operating system, so that when I press `k` for instance, the system will hear it as I actually typed `m`? Or any other key for that matter. The thing is that the keyboard really isn't setup the way I would want to have it. If I could change the OS's keyboard then my efficiency would increase big time, especially in the long run as I could for instance, slowly evolve my keyboard towards a more efficient setting, such as Dvorak. here


title: Distro Customisation And Middleware Software Inclusion

text: I have been very recently introduced to UNIX/LINUX and I am overwhelmed by the sheer power. I am a CS Graduate student and for my final year project I want to make an artificially intelligent Linux Distro. While I can achieve the AI Part, I am confused about the customizing and OS. My initial thought was to use SUSE Studio to create a custom version to suit my needs, however I have a few queries.   * Say I install the SUSE in a virtual machine and customize it to it's brim and add middleware software to it. Then can I make it a distro from the installed version?   * If it is not possible with SUSE what would be your suggested oS?   * I would like to customize everything that is graphically visible to an user (boot screen, UI etc) and I would like to add my own software that starts up with the OS or as a background service.   * I will not customize the kernel although there is a probability that I might need to tweak it.


title: How can I change the battery icon in the systray?

text: I have installed Gnome and Awesome window manager. The window manager has a panel that displays systray icons according to the freedesktop.org System Tray Protocol Specification. I'd like to change the icon of the battery in the system tray. ![systray with incorrectly themed icons for power and Parcellite](http://i.stack.imgur.com/gpdHc.png) I first tried changing the icon theme; the icon in the systray does not match the icon from the selected theme, so I'm not sure where the icon is coming from. I've tried several themes in case there was a problem with the one I selected. I've read the mentioned specification, as well as the Gnome Icon Theme Specification and the Creating icon themes for GNOME article. I've also tried using `inotifywait -mr` on `/usr/share/icons` while restarting my Gnome session and while changing the icon theme using `gnome-tweak-tool`. It actually does touch the battery icon in my theme, but that's not what gets displayed. [UPDATE: the theme icon is what is being displayed, but it's rendering as black instead of the true color, which is a couple shades of gray]. I looked through every image in `/usr/share/gnome-power-manager`. The icon wasn't anywhere in there [UPDATE: it was - but I didn't recognize it because it's not black]. I tried hitting it with `xprop`, but it didn't give me anything useful, and running `xprop -spy` isn't showing anything when the widget is updated.


title: Command substitution: splitting on newline but not space

text: I know I can solve this problem several ways, but I'm wondering if there is a way to do it using only bash built-ins, and if not, what is the most efficient way to do it. I have a file with contents like > AAA > > B C DDD > > FOO BAR by which I only mean it has several lines and each line may or may not have spaces. I want to run a command like               cmd AAA "B C DDD" "FOO BAR"      If I use `cmd $(< file)` I get               cmd AAA B C DDD FOO BAR      and if I use `cmd "$(< file)"` I get               cmd "AAA B C DDD FOO BAR"      How do I get each line treated a exactly one parameter?


title: How do I transfer files to a SunOS server via sftp with FileZilla?

text: According to the admin of the webserver, I should be able to use Filezilla to transfer files to the server but I am getting an error. I set up Filezilla for transferring files sftp - using these directions I found on the web. However, this is what I get:               Status:    Connecting to server.edu:12345...     Response:    fzSftp started     Command:    open "gmcnulty@server.edu" 12345     Error:    Connection timed out     Error:    Could not connect to server     Status:    Waiting to retry...     Status:    Connecting to server.edu:12345...     Response:    fzSftp started     Command:    open "gmcnulty@server.edu" 12345     Error:    Connection timed out     Error:    Could not connect to server      Any point in the right direction would be very helpful. FYI - I'm able to connect to the remote server using X-Win32 ssh, from my Windows 7 machine (and I do not run this at the same time as Filezilla):               SunOS server.edu 5.10 Generic_120011-14 sun4v sparc SUNW,SPARC-Enterprise-T5220     System type is SUN4V with 65408 MB of memory.          server.edu(1):       **EDIT: ANSWER** The port must be set to 22 for ssh, not my user port.   http://en.wikipedia.org/wiki/List_of_well-known_ports_%28computing%29#Well- known_ports


title: Cross-platform (Linux, BSD, Solaris) way to check if pid exists

text: I am looking for a reliable cross-platform way to check if a process with a specific pid is running. Two possible solutions came up:   1. `kill -0 $PID` — exit status is 0 if it the process exists and 1 if not, however it also returns 1 for pids that require additional privileges to kill.   2. `ps a | grep "^\s*${PID}"` and similar which are plain ugly. Is there a way to have something like #1, but without the owner limitation?


title: what is the benefit of --squeeze-repeats in tr command

text: What is the benefit of `-s` or `\--squeeze-repeats` when we use `tr`? What practical usage?


title: Is it possible to mount a gzip compressed dd image on the fly?

text: I like create an image backup for the first time I'm backing up a system. After this first time I use rsync to do incremental backups. My usual image backup is as follows: Mount and zero out the empty space: `dd if=/dev/zero of=temp.dd bs=1M` `rm temp.dd` umount and dd the drive while compressing it `dd if=/dev/hda conv=sync,noerror bs=64K | gzip -c > /mnt/sda1/hda.ddimg.gz` to put the system back to normal, i will usually do a `gunzip -c /mnt/sda1/hda.img.gz | dd of=/dev/hda conv=sync,noerror bs=64K` This is really straightforward and allows my to save the 'whole drive' but really just save the used space. Here is the problem. Lets say I do the above but not on a clean system and don't get the rsync backups going soon enough and there are files that I want to access that are on the image. Let's say I dont have the storage space to actually unzip and dd the image to a drive but want to mount the image to get individual files off of it.... Is this possible? Normally, one wouldn't compress the dd image, which will allow you to just mount the image using `-o loop`... but this isn't my case... Any suggestions for mounting the compressed img on the fly? EDIT Would using AVFS to 'mount' the gz file then mounting the internal dd.img work (I don't think so... but would need verification...)?


title: Why is bash extended-globbing variable substitution acting at the byte level?

text: I thought that bash variable substitution and globbing worked at _character_ resolution, so I was rather surprised to see it acting at the _byte_ level.   Everything in my `locale` is `en_AU.UTF-8` When there is nothing to match and the pattern allows zero-to-many, the replacement occurs at the _byte_ level, as seen by subsequent replacements. I would have expected it to move along to the next _character_ , but it doesn't... Maybe this is just a whacky fringe case pattern, or I'm missing something obvious, but I do wonder what is going on here, and can I expect this behaviour elsewhere besides this particular pattern? Here is the script (which started as an attempt to split a string into characters).   I expected that the last test, with character `ळ`, would end up with only a _single_ space preceding the `ळ`, but instead, the character's 3 UTF-8 bytes are each preceded by a space. This results in invalid UTF-8 output.               shopt -s extglob     for str in  $'\t' "ab"  ळ ;do         printf -- '%s' "${str//*($'\x01')/ }" |xxd     done      Output:               0000000: 2009                                      .     0000000: 2061 2062                                 a b     0000000: 20e0 20a4 20b3                            . . .


title: Restore system with no execute permissions for bash and chmod

text: Good day everyone! One of my friends asked me a question: how to restore an unbootable Linux system (let it be CentOS or whatever) in the following situation:   * no execute permissions for **bash**   * no execute permissions for **chmod** What is needed is to restore the system with NO appeal to external sources in case we can. My first thought was to boot the system giving the kernel something like **init=/bin/something** parameter. I tried **/sbin/busybox** but with no result - got kernel panic instead of the command line. I know there are threads about fixing chmod itself, but what about bash? And using only what is located on the hard drive?


title: cannot mount usb

text: I have a compiled arch kernel. As there are some files in the /root, the user has enabled usb mounting. as dmesg shows it identifies two usbs. one is plugged to keyboard. I tried these commands, but they mounted folder is not my usb:               mount -t auto /dev/sdb2 /mnt/media     mount -t auto /dev/sda2 /mnt/media      in /dev I cannot see anything except               sda     sda1      sda2     sdb     sdb1     sdb2      what should I do to get my usb mounted? update: I am trying to mount the device on sdb1 and sdaxx, but it only mounts /root filesystem into /mnt/media. I also changed the format type of usb to ext4 as this is the only filesystem module loaded into the kernel. still not result.


title: Asus X101H - Touchpad not recognized (want to disable while typing)

text: I have been struggling with this issue for a while and have done an exhaustive search for answers here and elsewhere before posting this question. On my Asus X101H, the touchpad is not recognized as a touchpad. I have noticed that this problem does not only occur with my netbook, or Asus netbooks, but a whole host of netbooks. The devices are identified as "Glidepads". From what I have gathered, it is a kernel issue. And it is up to those working on the kernel to be resolved. However, people making bug reports on this issue have had issues with them being closed without being resolved, etc. All I want is for this miserable "glidepad" to be disabled while I am typing so it doesn't ruin what I am trying to write. On my notebooks, it works fine. But on netbooks, the only options present are for a mouse. I tried everyone's suggestion of installing "gpointing...", but that doesn't work even when I choose to "disable touchpad while typing". It has no effect. Does anyone have a solution for this issue? It affects Ubuntu, Kubuntu, Debian, and Mint (and probably many, many more.)


title: Fail to ssh to remote machine via hostname

text: The problem is that I fail to SSH to a remote machine via its hostname, while using its IP works. The hostname returned by command `hostname` is: `california_desert` while the name returned by command `nslookup $IP_address` is: `pcpp3238782`. They did not match each other. I think that's why I cannot connect to remote machine using its hostname. I have checked `/etc/hosts`, `/etc/hostname`, `/etc/sysconfig/network`: all set the hostname to `california_desert`. Checked with `/etc/resolve.conf`, the name server is set to the right one. Also tried `strace` but no new clue. Anybody can please help?


title: Restore default /etc directory

text: I just ran a script I'm working on, and due to a mistake in directories, overwrote most of the default `/etc` directory files. I can re-add my user account easily, but most other things are gone such as:               fstab     passwd     group     issue     mtab (syn link)     mdev     profile     inittab     shells     release     hostname     hosts      I'm not using any real custom configs, mostly a base `Fedora 19` install upgraded last week to `Fedora 20` via `fedup`. Do I have any options to re-create the default `/etc` files including my default-from-install `fstab`? I haven't shutdown/rebooted since this happened... so my current session is still active, although I can't open any additional terminals without getting the `I have no name!` user showing up (with no correct env variables); I do have one valid terminal open (if there is some way to write-out it's env variables or something). Reinstalling is possible as a last resort.


title: Migrating Data from Debian to ubuntu server

text: I am current in the process of migrating my website(big and complex with mysql backend) from debian server to ubuntu server. The kernel of debian and ubuntu are different. I have some concerned questions :   1. Is it possible to migrate database and website (with etc and home folder) from one server to another if the kernel version is different?   2. My understanding is it may cause error, because the kernel architecture are different which may cause some dependency error. Does my understanding is wrong?


title: How to know the event by looking at /dev/input/by-id

text: I want to access the keyboard device driver. I usually accesses it by looking at `/dev/input/by-name` but the event provided by it gets changed every time I log in. After searchin on the Net, I found that this problem can be removed if I use `/by-id` but I am unable to find any device there in that folder.


title: Installing GRUB to first sector of /dev/sdb damages partition table

text: I'm trying to build a linux-based embedded OS using buildroot framework. After compilation I extracted contents of root filesystem on micro SD card. Now I need to install GRUB. I have stage 1 and stage 2 files. trying to write them on first sectors of /dev/sdb (using a memory reader) destroys partition table:               dd if=stage1 of=/dev/sdb bs=512 count=1     dd if=stage2 of=/dev/sdb bs=512 seek=1      Also installation on a partition (/dev/sdb1) causes damage on it. How do I install GRUB?


title: Exit Google Chrome from terminal

text: Is there a way to cause `google-chrome` to quit, from the terminal, besides using `killall google-chrome`?   I would like to be able to close it from a script without killing it.


title: How to get the arguments to a php function via grep?

text: I am writing a script to let me know the database login info for each PHP- based web site on a server that I am migrating. The login information is usually done either like this:               $servername='localhost';     $database_username='someName';     $database_password='p@ssw0rd';     $database_name='someDatabase';          mysql_connect($servername, $database_username, $database_password);     mysql_select_db($database_name);      Or like this:               $pdo = new PDO("mysql: host={$servername}; dbname={$$database_name}", $database_username, $database_password);      The script is searching for each line which contains one of the PHP connection functions:               grep -irE "mysql_connect\|mysql_select_db\|new PDO" *      Now, how can I get each string that begins with `$` and ends with a non- alphanumeric? Additionally, if no `;` character is found on the screen I would like to be notified so that I could handle it manually, as some coders might do this:               $pdo = new PDO("mysql: host={$servername};                     dbname={$$database_name}",                     $database_username,                     $database_password                    );      After I get these tokens (PHP variables), I'll grep the file again for the tokens in hope to get their values;


title: Centos 6.5, openvpn port and SElinux

text: I am configuring an openvpn server on a new centos 6.5. But the main problem is that selinux is blocking openvpn to use the default port tcp 1194. The following is the sealert -a /var/log/audit/audit.log               SELinux is preventing /usr/sbin/openvpn from name_bind access on the tcp_socket .          ***** Plugin bind_ports (92.2 confidence) suggerisce  ************************          Se you want to allow /usr/sbin/openvpn to bind to network port 7505     Quindi you need to modify the port type.     Fai     # semanage port -a -t TIPO_PORTA -p tcp 7505     dove TIPO_PORTA è una delle seguenti: openvpn_port_t, http_port_t.      I am sorry, as u see the sealert is translated in italian. Anyway should I follow the advice like this:               # semanage port -a -t vpn -p udp 1194      or there are other more clean way to open the openvpn default port ?


title: Differences between %pre and %post in Kickstart on CentOS?

text: I have been setting up machines with Kickstart on CentOS and I am unsure about the differences between the `%pre` and `%post` sections of the kickstart `.cfg` file. The CentOS Documentation for the Pre-Installation Script states:               You can add commands to run on the system immediately after the ks.cfg has been parsed.      While the section for the Post-Installation Script states:               You have the option of adding commands to run on the system once the installation is complete.       After also reading this question, i notice that the `%pre` section does not seem to have access to the file system in some way. My question(s) are:   * What are the differences between `%pre` and `%post` sections of a kickstart script in CentOS?   * Is the `%pre` section run concurrently with the kickstart script (after parsing)?   * Is there persistent storage available during the `%pre` section of the kickstart script?


title: Not able to execute system files

text: I was trying to install ruby with :               sudo apt-get install ruby1.8      output:               W: Not using locking for read only lock file /var/lib/dpkg/lock     E: Unable to write to /var/cache/apt/     E: The package lists or status file could not be parsed or opened.      Output of `sudo dpkg --configure -a`               dpkg: unable to access dpkg status area: Read-only file system       output of `mount`               /dev/sda3 on / type ext4 (rw,errors=remount-ro)     tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)     proc on /proc type proc (rw,noexec,nosuid,nodev)     sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)     udev on /dev type tmpfs (rw,mode=0755)     tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)     devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)     /dev/sda1 on /boot type ext4 (rw)     /dev/sdb1 on /home type ext4 (rw)          mount: warning: /etc/mtab is not writable (e.g. read-only filesystem).            It's possible that information reported by mount(8) is not            up to date. For actual information about system mount points            check the /proc/mounts file.      Output of               cat /proc/mounts                    rootfs / rootfs rw 0 0     none /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0     none /proc proc rw,nosuid,nodev,noexec,relatime 0 0     none /dev devtmpfs rw,relatime,size=1553128k,nr_inodes=216450,mode=755 0 0     none /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0     /dev/disk/by-uuid/cf4fb4ae-6d12-407b-bf43-3b0daaaaaf74 / ext4 ro,relatime,errors=remount-ro,barrier=1,data=ordered 0 0     tmpfs /lib/init/rw tmpfs rw,nosuid,relatime,mode=755 0 0     tmpfs /dev/shm tmpfs rw,nosuid,nodev,relatime 0 0     /dev/sda1 /boot ext4 rw,relatime,barrier=1,data=ordered 0 0     /dev/sdb1 /home ext4 rw,relatime,barrier=1,data=ordered 0 0      output of dmesg (some last part)               [1968636.237601] JBD2: Detected IO errors while flushing file data on sdb1-8     [1968772.229102] JBD2: Detected IO errors while flushing file data on sdb1-8     [1968789.799409] IPv6 addrconf: prefix with wrong length 56     [1968990.325125] IPv6 addrconf: prefix with wrong length 56     [1969190.801848] IPv6 addrconf: prefix with wrong length 56     [1969192.245363] JBD2: Detected IO errors while flushing file data on sdb1-8     [1969197.698223] IPv6 addrconf: prefix with wrong length 56     [1969223.105506] JBD2: Detected IO errors while flushing file data on sdb1-8     [1969349.119764] JBD2: Detected IO errors while flushing file data on sdb1-8     [1969398.205686] IPv6 addrconf: prefix with wrong length 56     [1969598.713179] IPv6 addrconf: prefix with wrong length 56     [1969607.241633] JBD2: Detected IO errors while flushing file data on sdb1-8     [1969799.220758] IPv6 addrconf: prefix with wrong length 56     [1969825.462909] JBD2: Detected IO errors while flushing file data on sdb1-8     [1969831.231049] JBD2: Detected IO errors while flushing file data on sdb1-8     [1969999.728348] IPv6 addrconf: prefix with wrong length 56     [1970200.247944] IPv6 addrconf: prefix with wrong length 56     [1970221.321558] JBD2: Detected IO errors while flushing file data on sdb1-8     [1970253.105491] JBD2: Detected IO errors while flushing file data on sdb1-8      . `/var/log/syslog` do not have updated log   1. What should I do in order to have my file system read write without loosing all my data ?   2. Is it appropriate to do `sudo mount / -o remount,rw` ? What other option do I have ? NOTE: System is debian vm running in ESXI server.


title: Nouveau power management with Nvidia Tesla graphics

text: I have a MacBook Pro 13" Mid 2010 with a Nvidia GeForce 320M (NV50 family (Tesla) according to this list). I installed Linux on this machine and wanted to use Nouveau as the video driver. Everything works fine except for power saving, which is very annoying because the MacBook get's pretty hot all the time (even under no load the GPU stays at 90°C in even without a graphical environment) and battery is very limited. According to the `/sys/class/drm/card0/device/performance_level_*` information, the card should at least support clocking down the shader. I tried to change the performance_level to a lower value which only caused my graphics to stop working. This page suggests nouveau should be able to handle most of the power management features though.   1. Is there someone that got power management on a similar chip set-up and working?   2. Does anyone have more ideas on what to try? In particular I would like to make use of voltage regulation as I think that would work best.


title: Use cookies in curl to set language

text: I need to `curl | grep` some data from a webpage but _after_ setting language to English. In a browser, I can do this by clicking on a link. I first get the `SelectCulture` page and save the cookie in a file, then I use it to get the page I need:               #!/bin/bash          #tmp_file="$(mktemp)"     tmp_file="cookies"          curl -s \         --location \         --cookie "$tmp_file" \         --cookie-jar "$tmp_file" \         --user-agent Mozilla/4.0 \         --data-urlencode "ReturnUrl=http://it.bca-europe.com/Default.aspx" \         "http://it.bca-europe.com/Home/SelectCulture/en-GB-BDIT" | egrep "Ospite|Guest"          curl -s \         --location \         --cookie "$tmp_file" \         --user-agent Mozilla/4.0 \         "http://it.bca-europe.com/Default.aspx" | egrep "Ospite|Guest"      The problem is that on first run, when the `cookies` file does not exist yet, somehow the language doesn't change (you get italian _Ospite_ instead of _Guest_ ), whereas the script works from the second run. This, for example, avoids the need to use a temporary file instead of a static file. Moreover, weirdly, I can't get it to work in a single run. Any advice?


title: What happened to the GLP OpenGL extension?

text: I need to do headless hardware accelerated server rendering using OpenGL and found out that this is possible with pbuffers and frame buffer objects (FBO). But today these approaches still need a context and can't run without a running X server. I found a (now deleted, but on web archive) presentation from Sun about exactly what I want to do with the title "The GLP OpenGL Extension, OpenGL Rendering Without A Window System". What happened to this proposal and are there any alternatives today or any similar developments underway?


title: Comment the if statement and the matching endif keyword

text: In vim, I can find the matching `if` statement and prepend the appropriate comment symbol. (e.g. %s/. _alarm._ /#\0/g), but then I am left with dangling `endif`s that I have to find manually. I could simplify the process by using macro, but I could I achieve this with `sed` (more specifically one in vim)?


title: My Laptop gets hot on OpenSUSE

text: Recently I have installed openSUSE 12.3 on my Lenevo U410. I am using Windows on this machine too. But when I using openSUSE I realize that my laptop get much hotter than what is it in Windows. I also used Ubuntu before openSUSE. Ubuntu works fine, but now my fan works a little. Do you know how to solve this?


title: Gzip large amount of symlinked files

text: I have a folder containing a large amount of symlinked files. These files are each on the order of 10-11GB (fastq files to be specific). They come from a variety of source folders, but I made sure there's only one level of symlinks. I'm trying to gzip them by simply doing:               gzip *.fastq      That results in a bunch of               too many levels of symbolic links      And thus fails. However, when I do:               for i in `ls | egrep *.fastq$`; do gzip -c $i > $i.gz; done;      it does work. My question is simple. What is the difference between those? AFAIK, the only difference is that the second approach starts a new gzip process for each file, whereas the first one should do everything in one process. Can gzip only handle one symlinked file at a time? Doing the same on a test folder with normal files works both ways.