failure in connecting to my server through ssh

My goal: I want to be able to ssh to my workstation from external client. My workstation(in the following also referred as server) is on a lan. Its ip address on this lan is obviously different from its ip on the internet. I have set up the ssh server with public keys. This is what happens when I try to ssh from a client:   1. If the client is on the same lan: I try to ping my server using the ip returned by ifconfig. The client cannot ping my server.   2. If the client is from outside, not on the lan: The client can ping the server, but when I try to connect I get `Connection timed out` * * * output of `iptables -L -v`               Chain INPUT (policy ACCEPT 346K packets, 233M bytes)      pkts bytes target     prot opt in     out     source               destination               346K  233M sshguard   all  --  any    any     anywhere             anywhere                  346K  233M sshguard   all  --  any    any     anywhere             anywhere                      Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)      pkts bytes target     prot opt in     out     source               destination                   Chain OUTPUT (policy ACCEPT 193K packets, 26M bytes)      pkts bytes target     prot opt in     out     source               destination                   Chain sshguard (2 references)      pkts bytes target     prot opt in     out     source               destination


How to exclude hidden files in recursive chmod?

I am having to do `chmod -R 755 some_dir` where 'some_dir' contains '.git' folders. Is there any way I can exclude hidden files and folder when doing recursive chmod? Note: chmoding .git folder is throwing the following error               some_dir/.git/objects/pack/pack-dd149b11c4e5d205e3022836d49a972684de8daa.idx': Operation not permitted      I don't really need to chmod .git folders but unfortunately I can't remove them also in my case.


What are some suggestions for using hdiutil (or other tools) to assist in recovery of files from dmg image?

**Background** I am attempting to recover information from a USB using GNU ddrescue 1.18.1. I have completed the rescue operation output from the /dev/disk2s2 partition to a disk image file on a networked resource (.dmg). I have attempted to execute the following command:               hdiutil attach /Volumes/etc/photos.dmg -nomount      **Which presents this error information:** > 2014-08-12 11:39:15.679 hdiutil[13866:1528817] Error loading /Library/Plug- > ins/DiskImages/VirtualPCDiskImagePlugin.bundle/Contents/MacOS/VirtualPCDiskImagePlugin: > dlopen(/Library/Plug- > ins/DiskImages/VirtualPCDiskImagePlugin.bundle/Contents/MacOS/VirtualPCDiskImagePlugin, > 262): no suitable image found. Did find: /Library/Plug- > ins/DiskImages/VirtualPCDiskImagePlugin.bundle/Contents/MacOS/VirtualPCDiskImagePlugin: > mach-o, but wrong architecture 2014-08-12 11:39:15.680 > hdiutil[13866:1528817] Cannot find function pointer > MacDiskImagePluginFactory for factory 7F1FD83E-6684-11D8-968F-000A957703C0 > in CFBundle/CFPlugIn 0x7fd383c12db0 (bundle, not loaded) **NB: I was creating a Windows virtual-box image (writing) on the original USB drive when it fell and lost the physical connection. (after this event is when the USB stopped mounting)**   * Also, the Library Plugin mentioned in the error message may need to be reinstalled as I've updated the host OS of my machine. **Questions**   * Are there other steps that I can try to read the files from the .dmg file? (just enough to recover photos to another disk)   * Are there any free software options that might help me take the recovery process further?   * I no longer use Virtual PC (switched to VirtualBox) but should I reinstall it at this point? Setup: MacOSX 10.10 ddrescue 1.18.1 VirtualBox 4.3.14


Can I create a user-specific hosts file to complement /etc/hosts?

Is it possible to add a list of hosts that are only specific to a certain user? Perhaps a user-specific hosts file? This mechanism should also complement the entries in the `/etc/hosts` file.


User made host aliases

I would like to set up aliases for hosts `/etc/hosts` style, but I don't have root privileges. Would I be able to set these up from within my /home directory? How?


How can I override the /etc/hosts file at user level?

> **Possible Duplicate:**   >  Can I create a user-specific hosts file to complement /etc/hosts? In short: I would like to know if it is possible to get a `~/hosts` file that could override the `/etc/hosts` file, since I don't have any privileged access. A machine I am working on does seem to be properly configured with a correct DNS server. When I try to ping usual machine **name** I am working with, it fails. But when I try to ping them by **IP address** it works as expected. I want to avoid changing any scripts and other _musuculary memorized handcrafted commmand line_ ™ that I made because of a single unproperly configured machine. I contacted sys admin, but they have other fish to fry. How can I implement that?


ntpdate -d seems successful, but ntpdate returns no server suitable

I've got a system that is not running ntpd on which I'm attempting to update the clock using ntpdate. The system is an appliance that appears to be CentOS 6 based. When I run `ntpdate 0.pool.ntp.org`, I get:               8 Sep 17:52:05 ntpdate[7445]: no server suitable for synchronization found      However, when I do `ntpdate -d 0.pool.ntp.org`, I get:               8 Sep 17:55:14 ntpdate[9499]: ntpdate 4.2.2p1@1.1570-o Fri Nov 18 13:21:21 UTC 2011 (1)     Looking for host 0.pool.ntp.org and service ntp     host found : 4.53.160.75     transmit(4.53.160.75)     receive(4.53.160.75)     transmit(4.53.160.75)     receive(4.53.160.75)     transmit(4.53.160.75)     receive(4.53.160.75)     transmit(4.53.160.75)     receive(4.53.160.75)     transmit(4.53.160.75)     transmit(64.16.214.60)     receive(64.16.214.60)     transmit(64.16.214.60)     receive(64.16.214.60)     transmit(64.16.214.60)     receive(64.16.214.60)     transmit(64.16.214.60)     receive(64.16.214.60)     transmit(64.16.214.60)     transmit(54.236.224.171)     receive(54.236.224.171)     transmit(54.236.224.171)     receive(54.236.224.171)     transmit(54.236.224.171)     receive(54.236.224.171)     transmit(54.236.224.171)     receive(54.236.224.171)     transmit(54.236.224.171)     transmit(50.22.155.163)     receive(50.22.155.163)     transmit(50.22.155.163)     receive(50.22.155.163)     transmit(50.22.155.163)     receive(50.22.155.163)     transmit(50.22.155.163)     receive(50.22.155.163)     transmit(50.22.155.163)     server 4.53.160.75, port 123     stratum 2, precision -23, leap 00, trust 000     refid [4.53.160.75], delay 0.03160, dispersion 0.00005     transmitted 4, in filter 4     reference time:    d7b867d0.f9841075  Mon, Sep  8 2014 17:37:20.974     originate timestamp: d7b86c03.b6a49dae  Mon, Sep  8 2014 17:55:15.713     transmit timestamp:  d7b86c02.7e12a51e  Mon, Sep  8 2014 17:55:14.492     filter delay:  0.03189  0.03188  0.03172  0.03160              0.00000  0.00000  0.00000  0.00000     filter offset: 1.218061 1.217856 1.218023 1.217968              0.000000 0.000000 0.000000 0.000000     delay 0.03160, dispersion 0.00005     offset 1.217968          server 64.16.214.60, port 123     stratum 2, precision -23, leap 00, trust 000     refid [64.16.214.60], delay 0.04886, dispersion 0.00006     transmitted 4, in filter 4     reference time:    d7b86425.55948a73  Mon, Sep  8 2014 17:21:41.334     originate timestamp: d7b86c03.f7d91219  Mon, Sep  8 2014 17:55:15.968     transmit timestamp:  d7b86c02.bed42c3c  Mon, Sep  8 2014 17:55:14.745     filter delay:  0.04919  0.04892  0.04912  0.04886              0.00000  0.00000  0.00000  0.00000     filter offset: 1.210967 1.210879 1.210967 1.210836              0.000000 0.000000 0.000000 0.000000     delay 0.04886, dispersion 0.00006     offset 1.210836          server 54.236.224.171, port 123     stratum 3, precision -20, leap 00, trust 000     refid [54.236.224.171], delay 0.04878, dispersion 0.00011     transmitted 4, in filter 4     reference time:    d7b864eb.b06fee7d  Mon, Sep  8 2014 17:24:59.689     originate timestamp: d7b86c04.2b9d2547  Mon, Sep  8 2014 17:55:16.170     transmit timestamp:  d7b86c02.f1e80bed  Mon, Sep  8 2014 17:55:14.944     filter delay:  0.04977  0.04950  0.04878  0.04887              0.00000  0.00000  0.00000  0.00000     filter offset: 1.214091 1.214069 1.213755 1.213750              0.000000 0.000000 0.000000 0.000000     delay 0.04878, dispersion 0.00011     offset 1.213755          server 50.22.155.163, port 123     stratum 2, precision -23, leap 00, trust 000     refid [50.22.155.163], delay 0.07384, dispersion 0.00005     transmitted 4, in filter 4     reference time:    d7b869c9.2b3f3d0b  Mon, Sep  8 2014 17:45:45.168     originate timestamp: d7b86c04.75472e97  Mon, Sep  8 2014 17:55:16.458     transmit timestamp:  d7b86c03.384a83b1  Mon, Sep  8 2014 17:55:15.219     filter delay:  0.07408  0.07414  0.07384  0.07387              0.00000  0.00000  0.00000  0.00000     filter offset: 1.214115 1.214122 1.214012 1.214069              0.000000 0.000000 0.000000 0.000000     delay 0.07384, dispersion 0.00005     offset 1.214012           8 Sep 17:55:15 ntpdate[9499]: step time server 4.53.160.75 offset 1.217968 sec      Based on my previous searches, this result (with the various receive() lines and the offset) suggests that it is communicating with the remote NTP servers correctly (not blocked by a firewall). So, why does it not update my clock when I run it?


OSX plist editing causes app crash

Does anyone have any idea why Finder (or iBooks or Mail, or Preview BUT NOT Terminal) crashes after adding the following key:value to its plist:               LSUIPresentationMode -int 4       (puts the Finder's menu bar into hide/show mode, just like the dock) Used to work fine prior to Mavericks. And it's driving me absolutely bonkers as the annoying system menu bar is burning a ghost image into the laptop's display.


How can I periodically check if my network is up and reconnect if not?

I've written a script to periodically check whether my network is up by pinging three major sites and disconnecting and then reconnecting my network if all three fail. This script works fine from the command line, even if I don't have an X session. The script looks like this:               #!/bin/bash          /usr/bin/notify-send -i 'dialog-information' 'Running CheckNetUp.sh' 'Checking whether network is up'          AtLeastOneSiteFound=false;          # Try to download three sites and indicate a site was found if they work     # as long as we can grab at least one site, we're good.     # Otherwise, we'll disconnect and reconnect.          /usr/bin/wget --spider --read-timeout=15 http://google.ca     if [ "$?" = 0 ]; then       AtLeastOneSiteFound=true;     fi          /usr/bin/wget --spider --read-timeout=15 http://facebook.com     if [ "$?" = 0 ]; then       AtLeastOneSiteFound=true;     fi          /usr/bin/wget --spider --read-timeout=15 http://wikipedia.org     if [ "$?" = 0 ]; then       AtLeastOneSiteFound=true;     fi          if [ "$AtLeastOneSiteFound" = false ]; then       # Disconnect my wifi (and, consequently, VPN)       /usr/bin/nmcli dev disconnect wlp0s20u2       # Bring my wifi up       /usr/bin/nmcli con up uuid e23f4af0-7411-4f4e-8d3c-a7cd35b607e1       # Bring my VPN up       /usr/bin/nmcli con up uuid 6b0f8740-df8e-411e-adeb-bcf70ced772f     fi      Here's the problem: the script fails in cron with this error message when it tries to bring up the wifi:               Error: Connection activation failed: Not authorized to control networking.      I've found a bunch of potential solutions online, but no luck so far. Most promising seemed to be making the wifi and VPN connections system connections/accessible to all users with the passwords in the text configuration but that didn't change anything. EDIT: The script is running under my user in both the crontab and when run manually.


df says I have 20G more disk space used than du. Why?

I used du to list all folders and sort by size, the results simply doesn't add up to how much disk space is used(using df). There's about 20G in discrepency, why?               [root@xxx lib]# du --max-depth=1 -h /| sort -n -r     310M    /lib     123M    /root     96K /dev     88M /etc     75G /     73G /var     30M /sbin     20M /boot     20K /tmp     18M /lib64     16K /mnt     16K /lost+found     12K /home     8.0K    /srv     8.0K    /selinux     8.0K    /opt     8.0K    /misc     8.0K    /media     7.0M    /bin     1.2G    /usr     0   /sys     0   /proc     [root@xxx lib]# df -h     Filesystem            Size  Used Avail Use% Mounted on     /dev/mapper/VolGroup00-LogVol00                           298G   94G  189G  34% /     /dev/sda1              99M   26M   69M  28% /boot     tmpfs                 2.0G     0  2.0G   0% /dev/shm


`du -sh` reports different used size than `df -h`

> **Possible Duplicates:**   >  linux free disk space confusion   >  Why is there a discrepancy in disk usage reported by df and du? `df -h` says that I have 494G used on `/var`:               Filesystem            Size  Used Avail Use% Mounted on     /dev/sda3             564G  494G   41G  93% /var      But `du -sh /var` says it's `350G` What makes them different?


Why is there a discrepancy in disk usage reported by df and du?

I have a Linux(CentOS) server, the OS+packages used around 5GB. Then, I transferred 97GB data from a Windows server to two folders on this Linux server, after calculated the disk usage, I see the total size of the two folders is larger than the disk used size. Run du -sh on each folder, one use 50GB, the other one use 47GB But run df -h, the used space is 96G. (50GB + 47GB + 5GB) > 96GB Is there any problem? Those two folders contain lots of files(1 million+). Thanks.


Why does df show Available 0 when 1K-blocks minus Used is greater than 0?

Why does it show 0 in the available column?               [root@server log]# df     Filesystem           1K-blocks      Used Available Use% Mounted on     /dev/sda2              4128448   4096484         0 100% /      It's an ext3 filesystem.


GPT Partition - Used Space immediately after creating partition

I wanted to try out the new GPT system, and used it to partition my new HDD, with the partitions themselves using ext4. For some reason, about 1-2% of the space in each partition is already shown as used, both in `df` and `gparted`. Currently the only content of the partitions is the lost+found folder which occupies all of `16K`. Is there a reason for this? Can this be fixed? Or is this just the space used by the file table (or equivalent)? Edit: Is this more related ext4 than GPT? I found this just now, ext4: How to account for the filesystem space?


Why does "df -h" show out of sync space used?

I have tried different commands to see sizes of partitions and space used/left and it seems that they always differ in their results. Here is my space used/left with from the command `df -h`:               Size  Used Avail Use% Mounted on     395G  355G   21G  95% /home      Notice that used and availabe only add up to 376G but size is 395G


SSD seems full, but file system says otherwise

I'm running CentOS and have a 100GB Micron RealSSD P300. It appears that the drive is almost full, as noted by running `df`:               Filesystem     1K-blocks     Used Available Use% Mounted on     /dev/sda3       94753636 86002428   3937948  96% /     tmpfs           12298364        0  12298364   0% /dev/shm     /dev/sda1         253871    58571    182193  25% /boot      However, running `du /` tells another story:               6.9M    /bin     56M     /boot     188K    /dev     28M     /etc     3.3M    /home     251M    /lib     25M     /lib64     16K     /lost+found     4.0K    /media     4.0K    /mnt     8.0K    /opt     0       /proc     11M     /root     18M     /sbin     4.0K    /selinux     0       /service     4.0K    /srv     0       /sys     436K    /tmp     1.4G    /usr     1.9G    /var      What could be taking up all of these blocks that I can't see? Could the drive just be broken? I don't have too much experience working with SSDs, so perhaps there's an obvious step I'm missing?


Why are there so many different ways to measure disk usage?

When I sum up the sizes of my files, I get one figure. If I run `du`, I get another figure. If I run `du` on all the files on my partition, it doesn't match what `df` claims is used. Why are there so many different figures for the total size of my files? Can't computers add? Speaking of adding: when I add the “Used” and “Available” columns of `df`, I don't get the total figure. And that total figure is smaller than the size of my partition. And if I add up my partition sizes I don't get my disk size! What gives?


df vs. du: why so much difference?

> **Possible Duplicate:**   >  Why is there a discrepancy in disk usage reported by df and du? `df` says 8.9G used by the partition mounted in `/`               :~$ df -h     Filesystem      Size  Used Avail Use% Mounted on     /dev/sda5       227G  8.9G  207G   5% /      However, a `du` in `/` yields a **much** smaller number.               :~# du -chs /     5.5G    /     5.5G    total      I was expecting a smaller number, but why is to **so much** smaller?


Most accurate disk usage report?

Since disk space is allocated in blocks, is it a more accurate representation of the actual space consumed by a directory to report it in blocks vs bytes? If a file of size 1,025 bytes resides on a file system where space on the file system is doled out in units of 1,024 byte blocks, that file consumes two whole blocks. That seems more accurate than to say that this file consumes 1,025 bytes of space. Edit: File system in question is ext4, no dedupe, no compression, fwiw. This is my attempt:               def getDirUsage(filepath, block_size=1024):  # block_size as reported by os.statvfs()         '''         return the number of blocks consumed by a directory         '''         total_size = int(math.ceil(os.path.getsize(filepath)/block_size))  # debatable whether this should be included in the size         allfiles = os.listdir(filepath)         for f in allfiles:             p = os.path.join(filepath,f)             if os.path.isdir(p):                 total_size += getDirUsage(p,block_size)             else:                 total_size += int(math.ceil(os.stat(p).st_size/block_size))         return total_size


Disk space shows up as used but not on `du`

I have a problem where 70G on a server seems unreachable:               XXX@XXX:/data$ df -h     Filesystem                        Size  Used Avail Use% Mounted on     /dev/mapper/ubuntu--Storage-root  120G  2.9G  111G   3% /     udev                              7.9G  4.0K  7.9G   1% /dev     tmpfs                             3.2G  296K  3.2G   1% /run     none                              5.0M     0  5.0M   0% /run/lock     none                              7.9G     0  7.9G   0% /run/shm     /dev/sda1                         228M   25M  192M  12% /boot     /dev/sdb1                          19T   70G   18T   1% /data      and when checking usage in the mount point `/data/`:               XXX@XXX:/data$ du -h     8.0K    ./STR1     4.0K    ./STR2     16K .      nothing shows up


df-command free disk-space wrong

Filesystem      Size  Used Avail Use% Mounted on     /dev/sda1       107G  4.4G   97G   5% /     dev             3.9G     0  3.9G   0% /dev     run             3.9G  576K  3.9G   1% /run     tmpfs           3.9G   23M  3.9G   1% /dev/shm     tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup     tmpfs           3.9G   14M  3.9G   1% /tmp     tmpfs           788M  4.0K  788M   1% /run/user/1000      Why does df shows 97G Available Disk-Space? Shouldn't it be 102.6?


GRUB does not boot automatically

GRUB does not boot my kernel automatically or display a boot menu. Why not? My /boot/grub/grub.conf contains the following               default 0     timeout 5          root (hd0,0)     kernel /boot/3.8.13      Instead of booting, I'm given a prompt, I can then do:               > kernel /boot/3.8.13     > boot      and the kernel will start. I want this to happen automatically. I should probably mention that the kernel _fails_ to boot, but that is a different topic and I don't see how it could be related (I'm assuming GRUB has no way of knowing this, unless it would be something trivial like an incompatible architecture, however it is not that trivial). I _have_ followed the guide at http://www.gentoo.org/doc/en/grub-error- guide.xml section 11. "Grub Just Shows a Grub Prompt" In particular I have verified that the file grub.conf exists under /boot/grub and that the menu.lst in the same directory is a symbolic link to grub.conf. I have also executed the grub-install command. I have tried the following arguments to grub-install:               grub-install --no-floppy /dev/sda     grub-install --root-directory=/boot /dev/sda      My system has one physical HDD, /dev/sda. I have /boot on /dev/sda1 and root on /dev/sda2, which is encrypted. However I'm not even trying to make grub load some initrd yet, first things first I want GRUB to at least be able to start the kernel before I try with the initrd.


Brand new to Linux - running a web server/database server, need to connect to my servers- how?

I am brand new to Linux. I have a database server and web server both running CentOS. My database server will host MySQL and my web server will host Apache. I am very familiar with Windows and remote desktop. My question:   1. How do I connect to my Linux-based servers? Is there something similar to Remote Desktop, or do I need to use straight command line Linux commands? Ultimately, obviously, I will need to upload my web files to my web server.   2. I need to create a REST based service that will live on my database server- I know this is a very, very broad question, but where would I start with that? Is EVERYTHING Linux-based controlled from the command prompt? **EDIT** My REST service will most likely be written in server side Javascript.


How to send to background a running process started with sudo?

I have just installed SLC6 (derived from SL6 derived from RHEL6). I can send a running process to the background by hitting Ctrl-Z in the terminal where it was started. However, I can't do it when I started the command with sudo. It used to work seamlessly in SLC5. Is there any configuration I could do to allow this ? EDIT This is an example of command I try to run :               [user@pcald02 ~]$ sudo emacs     ^Z^C      The Ctrl-Z makes the symbols ^Z appear but nothing else happens. Now I realized that even Ctrl-C is ineffective. Without sudo :               [user@pcald02 ~]$ emacs     ^Z     [1]+  Stopped                 emacs     [user@pcald02 ~]$


rsync remote to local automatic backup

Because all my work is stored on a remote server I would like to auto backup my server monthly and weekly. My server is running Centos 5.5 and while searching the web I'm found a tool named rsync. I got my first update manually by using this command in terminal:               sudo rsync -chavzP --stats USERNAME@IPADDRES: PATH_TO_BACKUP LOCAL_PATH_TO_BACKUP      I then prompt my password for that user and bob's my uncle. This backups the necessary files from my remote server to my local device but does somebody know how I can automate this? Like automatic running this script every sunday? **EDIT** I forgot to mention that I let direct admin backup the files I need and then copy those files from the remote server to a local server.


Kexec immediately after Kickstart install (where is cmdline?)

I used to be able to kexec into a new kernel immediately after a kickstart (anaconda) install via pxe. I was able to do this by figuring out the current kernel version, and grabbing cmdline options by using /boot/grub/grub.conf `cmdline=$(awk /kernel.*console/'{$1=$2=""; print$0}' /boot/grub/grub.conf)` Then: `kexec -l /boot/vmlinuz-$(uname -r) --initrd=/boot/initramfs-$(uname -r).img --append="${cmdline}"` Now I am unable to find what the cmdline options for the next reboot are since /proc/cmdline and the cmdline command only show me what the cmdline is for the installation disc. How would I be able to find out what the cmdline is for next reboot now?


Uninstall dig command in centos 6?

I've realized that for some commands like `wget` and `dig`, we need to use the command `yum` to install them before we can use them. Doing some research the `dig` command doesn't come installed for security purposes and for it's installation we can run the following command: `yum install bind-utils` which is a package that comes with `dig`. So my question's are:   * what if I don't want the `dig` command anymore, how do I get rid of it?   * Is there an uninstall command I can use?


Using winexe to run "wmic" commands on a Windows machine

We use winexe to execute commands on our Windows machines from Linux. For example:               winexe -A authfile //syspc4.domain.com "ipconfig /all"      Expectedly the above prints out the same thing as if you had run cmd.exe on a Windows machine and typed in "ipconfig /all" My ultimate goal is to remotely (from Linux) get the Window's machines serial number and model name. This is very easily achievable with the following two commands in cmd.exe locally on the Windows (Windows XP) machine:               wmic bios get serialnumber     wmic computersystem get model      However, any attempts to execute this via winexe simply do not work --- after hitting enter, nothing happens. No error, nothing. It will just appear to be frozen until I ctrl+c out of it. Here are the commands that I've tried:               winexe -A authfile //syspc4.domain.com "wmic bios get serialnumber"     winexe -A authfile //syspc4.domain.com "cmd wmic bios get serialnumber"     winexe -A authfile //syspc4.domain.com "cmd /c wmic bios get serialnumber"     winexe -A authfile //syspc4.domain.com "cmd"     Microsoft Windows XP [Version 5.1.2600]     (C) Copyright 1985-2001 Microsoft Corp.          C:\WINDOWS\system32>wmic bios get serialnumber      In all cases, no response. A quick look at winexe --help reveals a log option, but even with that set, there is no output log of any kind. I found the following post on another forum, in which the person is asking almost the _exact_ same thing as me, and naturally he just never got an answer: http://www.linuxquestions.org/questions/linux- software-2/winexe-780343/ **EDIT** : With debug turned on, this is where it hangs:               winexe -d 6 -A authfile //syspc4.domain.com "wmic bios get serialnumber"          ...     IN: async_open(\pipe\ahexec, 2)     IN: async_open_recv     CTRL: Sending command: get version     CTRL: Sending command: run wmic bios get serialnumber     CTRL: Recieved command: std_io_err 15C40030     IN: async_open(\pipe\ahexec_stdin15C40030, 2)     IN: async_open(\pipe\ahexec_stdout15C40030, 2)     IN: async_open(\pipe\ahexec_stderr15C40030, 2)     IN: async_open_recv     IN: async_open_recv     IN: async_open_recv          **hangs forever here**          Then ctrl+c:          ^CAborting...     ERROR: smb_raw_read_recv - NT_STATUS_PIPE_DISCONNECTED     ERROR: smb_raw_read_recv - NT_STATUS_PIPE_DISCONNECTED     ERROR: smb_raw_read_recv - NT_STATUS_PIPE_DISCONNECTED     ERROR: smb_raw_read_recv - NT_STATUS_PIPE_DISCONNECTED     ERROR: on_ctrl_pipe_error - NT_STATUS_PIPE_DISCONNECTED      However the curious thing is that even with a command that doesn't fail (like ipconfig /all), it gives the exact same thing:               ...     IN: async_open(\pipe\ahexec, 2)     IN: async_open_recv     CTRL: Sending command: get version     CTRL: Sending command: run ipconfig /all     CTRL: Recieved command: std_io_err 15C40031     IN: async_open(\pipe\ahexec_stdin15C40031, 2)     IN: async_open(\pipe\ahexec_stdout15C40031, 2)     IN: async_open(\pipe\ahexec_stderr15C40031, 2)     IN: async_open_recv     IN: async_open_recv     IN: async_open_recv          Windows IP Configuration     ...     ERROR: smb_raw_read_recv - NT_STATUS_PIPE_DISCONNECTED     ERROR: smb_raw_read_recv - NT_STATUS_PIPE_DISCONNECTED     ERROR: smb_raw_read_recv - NT_STATUS_PIPE_DISCONNECTED     ERROR: smb_raw_read_recv - NT_STATUS_PIPE_DISCONNECTED     ERROR: on_ctrl_pipe_error - NT_STATUS_PIPE_DISCONNECTED


How do I correct both too many and too few space characters?

I have files that are edited by people other than me. They contain lines that look like this:               <E> This is text </E>      I use some Bash shell scripts do a bunch of text replacement functions on these lines of text. However, in order for the text replacements to work, the format has to be exactly correct. Most of the time they are, but of course I can't rely on the editors I'm getting these files from to not make any typos. Part of that format is that there be one space after `<E>`, and one space before `</E>`. No more, no less. So these are all incorrect:               <E>This is text </E>     <E> This is text</E>     <E> This is text     </E>     <E>   This is text </E>      I know I can use `sed` to search for _specific_ problems, like two spaces before `</E>` (using `#` instead of `/` since the text I'm acting on also contains `/` characters):               sed -i '$ s#  </E>#" </E>#g' *.txt      ... but I don't know how to use it to search for an unknown number. Also, in cases where there is no space, then the character adjacent to `<E>` or `</E>` might be anything. Bottom line, how can I search for instances of both zero spaces and of two or more spaces separated the text and `<E>` and `</E>` tags, and convert them to one space?


Identifying the system package manager

Is there a way (from a script) to identify the default system package manager? To clarify, what I want to do is run a given command and, on Debian or any of its derivatives it'll return something like "apt", on openSUSE it'll return "zypp", on Fedora et al it'll return "yum", on Arch Linux it'll return "pacman" etc. I know I can do this with something like the following, I just wondered if there was a more robust method that won't break as soon as there is an executable with the same name.               which apt >/dev/null 2>&1     if [ $? -eq 0 ]     then         echo "apt"     fi     # etc...


How to merge chunks of text files in a directory to one or more files?

I have a requirement to merge chunks of text files in a directory to one or more files and then zip the merged file. For ex: If i have half a million text files in a directory, say A. I want to merge sets of 50,000 files into 1 i.e. I will have 10 merged files each having the content of 50,000 files. Finally, I want to zip each merged file, i.e. there will be totally 10 zip files at the end of this process. I tried doing this in shell script. I am unable to find a solution. Can someone let me know the most efficient way to achieve this using a shell script?


Change order of Private Keys passed via SSH login

ssh -i ~/.ssh/username username@xx.xx.xx.xxx -v      Server is set to accept only 3 log on tries. The ssh system is trying 3 identity files before attempting the correct identity file.               debug2: key: /path/to/.ssh/identity1      debug2: key: /path/to/.ssh/identity2     debug2: key: /path/to/.ssh/identity3      debug2: key: /path/to/.ssh/username      How can I remove the 3 incorrect identity files? I have already tried deleting them from the directory. I have also tried updating `~/.ssh/config`               Host xx.xx.xx.xxx       User username       IdentityFile ~/.ssh/username      How can I get have ssh use the correct identity file?


Correctly determining memory usage in Linux

I'm a bit confused on some of the results I am seeing from "ps" and "free". On my server, this is the result of "free -m"               [root@server ~]# free -m                  total       used       free     shared    buffers     cached     Mem:          2048       2033         14          0         73       1398     -/+ buffers/cache:        561       1486     Swap:         2047         11       2036      My understanding of how Linux manages memory, is that it will store disk usage in RAM, so that each subsequent access is quicker. I believe this is indicated by the "cached" columns. Additionally, various buffers are stored in RAM, indicated in the "buffers" column. So if I understand correctly, the "actual" usage is supposed to be the "used" value of "-/+ buffers/cache", or 561 in this case. So assuming all of that is correct, the part that throws me is the results of "ps aux". My understanding of the "ps" results, is that the 6th column (RSS), represents the size in kilobytes the process uses for memory. So when I run this command:               [root@server ~]# ps aux | awk '{sum+=$6} END {print sum / 1024}'     1475.52      Shouldn't the result be the "used" column of "-/+ buffers/cache" from "free -m"? So, how can I properly determine the memory usage of a process in Linux? Apparently my logic is flawed.


About the usage of Memory in a linux server

I find my server's memory usage is so high, part of the output of command free is shown below:                         total       used       free     shared    buffers     cached     Mem:      82446460   81961412     485048          0     152820   77580400     -/+ buffers/cache:    4228192   78218268     Swap:     83841020     200108   83640912      You see, it used almost all of my memory. However, I can't the process which consumes a lot of memory. The following is the output of command `top` which is sorted by `M`.                 PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND     18434 cloud     20   0 19.5g 754m  11m S    0  0.9  13:14.90 jsvc     15420 root      20   0 25.0g 506m  16m S    0  0.6   4:14.67 jsvc     15826 root      20   0 5125m 344m 6896 S    1  0.4   7:37.66 kvm     24435 root      20   0 5229m 299m 6868 S    0  0.4   0:49.09 kvm     16993 root      20   0 4507m 277m 6944 S    0  0.3  27:20.54 kvm     23789 root      20   0 4401m 147m 6896 S    0  0.2   0:28.46 kvm      2057 mysql     20   0 1435m  96m 8208 S    0  0.1  11:37.82 mysqld     15130 root      20   0  812m 7276 3408 S    0  0.0   1:25.45 libvirtd     24993 root      20   0 21832 4396 1720 S    0  0.0   0:00.26 bash      I think the memory consumed by processes is less than 3% in total. So, I wonder where my memory goes?


Redhat find process memory usage

When I `cat /proc/meminfo` I see:               MemTotal:      1048576 kB     MemFree:         11136 kB     Buffers:             0 kB     Cached:              0 kB     SwapCached:          0 kB     Active:              0 kB     Inactive:            0 kB     HighTotal:           0 kB     HighFree:            0 kB     LowTotal:      1048576 kB     LowFree:         11136 kB     SwapTotal:           0 kB     SwapFree:            0 kB     Dirty:              88 kB     Writeback:           0 kB     AnonPages:           0 kB     Mapped:              0 kB     Slab:                0 kB     PageTables:          0 kB     NFS_Unstable:        0 kB     Bounce:              0 kB     CommitLimit:         0 kB     Committed_AS:        0 kB     VmallocTotal:        0 kB     VmallocUsed:         0 kB     VmallocChunk:        0 kB     HugePages_Total:     0     HugePages_Free:      0     HugePages_Rsvd:      0     Hugepagesize:     2048 kB      when I do `top` and sort by memory I see:               %MEM    TIME+  COMMAND     %22.9   0:44.11 java     % 0.1   0:04.57 init     % 2.9   0:02.52 /usr/local/cpan     % 0.3   0:00.50 sshd     % 1.5   0:00.14 mysqld     % 0.5   0:00.13 leechprotect     % 0.1   0:00.12 bash     % 0.4   0:00.11 httpd     % 0.3   0:00.07 queueprocd - wa     % 0.4   0:00.06 tailwatchd     % 0.8   0:00.02 cpsrvd-ssl     % 0.1   0:00.02 top     % 0.1   0:00.01 syslogd     % 0.4   0:00.01 named     % 0.1   0:00.00 udevd     % 0.0   0:00.00 klogd     % 0.0   0:00.00 courierlogger     % 0.1   0:00.00 authdaemond     % 0.0   0:00.00 authdaemond     % 0.0   0:00.00 authdaemond     % 0.1   0:00.00 sshd     % 0.1   0:00.00 xinetd     % 0.1   0:00.00 mysqld_safe     % 0.0   0:00.00 courierlogger     % 0.1   0:00.00 couriertcpd     % 0.1   0:00.00 exim     % 0.1   0:00.00 pure-ftpd     % 0.1   0:00.00 pure-authd     % 0.1   0:00.00 crond     % 0.0   0:00.00 atd     % 0.2   0:00.00 cPhulkd - proce     % 2.8   0:00.00 spamd child     % 0.8   0:00.00 cpdavd - accept     % 0.4   0:00.00 httpd     % 0.4   0:00.00 httpd     % 0.4   0:00.00 httpd     % 0.4   0:00.00 httpd     % 0.4   0:00.00 httpd     % 0.2   0:00.00 cpanellogd - sl     % 0.1   0:00.00 saslauthd     % 0.0   0:00.00 saslauthd     % 0.1   0:00.00 ssh-agent      Why does top show ~38% used when in reality it used 900mb out of 1000mb? How i know how much memory each process uses?


real memory usage

if I understand correctly, in the following output produced by free, 3535m is the actual free memory available to applications, only 413m is used, is this correct? need some clarification on the difference between Mem and -/+ buffers/cache row.               free -m                  total       used       free     shared    buffers     cached     Mem:          3949       3854         95          0          9       3431     -/+ buffers/cache:        413       3535     Swap:         2047       1322        725


free reporting huge amount of used memory

> **Possible Duplicate:**   >  real memory usage I recently got access to a machine which remains rather unoccupied. I looked up the available memory and was surprised to see that so much memory has been occupied:               $ free -g                   total       used       free     shared    buffers     cached     Mem:            62         20         42          0          0         18            -/+ buffers/cache:          1         61            Swap:           62          0         62      The same happens when I check /proc/meminfo:               $ cat /proc/meminfo      MemTotal:     65962088 kB     MemFree:      44583348 kB      I do not see which process is using 20G of memory when the machine is completely free:               $ uptime     11:20:09 up 71 days, 21:31,  4 users,  load average: 0.00, 0.00, 0.00      Any clues?


better way to get memfree from /proc and convert to decimal

I'm using awesome wm with bashets to make a little text widget to display the free memory. I wanted to convert the number from total kB to gigs (i.e. 1.2). this is what I came up with...               mem_Kb=$(grep -i memfree /proc/meminfo | cut -d: -f2 | tr -d [kB] | sed "s/^[ \t]*// ; s/[ \t]*$//")          mem_Gig=$(echo "scale = 1 ; $mem_Kb / 1000000" | bc )          echo mem_Gig: $mem_Gig      what are some better / cleaner ways?


How do create an encrypted system with multiple Linux distributions?

A few weeks ago I created a completely encrypted system on a notebook and must say I like the idea. It's a little bit annoying to enter the password on every boot, but it's nice to know even if I loose the computer I don't give my data to other people. With the alternate-cd it's easy to do. Now I have to setup a new system where I want to combine the new idea with my usual usage strategy. There I have more partitions: 3 system, Home, Different Data-Partitions for vm-data, photo-data and mp3-data. The background is that I prefer not to update a system. I prefer to install the new version parallel to the old system. So I can easily test it. Obviously the Data-Partitions are used for both systems. My questions is, how can I easily combine both my strategy and the crypto- approach? Or is it impossible. The way to do the crypted stuff by hand is in my eyes to complicated.


Error in installing R package headers/libs are not available

I am installing the R package (`R-3.0.1`) in Red Hat Linux 6.0. Initially when I tried to install it gave the error “F77 compiler not found”. I installed the compiler and tried it again, now the error I am getting is               configure: error: --with-readline=yes (default) and headers/libs are not available      I tried `./configure --with-x=no` but it doesn't work, again I am getting the same error.


Unable to access http service intranet

I'm not sure if this is the right place, if this is the case I will move the question with no problem. I'm setting up a web server for testing Wordpress. Everything works fine if I try to access the website from the same machine, but when I'm trying to access the root directory of the web site (running in my laptop) from a different machine (inside the intranet) I will get an `unable to connect`. I'm passing the IP to the web browser, but the browser redirects itself to localhost. If I ask for a specific file `readme.html` in the root directory I can read the file from the external computer. During the installation I set the HOSTNAME of Wordpress to `localhost`, so I'm guessing there might be some problem with redirection to the wrong machine. If I try to change this name (in the machine running Wordpress) to the name of the machine running Wordpress (the name of the machine is Bestia), Wordpress stops working. Can anyone provide me some ideas as to a possible solution? .htaccess file:               RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]          # add a trailing slash to /wp-admin     RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]     RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]     RewriteRule . index.php [L]      **Update** In the file `wp-config.php` is present a line               define('DOMAIN_CURRENT_SITE', 'localhost');      when I try to change the string `localhost`, redirecting is different from my external computer (actually on both machines); e.g. if I change `localhost` to `Bestia` when I call the IP 192.168.0.111 from the browser of my external machine I am redirected to Bestia (and of course the request fails on both machines, 'cause I have not a DNS server inside my network).


Music management software that sync playlists onto Android device

I am trying to find a music management software that can sync playlists onto my Android phone running Cyanogenmod 9. BTW, this handset does not have an Internet connection. Specifically, I want the device to appear in the software so that I can drag and drop a playlist into it. When this happens, I want the software to not only copy the songs over, but the _playlist_ itself (whether a cue sheet, m3u, or something like that). The more seamless the integration the better. This way, the music player on my handset can start playing the playlist right away and I won't have to reconstruct the list. My search so far seems to indicate Rythmbox and Amarok can do this (can someone confirm?), but are there any others? I would like to know what my choices are before settling on one music manager.


linux + add X days to date and get new virtual date

I have Linux ( RH 5.3) machine I need to add/calculate 10 days plus date so then I will get new date (expiration date)) for example                # date       Sun Sep 11 07:59:16 IST 2012      So I need to get                    NEW_expration_DATE = Sun Sep 21 07:59:16 IST 2012      Please advice how to calculate the new expiration date ( with bash , ksh , or manipulate date command ?)


How to configure a video4linux loopback device

I am writing an application which is based on Motion. Motion allows me to define a video4linux loopback device:               # Output images to a video4linux loopback device     # The value '-' means next available (default: not defined)     ; video_pipe value          # Output motion images to a video4linux loopback device     # The value '-' means next available (default: not defined)     ; motion_video_pipe value      Motion already accesses the webcam to detect motion, now I would like to access images of the webcam, too. I think the loopback device is the right thing to do this. But what do I have to do exactly? Do I have to configure another(?) video4linux device and add it in the configuration? Motion offers documentation about this topic. But I find it hard to get starting, as I am still troubled with how the whole architecture is working.


Code duplication in a shell script

My bash script (lets call it `myscript`) takes input either from stdin (pipe), or form a regular file (if filename was provided as an argument)               a) someprog | myscript             or          b) myscript file.txt      Then, the data is processed line by line. At the moment, my code looks something like the following:               if [ -t 0 ] ; then         while read LINE           do              prog_1              prog_2              ...              prog_n           done     else         while read LINE           do              prog_1              prog_2              ...              prog_n           done < $1     fi      This script works fine, but there seems to be too much duplicity. I am wondering whether there is a better (more elegant) way to do it. All the steps `1` to `n` are the same. The only difference is whether there is a `< $1` at the end or not. is there no better way to do it?


How can I make ls show information about the directory specified only, not info about its sub-files or folder contents?

Say I have folder "foo" residing, the home directory. I want to get some info of it, owner, group, permissions, etc... I then do this to try to get the information:               cd ~     ls -l foo      Of course it now lists the info of the contents of "foo" Then I could do something like this               cd ~     dir=foo     ls -l $foo/.. | awk 'BEGIN { dir="'$foo'" } { if($9 == dir) { print $0 }  }'      But isn't there an easier way to do this?


How to display directory permission without listing permission for their contents

> **Possible Duplicate:**   >  How can I make ls show information about the directory specified only, not > info about its sub-files or folder contents? I am new to UNIX and I want to display the permission for several directories without listing the permission for the files inside those directories. I have the following directories - each of this directories contains a file inside them, for example :               Directory1     File1     Directory2     File2     Directory3     File3      I am using this command to list directories and their files : `ls di*` what should I add to this command to list the files permission of the directories without listing the files permissions?


How to copy a file that is still being written over ssh?

Here is the situation:   1. I am uploading a large file from client A to a server using sftp.   2. I also need to download this file from the server to client B over ssh. What I would like to do is start the transfer from the server to client B when the upload is still happening from client A. What is the best method/tool to get this done? **UPDATE** : The answers so far are interesting--I'll be sure to read and test them all. Bonus points for answers that don't depend on controlling how Client A is uploading the file. (ie. the only thing we know from client A is that the file is being written to a known filename.)


Sharing an X server (session) across computers

I have 2 computers (both running linux) and I'm currently using synergy to use them. This is great, but now I'm wondering, is there any way (is it possible? being worked on? tried and failed? definitely not possible?) to not only share a mouse/keyboard/clipboard between the computers, but to share an X session? What I'm thinking is being able to drag X windows between monitors. I realize that this is extremely non-trivial to do and I know enough about linux (though not about xserver) that I'd like to pursue this idea even if there's nothing that does this for you. Also, I don't need to be able to just "install this and it works". I'm completely willing (and would be surprised if it didn't require) to install custom kernals, or mount partitions between machines, or whatever it takes. Since I assume it would require the same instance of xorg server running on both machines.


What caused this ext3 filesystem / mounting problem?

((K)Ubuntu 12.04, kernel 3.2.0-38-generic, fstype ext3) I recently came across the 'great idea' of using hibernation to save state in my main OS, while I boot another OS. I've done this without problems for the last few weeks. A few days ago, my luck ran out .. I resumed from hibernation into my main OS, used it all day (missing a couple warning signs - like being unable to save a file), and then realized that my root filesystem was mounted read-only; I tried remounting with no success, ran fsck, and rebooted. Most things seem to have recovered OK (other than unsaved work (duh/not too big deal), and a Firefox problem), but obviously that's not something I'd like to repeat. Dmesg and /var/log/ logs didn't tell me anything obvious (to my eyes) about what happened. I didn't think to save the output from fsck. Just to make things a little weirder - I actually physically removed the drive with the main OS (and swap/hibernate partition). The secondary OS I was playing with is a 'live' OS. So, the secondary never had direct access to the partition in question (or the hibernation image). So, main question: What caused this? // // // **Edit:** for clarification, the above is the question, below was just my specualtion. Per the comments, the RTC thing may be a red herring - it was just a guess. My best guess of what happened is that perhaps the live OS changed my system clock, which then messed up my main/root ext3 fs (because .. timestamps?), causing an error, which forced a remount as ro. (The root partition is normally mounted with the option "errors=remount-ro"). That said, at a user level, my desktop clock is not wrong/changed. I didn't think to check more precisely (or at all) immediately after the 'problematic resume'. Still, it's the only way I can think of for the secondary to break something _without having access to the primary_. I think it had been a while since I ran fsck, but I'm not sure why that would crop up so abruptly. But I guess that could be an explanation without any 'cross drive magic' - and would have nothing to do with my hibernation hijinks. So, main question: What caused this? Additional questions, if/as they fit: is the RTC thing plausible? I'm pretty sure I've seen RTC related options in BIOS (to 'write-protect' it?) - is that a standard/consistent thing? (Or will some systems not be able to guard against RTC manipulation?)   What, if any, other non-volatile storage do I need to consider? (That last one, especially, might need to be a seperate question, I guess.)


Problems with RPM (JRE)

I'm trying to install a JRE on Ubuntu 10.04, but I failed:               oneat@oneat-desktop:~/Downloads$ sudo rpm -i --force-debian jre-6u21-linux-i586.rpm     error: Failed dependencies:         /bin/basename is needed by jre-1.6.0_21-fcs.i586         /bin/cat is needed by jre-1.6.0_21-fcs.i586         /bin/cp is needed by jre-1.6.0_21-fcs.i586         /bin/gawk is needed by jre-1.6.0_21-fcs.i586         /bin/grep is needed by jre-1.6.0_21-fcs.i586         /bin/ln is needed by jre-1.6.0_21-fcs.i586         /bin/ls is needed by jre-1.6.0_21-fcs.i586         /bin/mkdir is needed by jre-1.6.0_21-fcs.i586         /bin/mv is needed by jre-1.6.0_21-fcs.i586         /bin/pwd is needed by jre-1.6.0_21-fcs.i586         /bin/rm is needed by jre-1.6.0_21-fcs.i586         /bin/sed is needed by jre-1.6.0_21-fcs.i586         /bin/sort is needed by jre-1.6.0_21-fcs.i586         /bin/touch is needed by jre-1.6.0_21-fcs.i586         /usr/bin/cut is needed by jre-1.6.0_21-fcs.i586         /usr/bin/dirname is needed by jre-1.6.0_21-fcs.i586         /usr/bin/expr is needed by jre-1.6.0_21-fcs.i586         /usr/bin/find is needed by jre-1.6.0_21-fcs.i586         /usr/bin/tail is needed by jre-1.6.0_21-fcs.i586         /usr/bin/tr is needed by jre-1.6.0_21-fcs.i586         /usr/bin/wc is needed by jre-1.6.0_21-fcs.i586         /bin/sh is needed by jre-1.6.0_21-fcs.i586      How can I work around that? * * * **Edit** : I tried Riccardo's answer, but it still doesn't work:               root@oneat-desktop:/home/oneat/Downloads/untitled folder# rpm --nodeps --force-debian -i jre.rpm     Unpacking JAR files...         rt.jar...         jsse.jar...         charsets.jar...         localedata.jar...         plugin.jar...         javaws.jar...         deploy.jar...     [: 924: /usr/java/jre1.6.0_21: unexpected operator     [: 924: /usr/java/jre1.6.0_21: unexpected operator      Those are only some of the errors:               dpkg-shlibdeps: warning: Can't extract name and version from library name `libjava.so'     dpkg-shlibdeps: warning: couldn't find library libjvm.so needed by debian/jre/usr/java/jre1.6.0_21/lib/i386/libj2gss.so (ELF format: 'elf32-i386'; RPATH: '/usr/java/jre1.6.0_21/lib/i386').     Note: libraries are not searched in other binary packages that do not have any shlibs or symbols file.     To help dpkg-shlibdeps find private libraries, you might need to set LD_LIBRARY_PATH.     dpkg-shlibdeps: warning: Can't extract name and version from library name `libjava.so'     dpkg-shlibdeps: warning: Can't extract name and version from library name `libjava.so'     dpkg-shlibdeps: warning: couldn't find library libjvm.so needed by debian/jre/usr/java/jre1.6.0_21/lib/i386/libjava.so (ELF format: 'elf32-i386'; RPATH: '/usr/java/jre1.6.0_21/lib/i386').     Note: libraries are not searched in other binary packages that do not have any shlibs or symbols file.     To help dpkg-shlibdeps find private libraries, you might need to set LD_LIBRARY_PATH.     dpkg-shlibdeps: warning: Can't extract name and version from library name `libverify.so'     dpkg-shlibdeps: warning: Can't extract name and version from library name `libverify.so'     dpkg-shlibdeps: warning: couldn't find library libjvm.so needed by debian/jre/usr/java/jre1.6.0_21/lib/i386/libjsoundalsa.so (ELF format: 'elf32-i386'; RPATH: '/usr/java/jre1.6.0_21/lib/i386').     Note: libraries are not searched in other binary packages that do not have any shlibs or symbols file.     To help dpkg-shlibdeps find private libraries, you might need to set LD_LIBRARY_PATH.     dpkg-shlibdeps: warning: Can't extract name and version from library name `libjava.so'     dpkg-shlibdeps: warning: Can't extract name and version from library name `libjava.so'     dpkg-shlibdeps: warning: Can't extract name and version from library name `libjli.so'     dpkg-shlibdeps: warning: Can't extract name and version from library name `libjli.so'     dpkg-shlibdeps: warning: couldn't find library libmawt.so needed by debian/jre/usr/java/jre1.6.0_21/lib/i386/libjawt.so (ELF format: 'elf32-i386'; RPATH: '/usr/java/jre1.6.0_21/lib/i386').     Note: libraries are not searched in other binary packages that do not have any shlibs or symbols file.     To help dpkg-shlibdeps find private libraries, you might need to set LD_LIBRARY_PATH.     dpkg-shlibdeps: warning: couldn't find library libjvm.so needed by debian/jre/usr/java/jre1.6.0_21/lib/i386/libjawt.so (ELF format: 'elf32-i386'; RPATH: '/usr/java/jre1.6.0_21/lib/i386').


linux + cant run dialog utility + got errors

Problem is as follows: Linux kernel: 3.0.13-0.27-default #1 SMP I’ve installed “dialog” utility ( `/usr/bin/dialog` ), just copied bin file to `/usr/bin` When I have tried to run it, error message regarding missing `libncursesw.so.5` lib appeared. To solve the problem I try to copied the file `libncursesw.so.5` to `/usr/lib/` but not help Now, I got another error:               error while loading shared libraries: /usr/lib/libncursesw.so.5: file too short      Please advise


Can't start mysql on Fedora 19

I'm running Fedora 19 and I have installed MySQL using `yum install mysql`. When I issue the `mysql` command, I get the following error message: > ERROR 2002 (HY000): Can't connect to local MySQL server through socket > '/var/lib/mysql/mysql.sock' (2) If I do create the /var/lib/mysql/mysql.sock file the number after the error message change to `(111)` (it is possible that I have created the file with wrong permissions). After reading to this question and this one I tried to `service mysqld start`, but I get:               Redirecting to /bin/systemctl start  mysqld.service     Failed to issue method call: Unit mysqld.service failed to load: No such file or directory. See system logs and 'systemctl status mysqld.service' for details.      and `service mysqld status` returns               Redirecting to /bin/systemctl status  mysqld.service     mysqld.service        Loaded: error (Reason: No such file or directory)        Active: inactive (dead)


AWK special character

If i want to awk the below pattern in a file               Mobilenumber '91_987986787688899' was successful      I used the below code               awk '/Mobilenumber '91_987986787688899' was successful/ {print $0}' Log Filename      Though the log file has that sentence its not rendering any result. I spent a while on this but was not successful... Please help


How do I run a script when I switch between keyboard layouts

I use more than one keyboard layout, and I would like to find a way to run a script when I switch between them. Is this possible? So far, I can assign a shortcut for a script like this:               #!/bin/bash          #switch between two layouts (English and Greek in this case)     current_layouts=$(gsettings get org.gnome.libgnomekbd.keyboard layouts)          if [ "$current_layouts" = "us" ]; then         gsettings set org.gnome.libgnomekbd.keyboard layouts "['gr']"     else          gsettings set org.gnome.libgnomekbd.keyboard layouts "['us']"     fi          exec /path/to/another/script      But using this method, I can use only that shortcut to switch between layouts and the keyboard indicator will disappear from the status menu, what is unpleasantly.


WPA pre-shared key format in linux and macintosh

I'm temporarily in a situation where the wifi network I need to use is implemented using Macintosh equipment. They have encoded their network using WPA and TKIP. I can't seem to get onto their network and I _think_ I've tracked the problem down to the pre-shared key format. When others (using Macs) enter the PSK into thier Mac interface thing, they use a 13 digit code that is all integers [0-9], e.g. `0123456789123`. In my `wpa1.conf` file, which is used by `wpa_supplicant` to configure `iwconfig`, I have a line in the network block:               psk="0123456789123"      I _think_ that I should be entering a hex string (yes, I know this _could_ be a hex string already). **Does anyone here have any experience with Mac's UI concerning the format psk's are entered in, and whether I need to change them into hex to use a psk in my linux (slackware 13.1)?** Note that my wireless setup works fine in other environments that don't use WPA or a pre-shared key which indicates that the hardware and firmware are ok.


What are the allowed group names for groupadd?

I followed these instructions to build Shadow, which provides the **`groupadd`** command. I am now getting an error when trying this:               $ groupadd automake1.10     groupadd: 'automake1.10' is not a valid group name      I checked alphanumeric names, and they work okay.


How can I automount devices with no desktop environment?

> **Possible Duplicate:**   >  Replacement for halevt? I've installed Arch Linux on my computer and I'm not using a desktop environment. I just have Openbox window manager installed and bit by bit I'm building up my system with necessary applications etc. My problem is that with a DE I had the convenience of being able to access my two CD drives or my pen drive immediately - it just detected them and would mount them automatically. The same can be said for my Windows partition that used to be detected automatically with a DE. Why is it that with no DE this sort of functionality is no longer present? I have my Windows partition mounting through an entry in fstab and creating a mount point in /mnt...that's all well and good but having to do the same thing or having to use the mount command in the terminal for simple things like plugging a USB pen drive in is a bit ridiculous. Is there any way that I can get automounting functionality? I looked around for similar questions but all of them used a DE so I couldn't really relate to them.


automount usb drive

I have a RaspberryPi with Raspbian (no GUI, only terminal). I want to use it as a music player (I will install a music daemon with web interface). Currently, when want to mount an external usb drive, I have to execute this command:               sudo mount -t ntfs -o rw,auto,user,fmask=0022,dmask=0022 \         /dev/whatever /mnt/whatever      In this way everything works well; but I need a way to mount an external drive without executing the above command. I just want to insert the usb-drive, and the usb-drive should automatically mount in a specific folder (for example in `/mnt/USBs`). I tried to modify the `fstab` file, but it works only when I turn on the computer and not at run-time. How can I have the computer mount the USB drive whenever I insert it?


Problem with Debian Squeeze and Wheezy mixed

nrc1:/var/cache/apt# apt-get upgrade     Reading package lists... Done     Building dependency tree            Reading state information... Done     You might want to run 'apt-get -f install' to correct these.     The following packages have unmet dependencies:      libc6 : Depends: libc-bin (= 2.11.3-3) but 2.13-35 is installed      locales : Depends: glibc-2.13-1 but it is not installable     E: Unmet dependencies. Try using -f.      I had this original Lenny install in use for thin client facility to students I successfully upgraded it to Squeeze long back During my leave for five long months, the other guy tried to install some things from Testing and Sid Now as I'm trying `apt-get upgrade` the above is the result my current `sources.list`               deb http:// ftp .us.debian.org/debian/ squeeze main contrib non-free     deb http:// ftp .us.debian.org/debian/ squeeze-proposed-updates contrib non-free main     deb http://security.debian.org/ squeeze/updates contrib non-free main      I have no idea how to cope up the machine is in use by nearly 900 students but has all old software


To use -c0 -io in file-systems with journal

I've several partitions with EXT4.   Now, I would want if it makes sense to use _tune2fs_ with flags **-c0** ( _max-mount-counts_ ) and **-i0** ( _interval-between-checks_ ) in the partitions with a journal file-system since it needs less checks?


Backspace, Tab not working in terminal (using ssh)

When I ssh into another machine with Debian with my account(with sudo permissions), my backspace key generates some awkward symbols on pressing. Also Tab & del keys don't work too. On the other hand, I also have another account on the same machine & when I ssh through this account, its terminal works perfectly fine. I couldn't figure out why is this happening.


largefile feature at creating file-system

Is useful to use _-T largefile_ flag at creating a file-system for a partition with big files like video, and audio in flac format? I tested the same partition with that flag and without it, and using _tune2fs -l [partition]_ , I checked in "Filesystem features" that both have "large_file" enabled. So, is not necessary to use _-T flag largefile_?


First FreeBSD install. Is there anything I should know about differences between Linux and BSD?

I want to install FreeBSD today on a spare HDD I have lying around. I'd like to give it a trial run, learn a few things, and if it suits me I'll replace my current Ubuntu 10.10 'server/NAS/encoding box' with it. Curiosity is the main reason. I also want to see most of the major bugs ironed out of GNOME 3/Unity before I jump aboard the next Ubuntu iteration. I have no experience with the BSDs (except for OS X) but I have installed and used quite a few Linux distros over the years. I have a _fairly_ good understanding of how to get Linux up and running, including some of the roll- your-own distros such as Arch. But I'm not an expert by any stretch of the imagination. Basically, I'd say I'm better than my grandma is. So is there anything that I should keep in mind when installing FreeBSD for the first time? In particular, are there any major differences between installing and setting up FreeBSD and a Linux distro? Furthermore, should I be using a i386 release? I read somewhere in the documentation that i386 is recommended but I'm not sure if that's out-of-date information.


Performance Issue: AWS Medium Linux Instance V/S Hetzner Dedicated Instance

I am testing an AWS Medium Instance with CentOS (AWS AMI) and comparing it with Hetzner's EX40-SSD (http://www.hetzner.de/hosting/produkte_rootserver/ex40ssd). Software setup on both is comparable( Same OS, Same version of MySQL 5.6.14). CPU Speed of AWS was 2Ghz and CPU Speed of Hetzner was 3.4GHZ. mysql my.cnf was exactly same for both the servers. Have a large abc.sql file which has dump from another server (2GB Size) copied locally onto both the above servers. I ran the following command on both the machines #               date > StartTime ; mysql -pxyz < abc.sql ; date >> StartTime &      Strangely, the AWS Small instance completed the task in 12 mins where as the Hetzner instance took more than 40 mins to complete the task. There are no other servers/apps running on Hetzner machine (Clean machine with only MySQL). AWS Machine has other software running like SugarCRM, Piwik, Nginx, but not loaded. What could be the reason why the AWS outperformed the Hetzner ? Logically, Hetzner should be faster as it has SSD (Faster IO), faster CPU (3.4Ghz) and operating as Dedicated Machine and not a VM instance. How to debug and trace the root cause for such strange behavior.


How do I allow only certain IPSet set's to access a certain port with iptables?

I'm using IPSet to build IP ranges for different countries as follows :               # Canada     ipset -F ca.zone     ipset -N ca.zone nethash     for IP in $(wget -O - http://www.ipdeny.com/ipblocks/data/countries/ca.zone)             do ipset -A ca.zone $IP              echo $IP     done      I'm then blocking those countries from certain ports on my server with the following iptables rules :               iptables -A INPUT -m set --match-set fr.zone src -p tcp --dport 15765 -j DROP     iptables -A INPUT -m set --match-set cn.zone src -p tcp --dport 15765 -j DROP     iptables -A INPUT -m set --match-set ca.zone src -p tcp --dport 16247 -j DROP     iptables -A INPUT -m set --match-set de.zone src -p tcp --dport 16247 -j DROP      This all works well but I want to achieve the opposite of this for some of the ports by only allowing certain IPSet country ip ranges. For example block all IP's apart from those inside my uk.zone and th.zone sets. What iptables rules would I need to achieve this ?


Linux Mint 15 Ethernet Issue

I have a dual boot system with Mint and Win7. Under Mint the **wired** connection is going in and out randomly, short period of being out and 10-20 minutes up and working. I start up Linux and everything fine. Maybe about 10 minutes or so my ethernet connection goes out. I get a notification on the top right "Wired Connection 1: Disconnected" or something like that. I open Networking app that connection status says "cable unplugged" until out of no where it will go back on. Then maybe 20 or so minutes later it'll go back out. Same notification and my status will read "cable unplugged" again. The time its not working is much shorter than the time that it is working, most of time. It certainly is not physically 'unplugged' or loss or anything like that. Since I dual boot with windows and the internet connection when using Windows is fine all the time, the issue must lay within Linux. Any suggestions?


Is the id_rsa.pub file needed on client side?

If we would use: 1) password authentication through ssh 2) key auth - the public key's line are already in the servers authorized_keys **Q: So in either these two ways, storing the public key is unneeded on the client side?** p.s.: I tried to rename the id_rsa.pub file, and I still could log in to a server. so afaik storing the pubkey on client side is not needed. I'm asking this to be 100% sure.


What does the "notify" button in AUR do?

There are three buttons when looking at a package in AUR: "Vote", "Notify" and "Flag Out-of-date". What does the "Notify" button do?


Where to install applications

I'm a long-time Windows user in the middle of a multi-year personal migration to Linux-based development. On Windows when I installed an application it got put in the Program Files folder and I'd have the app store the files that I create while using the app in a separate data folder hierarchy that I could back up regularly. What are the corresponding folders/directories in Linux (OK, I'm really running on a Mac)?


How to copy a public key to your server

I was trying to figure out how to add a new SSH key to my amazon server - I found this question and answer How do you copy the public key to a ssh-server? However I am so new to Linux/Unix and I overthink things so I thought the following   1. Since my clients access this server if I mess this up I am going to have serious problems recovering.   2. How could this possibly work because I have no connection to that other server. I read the first response and it suggests that I could send my newly generated public key to any server in the land. Does my second point make sense. The command from the shell (which I just installed) reads to me as   1. ssh - use an ssh session   2. copy the key to (in my case it would be ubuntu@ourspecial.server.com (hosted by Amazon though I am not sure it matters) In other words - for a totally new user the command suggests that if I use the following command               $ ssh-copy-id tim@just.some.other.server      if there is actually a user named tim and a server named just.some.other.server I would then have some privileges at that server And so I finally tried the command and clearly there is something missing as when I keyed in               $ ssh-copy-id ubuntu@my.amazonserver.com      the shell returned               /usr/bin/ssh-copy-id: ERROR: No identities found


How to copy permissions from owner to others using `chmod`?

Is it possible to recursively copy the permissions of owner to group and others for all files in a given directory? PS: my `chmod` is 5.97


How do I aggregate data from many files into one file?

I have this directory structure for about 100 users.               users     - user1       - info.txt     - user2       - info.txt     - user3       - info.txt     ...      Inside the `info.txt` files, the contents look like this.               5 some_other_info      Basically, it's just one line, containing a number, a space, then some text (may have spaces within). I'd like to create a file `result.txt` that looks like this.               user1 5     user2 6     user3 7     ...      Where `user1`, `user2`, `user3`, ... matches the directory name and the numbers match what's in their respective `info.txt` files. You can assume that the user directories have no spaces in their names. What's a good way to do this?


Mosh: Retain backscroll beyond terminal window height

I'm experimenting using Mosh instead of raw SSH for remote shell connections. So far I like it, but I've become used to being able to page-up or scroll through backscroll in my terminal window to see the results of older commands or commands that print too much info to fit in a single window. This works fine with normal SSH connections, but Mosh seems to be "eating" lines beyond the height of the window, so when I scroll back all I can see is stuff printed before I invoked Mosh. Is there a way I can get Mosh to behave like raw SSH and retain the backscroll? If it matters, the client is running on OS X Mountain Lion (10.7) in the standard "Terminal" program, with tcsh.


How can I find out what kind of wireless card I have from output of lspci

I am trying to install a wireless driver for a new laptop running `ubuntu 12.04`. If I run `lspci` I do not see any human readable mention of a wireless card.               $ lspci     00:00.0 Host bridge: Intel Corporation Haswell-ULT DRAM Controller (rev 09)     00:02.0 VGA compatible controller: Intel Corporation Haswell-ULT Integrated Graphics Controller (rev 09)     00:03.0 Audio device: Intel Corporation Device 0a0c (rev 09)     00:14.0 USB controller: Intel Corporation Lynx Point-LP USB xHCI HC (rev 04)     00:16.0 Communication controller: Intel Corporation Lynx Point-LP HECI #0 (rev 04)     00:19.0 Ethernet controller: Intel Corporation Ethernet Connection I218-V (rev 04)     00:1b.0 Audio device: Intel Corporation Lynx Point-LP HD Audio Controller (rev 04)     00:1c.0 PCI bridge: Intel Corporation Lynx Point-LP PCI Express Root Port 6 (rev e4)     00:1c.1 PCI bridge: Intel Corporation Lynx Point-LP PCI Express Root Port 3 (rev e4)     00:1d.0 USB controller: Intel Corporation Lynx Point-LP USB EHCI #1 (rev 04)     00:1f.0 ISA bridge: Intel Corporation Lynx Point-LP LPC Controller (rev 04)     00:1f.2 SATA controller: Intel Corporation Lynx Point-LP SATA Controller 1 [AHCI mode] (rev 04)     00:1f.3 SMBus: Intel Corporation Lynx Point-LP SMBus Controller (rev 04)     02:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. Device 5227 (rev 01)     03:00.0 Network controller: Realtek Semiconductor Co., Ltd. Device 818b     abe-lens-laptop@abe:~$ lspci | wireless     wireless: command not found      But if I `grep` for "0280", which ubuntu help forums say will show me `lspci` output for wireless cards, I do get machine-readable output that does not mean much to me.               $ lspci -nm | grep 0280     03:00.0 "0280" "10ec" "818b" "10ec" "001b"      How can I find out what kind of wireless card I have?


Failed dependencies: libcurl.so.4(CURL_OPENSSL_3)(64bit)

I'm trying to install Synergy in my CentOS 6.5, here's what happens:               # rpm -ivh ./synergy-1.4.16-r1969-Linux-x86_64.rpm     error: Failed dependencies:      > libcurl.so.4(CURL_OPENSSL_3)(64bit) is needed by synergy-1.4.16-1.x86_64 And I have this `libcurl` package:               # rpm -qa |grep libcurl     libcurl-7.19.7-37.el6_4.x86_64      I've installed CentOS today, it's my first day using Linux.


Compiling code from vim

New to `vim` and and I want to be able to compile code from within `vim` without running a new terminal and calling the compiler. How do I go about doing this? Note that this requirement is not restricted to `gcc` only, I sometimes need to call `python` also on the current script I am working on, so you get the idea...


mc: customizig colors with skins

I am editing the default skin for `midnight commander` and I would like to add some more rules for file highlighting. In the `filehighlight` section, there are several categories, for example `archive=red;` will display all `gz` files red.               [filehighlight]         directory=white;         executable=brightgreen;         symlink=lightgray;         hardlink=         stalelink=brightred;         device=brightmagenta;         special=black;         core=red;         temp=gray;         archive=red;         doc=brown;         source=cyan;         media=green;         graph=brightcyan;         database=brightred;      I would like to add new rules, for example all `*.deb` files should have blue color. Is it possible to create new categories ? Where are these categories defined, anyway?


can i modify an .rpm-based system to use .deb files, apt-get and debian/ubuntu repositories?

I recently ran into trouble when installing Debian on a netbook. There were three major hardware/kernel issues that I didn't feel like fixing, and since every single forum/wiki writeup reported the exact same problems with very few easy solutions, I decided to try something new. So I just tried every distro I could get my hands on, hoping to find one that would work more or less perfectly out of the box. To my surprise, the latest version of openSUSE works flawlessly and runs about as fast as Debian. Unfortunately, many packages that are standard in Debian-based systems are not even installed by default in openSUSE. The repository of available software is depressingly small. Is there any way I can get around this? Build a Debian-based system on top of the out-of-the-box kernel setup from a totally unrelated distro?


How can I solve this ssh-agent problem?

I'm using Linux Mint, and have not been able to get gnome-keyring to unlock automatically at login, it seems. A symptom of my problem is as follows:               $ ssh-add     Identity added: /home/me/.ssh/id_rsa (/home/me/.ssh/id_rsa)          $ git pull     WARNING: gnome-keyring:: couldn't connect to: /tmp/keyring-Nmf3J3/pkcs11: No such file or directory      How can I make it that git can push/pull without any passphrase input from me? I realize there's several things here with gnome-keyring, and ssh-agent, but have not been able to nail it down. ## Edit Running `ssh-add` during a session means that I am no longer asked for my passphrase for SSH/git. The problem is that I would need to run `ssh-add` during each session - I must be missing how to have Gnome's keyring unlock at login. As requested by didster:               $ export | grep GNOME               GNOME_KEYRING_CONTROL=/tmp/keyring-hjMM4V     GNOME_KEYRING_PID=1961      Edit 2 It happened again during the same session as the first edit. I did `git pull` and got `WARNING: gnome-keyring:: couldn't connect to: /tmp/keyring- hjMM4V/pkcs11: No such file or directory`. As requested by Stephane:               $ env | grep SSH     SSH_AGENT_PID=2116     SSH_AUTH_SOCK=/tmp/ssh-OACxJMBY2038/agent.2038          $ps -fp $SSH_AGENT_PID     UID        PID  PPID  C STIME TTY          TIME CMD     eoin      2116  2038  0 09:47 ?        00:00:00 /usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session x-session-manager


How to delete empty comments with sed?

I want to delete empty Java comments like the following:               /**     */          /*      *      *      *     */      I tried it with sed, but the following deletes all comments, not just the empty ones:               sed -r "/^\s*\/\*+\s*/,/\s*\*+\/\s*/d"      How can I tell sed to only delete ranges with lines of the shape `\s\\*+\s` in between? I looked at http://www.grymoire.com/Unix/Sed.html#uh-29 but I didn't find the solution there. P.S.: I created the following test file:               /**     bla bla bla     */          /*ba dff      *dd fdf      *d f      *df df df     */          /**     */          /*      *      *      *     */          class Test     {      some code...     }      The first approach:               sed -n '/[^ \/\*]/p' /tmp/tmp           bla bla bla     /*ba dff      *dd fdf      *d f      *df df df     class Test     {      some code...     }      One of the comment has its intro and outro stripped.               perl -0777 -pe 's,\s*/\*[*\s]*\*/\s*, ,gs' < /tmp/tmp          /**     bla bla bla     */          /*ba dff      *dd fdf      *d f      *df df df     */  class Test     {      some code...     }      The last comment is on the same line as the class definition. warl0ck's approach:               $ removeemptycomments /tmp/tmp                                             class Test     {      some code...     }


Are there network connections that don't use the WiFii card or the Ethernet port?

I see many connections like when I use `netstat`, are they all to the internet? Are there any connections to the internet or other things that aren't forthcoming? I guess what I'm asking is what does "AC adapter is online" actually mean, and do I have to have a WiFi adapter to connect to the "cloud" or is there something built in that does that without my permission?


How to compile gcc toolchain with special sysroot correctly?

I try to compile a new `gcc`, including `binutils` and `glibc`. Since I can not be root, I want to install it all in `~/local`. I set these variables:               PREFIX=~/local && export PREFIX     PATH=~/local/bin:$PATH && export PATH      I built `binutis`, `gcc` and `glibc` (in exactly this order), with this configuration:               ../binutils-2.22/configure --prefix=$PREFIX --with-sysroot     ../gcc-4.7.3/configure --prefix=$PREFIX     CC='gcc --sysroot=~/local' ../glibc-2.15/configure  --prefix=$PREFIX      My idea was that I'd first compile `binutils`, then compile a `gcc` which is linked with the new binutils, and finally, the two compile `glibc` (without need of my system's `glibc` of `/usr/lib`). However, after `binutils` and `gcc` were compiled and installed correctly, `gcc` fails to compile a simple program while configuring `glibc`:               int main() { return 0; }      Output (shortened):               > gcc --sysroot=~/local/ test.cpp -o test     ld: cannot find crt1.o: No such file or directory     ld: cannot find crti.o: No such file or directory     ld: cannot find -lc     ld: cannot find crtn.o: No such file or directory      However, this displays no files:               find ~/local -name crti.o      Did I configure anything wrong? My system is a server running a 64 bit Ubuntu 12.04 ("precise"), but I think it is not system related. The versions of the three toolchain components should fit each other, since openSuSE 12.2 has this combination.


Fedora 17 freezes at loading screen with a CD-based installation

I'm trying to install F17 on my laptop (Toshiba A-665 ... 4gigs RAM, nividia gforce GTS350M,core-i7 1.7 GHz processor), but the liveCD boot freezes about 3/4 of the way through the loading icon... EVERY TIME. I've checked the image, the LiveCD (using Fedora 17s own media checker) and re-downloaded / rewritten the ISO about a thousand times now. Conclusion: the ISO is fine, the media is fine. The Fedora live environment just WILL NOT BOOT. I even tried to install other Distros of Linux (Ubuntu 12.10, Opensuse 12.2), and both gave me the same problem exactly. To clarify: I turn on my laptop, push F12 to select CD\DVD as boot device Fedora boot options appear, hit enter on the first option, screen flashes white-ish, little cursor at top left (about 3-5 seconds here) little icon appears on screen, starts filling up ~3/4 of the way through, the icon stops filling at this point, the CD Drive stops spinning, as does the disk-usage light on my laptop. And I can't open the DVD Drive tray, with no response AT ALL. No "could not find this, that, or the other thing" errors. No response at all from the keyboard, I have to hold down the power button to reboot. I get exactly the same result (with different progress bar) when I select "Trouble Shooting" and then "Boot in something-or-other graphics mode."


How do I get rid of these broken package errors and install Mate in Linux Mint 16 Petra?

I have upgraded my computer to Linux Mint 16 Petra. Everything worked smoothly during the install with no errors, or indications of any problems. However, after I rebooted, Mate was no longer an option among all the sessions. I have Cinnamon and Gnome, but no Mate. I logged in using Cinnamon and tried to install Mate using Synaptic, but it keeps giving me errors about broken packages. How do I install Mate in Linux Mint 16 Petra? Here is some output that I hope will be helpful in determining the problem:               homebase ~ # sudo apt-get install mate-desktop-environment     Reading package lists... Done     Building dependency tree            Reading state information... Done     Some packages could not be installed. This may mean that you have     requested an impossible situation or if you are using the unstable     distribution that some required packages have not yet been created     or been moved out of Incoming.     The following information may help resolve the situation:          The following packages have unmet dependencies:      mate-desktop-environment : Depends: mate-core (= 1.6.0.1+raring) but it is not going to be installed                                 Depends: mate-screensaver (>= 1.6.0) but it is not going to be installed                                 Depends: mate-applets (>= 1.6.0) but it is not going to be installed     E: Unable to correct problems, you have held broken packages.     homebase ~ # apt-get install mate-core     Reading package lists... Done     Building dependency tree            Reading state information... Done     Some packages could not be installed. This may mean that you have     requested an impossible situation or if you are using the unstable     distribution that some required packages have not yet been created     or been moved out of Incoming.     The following information may help resolve the situation:          The following packages have unmet dependencies:      mate-core : Depends: libmatekbd (>= 1.6.0)                  Depends: libmatewnck (>= 1.6.0)                  Depends: libmatedesktop (>= 1.6.0)     E: Unable to correct problems, you have held broken packages.     homebase ~ # apt-get install libmatekbd     Reading package lists... Done     Building dependency tree            Reading state information... Done     Some packages could not be installed. This may mean that you have     requested an impossible situation or if you are using the unstable     distribution that some required packages have not yet been created     or been moved out of Incoming.     The following information may help resolve the situation:          The following packages have unmet dependencies:      mate-settings-daemon : Depends: mate-settings-daemon-gstreamer (>= 1.6.1-1~mate1+petra) but it is not going to be installed or                                      mate-settings-daemon-pulse (>= 1.6.1-1~mate1+petra) but it is not going to be installed     E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.


Question about MX records and mail delivery?

Let's say, we have multiple mail servers in DNS records. If someone is sending a mail, the outgoing mail server will check the MX and contact the first server with the lowest cost. If this server doesn't have the requested mail address, what happens then? Does the outgoing mailserver send the message to the second mailserver in the MX record? Or does that depends on the error message by the first mailserver? How are messages to "unknown addresses" handled? By the first server attempting to deliver them to the appropriate MX mailserver, or does the MX mailserver attempt to resolve this?


Notify of changes on a file under /proc

I have written a small 'daemon' in bash that will switch to the headphones if they are detected, and if not, switch to an external USB speaker with PulseAudio. What I'm looking for is some way to get notification of changes on the file `/proc/asound/card0/codec#0`, just like `inotifywait` does on real files (considering files under /proc to be as "pseudo-files"). I find my code a bit insane, because it runs `sleep 1` with `awk` for the whole day, that is 86400 times a day :)               while sleep 1; do         _1=${_2:-}         _2=$(awk '/Pin-ctls/{n++;if(n==4)print}' '/proc/asound/card0/codec#0')              [[ ${_1:-} = $_2 ]] ||             if [[ $_2 =~ OUT ]]; then                 use_speakers             else                 use_internal             fi     done      What I'm looking for is something like (this example doesn't work):               codec=/proc/asound/card0/codec#0     while inotifywait $codec; do         if [[ $(awk '/Pin-ctls/{n++;if(n==4)print}' $codec) =~ OUT ]]; then             use_speakers         else             use_internal         fi     done      This way the commands inside the loop would be run only when there are real changes on the `$codec` file.


Plugin support for gcc in RHEL/CentOS?

Is there anyway to enable or install plugin support for gcc in RHEL/CentOS?


How to interpret this output of lsof command?

root@host [/home2]# lsof /home2     COMMAND     PID     USER   FD   TYPE DEVICE SIZE/OFF     NODE NAME     php        3182 ctxmortg  cwd    DIR   8,17     4096 32858196 /home2/ctxmortg/public_html/hello     php        3182 ctxmortg    3r   REG   8,17    46404 55781766 /home2/ctxmortg/public_html/hello/cache/subprimemortgagemorgage.com/cache-zch-8284-cache.txt     php        3185 ctxmortg  cwd    DIR   8,17     4096 32858196 /home2/ctxmortg/public_html/hello     php        3185 ctxmortg    3r   REG   8,17     4185 35962154 /home2/ctxmortg/public_html/hello/cache/curl/http%3A%2F%2Fimage.yahoo.cn%2Fs%3Fq%3DNudity%26c%3D0%26s%3D%26page%3D277     php        3187 ctxmortg  cwd    DIR   8,17     4096 32858196 /home2/ctxmortg/public_html/hello     php        3187 ctxmortg    3r   REG   8,17    54640 69699731 /home2/ctxmortg/public_html/hello/cache/newdatingfriends.com/cache-zch-1545-cache.txt     php        3188 ctxmortg  cwd    DIR   8,17     4096 32858196 /home2/ctxmortg/public_html/hello     php        3188 ctxmortg    3r   REG   8,17    54640 21557063 /home2/ctxmortg/public_html/hello/cache/customersdeals.com/cache-zch-5715-cache.txt     php        3189 ctxmortg  cwd    DIR   8,17     4096 32858196 /home2/ctxmortg/public_html/hello     php        3189 ctxmortg    3r   REG   8,17     4185 36028071 /home2/ctxmortg/public_html/hello/cache/curl/http%3A%2F%2Fimage.yahoo.cn%2Fs%3Fq%3DVideos%26c%3D0%26s%3D%26page%3D329     php        3200 ctxmortg  cwd    DIR   8,17     4096 32858196 /home2/ctxmortg/public_html/hello     php        3200 ctxmortg    3r   REG   8,17    21036  9155614 /home2/ctxmortg/public_html/hello/cache/indorealestates.com/cache-zch-8562-cache.txt     lsof       3201     root  cwd    DIR   8,17     4096        2 /home2     lsof       3202     root  cwd    DIR   8,17     4096        2 /home2     webalizer 32342 ctxmortg  cwd    DIR   8,17     4096 32890953 /home2/ctxmortg/tmp/webalizer/eyebestdatedotcomauph.ctxmortgagemortgagerefi.com     webalizer 32342 ctxmortg    5uW  REG   8,17    12288 32890954 /home2/ctxmortg/tmp/webalizer/eyebestdatedotcomauph.ctxmortgagemortgagerefi.com/dns_cache.db     webalizer 32360 ctxmortg  cwd    DIR   8,17     4096 32890953 /home2/ctxmortg/tmp/webalizer/eyebestdatedotcomauph.ctxmortgagemortgagerefi.com     webalizer 32360 ctxmortg    5u   REG   8,17    12288 32890954 /home2/ctxmortg/tmp/webalizer/eyebestdatedotcomauph.ctxmortgagemortgagerefi.com/dns_cache.db     webalizer 32361 ctxmortg  cwd    DIR   8,17     4096 32890953 /home2/ctxmortg/tmp/webalizer/eyebestdatedotcomauph.ctxmortgagemortgagerefi.com     webalizer 32361 ctxmortg    5u   REG   8,17    12288 32890954 /home2/ctxmortg/tmp/webalizer/eyebestdatedotcomauph.ctxmortgagemortgagerefi.com/dns_cache.db     webalizer 32362 ctxmortg  cwd    DIR   8,17     4096 32890953 /home2/ctxmortg/tmp/webalizer/eyebestdatedotcomauph.ctxmortgagemortgagerefi.com     webalizer 32362 ctxmortg    5u   REG   8,17    12288 32890954 /home2/ctxmortg/tmp/webalizer/eyebestdatedotcomauph.ctxmortgagemortgagerefi.com/dns_cache.db     webalizer 32363 ctxmortg  cwd    DIR   8,17     4096 32890953 /home2/ctxmortg/tmp/webalizer/eyebestdatedotcomauph.ctxmortgagemortgagerefi.com     webalizer 32363 ctxmortg    5u   REG   8,17    12288 32890954 /home2/ctxmortg/tmp/webalizer/eyebestdatedotcomauph.ctxmortgagemortgagerefi.com/dns_cache.db     webalizer 32364 ctxmortg  cwd    DIR   8,17     4096 32890953 /home2/ctxmortg/tmp/webalizer/eyebestdatedotcomauph.ctxmortgagemortgagerefi.com     webalizer 32364 ctxmortg    5u   REG   8,17    12288 32890954 /home2/ctxmortg/tmp/webalizer/eyebestdatedotcomauph.ctxmortgagemortgagerefi.com/dns_cache.db     webalizer 32365 ctxmortg  cwd    DIR   8,17     4096 32890953 /home2/ctxmortg/tmp/webalizer/eyebestdatedotcomauph.ctxmortgagemortgagerefi.com     webalizer 32365 ctxmortg    5u   REG   8,17    12288 32890954 /home2/ctxmortg/tmp/webalizer/eyebestdatedotcomauph.ctxmortgagemortgagerefi.com/dns_cache.db     webalizer 32366 ctxmortg  cwd    DIR   8,17     4096 32890953 /home2/ctxmortg/tmp/webalizer/eyebestdatedotcomauph.ctxmortgagemortgagerefi.com     webalizer 32366 ctxmortg    5u   REG   8,17    12288 32890954 /home2/ctxmortg/tmp/webalizer/eyebestdatedotcomauph.ctxmortgagemortgagerefi.com/dns_cache.db     webalizer 32367 ctxmortg  cwd    DIR   8,17     4096 32890953 /home2/ctxmortg/tmp/webalizer/eyebestdatedotcomauph.ctxmortgagemortgagerefi.com     webalizer 32367 ctxmortg    5u   REG   8,17    12288 32890954 /home2/ctxmortg/tmp/webalizer/eyebestdatedotcomauph.ctxmortgagemortgagerefi.com/dns_cache.db     webalizer 32368 ctxmortg  cwd    DIR   8,17     4096 32890953 /home2/ctxmortg/tmp/webalizer/eyebestdatedotcomauph.ctxmortgagemortgagerefi.com     webalizer 32368 ctxmortg    5u   REG   8,17    12288 32890954 /home2/ctxmortg/tmp/webalizer/eyebestdatedotcomauph.ctxmortgagemortgagerefi.com/dns_cache.db     webalizer 32369 ctxmortg  cwd    DIR   8,17     4096 32890953 /home2/ctxmortg/tmp/webalizer/eyebestdatedotcomauph.ctxmortgagemortgagerefi.com     webalizer 32369 ctxmortg    5u   REG   8,17    12288 32890954 /home2/ctxmortg/tmp/webalizer/eyebestdatedotcomauph.ctxmortgagemortgagerefi.com/dns_cache.db     bash      32409     root  cwd    DIR   8,17     4096        2 /home2      I want to umount a drive but cannot. So, what does cwd, 3r dir, and reg mean anyway?


Do I need Nautilus on RedHat / CentOS / Scientific Linux 6?

I've found that Nautilus causes problems in my Scientific Linux 6 desktop (specifically it gets into an infinite loop opening the file manager at startup). While those problems are interesting in their own right, it got me wondering if I really need it for anything. When I do this:               sudo yum remove nautilus      the problem goes away, and since I never interact with the GUI file manager this doesn't seem like a problem. Will this bite me later on? Are there some hidden uses for Nautilus other than browsing files with a GUI?


setserial /dev/ttyS4: Cannot set serial info

So, I have a board with 6 hardware serial ports: the first 2 on the ETX bus and the last 4 on the ISA bus. The following configuration is how it is supposed to be:               /dev/ttyS0 port 0x03F8 irq 4     /dev/ttyS1 port 0x02F8 irq 3     /dev/ttyS2 port 0x0100 irq 5     /dev/ttyS3 port 0x0108 irq 5     /dev/ttyS4 port 0x0110 irq 5     /dev/ttyS5 port 0x0118 irq 5      On startup, I run:               # dmesg | egrep -i 'serial|ttys'     Serial: 8250/16550 driver, 6 ports, IRQ sharing enabled     serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A     serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A     00:06: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A     00:07: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A          # cat /proc/tty/driver/serial     Serinfo:1.0 driver revision:     0: uart:16550A port: 000003F8 irq:4 tx:0 rx:0     1: uart:16550A port: 000002F8 irq:3 tx:0 rx:0     2: uart:unknown port:000003E8 irq:4     3: uart:unknown port:000002E8 irq:3     4: uart:unknown port:00000000 irq:0     5: uart:unknown port:00000000 irq:0      So, I'm trying to use setserial to configure ports ttyS2-ttyS5 with the correct values:               # setserial /dev/ttyS2 irq 5 port 0x100 uart 16550A     # setserial /dev/ttyS3 irq 5 port 0x108 uart 16550A     # setserial /dev/ttyS4 irq 5 port 0x110 uart 16550A     Cannot set serial info: Invalid argument     # setserial /dev/ttyS5 irq 5 port 0x118 uart 16550A     Cannot set serial info: Invalid argument      Even taking out the uart option from the last command:               # setserial /dev/ttyS4 irq 5     Cannot set serial info: Invalid argument      What do I need to do to get ttyS4 and ttyS5 configured through setserial?


Can a user with /sbin/nologin shell login through ssh?

Is it possible to ssh to a machine as a user with no valid shell (say, `mail`)? So far I cannot, and using the command below doesn't work:               $ ssh mail@machine.local /bin/bash      It will always say "This account is currently not available.". But if I'm logged-in to the machine and use 'su'               $ su mail -s /bin/bash      I can become user `mail`.


Repeated commands in a bash pipeline

Sometimes commands repeat in pipeline command. For example (just to illustrate):               $ grep -lF 'pattern' ./foo/**/*.bar | xargs dirname | xargs dirname      Is there a way to shorten chaining command? For example, I have a command:               $ ... | some-command | some-command | some-command | ...      I'd like to get same result with something like to the following               $ ... | (some-command) ^ 3 | ...      Of course, it wouldn't work, but it illustrates what I'd like to make.


Number of running processes show in top

The usual maximum number that I have seen in the "running" field displayed in `top`(1) is the number of logical CPUs installed in the system. However, I have observed that under Ubuntu 10.04 (not checked in other versions), sometimes `top`(1) shows more processes running than the limit I've mentioned. What can be causing the display of say, for example, 2 running processes in a single core system?


Can't start mysql service

Trying to start my mysql service.               /etc/init.d/mysql start      returns:               Job failed. See system logs and 'systemctl status' for details.      Further:               systemctl status mysql.service      returns:               mysql.service - LSB: Start the MySQL database server           Loaded: loaded (/etc/init.d/mysql)           Active: failed since Mon, 04 Aug 2014 16:20:43 -0400; 38s ago          Process: 14148 ExecStop=/etc/init.d/mysql stop (code=exited, status=0/SUCCESS)          Process: 16457 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)           CGroup: name=systemd:/system/mysql.service      Any ideas how I can find out what's happening? That latest entry in `/var/log/mysql/mysqld.log`:               140805 08:52:42 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql     140805  8:52:42 [ERROR] mysqld: Can't lock aria control file '/var/lib/mysql/aria_log_control' for exclusive use, error: 11. Will retry for 30 seconds     140805  8:53:13 [ERROR] mysqld: Got error 'Could not get an exclusive lock; file is probably in use by another process' when trying to use aria control file '/var/lib/mysql/aria_log_contr$     140805  8:53:13 [ERROR] Plugin 'Aria' init function returned error.     140805  8:53:13 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.     140805  8:53:13 [ERROR] Failed to initialize plugins.     140805  8:53:13 [ERROR] Aborting          140805  8:53:13 [Note] /usr/sbin/mysqld: Shutdown complete          140805 08:53:13 mysqld_safe mysqld from pid file /var/run/mysql/mysqld.pid ended


How to modify output in bash command pipeline

For example, I got from some command some lines               $ some-command     John     Bob     Lucy      Now I'd like to add chaining command, that modifies output.               $ some-command | other-command     Hi John Bye     Hi Bob Bye     Hi Lucy Bye      How to write `other-command`? (I'm a novice in bash)