How to check integrity to HDD with UDF format

I'm having problem with a USB external drive, which seem to be formated with UDF and was being used for MAC and Windows (or at least that is what told). When I attached the HDD to my Linux system the next are the dmesg entries:               [21784.312960] usb 2-1.2: new high-speed USB device number 5 using ehci-pci     **[21784.406283] usb 2-1.2: New USB device found, idVendor=1058, idProduct=1023**     [21784.406291] usb 2-1.2: New USB device strings: Mfr=1,Product=2,SerialNumber=3     [21784.406296] usb 2-1.2: Product: Elements 1023     **[21784.406299] usb 2-1.2: Manufacturer: Western Digital**     [21784.406303] usb 2-1.2: SerialNumber: <The serial number>     [21784.406815] scsi8 : usb-storage 2-1.2:1.0     [21785.403470] scsi 8:0:0:0: Direct-Access     WD       Elements 1023    2005 PQ: 0 ANSI: 4     [21785.404686] sd 8:0:0:0: Attached scsi generic sg2 type 0     [21785.409491] sd 8:0:0:0: [sdb] 1953519616 512-byte logical blocks: (1.00 TB/931 GiB)     [21785.410605] sd 8:0:0:0: [sdb] Test WP failed, assume Write Enabled     [21785.411723] sd 8:0:0:0: [sdb] Asking for cache data failed     [21785.411729] sd 8:0:0:0: [sdb] Assuming drive cache: write through     [21785.413600] sd 8:0:0:0: [sdb] Test WP failed, assume Write Enabled     [21785.414603] sd 8:0:0:0: [sdb] Asking for cache data failed     [21785.414609] sd 8:0:0:0: [sdb] Assuming drive cache: write through     **[21785.449997]  sdb: sdb1 < >**     [21785.452466] sd 8:0:0:0: [sdb] Test WP failed, assume Write Enabled     [21785.453503] sd 8:0:0:0: [sdb] Asking for cache data failed     [21785.453515] sd 8:0:0:0: [sdb] Assuming drive cache: write through     [21785.453524] sd 8:0:0:0: [sdb] Attached SCSI disk      With that information the HDD seem to be OK. However I'm unable to identify the type of partition (some commands from Windows console show is UDF but I can't confirm with Linux counterparts) Trying to get more information, the fdisk -l throw the next: > Disk /dev/sdb: 1000.2 GB, 1000202043392 bytes 255 heads, 63 sectors/track, > 121600 cylinders, total 1953519616 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: 0x0bba88f0 > > Device Boot Start End Blocks Id System /dev/sdb1 0 1953519615 976759808 5 > Extended fdisk: unable to read /dev/sdb1: Inappropriate ioctl for device As the partition don't mount, tools like testdisk and fsck can't work here (Well testdisk and photorec just got freeze trying to read the HDD). And due the size of the disk the badblocks command take a lot of time (and is still running). I can't find many material about the UDF format (and I don't understand why a HDD use it when is ) and neither what to do when is unable to read any partition at all. Any suggestion?


What relationships do tie ACL mask and standard group permission on a file?

At first I create a file and check it's standard permissions and ACL entries:               $ touch file; ls -l file; getfacl file     -rw-r--r-- 1 user user 0 Jul 30 16:26 file     # file: file     # owner: user     # group: user     user::rw-     group::r--     other::r--      Then I set the ACL mask on the file and again check it's standard permissions and ACL entries:               $ setfacl -m mask:rwx file     $ ls -l file; getfacl file     -rw-rwxr--+ 1 user user 0 Jul 30 16:26 file     # file: file     # owner: user     # group: user     user::rw-     group::r--     mask::rwx     other::r--      Note that along with ACL mask standard group permission on the file also changed.   1. What connection does exist between ACL mask and standard group permission?   2. What is the reason for coupling ACL mask and file group permissions? What logic does lay behind it? The distributions in question are Debian Linux 7.6 and CentOS 7 * * * EDIT At this point I just wanted to share some findings of mine I came up with while researching the relations between standard file group permissions and ACL mask. Here are the empirical observations I found:   1. The ACL mask can be changed:     1. by directly setting it with `setfacl -m m:<perms>` command;      2. by changing file group permissions with `chmod` command (if ACL mask is already present; it may not be present because it is optional if there are no named user or group ACL permissions on the file);     3. by adding either named user or group ACL entry (mask will be automatically recalculated).   2. The mask will enforce maximum access rights (if there are ACL entries with permissions present that exceed the ACL mask permissions) only if the mask is set directly by setfacl or by modification of file group permission with chmod (not auto-calculated). Any changes to ACL entries will trigger the ACL mask automatic recalculation and effectively turn off the "enforcing mode".   3. There are a couple of side effects implicitly affecting standard file group permissions when using ACLs:     1. Named user or group ACL entry applied to a file can change the ACL mask (increase it's permissions) and hence the effective file group permissions. For example if you, as a file owner, have "rw-r--r-- jim students" permissions set on it and you also grant rw permission to the user "jack", you'll also implicitly grant rw permissions to anyone from the "students" group.     2. Stricter (less permissions) ACL mask can permanently remove corresponding standard file group permissions. E.g. if you have a file with rw standard file group permissions and you apply a read-only ACL mask to the file it's group permissions will decrease to read-only. Then if you remove all extended ACL entries (with `setfacl -b` command), the group permissions will stay read-only. This applies only to stricter ACL mask, softer ACL mask (more permissions) don't permanently alter original file group permission after it is removed.


updatedb for a beginner

The `updatedb` command, as I understand it, is basically the utility that keeps the `mlocate.db` database file updated. And it's a good idea to keep it updated regularly. For that matter, I've kept a daily cron to run the updatedb command. Now I'm looking under the hood, for the sake of understanding it better. When I cat `/etc/updatedb.conf` I see a few options:               PURNE_BIND_MOUNTS     PRUNENAMES     PRUNESPATHS     PRUNEFS      These options, as I read the manpage and other sites, let `updatedb` know to skip scanning specific files or directories on the file system. So, here's my question. Why would we want to skip indexing anything at all?   Obviously there must be good moments for it.


Cygwin ssh X forwarding - "The system network services are not compatible with this version."

I connect to Ubuntu system from windows system using Cygwin and putty with X forwarding. When I try to change Network settings in unity-control-center I get "The system network services are not compatible with this version" dialog window. Is it something to do with policy kit? How to able to perform all types of(non graphic intensive) tasks remotely using Cygwin X server. I also get this "libGL error: failed to load driver: swrast"; How can I avoid it?


Get package version of file

I've deleted a file in `/etc` provided by package `packageA`. Is there a way that I can reinstall only that file, provided I know where it is and which package provides it? I'm running Ubuntu 12.04 and 14.04 on my servers.


Creating symbolic links

When creating a softlink how do add the path, I did the following:               ln -s file1.txt /home/user9000/Desktop/SymbolicLink.txt      When I see the softlink on the desktop it marks that the doc doesn't exist. Am I doing something wrong?


Append a column

I've trawled through here and a few other places to try and find an answer to this, but it seems so stupidly simple that no one has answered it. All I need to do is add a single value in a new column to the end of every line. The closest thing I've found is using `sed -i "s/$/green/" ./test.txt` but this adds the value green to the next line, I need it added as a new column after the current final column I have a file like this:               chr -   xyz ordered_A01 5480    6144     chr -   xyz ordered_A01 5480    58001      I need it to look like this:               chr -   xyz ordered_A01 5480    6144    green     chr -   xyz ordered_A01 5480    58001   green      But instead I get this:               chr -   xyz ordered_A01 5480    6144     green     chr -   xyz ordered_A01 5480    5801     green


Command to highlight the occurrence of a method in a file?

How would I do the above? Would it be different for each text editor? Could it be done in the terminal? Thanks


CentOS - install using yum Apache 2.4

I need Apache 2.4 in CentOS because with Apache 2.2 mod_proxy_wstunnel is not possible. I have tried https://fedorahosted.org/SoftwareCollections/ but unfortunately its for RHEL after installing i cant execute the apache 2.4 yet Can anyone please show how to install a complete working Apache 2.4 in CentOS? EDIT:               # yum list installed | grep httpd     Failed to set locale, defaulting to C     httpd.x86_64                         2.2.15-30.el6.centos       @updates             httpd-tools.x86_64                   2.2.15-30.el6.centos       @updates             httpd24.x86_64                       1-6.el6                    @epel-httpd24        httpd24-apr.x86_64                   1.4.8-2.el6                @epel-httpd24        httpd24-apr-util.x86_64              1.5.2-5.el6                @epel-httpd24        httpd24-httpd.x86_64                 2.4.6-5.el6                @epel-httpd24        httpd24-httpd-tools.x86_64           2.4.6-5.el6                @epel-httpd24        httpd24-mod_ssl.x86_64               1:2.4.6-5.el6              @epel-httpd24        httpd24-runtime.x86_64               1-6.el6                    @epel-httpd24


Change Partition Table with GParted

I have an Ubuntu 12.04 LTS server that has 6x600GB SAS drives in a RAID 5 configuration (Perc 6/i). The partition scheme looks like this:               Partition    File System   Mount Point    Size     /dev/sda1    ext2          /boot          243.00 MiB     /dev/sda2    extended                     1.09 TiB       /dev/sda5  lvm2                         1.09 TiB     unallocated  unallocated                  1.64 TiB      I want to extend the `/dev/sda5` partition to include the unallocated space, and create one large partition. However, when I attempt to extend the partition, I get an error: > partition length of 5854484482 sectors exceeds the msdos-partition-table- > imposed maximum of 4294967295 I believe that I need to create a new partition table. However, I have also read that doing so can cause problems. My basic question is this: if I boot from the GParted Live CD, apply a new partition table, extend the `/dev/sda2` partition, and increase the size of the LVM, is the system going to boot up afterwards, and will the LVM still be intact? I understand that there is always the possibility of data corruption, and I've backed everything up. The real question is whether this is the correct way to go about modifying the disk configuration. Alternatively, is there a better way to incorporate the unallocated space into the LVM?


Where does the yanked text on commadline get stored?

When you delete characters on the command line using readline commands (e.g. `Ctrl-U`, you can paste using `Ctrl-y`, but where does it get stored? It does not seem to use X11 clipboard at all.


Changing soundtrack in a movie clip

What is the easiest way to change soundtrack of a movie clip? We recorded a clip using our camera, but the sound is not very interesting, hence we would like to use some music instead (we have an mp3 file). How can we swap the original sound in the clip for the one from mp3?


Turning standard output hyphen into a single command

I am working with scripts that output xml and I am using xmllint to format the output. Xmllint requires a source argument, so I use the hyphen to pipe standard output to it:               $> script.php source.txt | xmllint --format - > nice_output.xml      Since I run these scripts quite a bit, I would like to turn the `xmllint --format -` part into a single command that I can pipe into, but I am not sure how to even start. I would like to do this:               $> script.php source.txt | nicexml > nice_output.xml      Where `nicexml` is my custom command/alias. How do I do this?


ftdi_sio not pre-installed

I have recently recompiled my Ubuntu's kernel to Linus' most recent one. After rebooting, I tried to connect my computer to a development board via an FTDI FT232 USB-to-Serial converter. It used to work by just plugging it, but now it doesn't. When I type lsusb, the device is recognized:               Bus 001 Device 003: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC      But there is no /dev/ttyUSB0 file. I thought it was some problem with udev, but apparently, the ftdi_sio driver was deleted. It should come along with Ubuntu, but when I use lsmod | grep ftdi_sio, nothing is found. I've tried downloading the driver from FTDI's page, but after running make, I got the following error:               gcc -Wall -D__KERNEL__ -DMODULE -I/lib/modules/3.15.0-rc6/build/include -          D__SMP__ -DSMP -DMODVERSIONS -include /lib/modules/3.15.0-  rc6/build/include/linux/modversions.h -I/usr/src/linux-3.15.0-  rc6/drivers/usb/serial/ -O   -c -o ftdi_sio.o ftdi_sio.c     In file included from <command-line>:0:0:     /usr/include/stdc-predef.h:59:1: fatal error: /lib/modules/3.15.0- rc6/build/include/linux/modversions.h: No such file or directory      #endif      ^      compilation terminated.     make: *** [ftdi_sio.o] Error 1      I'm not sure what the following step would be. If I should keep trying to install the driver or find some way to make udev create the ttyUSB0 file.


Start notification-daemon as a service

I am running Debian and wish to make use of `notify-send`. But `notify-send` doesn't give me any notification unless I have one of the following running:               # either:     /usr/lib/notification-daemon/notification-daemon     # or:     /usr/lib/notify-osd/notify-osd      I'd like to run one of these as a service, rather than letting them be jobs in my shell. However, when I create a startup script for them in /etc/init.d (using skeleton as a template), trying to start the service results in the following output, and `notify-send` displays no notifications: > (notification-daemon:14467): Gtk-WARNING **: cannot open display:


Impossible to mount USB hard drive. Filesystem not recognized?

I have been using a raspberry PI since more than one year, with two USB 500GB IDE hard drives as a NAS/torrent box. Yesterday, one of the two hard drives started a repetitive rattling noise, and I could not read data from it through `sftp`. I assumed it was broken, so I opened the box the raspberry and the hard drives were in, connected the first HD to my laptop using the IDE to USB adapter I had. Windows wasn't able to mount it. I really cannot remember which FS this HD is using, so I tried to mount it on a Debian Virtual Machine. The image below shows the error I get. I have no idea what it means, what I understand is that Debian does not recognize which FS the hard disk is using. ![screenshot](http://oi41.tinypic.com/24o9jjq.jpg) This is the result of `fdisk -l` (only the part regarding the mentioned HDD):               Disk /dev/sdb: 500.1 GB, 500107862016 bytes     81 heads, 63 sectors/track, 191411 cylinders, total 976773168 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: 0x17e817e7            Device Boot      Start         End      Blocks   Id  System     /dev/sdb1            2048   976773167   488385560   83  Linux


Creating/Removing a symbolic link when a USB device connects/disconnects

I'm working with an Arduino board and Matlab under Linux. Matlab, unfortunately, doesn't recognize the Arduino board when is connected _unless_ I create a symbolic link to the Arduino board in `/dev` by:               sudo ln -s /dev/ttyACM0 /dev/ttyUSBx      Where `x` is a number and `ttyACM0` is the device associated to the Arduino board. I have to run this line every time I want to work with the Arduino and Matlab. So, my question is pretty simple: Is it possible to automatically create this symbolic link exactly when the Arduino board is connected and remove it when disconnected?


Unable to reduce core frequency freebsd

I'm working on a FreeBSD project where I need to maintain the temperature of the processor below a threshold value. In order to reduce the temperature I'm trying to dynamically change the frequency of the processor. I've used the following command to set the highest frequency of the processor.               sysctl debug.cpufreq.highest=value (in MHz)      But the change is not happening instantly. I've tried many times and it took random amount of time for changes to take effect. Why is it so?


Low-RAM Linux Distro Specifically for serving static sites

I'm looking for a near-zero-configuration linux distro that is designed specifically for serving static web sites and nothing else on a low-RAM machine (I'm planning on 128MB, but the option of less would be nice). Any ideas of a linux distro specifically tuned for serving static sites in a small footprint?


Squid not forwarding my packets proxied from iptables on router

I am trying to make openwrt's iptables from my router to direct to my squid proxy on my machine (since there is no enough space in router's flash memory) but even if I have my squid config ok ( meaning I set it up as proxy in my system and it works fine) when I set this up I won't get any response               iptables -t nat -I PREROUTING -s 192.168.1.0/255.255.255.0 -p tcp -j DNAT --to-destination 192.168.1.196:3128      What should I change in my config ? I have something like this               iptables -t nat -A PREROUTING -i eth0 -s ! squid-box -p tcp --dport 80 -j DNAT --to squid-box:3128     iptables -t nat -A POSTROUTING -o eth0 -s local-network -d squid-box -j SNAT --to iptables-box      but I do not really understand how should I perform this with my config.               br-lan    Link encap:Ethernet  HWaddr XX:XX:XX:XX:XX:XX                inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0          eth1      Link encap:Ethernet  HWaddr XX:XX:XX:XX:XX:XX               inet addr:188.XXX.XX.XX  Bcast:188.246.39.255  Mask:255.255.252.0


What are the pros and cons to editing iptables configuration file vs adding rules via the iptables command

I am working with a product on CentOS that occasionally needs to automatically add and remove rules from the iptables configuration. For example, during an update, we want to explicitly refuse inbound service traffic until the update is complete. Currently, the approach being used in the update code is to use `sed` and other text-handling utilities to comment out the relevant lines in the configuration file, restart the `iptables` service with the new configuration file, and then reverse the process at the end of the update, and restart the service once again. It seems to me that a better approach would be to use the `iptables -D table rule-specification` command at the start of the process, and then `iptables -A table rule-specification` at the end of the update. The biggest problem I see with automatically manipulating the configuration file is fragility: there are system tools that rewrite the configuration file, and may reorder parameters etc, possibly breaking the text parsing (`service iptables save` is an example). What is the recommended approach to making system configuration changes like this from within code, and why?


Making a FAT disk write-only or "hidden"

I have a USB device that by itself writes to some built-in flash memory. When it's plugged into a PC, it works like a USB mass storage device with a FAT fs. The device cannot be configured in any way other than to configure its filesystem from a PC. I would like to simply hide the files that this device writes to its filesystem. Is there a way to configure a FAT fs so that it accepts writes like normal but the directory structure cannot be viewed on a PC without me using a special command like changing permissions or setting a flag? The "hiddenness" doesn't need to protect from technically skilled people of any sort, just compulsive prying eyes. So something as simple as requiring the viewer to type a flag on "ls" would be good enough. But the hiding mechanism must work on Windows, Mac, and *nix.


What's the state-of-the-art in package "encapsulation" on Linux?

Is there any general, universal way that if I want to install package Foo or build Foo from source, I can have it do everything, install dependencies, etc, in its own "sandbox" directory without modifying anything else on the system? I'm asking about a way that I as an end-user of the package can use it without modifying anything outside of my chosen "installation directory". Not asking about how a package-maker could set this up.


How can I get a Low-RAM Ubuntu

I've seen several complaints that Ubuntu uses twice as much RAM in a fresh install compared to Debian. But it appears that using Ubuntu will make my life much easier due to its more recent versions of many packages. How can I install Ubuntu and then drastically reduce the amount of RAM it consumes? This is for a server with 256MB and no X.


Single command taking two strings to extract string between them, like 'tr' (without expressions)

Saw here a way to use sed to get text between two other strings in a line, like:               sed 's/.*starting_text\(.*\)ending_text.*/\1/'      but I'd like a simple command (like `tr`, but for string extraction) that just took two strings and would trim everything before the first string or after the second string, e.g.               grep something some_file | between message\"\:\" " with"      and would handle escaping characters.


libssl1.0.0 doesn't satisfy libssl0.9.8 dependency?

In Debian Wheezy, I'm trying to install the vmware-view-client package from the Ubuntu Software Center (because the open client won't work for my situation), but dpkg can't handle it. Synaptic says I have libssl1.0.0 installed (1.0.1c-4, along with -dev and -doc), but I get the following error message:               $ dpkg -i vmware-view-client_1.6.0-0ubuntu0.13.04_i386.deb      (Reading database ... 154107 files and directories currently installed.)     Preparing to replace vmware-view-client 1.6.0-0ubuntu0.13.04 (using vmware-view-client_1.6.0-0ubuntu0.13.04_i386.deb) ...     Unpacking replacement vmware-view-client ...     dpkg: dependency problems prevent configuration of vmware-view-client:      vmware-view-client depends on libssl0.9.8 (>= 0.9.8m-1); however:       Package libssl0.9.8 is not installed.          dpkg: error processing vmware-view-client (--install):      dependency problems - leaving unconfigured     Processing triggers for desktop-file-utils ...     Errors were encountered while processing:      vmware-view-client      Do I need to somehow get an earlier version of libssl (if so, how?) or can I somehow convince dpkg to use my version of libssl anyways?


How is ssh-agent being autostarted?

I am currently running Crunchbang Linux with Openbox, and as soon as I log in I have an `ssh-agent` process running and I can't for the life of me figure why it is being autostarted. Here is the `ssh-agent` process as well as its parent:               $ ps -ef | grep 2085     jonyamo   2085  1759  0 10:50 ?        00:00:00 /usr/bin/openbox --startup /usr/lib/openbox/openbox-autostart OPENBOX     jonyamo   2469  2085  0 10:50 ?        00:00:00 /usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session x-session-manager      It seems clear to me that it is being started via `/usr/lib/openbox/openbox- autostart`. So, investigating that file I found that there are three places it looks for processes to autostart: `/etc/xdg/openbox/autostart`, `$HOME/.config/openbox/autostart`, and `/usr/lib/openbox/openbox-xdg- autostart`.   1. `/etc/xdg/openbox/autostart` is empty, so that's not it.   2. `$HOME/.config/openbox/autostart` contains this potential culprit: `eval $(gnome-keyring-daemon -s --components=pkcs11,secrets,gpg) &` However, I completely disabled that and `ssh-agent` still autostarts.   3. `/usr/lib/openbox/openbox-xdg-autostart` is a script that starts xdg autostart .desktop files found in `/etc/xdg/autostart/`. But, apparently that is only starting the following processes: * * *                  $ /usr/lib/openbox/openbox-xdg-autostart --list | grep "\[\*\]"        [*] Print Queue Applet        [*] PulseAudio Sound System        [*] Network      Perhaps I am missing something completely obvious, but I would greatly appreciate anyone being able to help explain this mystery to me.


How to print the longest line in a file?

I'm looking for the simplest method to print the longest line in a file. I did some googling and surprisingly couldn't seem to find an answer. I frequently print the length of the longest line in a file, but I don't know how to actually print the longest line. Can anyone provide a solution to print the longest line in a file? Thanks in advance.


How to list available app commands in terminal

I'm using fluxbox and recently i wanted to start an application for video editing and i couldn't remember it's name. I usually run apps from terminal so I was wondering is there a way to list all (applications or) app specific commands like Xmonad's "run or raise" feature? This feature can be seen here at 1:14 : http://www.youtube.com/watch?v=AyNkBLhIpQk&feature=related Edit : I want to te able to type a command in terminal that will return the list of all applications installed (the list of all application commands available e.g. shotwell, gedit, gvim, vim, vi, firefox, chromium-browser etc.) basically i want to know which apps I can run (which apps i have)


Compiling kernel modules in Arch Linux

I'm currently running Arch Linux on linux-3.0-ARCH and I'm looking to compile kernel modules written for linux-2.6.22.14. I've only compiled kernel modules on a pre-configured debian. So all I had to know was the location for the kernel source and how to edit the module's Makefile accordingly. But since I'm trying this on my machine now, I downloaded the source for 2.6.22.14 and put it in /root/. I changed the Makefile for the module to point to this and I executed 'make'. All I get now is:               Makefile:1443: *** mixed implicit and normal rules. Stop.      Someone once said I'd have to compile this kernel source. If so, is there an easier way to obtain the compiled version, to plug here instead of the source code?


Got the "ERROR: Cannot decode data link type 239" message when turn on sniffer mode

I would like install snort 2.9.6 into Centos 7 the installation is ok and the result of the self-testing mode is correct but when I run this command to change Snort into sniffer or nids mode. I got this error message: " **_ERROR: Cannot decode data link type 239_** " I try to recompile again with including the " --enable-non-ether-decoders " option as these steps:               ./configure  --enable-non-ether-decoders --enable-sourcefire     make     make install     make clean      I still get that error


Switching from Debian 6 Squeeze stable to testing version

I had this problem and I asked some friends of mine and their advice was to upgrade from my messed-up Debian Squeeze system to the testing version. So I did it. First I changed the `/etc/apt/sources.list` file to use testing repositories. Then I used `sudo apt-get update` and after that `sudo apt-get dist-upgrade`. After a long hour everything was upgraded (I suppose). Then I saw that system warning for restarting the system. Done. First thing after the restart that surprised me was the GRUB loader. There were not just the 2 choices for `Debian 2.6.x.x` and `Debian 2.6.x.x (recovery)` but also the new versions `Debian 3.0.xx` (first in the grub list) and `Debian 3.0.xx`. I selected the `Debian 3.0.xx` and then the whole screen messed-up. Just some colorful pixels and nothing clear to see. Does anyone have any idea how can I cope with it? P.S. If I select the Debian 2.6.xx it is working (lets say properly) but the design is changed and I have no System menu top-left any more + I don't have right mouse click on the desktop. As Gilles suggested I am posting the output from `/boot/grub/grub.cfg`               maistora@maistora:~$ vi /boot/grub/grub.cfg                #     # DO NOT EDIT THIS FILE     #     # It is automatically generated by grub-mkconfig using templates     # from /etc/grub.d and settings from /etc/default/grub     #          ### BEGIN /etc/grub.d/00_header ###     if [ -s $prefix/grubenv ]; then       load_env     fi     set default="0"     if [ "${prev_saved_entry}" ]; then       set saved_entry="${prev_saved_entry}"       save_env saved_entry       set prev_saved_entry=       save_env prev_saved_entry       set boot_once=true     fi          function savedefault {       if [ -z "${boot_once}" ]; then         saved_entry="${chosen}"         save_env saved_entry       fi     }          function load_video {       insmod vbe       insmod vga       insmod video_bochs       insmod video_cirrus     }          insmod part_msdos     insmod ext2     set root='(hd0,msdos1)'     search --no-floppy --fs-uuid --set=root 94dc5612-177b-4222-b426-f9fa5bad2664     if loadfont /usr/share/grub/unicode.pf2 ; then       set gfxmode=640x480       load_video       insmod gfxterm       insmod part_msdos       insmod ext2       set root='(hd0,msdos1)'       search --no-floppy --fs-uuid --set=root 94dc5612-177b-4222-b426-f9fa5bad2664       set locale_dir=($root)/boot/grub/locale       set lang=en_US       insmod gettext     fi     terminal_output gfxterm     set timeout=5     ### END /etc/grub.d/00_header ###          ### BEGIN /etc/grub.d/05_debian_theme ###     insmod part_msdos     insmod ext2     set root='(hd0,msdos1)'     search --no-floppy --fs-uuid --set=root 94dc5612-177b-4222-b426-f9fa5bad2664     insmod png     if background_image /usr/share/images/desktop-base/spacefun-grub.png; then       set color_normal=light-gray/black       set color_highlight=white/black     else       set menu_color_normal=cyan/blue       set menu_color_highlight=white/blue     fi     ### END /etc/grub.d/05_debian_theme ###          ### BEGIN /etc/grub.d/10_linux ###     menuentry 'Debian GNU/Linux, with Linux 3.0.0-1-686-pae' --class debian --class gnu-linux --class gnu --class os {             insmod gzio             insmod part_msdos             insmod ext2             set root='(hd0,msdos1)'             search --no-floppy --fs-uuid --set=root 94dc5612-177b-4222-b426-f9fa5bad2664             echo    'Loading Linux 3.0.0-1-686-pae ...'             linux   /boot/vmlinuz-3.0.0-1-686-pae root=UUID=94dc5612-177b-4222-b426-f9fa5bad2664 ro  quiet             echo    'Loading initial ramdisk ...'             initrd  /boot/initrd.img-3.0.0-1-686-pae     }     menuentry 'Debian GNU/Linux, with Linux 3.0.0-1-686-pae (recovery mode)' --class debian --class gnu-linux --class gnu --class os {             insmod gzio             insmod part_msdos             insmod ext2             set root='(hd0,msdos1)'             search --no-floppy --fs-uuid --set=root 94dc5612-177b-4222-b426-f9fa5bad2664             echo    'Loading Linux 3.0.0-1-686-pae ...'             linux   /boot/vmlinuz-3.0.0-1-686-pae root=UUID=94dc5612-177b-4222-b426-f9fa5bad2664 ro single             echo    'Loading initial ramdisk ...'             initrd  /boot/initrd.img-3.0.0-1-686-pae     menuentry 'Debian GNU/Linux, with Linux 2.6.32-5-686' --class debian --class gnu-linux --class gnu --class os {             insmod gzio             insmod part_msdos             insmod ext2             set root='(hd0,msdos1)'             search --no-floppy --fs-uuid --set=root 94dc5612-177b-4222-b426-f9fa5bad2664             echo    'Loading Linux 2.6.32-5-686 ...'             linux   /boot/vmlinuz-2.6.32-5-686 root=UUID=94dc5612-177b-4222-b426-f9fa5bad2664 ro  quiet             echo    'Loading initial ramdisk ...'             initrd  /boot/initrd.img-2.6.32-5-686     }     menuentry 'Debian GNU/Linux, with Linux 2.6.32-5-686 (recovery mode)' --class debian --class gnu-linux --class gnu --class os {             insmod gzio             insmod part_msdos             insmod ext2             set root='(hd0,msdos1)'             search --no-floppy --fs-uuid --set=root 94dc5612-177b-4222-b426-f9fa5bad2664             echo    'Loading Linux 2.6.32-5-686 ...'             linux   /boot/vmlinuz-2.6.32-5-686 root=UUID=94dc5612-177b-4222-b426-f9fa5bad2664 ro single             echo    'Loading initial ramdisk ...'             initrd  /boot/initrd.img-2.6.32-5-686     }     ### END /etc/grub.d/10_linux ###          ### BEGIN /etc/grub.d/20_linux_xen ###     ### END /etc/grub.d/20_linux_xen ###          ### BEGIN /etc/grub.d/30_os-prober ###     ### END /etc/grub.d/30_os-prober ###          ### BEGIN /etc/grub.d/40_custom ###     # This file provides an easy way to add custom menu entries.  Simply type the     # menu entries you want to add after this comment.  Be careful not to change     # the 'exec tail' line above.     ### END /etc/grub.d/40_custom ###          ### BEGIN /etc/grub.d/41_custom ###     if [ -f  $prefix/custom.cfg ]; then       source $prefix/custom.cfg;     fi     ### END /etc/grub.d/41_custom ###      lspci               maistora@maistora:~$ lspci     00:00.0 Host bridge: Silicon Integrated Systems [SiS] 671MX     00:01.0 PCI bridge: Silicon Integrated Systems [SiS] PCI-to-PCI bridge     00:02.0 ISA bridge: Silicon Integrated Systems [SiS] SiS968 [MuTIOL Media IO] (rev 01)     00:02.5 IDE interface: Silicon Integrated Systems [SiS] 5513 [IDE] (rev 01)     00:03.0 USB Controller: Silicon Integrated Systems [SiS] USB 1.1 Controller (rev 0f)     00:03.1 USB Controller: Silicon Integrated Systems [SiS] USB 1.1 Controller (rev 0f)     00:03.3 USB Controller: Silicon Integrated Systems [SiS] USB 2.0 Controller     00:04.0 Ethernet controller: Silicon Integrated Systems [SiS] 191 Gigabit Ethernet Adapter (rev 02)     00:05.0 IDE interface: Silicon Integrated Systems [SiS] SATA Controller / IDE mode (rev 03)     00:06.0 PCI bridge: Silicon Integrated Systems [SiS] PCI-to-PCI bridge     00:07.0 PCI bridge: Silicon Integrated Systems [SiS] PCI-to-PCI bridge     00:0f.0 Audio device: Silicon Integrated Systems [SiS] Azalia Audio Controller     01:00.0 VGA compatible controller: ATI Technologies Inc Mobility Radeon HD 3400 Series     02:00.0 Network controller: Atheros Communications Inc. AR928X Wireless Network Adapter (PCI-Express) (rev 01)      dpkg -l linux-image-*               maistora@maistora:~$ dpkg -l linux-image-\*     Desired=Unknown/Install/Remove/Purge/Hold     | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend     |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)     ||/ Name                                   Version                                Description     +++-======================================-======================================-============================================================================================     un  linux-image-2.6                        <none>                                 (no description available)     un  linux-image-2.6-486                    <none>                                 (no description available)     ii  linux-image-2.6-686                    3.0.0+39                               Linux for modern PCs (dummy package)     un  linux-image-2.6-686-bigmem             <none>                                 (no description available)     un  linux-image-2.6-amd64                  <none>                                 (no description available)     un  linux-image-2.6-k7                     <none>                                 (no description available)     un  linux-image-2.6-openvz-686             <none>                                 (no description available)     un  linux-image-2.6-vserver-686            <none>                                 (no description available)     un  linux-image-2.6-vserver-686-bigmem     <none>                                 (no description available)     un  linux-image-2.6-xen-686                <none>                                 (no description available)     ii  linux-image-2.6.32-5-686               2.6.32-38                              Linux 2.6.32 for modern PCs     ii  linux-image-3.0.0-1-686-pae            3.0.0-3                                Linux 3.0.0 for modern PCs     ii  linux-image-686-pae                    3.0.0+39                               Linux for modern PCs (meta-package)      Hope I got everything right.


Unable to mount root fs over NFS

I am attempting to set up the first (of many) Raspberry Pis running Pidora (a Fedora Remix) to boot from an NFS share. It is my goal to eventually place a dozen or more Raspberry Pis in the datacenter I use to power several different services for my infrastructure and clients and hopefully replace some of the smaller VPS nodes that I am currently using. My configuration in cmdline.txt is:               dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/nfs nfsroot=<serverip>:/fake/path,nolock ip=dhcp elevator=deadline rootwait      On the Pi, the output I see is:               IP-Config: Got DHCP answer from <router>, my address is <clientip>     IP-Config: Complete:     device=eth0, hwaddr=<macaddress>, ipaddr=<clientip>, mask=255.255.255.0, gw=<routerip>     host=<clientip>, domain=, nis-domain=(none)     bootserver=<routerip>, rootserver=<serverip>, rootpath=     nameserver0=<routerip>     (It pauses for a bit here)     VFS: Unable to mount root fs via NFS, trying floppy     VFS: Cannot open root device "nfs" or unknown-block(2,0); error -6     Please append a correct "root=" boot option; here are the available partitions:     .....      The export configuration is:               /fake/path        <clientip>(rw,no_root_squash,insecure,no_subtree_check)      On the NFS Server (an OpenVZ Container), the output I see in the /var/log/messages is:               Aug 22 23:24:01 vps-4178 rpc.mountd[928]: authenticated mount request from <clientip>:783 for /fake/path (/fake/path)     Aug 22 23:24:38 vps-4178 rpc.mountd[928]: authenticated mount request from <clientip>:741 for /fake/path (/fake/path)     Aug 22 23:25:25 vps-4178 rpc.mountd[928]: authenticated mount request from <clientip>:752 for /fake/path (/fake/path)     Aug 22 23:26:12 vps-4178 rpc.mountd[928]: authenticated mount request from <clientip>:876 for /fake/path (/fake/path)      To test, I've made sure I can mount (non-root) from both the Pi and another machine and it worked. Does anyone have an idea on what could be wrong or how to narrow it down? **UPDATE:** The process has gotten slightly further. The server is still showing the same message, however the client is now saying " is not responding, still trying". Here is the tcpdump (tcdump -vv 'port not 22') during the process:               tcpdump: listening on venet0, link-type LINUX_SLL (Linux cooked), capture size 65535 bytes     02:27:49.396600 IP (tos 0x0, ttl 50, id 56458, offset 0, flags [DF], proto UDP (17), length 144)         <clienthostname>.3541049940 > <serverhostname>.nfs: 116 read fh Unknown/01000401D2255200F6209D570C172001AA2F2645000000000000000000000000 4096 bytes @ 516096     02:27:49.396694 IP (tos 0x0, ttl 64, id 22318, offset 0, flags [+], proto UDP (17), length 1500)         <serverhostname>.nfs > <clienthostname>.3541049940: reply ok 1472 read REG 100755 ids 0/0 sz 1630184 nlink 1 rdev ffffffff fsid 579d20f6 nodeid 120170c a/m/ctime 1408774668.892909 1404929018.000000 1408747025.202589     02:27:49.396700 IP (tos 0x0, ttl 64, id 22318, offset 1480, flags [+], proto UDP (17), length 1500)         <serverhostname> > <clienthostname>: udp     02:27:49.396701 IP (tos 0x0, ttl 64, id 22318, offset 2960, flags [none], proto UDP (17), length 1264)         <serverhostname> > <clienthostname>: udp     02:27:49.396963 IP (tos 0x0, ttl 64, id 34369, offset 0, flags [DF], proto UDP (17), length 72)         <serverhostname>.57067 > <redacted2>.domain: [udp sum ok] 45505+ PTR? <redacted>.in-addr.arpa. (44)     02:27:49.400054 IP (tos 0x0, ttl 60, id 0, offset 0, flags [DF], proto UDP (17), length 121)         <redacted2>.domain > <serverhostname>.57067: [udp sum ok] 45505 q: PTR? <redacted>.in-addr.arpa. 1/0/0 <redacted>.in-addr.arpa. PTR <clienthostname>. (93)     02:27:49.400289 IP (tos 0x0, ttl 64, id 34372, offset 0, flags [DF], proto UDP (17), length 73)         <serverhostname>.51421 > <redacted2>.domain: [udp sum ok] 15808+ PTR? <redacted3>.in-addr.arpa. (45)     02:27:49.401603 IP (tos 0x0, ttl 60, id 0, offset 0, flags [DF], proto UDP (17), length 115)         <redacted2>.domain > <serverhostname>.51421: [udp sum ok] 15808 q: PTR? <redacted3>.in-addr.arpa. 1/0/0 <redacted3>.in-addr.arpa. PTR <redacted2>. (87)     02:27:50.496543 IP (tos 0x0, ttl 50, id 56459, offset 0, flags [DF], proto UDP (17), length 144)         <clienthostname>.3541049940 > <serverhostname>.nfs: 116 read fh Unknown/01000401D2255200F6209D570C172001AA2F2645000000000000000000000000 4096 bytes @ 516096     02:27:50.496627 IP (tos 0x0, ttl 64, id 22319, offset 0, flags [+], proto UDP (17), length 1500)         <serverhostname>.nfs > <clienthostname>.3541049940: reply ok 1472 read REG 100755 ids 0/0 sz 1630184 nlink 1 rdev ffffffff fsid 579d20f6 nodeid 120170c a/m/ctime 1408774668.892909 1404929018.000000 1408747025.202589     02:27:50.496634 IP (tos 0x0, ttl 64, id 22319, offset 1480, flags [+], proto UDP (17), length 1500)         <serverhostname> > <clienthostname>: udp     02:27:50.496636 IP (tos 0x0, ttl 64, id 22319, offset 2960, flags [none], proto UDP (17), length 1264)         <serverhostname> > <clienthostname>: udp     02:27:52.694985 IP (tos 0x0, ttl 50, id 56460, offset 0, flags [DF], proto UDP (17), length 144)         <clienthostname>.3541049940 > <serverhostname>.nfs: 116 read fh Unknown/01000401D2255200F6209D570C172001AA2F2645000000000000000000000000 4096 bytes @ 516096     02:27:52.695058 IP (tos 0x0, ttl 64, id 22320, offset 0, flags [+], proto UDP (17), length 1500)         <serverhostname>.nfs > <clienthostname>.3541049940: reply ok 1472 read REG 100755 ids 0/0 sz 1630184 nlink 1 rdev ffffffff fsid 579d20f6 nodeid 120170c a/m/ctime 1408774668.892909 1404929018.000000 1408747025.202589     02:27:52.695064 IP (tos 0x0, ttl 64, id 22320, offset 1480, flags [+], proto UDP (17), length 1500)         <serverhostname> > <clienthostname>: udp     02:27:52.695066 IP (tos 0x0, ttl 64, id 22320, offset 2960, flags [none], proto UDP (17), length 1264)         <serverhostname> > <clienthostname>: udp     02:27:57.105354 IP (tos 0x0, ttl 50, id 56461, offset 0, flags [DF], proto UDP (17), length 144)         <clienthostname>.3541049940 > <serverhostname>.nfs: 116 read fh Unknown/01000401D2255200F6209D570C172001AA2F2645000000000000000000000000 4096 bytes @ 516096     02:27:57.105451 IP (tos 0x0, ttl 64, id 22321, offset 0, flags [+], proto UDP (17), length 1500)         <serverhostname>.nfs > <clienthostname>.3541049940: reply ok 1472 read REG 100755 ids 0/0 sz 1630184 nlink 1 rdev ffffffff fsid 579d20f6 nodeid 120170c a/m/ctime 1408774668.892909 1404929018.000000 1408747025.202589     02:27:57.105456 IP (tos 0x0, ttl 64, id 22321, offset 1480, flags [+], proto UDP (17), length 1500)         <serverhostname> > <clienthostname>: udp     02:27:57.105458 IP (tos 0x0, ttl 64, id 22321, offset 2960, flags [none], proto UDP (17), length 1264)         <serverhostname> > <clienthostname>: udp     02:28:05.914058 IP (tos 0x0, ttl 50, id 56462, offset 0, flags [DF], proto UDP (17), length 144)         <clienthostname>.3541049940 > <serverhostname>.nfs: 116 read fh Unknown/01000401D2255200F6209D570C172001AA2F2645000000000000000000000000 4096 bytes @ 516096     02:28:05.914130 IP (tos 0x0, ttl 64, id 22322, offset 0, flags [+], proto UDP (17), length 1500)         <serverhostname>.nfs > <clienthostname>.3541049940: reply ok 1472 read REG 100755 ids 0/0 sz 1630184 nlink 1 rdev ffffffff fsid 579d20f6 nodeid 120170c a/m/ctime 1408774668.892909 1404929018.000000 1408747025.202589     02:28:05.914137 IP (tos 0x0, ttl 64, id 22322, offset 1480, flags [+], proto UDP (17), length 1500)         <serverhostname> > <clienthostname>: udp     02:28:05.914138 IP (tos 0x0, ttl 64, id 22322, offset 2960, flags [none], proto UDP (17), length 1264)         <serverhostname> > <clienthostname>: udp     02:28:07.014579 IP (tos 0x0, ttl 50, id 56463, offset 0, flags [DF], proto UDP (17), length 144)         <clienthostname>.3541049940 > <serverhostname>.nfs: 116 read fh Unknown/01000401D2255200F6209D570C172001AA2F2645000000000000000000000000 4096 bytes @ 516096     02:28:07.014665 IP (tos 0x0, ttl 64, id 22323, offset 0, flags [+], proto UDP (17), length 1500)         <serverhostname>.nfs > <clienthostname>.3541049940: reply ok 1472 read REG 100755 ids 0/0 sz 1630184 nlink 1 rdev ffffffff fsid 579d20f6 nodeid 120170c a/m/ctime 1408774668.892909 1404929018.000000 1408747025.202589     02:28:07.014672 IP (tos 0x0, ttl 64, id 22323, offset 1480, flags [+], proto UDP (17), length 1500)         <serverhostname> > <clienthostname>: udp     02:28:07.014674 IP (tos 0x0, ttl 64, id 22323, offset 2960, flags [none], proto UDP (17), length 1264)         <serverhostname> > <clienthostname>: udp     02:28:09.216009 IP (tos 0x0, ttl 50, id 56464, offset 0, flags [DF], proto UDP (17), length 144)         <clienthostname>.3541049940 > <serverhostname>.nfs: 116 read fh Unknown/01000401D2255200F6209D570C172001AA2F2645000000000000000000000000 4096 bytes @ 516096     02:28:09.216102 IP (tos 0x0, ttl 64, id 22324, offset 0, flags [+], proto UDP (17), length 1500)         <serverhostname>.nfs > <clienthostname>.3541049940: reply ok 1472 read REG 100755 ids 0/0 sz 1630184 nlink 1 rdev ffffffff fsid 579d20f6 nodeid 120170c a/m/ctime 1408774668.892909 1404929018.000000 1408747025.202589     02:28:09.216107 IP (tos 0x0, ttl 64, id 22324, offset 1480, flags [+], proto UDP (17), length 1500)         <serverhostname> > <clienthostname>: udp     02:28:09.216109 IP (tos 0x0, ttl 64, id 22324, offset 2960, flags [none], proto UDP (17), length 1264)         <serverhostname> > <clienthostname>: udp


Invert boolean variable

I want to try simple script               flag=false     while !$flag     do        read x        if [ "$x" -eq "true" ]        then          flag=true        fi        echo "${x} : ${flag}"     done      But when i run it, if i type true, i will see that x="true" and flag="true", but the cycle doesn't end. What is wrong with script? How to proper invert boolean variable?


How do I identify on my system after successful boot. weather it was crash or was it a shutdown or reboot or something else?

Depending on the restart of the system, I need to make my application taking some follow up. my system is get restarted as following:   1. my self as system admin rebooting sudo init 6 or sudo reboot   2. my self as system admin init 0 or sudo shutdown   3. NOT myself, System crash of get frozen and hangs (physically power off and power on)   4. NOT myself, System off, power failure (physically need to power on) Now, when I am not involved the system is either having reboot or shutdown where I have no, idea for those cases. But in my every power down/power off I have one preset problem where second hardware I need to send commands for setting configuration which match with my box. * * * So, how can I detect the previous actions? Was it frozen, was it shutdown, was it reboot or was it etc. etc. So that I can on boot read the log and take related actions?


Remote desktop server as daemon

I'm using KRFB as remote desktop server in my Linux Mint KDE. It works fine as usual remote desktop server but I've to log-in then run it manually (or at start up) How can I run KRFB of any remoter desktop server runs as daemon without need to log-in at first?


Regex awk to Cisco Interface

I would like to know if have some Sed/Grep or Awk regex to parse Cisco interface section, with specific attribute, like bellow. Content of file.txt               !     interface FastEthernet0/1      no ip unreachables     !     interface FastEthernet0/2      no ip proxy-arp     !      Script:               #!/bin/bash     VALUE="no ip proxy-arp"     awk -v RS='!\n' -v PATTERN=${VALUE} '/$PATTERN/' file.txt | awk '/^interface/';     exit 0      The problem is when I run line directly from shell, it work, but when I run from script, it don't work. Running with `bash -x`, I can see that `awk` can't replace variable value. Any suggestions ?


Execute commands coming from a serial port

I have some hardware that is sending commands over /dev/ttyACM0 every once in a while and I'd like to execute them in a terminal. For example, if the ascii "ls" comes over /dev/ttyACM0, I'd like to have a terminal actually run that. Is there some command-line-fu I can use to do that?


Remove a corrupted file in a Linux system

How to remove a file that is corrupted? In Linux (Fedora based), when I type: `ls -l` I get               drwxr-xr-x.  2 dmiller3 dmiller3     4096 Jul 26 13:57 SomeFile     ??????????   ? ? ?                   4096 Jul 26 13:57 CorruptedFile        I can't do anything with this CorruptedFile. I can't use it in delete or anything. It's the only file in the entire system that is like this. What causes this, and how can I remove it? File system is ext2.


Can I send the ouput of a log to a command as an argument to an option in syslog-ng?

According to the documentation I can execute a program somewhat like so:               destination knotifier { program('/path/to/executable'; };      And it will send the log to the stdin of the executable. But what if the program I'm executing would need the input as an argument to an option? Is there a way to do that? Or do I have to write a wrapper for the program I'm executing?


Allow a user to read some other users' home directories

I am new to system administration and I have a permission related query. I have a group called `administration`. Inside the `administration` group, I have the users `user1`, `user2`, `user3`, `superuser`. All the users are in the `administration` group. Now, I need to give permissions to the user `superuser` to be able to view the `/home` directory of the other users. However, I do not want `user1`, `user2`, `user3` to see the home of any other user other than himself. (That is, `user1` should be able to see only `user1`'s home and so on). I have created the users and groups and assigned all the users to the group. How should I specify the permissions for the `superuser` now? In other words, I'm thinking of having two groups (say `NormalUsers` and `Superuser`). The `NormalUsers` group will have the users `user1`, `user2` and `user3`. The `Superuser` group will only have the user `Superuser`. Now, I need the `Superuser` to have full access on the files of users in the group `NormalUsers`. Is this possible in Linux?


What does it mean to "quiesce" a filesystem?

Actually, I don't care whether you talk about filesystems or any other thing that might be Quiesce'd in a software setting. I'm just looking for some more clarification about what this bit of technical jargon actually means.


Split logs from cron jobs

I currently have a log file which has no limit and I was hoping to be able to set up a cron job that would start writing to a new file so it doesn't get too big. Would that be possible? So it would keep the old one with a date and start a new one, with a 10MB size limit.


Which filesystems can RHEL 5 read from and write to? Are there any that work but not well? I'm partitioning and external hard drive and I haven't been able to find a comprehensive list anywhere.


Does Redhat subscript provide access to yum repositories?

I created an install script on an AWS Redhat instance and i'm not trying to use the same script on a base Redhat install. Nearly every package in my script comes back as "No package..." I've expanded my local repos but i've still haven't been able to match the repos I had access to in AWS. Could this be because I do not have a Redhat subscription and access to the Redhat subscription channels? My experience in Redhat has been limited by always using Amazon Web Services, so I haven't had to deal with a clean install in the past.


Scrip to delete files older than 6 months

Setting up a cron job for once a month to start a script. the script is to rotate a file each month as it gets too big and rename the old one. when a file is older than six months I wanted it to be deleted. Looking to run this script once a month. Is that possible to get the old one deleted? Please let me know if that isn't clear enough.


Better approach to generating and adding contents to files

I have an input file like below.               1 First one     2 First two     3 First three     3 Second three      I am generating 2 output files like below.                 #FILE1       1 First one      2 First two      3 First three       #FILE2      1 First one      2 First two      3 Second three      I have the below code which works perfectly fine for smaller inputs.               containsElement () {       local e       for e in "${@:2}"; do [[ "$e" == "$1" ]] && return 0; done       return 1     }          declare -a InputIDs     touch file1.txt     while IFS=' ' read id value; do                       containsElement "$id" "${InputIDs[@]}"                  ret_val=$(echo $?)                  if [ "$ret_val" -eq 1 ]                  then                  #foreach file present in the directory, we need to add.                  for f in /home/ramesh/*; do                  echo "$id $value" >> $f;                  done                  else                       counter=0                  for f in /home/ramesh/*; do                  let counter=counter+1                  filename="$id.$counter"                  cp "$f" /home/ramesh/"$filename".txt                  sed -i '/^'$id'/d' /home/ramesh/"$filename".txt                  echo "$id $value " >> /home/ramesh/"$filename".txt                  done      The problem is the script takes almost 15 minutes to execute for inputs that have 50 values. (out of 50 values, 15 are repeated). For the 50 values, it generated **131,072** files which I believe are the total number of combinations possible for my input. Is there a better approach to implement this? EDIT: A more complicated example is as below.               16250 somevalue in second column for all rows     16875      17507      17662      18048      18276      18355      20544      23169      158497      160042      163152      163740      164017      164775      165500      166321      166600      166600      166600      166871      167201      169308      169762      169866      170408      171318      171529      171947      173032      174311      174760      177043      177176      177783      177783      177783      177783      177783      177783      177783      177783      177783      177783      177783      177783      177783      177783      177783      177783


Can not use mail command

error like this:               [user1@fedora ~]$ mail     No mail for user1      but that is appear Maildir(mailbox) in /home/user1.


What is the difference between a symlink and binding with fstab?

In Eric Hammond's article Running MySQL on Amazon EC2 with EBS he shows how to add a second drive (`/vol/`) and then progresses to move `mysql`'s config and data there. `/sdh` gets mounted as `/vol` by editing `fstab` and adding:               /dev/sdh /vol xfs noatime 0 0      And next some paths are added like this:               /vol/etc/mysql /etc/mysql     none bind      I don't have a problem with doing this way but I don't quite understand what is going on. I can most closely compare this to using a symlink, something like:               ln -s /etc/mysql /vol/etc/mysql      I've taken a look at `man fstab` without seeing much information about the `bind` syntax and can't find it in the `fstab` section in the Linux Administrator's Handbook either. Can someone shed some light on `fstab`'s `bind` syntax, how it works, what it does, and where I should be able to find more information on it?


Using grep to match only a match group in a regular expression?

I need to set my keyboard layout with `setxkbmap` before launching Wine games, as I use Dvorak for typing and this breaks every game's controls. What I'd like to do is simply write a script that grabs the current keyboard layout before starting the game, stores it in a variable, then restores it after the game is done:               ORIGINAL_LAYOUT=`setxkbmap -query | grep -P 'layout\:\s{5}(\w+)'`     setxkbmap us     wine ...     setxkbmap $ORIGINAL_LAYOUT      The problem that I'm having is that grep matches the entire line and not just my capture group. Is there a way for me to simply dump the matched capture group? For example, the output of `setxkbmap -query` is:               rules:      evdev     model:      pc105     layout:     dvorak      I'm interested in grabbing the layout.


How do I install Cinnamon on Xubuntu?

I have Xubuntu 13.10 on a Lenovo R60 Thinkpad type 9459-AT8, Intel Graphics 945GM, 3GB RAM usable. I tried to add Cinnamon from Synaptic, but after doing so and cycling power, there's no option to select it at login time. I also tried adding Cinnamon as per http://www.dedoimedo.com/computers/ubuntu-cinnamon.html, which did not give me a chance to select Cinnamon after a reboot:               sudo add-apt-repository ppa:gwendal-lebihan-dev/cinnamon-stable     sudo apt-get update     sudo apt-get install cinnamon


Automatic cleanup of Bash history

How can Bash history be automatically cleaned up? For example   * Remove detectable typos from history (`ls-lh` does not show up in `which`, so it is removed, I meant to type `ls -lh`)   * Clean excessive spaces `cd  /` and `cd /   ` should be normalized so they are the same. Can this be done in bash? Maybe a filter on all commands before they are executed, or before they go into history? I hope I don't have to wait until it is written to the file before running a cleanup routine. That would mean logging out before cleanup occurs. `:(`


Wireless problems

installed linux mint on a netbook and was working fine until yesterday. When I go to netwrk icon at the bottom, all my ssid are missing and I now "Wireless Network device not ready" in grey.It looks like the wireless is disabled and I don't know how to enable it. I keep loading the nameserver to my resolv.conf but it keep losing it. After enabling wireless - it says "wireless network device not ready" Please help


64-bit Linux doesn't recognize my RAM between 3 and 32 GB

**My problems were caused by a faulty memory module** and quite possibly a broken kernel binary. * * * I just now booted my PC with basically brand new hardware. I've been running Debian 6.0 AMD64 before, and no change there (literally; I just unplugged the hard disks from the old motherboard and reconnected them to the new one), but found something curious:   * I have physically installed 4 x 8 GB of RAM   * UEFI/BIOS setup reports 16383 MB of RAM   * Linux `free -m` reports 2985 MB of RAM 2985 MB seems too close to the magical 3 GB mark for it to be purely coincidence, but `uname -r` prints `2.6.32-5-amd64`; clearly a 64-bit kernel, which is all that has ever been installed on the system drive I'm using. The new motherboard is an Asus M5A97 Pro, which has four DDR3 slots supposedly supporting 8 GB modules. The memory modules themselves are identical, four Corsair XMS3 PC12800 8 GB, purchased together. I haven't looked around the UEFI setup in detail, but did browse through it and saw nothing that seemed like it would need changing to enable large amounts of RAM. **Edit:** Further confirmation that I really am running 64-bit:               # file `which free`     /usr/bin/free: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped     #      What's up with this, and what can I do about it? **Edit 2:** dmesg, dmidecode and meminfo, as requested. I don't have physical access to the system right now, so will have to wait until tonight to pull out some modules and see what that does. (Note that dmidecode reports 3 x 8GB plus one empty DIMM slot. Also note the MTRR mismatch message from the kernel, leading to a loss of 13 GB, which at least adds up with what the motherboard itself is reporting.)               # dmidecode --type memory     # dmidecode 2.9     SMBIOS 2.7 present.          Handle 0x0026, DMI type 16, 23 bytes     Physical Memory Array             Location: System Board Or Motherboard             Use: System Memory             Error Correction Type: Multi-bit ECC             Maximum Capacity: 32 GB             Error Information Handle: Not Provided             Number Of Devices: 4          Handle 0x0028, DMI type 17, 34 bytes     Memory Device             Array Handle: 0x0026             Error Information Handle: Not Provided             Total Width: 64 bits             Data Width: 64 bits             Size: 8192 MB             Form Factor: DIMM             Set: None             Locator: DIMM0             Bank Locator: BANK0             Type: <OUT OF SPEC>             Type Detail: Synchronous             Speed: 1333 MHz (0.8 ns)             Manufacturer: Manufacturer0             Serial Number: SerNum0             Asset Tag: AssetTagNum0             Part Number: Array1_PartNumber0          Handle 0x002A, DMI type 17, 34 bytes     Memory Device             Array Handle: 0x0026             Error Information Handle: Not Provided             Total Width: 64 bits             Data Width: 64 bits             Size: 8192 MB             Form Factor: DIMM             Set: None             Locator: DIMM1             Bank Locator: BANK1             Type: <OUT OF SPEC>             Type Detail: Synchronous             Speed: 1333 MHz (0.8 ns)             Manufacturer: Manufacturer1             Serial Number: SerNum1             Asset Tag: AssetTagNum1             Part Number: Array1_PartNumber1          Handle 0x002C, DMI type 17, 34 bytes     Memory Device             Array Handle: 0x0026             Error Information Handle: Not Provided             Total Width: 64 bits             Data Width: 64 bits             Size: 8192 MB             Form Factor: DIMM             Set: None             Locator: DIMM2             Bank Locator: BANK2             Type: <OUT OF SPEC>             Type Detail: Synchronous             Speed: 1333 MHz (0.8 ns)             Manufacturer: Manufacturer2             Serial Number: SerNum2             Asset Tag: AssetTagNum2             Part Number: Array1_PartNumber2          Handle 0x002E, DMI type 17, 34 bytes     Memory Device             Array Handle: 0x0026             Error Information Handle: Not Provided             Total Width: Unknown             Data Width: 64 bits             Size: No Module Installed             Form Factor: DIMM             Set: None             Locator: DIMM3             Bank Locator: BANK3             Type: Unknown             Type Detail: Synchronous             Speed: Unknown             Manufacturer: Manufacturer3             Serial Number: SerNum3             Asset Tag: AssetTagNum3             Part Number: Array1_PartNumber3     #     ======================================================================     # cat /proc/meminfo     MemTotal:        3056820 kB     MemFree:         1470820 kB     Buffers:          390204 kB     Cached:           194660 kB     SwapCached:            0 kB     Active:           488024 kB     Inactive:         419096 kB     Active(anon):     231112 kB     Inactive(anon):    96660 kB     Active(file):     256912 kB     Inactive(file):   322436 kB     Unevictable:           0 kB     Mlocked:               0 kB     SwapTotal:             0 kB     SwapFree:              0 kB     Dirty:                 8 kB     Writeback:             0 kB     AnonPages:        322320 kB     Mapped:            33012 kB     Shmem:              5472 kB     Slab:             613952 kB     SReclaimable:     597404 kB     SUnreclaim:        16548 kB     KernelStack:        2384 kB     PageTables:        19472 kB     NFS_Unstable:          0 kB     Bounce:                0 kB     WritebackTmp:          0 kB     CommitLimit:     1528408 kB     Committed_AS:     621464 kB     VmallocTotal:   34359738367 kB     VmallocUsed:      294484 kB     VmallocChunk:   34359429080 kB     HardwareCorrupted:     0 kB     HugePages_Total:       0     HugePages_Free:        0     HugePages_Rsvd:        0     HugePages_Surp:        0     Hugepagesize:       2048 kB     DirectMap4k:        9216 kB     DirectMap2M:     2054144 kB     DirectMap1G:     1048576 kB     #     ======================================================================     # dmesg | grep -i memory     [    0.000000] WARNING: BIOS bug: CPU MTRRs don't cover all of memory, losing 13295MB of RAM.     [    0.000000] WARNING: at /tmp/buildd/linux-2.6-2.6.32/debian/build/source_amd64_none/arch/x86/kernel/cpu/mtrr/cleanup.c:1092 mtrr_trim_uncached_memory+0x2e6/0x311()     [    0.000000]  [<ffffffff814f7f1e>] ? mtrr_trim_uncached_memory+0x2e6/0x311     [    0.000000]  [<ffffffff814f7f1e>] ? mtrr_trim_uncached_memory+0x2e6/0x311     [    0.000000]  [<ffffffff814f7f1e>] ? mtrr_trim_uncached_memory+0x2e6/0x311     [    0.000000] initial memory mapped : 0 - 20000000     [    0.000000] init_memory_mapping: 0000000000000000-00000000bdf00000     [    0.000000] PM: Registered nosave memory: 000000000009d000 - 000000000009e000     [    0.000000] PM: Registered nosave memory: 000000000009e000 - 00000000000a0000     [    0.000000] PM: Registered nosave memory: 00000000000a0000 - 00000000000e0000     [    0.000000] PM: Registered nosave memory: 00000000000e0000 - 0000000000100000     [    0.000000] PM: Registered nosave memory: 00000000bd94d000 - 00000000bd99c000     [    0.000000] PM: Registered nosave memory: 00000000bd99c000 - 00000000bd9a6000     [    0.000000] PM: Registered nosave memory: 00000000bd9a6000 - 00000000bdade000     [    0.000000] PM: Registered nosave memory: 00000000bdade000 - 00000000bdaef000     [    0.000000] PM: Registered nosave memory: 00000000bdaef000 - 00000000bdb02000     [    0.000000] PM: Registered nosave memory: 00000000bdb02000 - 00000000bdb04000     [    0.000000] PM: Registered nosave memory: 00000000bdb04000 - 00000000bdb0d000     [    0.000000] PM: Registered nosave memory: 00000000bdb0d000 - 00000000bdb13000     [    0.000000] PM: Registered nosave memory: 00000000bdb13000 - 00000000bdb75000     [    0.000000] PM: Registered nosave memory: 00000000bdb75000 - 00000000bdd78000     [    0.000000] Memory: 3046732k/3111936k available (3075k kernel code, 4728k absent, 60476k reserved, 1879k data, 584k init)     [    1.636730] Freeing initrd memory: 9501k freed     [    1.647370] Freeing unused kernel memory: 584k freed     [    4.876602] [TTM] Zone  kernel: Available graphics memory: 1528410 kiB.     [    4.876615] [drm] radeon: 256M of VRAM memory ready     [    4.876617] [drm] radeon: 512M of GTT memory ready.     [   25.571018] VBoxDrv: dbg - g_abExecMemory=ffffffffa051d6c0     #      Grepping for e820 shows a bunch of ranges, topping out with `e820 update range: 00000000bdf00000 - 000000043f000000 (usable) ==> (reserved)`. 43f000000 is 16 GiB, bdf00000 is 3039 MiB. I do _not_ see that being coincidental.               # dmesg | grep -i e820     [    0.000000]  BIOS-e820: 0000000000000000 - 000000000009d800 (usable)     [    0.000000]  BIOS-e820: 000000000009d800 - 00000000000a0000 (reserved)     [    0.000000]  BIOS-e820: 00000000000e0000 - 0000000000100000 (reserved)     [    0.000000]  BIOS-e820: 0000000000100000 - 00000000bd94d000 (usable)     [    0.000000]  BIOS-e820: 00000000bd94d000 - 00000000bd99c000 (ACPI NVS)     [    0.000000]  BIOS-e820: 00000000bd99c000 - 00000000bd9a6000 (ACPI data)     [    0.000000]  BIOS-e820: 00000000bd9a6000 - 00000000bdade000 (reserved)     [    0.000000]  BIOS-e820: 00000000bdade000 - 00000000bdaef000 (ACPI NVS)     [    0.000000]  BIOS-e820: 00000000bdaef000 - 00000000bdb02000 (reserved)     [    0.000000]  BIOS-e820: 00000000bdb02000 - 00000000bdb04000 (ACPI NVS)     [    0.000000]  BIOS-e820: 00000000bdb04000 - 00000000bdb0d000 (reserved)     [    0.000000]  BIOS-e820: 00000000bdb0d000 - 00000000bdb13000 (ACPI NVS)     [    0.000000]  BIOS-e820: 00000000bdb13000 - 00000000bdb75000 (reserved)     [    0.000000]  BIOS-e820: 00000000bdb75000 - 00000000bdd78000 (ACPI NVS)     [    0.000000]  BIOS-e820: 00000000bdd78000 - 00000000bdf00000 (usable)     [    0.000000]  BIOS-e820: 00000000fec00000 - 00000000fec01000 (reserved)     [    0.000000]  BIOS-e820: 00000000fec10000 - 00000000fec11000 (reserved)     [    0.000000]  BIOS-e820: 00000000fec20000 - 00000000fec21000 (reserved)     [    0.000000]  BIOS-e820: 00000000fed00000 - 00000000fed01000 (reserved)     [    0.000000]  BIOS-e820: 00000000fed61000 - 00000000fed71000 (reserved)     [    0.000000]  BIOS-e820: 00000000fed80000 - 00000000fed90000 (reserved)     [    0.000000]  BIOS-e820: 00000000fef00000 - 0000000100000000 (reserved)     [    0.000000]  BIOS-e820: 0000000100001000 - 000000043f000000 (usable)     [    0.000000] e820 update range: 0000000000000000 - 0000000000010000 (usable) ==> (reserved)     [    0.000000] e820 update range: 00000000bdf00000 - 000000043f000000 (usable) ==> (reserved)     [    0.000000] update e820 for mtrr     #       ### EDIT 3/4 -- partial success:   * Upgrading the UEFI BIOS from version `0705 x64 08/23/2011` to `1007 02/10/2012` did not help: the exact same problem remained.   * Removing one DIMM module (I took a lucky guess at which slot was #4: the one farthest from the CPU) allowed the BIOS to detect and use the remaining 24 GB, although a three-DIMM configuration is not "recommended" according to the diagram in the user's manual. Notably, seating one of the remaining DIMMs in slot #4 still allowed it to be used, so the slot is fine. Reseating the "original" DIMM into that slot dropped me back at my starting point.   * Booting from the Debian 6.0.3 AMD64 installation CD into a rescue environment and checking its `dmesg` output shows **no similar MTRR errors**. Also, in that environment, with 3 x 8GB installed, 24 GB (plus or minus epsilon times pi or thereabouts; I didn't do the exact math) shows up as usable according to `free`.   * Upgrading/reinstalling the kernel (there was a minor upgrade available) seems to have fixed the MTRR issues as well. `dmesg` now reports 26198016 KB total, and no MTRR errors, which is in line with what I would expect with 3 x 8GB installed. `free -m` now reports 24114 MB total RAM, which quite frankly is close enough for me. This smells like a barfed DIMM, plus a kernel that for whatever reason was damaged; that latter _may_ have happened during the power outage (though I must say that's an odd way for the kernel to break!). The non-working DIMM will go back to the reseller as soon as I talk to them (hopefully tomorrow). ### (hopefully) FINAL EDIT I RMA'd one of the two pairs of DIMMs, it was accepted by the reseller as damaged and they sent me a new pair, which seems to work just fine. So I'm now basically at where I originally intended nearly a month ago (although a large fraction of that time was not really due to the reseller), with 32 GB RAM usable; `free -m` reports 32194 MB total memory, and the kernel reports `34586624k` RAM on initialization, both of which are well in line with my expectations.


Automount cdrom when accessed via NFS

I am currently running CentOS 5 on a server that has a built-in CDROM drive. I currently have a setup where `/media/cdrom` is automatically mounted by autofs as needed and I am exporting `/media/cdrom` via NFS. I need to be able to unmount this cdrom, eject it, and put in a new one without breaking anything, but this doesn't seem to work. Is there a better way to do this (noting that I have very little control over the server that is attempting to mount `/media/cdrom` via NFS)?


How does GNOME Shell Extensions work?

I have switched over to GNOME Shell, and use GNOME Shell Extensions to tweak the looks and functionality of my distribution. However, I have not yet found out what technology is used to install, enable and disable the extensions from the webpage with just a few clicks. How is it implemented? Can any webpage do this?


Linux-distro with built-in Xen?

Are there any Linux-distros with Xen "built-in" and ready to act as host for virtual-computer out-of-the-box? Alternatively, distros where you can easily select "Xen-host" as an install option? I'm after setting-up a Xen-host as easily as possible...


Login screen reappears after login

I am on Fedora 16 KDE spin. Yesterday I ran the `fsck` command and that broke things. I can login via the tty, so I guess it has nothing to do with the shadow file. The login screen reappears after login no matter how many times I try to get past it. The permissions are the same as before. Also I have tried renaming the .kde folder. Doesn't help. This affects all the users, even root. My guess is the X server is restarting after login bringing me back to the login screen. Any way I can solve this?


How to change the Name of Logical volume in Volume group

I created an LVM and inside that i created Volume Group and within it created Logical Volume and given the mount point /u001/app/pracle I named it wrong instead of **ORACLE** i it should have been typed **PRACLE**. Now installation of RHEL 5.6 is complete and i noticed it now. How can i change this from **/u001/app/pracle** to **/u001/app/oracle** ![DF](http://i.stack.imgur.com/ISVGq.jpg)


How do I change emails from: address on FreeBSD?

Emails are now sent from www@hostname, but I want them to be sent from webmaster@my-domain.com My developer said it should be in `php.ini` but I figured out this is true only for Win32 systems. How do I make this change in FreeBSD 8.3-RELEASE-p3?


Is this possible to customize auth.log about which key was used?

I use a classical pair of private/public key in order to connect into servers. For now, we have one dedicated account, let's say `foo`, which is used by multiple users, each with their own pairs of public/private keys. I am looking for a way to log which user authenticated on this `foo` account. For now, I manage to found that if I raise `LogLevel` to `VERBOSE` in **/etc/ssh/sshd_config** , ssh log the _fingerprint_ of the public key in **/var/log/auth.log**. It looks like this :               Apr  2 18:33:15 xxx-yy sshd[32064]: Connection from A.B.C.D port 43286     Apr  2 18:33:15 xxx-yy sshd[32064]: Found matching RSA key: XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX     Apr  2 18:33:15 xxx-yy sshd[32064]: Accepted publickey for foo from A.B.C.D port 43286 ssh2      I then manage to get _fingerprint_ of each users with a call to `ssh-keygen -lf key.pub` on their public key and then apply a sed on the log. I would like to know if there's a simpler or a better way to have ssh log which user's key was used to authenticate on the server ?


Make the occurrences of a string bold

Now, this is a homework question, but I have simply no idea how to go about solving it. It'll be great if someone could guide me about how to go about it. I've been given a large string of Upper Case Alphabets in a .txt file. I basically need to find two given sub strings(3-4) characters and change the font (or make it bold, or highlight it) of the sub string that is between the two given sub strings.


How can I create a file with multiple lines from the command-line?

How can I enter the following contents in a file:               Hi     abcd      I tried using `echo "Hi\nabcd" >> ab.txt`, but in the file it's written as is (the `\n` is included, instead of a newline)


cron, every minute ram issues

I have a cronjob which runs php on a wordpres cron.php file. Its mainly used to schedule post and i believe it may refresh cache. Anyways... I run the cron job every minute. I checked out the ps often and i see TWO php instance running cron.php. Now this is unnecessary because running one instance will do everything it needs to. I have another job which checks for ram and sometimes two instance trip it off (i expect a high amount of ram available at all times, i can lower it but i dont want to). I hardly believe one job can take more than a minute (although it may). How do i run a job but not if the process exist already? I don't think the php code itself can check unless it connects/uses the db? Is there a cron command i may use? I don't want to kill an instance if its >1minute. Just not spawn new ones.


Why I got error: `error while loading shared libraries: libmpich.so.3`?

I installed mpich-3.0.4 not in a default location. I installed it based on the mpich installer's guidance. However when I try to run:               mpiexec -n 4 -f machinefile ./mpich-3.0.4/examples/cpi      It gives me an error, which is:               ./mpitrial/official_examples/cpi: error while loading shared libraries: libmpich.so.3: cannot open shared object file: No such file or directory      I had set PATH and LD_LIBRARY_PATH. But is still gives me that error. Finally I just typed:               sudo apt-get install mpich2      Afterwards, I can run the `mpiexec` without error. Why did this happen?


While lilo may be out dated, and surpassed by Grub, it is one of the questions on the lpic practice exam.               When do you need to run the lilo command?       The options are :   * After every boot   * After every modification of the lilo configuration file   * After installing a new kernel with a new name in /boot   * After overwriting the old kernel in /boot with a new one   * Only the first time after installing LILO * * * I'm pretty sure you need to run `lilo` under the following situations:   * After every modification of the lilo configuration file    * After installing a new kernel with a new name in /boot I'm not sure if you need to run lilo if you overwrite the old kernel The practic exam doesn't provide the correct answer, and I can't find anything in the man page or in the first dozen results of google that documents _when_ to run the lilo command. Do you need to run the lilo command if you overwrite your old kernel ?


Linux Fedora 17: locks up with a blank screen after default boot

I have installed Linux Fedora 17 on my new desktop PC, but the default boot ends up with a black screen and no response from the keyboard or mouse. This is after the oval in the centre of the screen fills up and becomes the "curly f" logo. At that point the screen goes blank, and the monitor indicates that it is receiving no input, going into power saving mode. I can boot up ok if I choose the second entry `Fedora Linux` on the grub list, shown below, and then everything seems ok -- I am using it to post this question. A couple of error messages flash up before the grub boot choices appear, but are too brief for me to read them. Here is the content of the grub boot screen:               Fedora (3.9.10.-100.fc17.i686.PAE)     Fedora Linux     Advanced Options for Fedora Linux     Micrsosoft Windows XP Home Edition (on /dev/sda1)      I assume that I should be able to edit `grub` to make the second entry default -- I have to be pretty snappy to catch it before that action goes ahead, so I would also like to lengthen the pause at the same time. However instructions on the Web for working with `grub` seem confusing and contradictory. It seems I should edit my `/etc/default/grub` file, but I don't understand the various instructions on how to do it, so here it is:               [harry@Harry ~]$ cat /etc/default/grub     GRUB_TIMEOUT=5     GRUB_DISTRIBUTOR="Fedora"     GRUB_DEFAULT=saved     GRUB_CMDLINE_LINUX="rd.lvm.lv=vg_harry/lv_swap rd.dm=0 SYSFONT=True rd.md=0  KEYTABLE=uk rd.luks=0 rd.lvm.lv=vg_harry/lv_root LANG=en_US.UTF-8 rhgb quiet"     #GRUB_THEME="/boot/grub2/themes/system/theme.txt"[harry@Harry ~]$       I have no problem with booting Windows if I select that option. I need Windoze for some of the electronics related software I use. Please can anyone help with this? Please don't suggest I go to more up-to-date versions, I work on the principle that "if it works, don't fix it", and I am very happy with Fedora 17, apart from this `grub` problem; and with using Windoze XP3 when I have to.


Prevent Zypper trying to use IPv6

I'm setting up a box with OpenSUSE 13.1. For reasons beyond my comprehension, Zypper utterly _insists_ on using IPv6 addresses and _refuses_ to use IPv4. Which is a problem, since IPv6 doesn't work on our LAN. I've tried disabling IPv6 multiple ways:   * I told YaST to disable IPv6.   * I tried poking and prodding `/etc/modprobe`.   * I tried setting `ipv6.disable=1` as a kernel boot parameter. None of these things had the slightest effect; Zypper _still_ refuses to use real IP addresses and keeps hopelessly trying to use IPv6. Note that I can ping the download server just fine; the `ping` command looks up the IPv4 address of the server, and has no problem pinging it. And yet, Zypper still _insists_ on using IPv6, and then giving up because the destination is unreachable. (Which is it - via IPv6.) I am having the exact problem described in this question. (Even the failing IPv6 address is identical.) That question addresses an older release of OpenSUSE, and the accepted answer just says to disable IPv6, which I already tried. I have now wasted multiple hours of my life trying to perform the trivial task of installing a few software packages. Does _anybody_ know how I can _completely destroy_ IPv6 and get networking to work again?


How do I make gpg-agent forget my passphrase automatically?

I'm using Thunderbird with enigmail and gpg. From thunderbird/enigmail, I can't make the gpg-agent forget my passphrase, enigmail tells me I'm using gpg-agent for passphrase management so enigmail can't forget my passphrase. Is there a way to make gpg-agent forget my passphrase periodically? To be honest, I only skimmed the manpage but it looked like there was nothingin there.


Extract data from a file and place in different files based on1 column value

We will generate a csv file with below values               yp1234,577,1,3     yp5678,577,3,5     yp9012,132,8,9      I need to extract data and create files based on second column. If it's 577 then the whole line has to be extracted and placed in a separate file. I mean I need a file having lines with second column as 577 alone and another file with second column as 132 alone I tried using IF but didn't work


WiFi error wpa_supplicant

I have a problem with the `wpa_supplicant` program. My problem is about the use of `wpa_cli` which needs `wpa_supplicant`. Error when I'm executing `sudo wpa_cli`:               Could not connect to wpa_supplicant      The manual start of `wpa_supplicant` gives me some errors:               sudo wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf          rfkill: Cannot open RFKILL control device     ioctl[SIOCSIWAP]: Operation not permitted     ioctl[SIOCSIWENCODEEXT]: Invalid argument     ioctl[SIOCSIWENCODEEXT]: Invalid argument     wlan0: CTRL-EVENT-DISCONNECTED bssid=00:00:00:00:00:00 reason=0   ### NEW!!!      Config **dhcp**               ## /etc/dhcp/dhcpd.conf     subnet 192.168.2.0 netmask 255.255.255.0 {        range 192.168.2.2 192.168.2.9;        option domain-name-servers 192.168.1.1;        option domain-name "home";        option routers 192.168.2.1;     }      Config **wpa_supplicant**               ## /etc/wpa_supplicant/wpa_supplicant.conf     ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev     update_config=1     # network={     #   ssid="__SSID__"     #   key_mgmt=WPA-PSK     #   psk="__PASS__"     #   id_str="home"     # }      Config **hostapd**               ## /etc/hostapd/hostapd.conf     interface=wlan0     driver=rtl871xdrv     ieee80211n=1     ssid=__SSID__     hw_mode=g     channel=1     macaddr_acl=0     auth_algs=1     ignore_broadcast_ssid=0     wpa=2     wpa_passphrase=__PASS__     wpa_key_mgmt=WPA-PSK     wpa_pairwise=TKIP     rsn_pairwise=CCMP          # EDIT     ctrl_interface=/var/run/hostapd     ctrl_interface_group=0      Results of `ifconfig` / `iwconfig`               wlan0   Link encap:Ethernet  HWaddr c0:4a:00:17:40:fd               inet adr:192.168.2.1  Bcast:192.168.2.255  Masque:255.255.255.0               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:14 errors:0 dropped:0 overruns:0 frame:0               TX packets:0 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 lg file transmission:1000               RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)          wlan0     IEEE 802.11bgn  ESSID:"__SSID__"  Nickname:"<WIFI@REALTEK>"               Mode:Master  Frequency:2.412 GHz  Access Point: C0:4A:00:17:40:FD               Sensitivity:0/0               Retry:off   RTS thr:off   Fragment thr:off               Power Management:off               Link Quality=100/100  Signal level=0 dBm  Noise level=0 dBm               Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0               Tx excessive retries:0  Invalid misc:0   Missed beacon:0      How can I start `wpa_supplicant` without errors and have `wpa_cli` connect?


I need a program to read the US Census's geodatabase files

I downloaded a file from here, and got something with extension `.gdb.zip`. I want to get one of the tables out of this "geodatabase" and into a format that's easily accessible to other programs; csv or some such would be the obvious goal but anything moderately open will work. The Census Bureau's description of the files is: > TIGER Geodatabases are spatial extracts from the Census Bureau’s MAF/TIGER > database for use with Esri’s ArcGIS. Since ArcGIS for home users costs $100, and I don't want any of its features other than the ability to read this file, I'm hoping there's an open source option.


Entry point in linking binary file with gnu ld

I am linking my own kernel with GNU `ld` and a simple script which says that `OUTPUT_FORMAT` should be a flat binary, and `ENTRY` point is the `main` function:               OUTPUT_FORMAT("binary")         /* flat file */     ENTRY("main")      So it is logical that the `main` function should be at the very beginning of the executable. But I noticed that the position of the object files in the resulting kernel file is the same as the way I specified them on the command line, so I must put `main.o` first. Is there any way to tell `ld` to put the file with the `main()` function at the beginning?


How to use crontab (Gentoo)?

First I installed and ran `crontab`:               emerge cron     crontab -e      In another console, I ran `man cron`, but this has no examples of how to use `crontab`. Where can I get examples, and why are there none in the man page?


ACPI conflicts with ACPI region SMRG

During startup, I noticed some error. I found this in `dmesg`:               i801_smbus 0000:00:1f.3: PCI INT B -> GSI 21 (level, low) -> IRQ 21     ACPI: I/O resource 0000:00:1f.3 [0x400-0x41f] conflicts with ACPI region SMRG [0x400-0x40f]     ACPI: If an ACPI driver is available for this device, you should use it instead of the native driver      What does this mean? Which device is it talking about and how do I know which driver I should install?


debian: Remove or reinstall package in a very bad inconsistent state

I'm having a package management problem: At some point, I must have interrupted an update or something, because the bluez package has broken. I've tried removing and/or reinstalling, but I get nothing but errors. I'm unable to perform any operations with apt as long as this package is broken. Output from my attempt to remove the package               $ sudo aptitude remove bluez      The following packages will be REMOVED:         bluez      The following partially installed packages will be configured:       dictionaries-common dmsetup grub-pc ifupdown install-info rsyslog      0 packages upgraded, 0 newly installed, 1 to remove and 235 not upgraded.     Need to get 0 B of archives. After unpacking 1,737 kB will be freed.     dpkg: error processing bluez (--remove):       Package is in a very bad inconsistent state - you should      reinstall it before attempting a removal.     configured to not write apport reports                                           Errors were encountered while processing:      bluez     E: Sub-process /usr/bin/dpkg returned an error code (1)     A package failed to install.  Trying to recover:     Setting up install-info (4.13a.dfsg.1-8) ...     /var/lib/dpkg/info/install-info.postinst: 32: /var/lib/dpkg/info/install-info.postinst: update-info-dir: not found     dpkg: error processing install-info (--configure):      subprocess installed post-installation script returned error exit status 127     Setting up ifupdown (0.7~alpha5+really0.6.15) ...     /var/lib/dpkg/info/ifupdown.postinst: 122: /var/lib/dpkg/info/ifupdown.postinst: update-rc.d: not found     dpkg: error processing ifupdown (--configure):      subprocess installed post-installation script returned error exit status 127     Setting up locales (2.13-18) ...     /var/lib/dpkg/info/locales.postinst: 64: /var/lib/dpkg/info/locales.postinst: locale-gen: not found     dpkg: error processing locales (--configure):      subprocess installed post-installation script returned error exit status 127     Setting up dictionaries-common (1.11.6) ...     /var/lib/dpkg/info/dictionaries-common.postinst: 45: /var/lib/dpkg/info/dictionaries-common.postinst: update-dictcommon-aspell: not found     dpkg: error processing dictionaries-common (--configure):      subprocess installed post-installation script returned error exit status 127     Setting up grub-pc (1.99-12) ...     /var/lib/dpkg/info/grub-pc.postinst: line 438: grub-mkdevicemap: command not found     /var/lib/dpkg/info/grub-pc.postinst: line 263: grub-probe: command not found     /var/lib/dpkg/info/grub-pc.postinst: line 263: grub-probe: command not found     /var/lib/dpkg/info/grub-pc.postinst: line 263: grub-probe: command not found     /var/lib/dpkg/info/grub-pc.postinst: line 559: grub-install: command not found     /var/lib/dpkg/info/grub-pc.postinst: line 669: update-grub: command not found     dpkg: error processing grub-pc (--configure):      subprocess installed post-installation script returned error exit status 127     Setting up dmsetup (2:1.02.65-1) ...     /var/lib/dpkg/info/dmsetup.postinst: 8: /var/lib/dpkg/info/dmsetup.postinst: update-initramfs: not found     dpkg: error processing dmsetup (--configure):      subprocess installed post-installation script returned error exit status 127     Setting up rsyslog (5.8.5-1) ...     /var/lib/dpkg/info/rsyslog.postinst: 45: /var/lib/dpkg/info/rsyslog.postinst: update-rc.d: not found     dpkg: error processing rsyslog (--configure):      subprocess installed post-installation script returned error exit status 127     Errors were encountered while processing:      install-info      ifupdown      locales      dictionaries-common      grub-pc      dmsetup      rsyslog      I'm running Debian testing. Is this problem actually with this particular package, or is it a problem with dpkg? What do I need to do to fix my package manager?


su user fails with "grep: /var/cpanel/users/user: Permission denied"

I just did something pretty simple. Given a user `user`, I modified his user id, primary group's id, and added him to a new group in order to make my server use the same uid and gid as another server which shares files with this server over NFS. (I was told that I needed to do this in order to keep permissions from going insane on the shared files.) What I did is the following:               groupadd -g 2000 mygroup     groupmod -g 1500 user     usermod -u 500 -g 1500 -G 1500,2000 user      This accomplished the following:   1. The user's ID now matches the remote user's ID so NFS permissions will work.   2. The user's primary group ID now matches the remote user's primary group ID.   3. The user now belongs to group `mygroup` which the remote user is also a part of. Now, unfortunately, I can't `su -l user`, as I get the following error:               grep: /var/cpanel/users/user: Permission denied      I don't think that I did anything wrong, as when I `id user`, then everything looks fine:               uid=500(user) gid=1500(user) groups=1500(user),2000(mygroup)      What gives? Why am I getting this cPanel-ish error? What did I do wrong here/forget to do? ## EDIT It seems that I'm able to get into the user's account, I just get that error every time I `su -l user`.


How print only the current logged in "root" user IP address?

Currently I can see my (root) IP address on top of the output for this command:               last      But what I want is just that the IP address is printed out to me in a clean way.               root     pts/1        1.1.1.1      Tue Aug 19 03:33   still logged in      The desire is to simply get:               1.1.1.1


Balance outgoing traffic

I'm running on Debian. I have an application that runs on `localhost` and listens for incoming connections with a port range from 10000 to 11000. I want to use a tool like a traffic balancer that runs on a specified port and balances my outgoing traffic within this port range that uses my application. If I can do it with default system tools please explain to me how I can do it. I also found a tool named balance but I am do not know how to use it with large port range.


failed to start LDAP server centos 6.5

When I try the following command:               $ slaptest -u      I get this error: > str2entry : invalid value for attributeType attributeTypes #0 (syntax > 1.3.6.1.4.1.1466.115.121.1.3) > > slaptest: bad configuration file!


Linux ls to show only filename date and size

How can I use `ls` in linux to get a listing of filenames date and size only. I don't need to see the other info such as owner or permission. Is this possible?


When do environment variables get set in tcsh?

I set a lot of environment variables in my .tcshrc file, using the `setenv` command.   When I needed to have one of these unset today, I moved this file and opened a new terminal (this is all in a Gnome graphical environment) expecting environment variables I set in my .tcshrc to no longer be in the env.   But some of these variables were still set; where else could they be being set? I know my .login file is empty. Are setenv commands more global than I think they are? When I open a new virtual terminal via alt-ctrl-F2 the variables were no longer set.


Trouble in adding a column with awk

I'm trying to add a column to a csv file by using:               awk -F "," '{print $0"new_col"}' file.csv      but I got :               new_col8,0.405,0.101     new_col4,0.374,0.100     new_col23,0.342,0.100     new_col130,0.298,0.100      instead of :               68,110,0.362,0.101,new_col     11,98,0.405,0.101,new_col     57,94,0.374,0.100,new_col     61,123,0.342,0.100,new_col     124,130,0.298,0.100,new_col      I tried like this too:               awk -F "," '{{$(NF+1)=",new_col"} print $0 }' file.csv      but i got the same result!!! Is someone already had this problem?


Force application to use specific port on Fedora machine

I have an application on my fedora machine that sends SIP TCP requests to the server. The application chooses a random source port to send the requests. Is there some way I can force the application to use a specific port (say 15000). Can I, maybe, block the application from using all other ports (and then it will have to choose a single source port)? Note that I cannot change the code of the SIP application to use a predefined source port for the socket.


How do I rebind M-/ in Emacs to M-- (dash)

I'm basically trying to figure out how to use keyboard-translate in Emacs to make `M`-`-` do the same thing as `M`-`/` How do I go about doing this?


gnome 3 system sounds not working

On my System (Debian Wheezy x64, Gnome 3) I don't have any system sounds. Other audio is working well. When I go to settings > Audio > Sounds (hope it is called like this in english) as normal user, all sounds are greyed out. However, when i go to this panel as root, I can play all these sounds. Is it a problem with privileges? How can it be solved? Help is very much appreciated, especially because I would need notifications in Empathy.


System menu and desktop right click dont appear in Gnome3

I run Arch Linux with Gnome3. I need to escape from the "routine" and change to Gnome for some weeks or even months. When I open it I can't see the system menu (which is supposed to be right of "places") and cannot right click my desktop. Is my Gnome corrupted? Is it rational?


Is it possible to use shell parameter variables ($1, ..., $@) directly in CLI?

Sometimes it is necessary to emulate and verify the above variables in small examples and then can be copied immediately to some script, etc. I tried to solve by using a simple example in the following ways:               (find $1) /tmp     sh -c '(find $1) /tmp'     sh -c "find $1" /tmp     echo '(find $1) /tmp' | sh      and with other combinations. Also experimented by adding the shebang interpreter directive `#!/bin/sh -x`, but did not get the desired result. Can I do this simply?


How to build an RPM package from the installed files?

There are two machines, identical version/arch of SLES. On machine #A there is a "foo" software installed that we can see using `rpm -qa`. On machine #B the "foo" software needs to be installed. The `foo.rpm` isn't available from any source, from the internet, etc. ### Question Since the package `foo.rpm` was installed on machine #A, can we build a `foo.rpm` file on it from the already installed files? There are pre/post scripts in the rpm's, too, I think. So then the `foo.rpm` ( **with dependencies?** ) can be installed.


Can I share a folder inside my home directory with another user? I have two users on a system, `agent` and `daemon`. An external server connects as `agent` and rsyncs files to `~agent/incoming` I want `daemon` to have access to the files in `~agent/incoming` but I don't want `agent` to have access to any of `daemon`'s files. I set up a group called `automaton` and added both users to it. I then chmod'ed the `~agent/incoming` folder to `drwxrws---` (notice the sticky bit) and chowned that folder to `agent:automaton`. The process runs and new files are delivered to the `incoming` folder and are set as `agent:automaton` with permissions `-rw-rw----` but `daemon` is not able to view or copy these files:               stat: cannot stat (path here) : Permission denied      What am I doing wrong?


Zip everything in current directory

I'd like to compress and package everything, including files and folders in current directory, into a single ZIP file on Ubuntu. What would be the most convenient command for this (and name of the tool needed to be installed if any)? Edit: What if I need to exclude one folder or several files?