title: Trying to connect to gateway in static ip network

text: I have arch-linux-arm running on a raspberryPi.   The network I am in uses static IPs.   `gateway IP` is `192.168.178.5`   IP for my device is `192.168.178.201` To connect to the internet I use:   `ip addr add 192.168.178.201 dev eth0`   `ip route add default via 192.168.178.5`   However the latter yields   `RTNETLINK answeres: Network is unreachable`   What am I missing? **UPDATE**   mtak's answer fixed the initial problem,   however I still cannot reach the gateway.   Attempting to `ping` result in `destination host unreachable`


title: Game server hosting and security

text: I'm working on a small controlpanel for a hobby project of mine, which is supposed to set up game servers. But I have some concerns regarding security that I would like some input on. **My first idea** is to have the controlpanel "remote" (which a web frontend interacts with) running as an user, and when setting up game servers they would all go in a subdirectory of it's home folder, like so:               /home/paneluser/servers/server1/     /home/paneluser/servers/server2/     /home/paneluser/servers/server3/      But then, as users would have FTP access to these subdirectories, they would be able to upload malicious code (i.e. change the executable) so they could easily gain access to files of other servers and for example delete files. **My second idea** is to run the controlpanel "remote" as it's own user (root?) which then creates separate users for each server and starts them as the appropriate user. **My third idea** is to expand on the first one, and run all servers in some kind of sandbox where where the executables can't access files outside. But I do not technically know how this would be done or if it's even possible. So what I would like to know is what the best approach would be. Or is there another, better, approach?


title: LVM2 pvdisplay and vgdisplay disagree

text: In my laptop, I have a single hard drive (`/dev/sda`). On this hard drive, I have an EFI partition (`/dev/sda1`), a boot partition (`/dev/sda2`), and an encrypted partition containing `/` (`/dev/sda3`). Inside the encrypted partition is an LVM volume group, which contains a couple of logical volumes (`/`, a swap partiton, etc.). All of this works fine; my initrd sets everything up correctly, and the system boots without any issues. However, after booting, I wanted to be able to manage the volume group. When I tried to do so, I got the following output:               # pvdisplay /dev/mapper/root        --- Physical volume ---        PV Name               /dev/mapper/root        VG Name               localdisk        PV Size               931.31 GiB / not usable 1.69 MiB        Allocatable           yes (but full)        PE Size               4.00 MiB        Total PE              238416        Free PE               0        Allocated PE          238416        PV UUID               I3wArE-g6yl-9ywx-Df8d-3w1N-wuuQ-FrQjoK           # vgdisplay localdisk        Volume group "localdisk" not found        Skipping volume group localdisk       How is it possible that `pvdisplay` reports that the physical device is a member of the volume group `localdisk`, however `vgdisplay` insists that the very same volume group doesn't exist? What's going wrong here? I can provide more information about my system as required / as relevant to the question. Because I am not sure what's wrong, I'm not sure what to add at this point. These are the device mapper entries I have setup. Note the two LVM logical volumes, as well as "root" (i.e., `/dev/mapper/root`), which is the LUKS- encrypted parent partition.               # dmsetup info      Name:              localdisk-swap      State:             ACTIVE      Read Ahead:        256      Tables present:    LIVE      Open count:        2      Event number:      0      Major, minor:      251, 1      Number of targets: 1      UUID: LVM-75jhqCBBFayCVQECgTH8NOFfkrjYCqiHa0oIafGLgBOZbuhrYISOHQo97Gamy74E           Name:              localdisk-root      State:             ACTIVE      Read Ahead:        256      Tables present:    LIVE      Open count:        1      Event number:      0      Major, minor:      251, 2      Number of targets: 1      UUID: LVM-75jhqCBBFayCVQECgTH8NOFfkrjYCqiHzpANUdFbPYfliL6gmKoBdhol2zj9Gl6z           Name:              root      State:             ACTIVE      Read Ahead:        256      Tables present:    LIVE      Open count:        2      Event number:      0      Major, minor:      251, 0      Number of targets: 1      UUID: CRYPT-LUKS1-d5f7cc568cc74201be3fde108e37162e-root       Here are the filesystems I have mounted (note `/dev/mapper/localdisk-root on /`):               # mount      rootfs on / type rootfs (rw)      proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)      udev on /dev type devtmpfs (rw,nosuid,relatime,size=10240k,nr_inodes=1006523,mode=755)      devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620)      sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)      /dev/mapper/localdisk-root on / type ext4 (rw,noatime,commit=0)      tmpfs on /run type tmpfs (rw,nosuid,nodev,relatime,size=805564k,mode=755)      mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)      shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime)      configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)      cgroup_root on /sys/fs/cgroup type tmpfs (rw,nosuid,nodev,noexec,relatime,size=10240k,mode=755)      fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)      efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)      openrc on /sys/fs/cgroup/openrc type cgroup (rw,nosuid,nodev,noexec,relatime,release_agent=/lib64/rc/sh/cgroup-release-agent.sh,name=openrc)      cpu on /sys/fs/cgroup/cpu type cgroup (rw,nosuid,nodev,noexec,relatime,cpu)      binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nodev,noexec,nosuid)


title: Changing a root file system from initramfs to JFFS2

text: I am running Linux on an ARM based development board from flash memory. The rootfs is _initramfs_. I chose this in the configuration utility under _"file system"_. Then I realized that I need persistent memory and _initramfs_ is in RAM. So I want to switch to JFFS2. Then I selected Jffs2 in configuration menu and I got image.ub (as always) and this time a new file called rootfs.jffs2. Now I have to put three things in the flash;               1- bootloadeer (uboot) in mtd0     2- image.ub in mtd1     3- rootfs.jffs2 in mtd3      I did this by the command `flashcp -v rootfs.jffs2 /dev/mtd3` But my kernel is hanging at "starting kernel..."   This was also happening when I was keeping mt3 (where I am a supposed to put rootfs.jffs2) empty. It means that kernel is not getting file system. Can someone tell me if the procedure for putting rootfs.jffs2 described above is correct. Means is it sufficient just to use the flashcp command above and put jffs2 file or there is any other thing also that I have to perform?


title: How do I run a script on unlock?

text: I'd like to run a screen if the XFCE session is locked and unlocked. Is there a way that I can intercept this and perform certain actions when the desktop is locked or unlocked? I see that it is possible in Ubuntu; but I'd like to achieve this in Xubuntu. I can't seem to find any events triggered by `xscreensaver` when it quits...


title: Correct locking in shell scripts?

text: Sometimes you have to make sure that only one instance of a shell script is running at the same time. For example a cron job which is executed via crond that does not provide locking on its own (e.g. the default Solaris crond). A common pattern to implement locking is code like this:               #!/bin/sh     LOCK=/var/tmp/mylock     if [ -f $LOCK ]; then       echo Job is already running\!       exit 6     fi     touch $LOCK     # do some work     rm $LOCK      Of course, such code has a race condition. There is a time window where the execution of two instances can both advance after line 3 before one is able to touch the `$LOCK` file. For a cron job this is usually not a problem because you have an interval of minutes between two invocations. But things can go wrong - for example when the lockfile is on a NFS server - that hangs. In that case several cron jobs can block on line 3 and queue up. If the NFS server is active again then you have thundering herd of parallel running jobs. Searching on the web I found the tool lockrun which seems like a good solution to that problem. With it you run a script that needs locking like this:               $ lockrun --lockfile=/var/tmp/mylock myscript.sh      You can put this in a wrapper or use it from your crontab. On current Linux systems you probably want to apply following patch to get working locking via NFS:               --- a/lockrun.c Tue Oct 04 20:39:42 2011 +0200     +++ b/lockrun.c Tue Oct 04 20:40:39 2011 +0200     @@ -97,11 +97,7 @@                     __attribute__((noreturn))                     __attribute__((format(printf, 1, 2)));          -#ifdef __sun      # define WAIT_AND_LOCK(fd) lockf(fd, F_TLOCK,0)     -#else     -# define WAIT_AND_LOCK(fd) flock(fd, LOCK_EX | LOCK_NB)     -#endif      This should also work on all current UNIX-like systems because lockf is POSIX. Are there alternatives to lockrun? What about other cron daemons? Are there common crond's that support locking in a sane way? A quick look into the man page of Vixie Crond (default on Debian/Ubuntu systems) does not show anything about locking. Would it be a good idea to include a tool like `lockrun` into coreutils? In my opinion it implements a theme very similar to `timeout`, `nice` and friends.


title: deny any writing to given app and its children

text: So I have a Python app (which spawns other processes) which I want to deny any writing. It seems like a job for SELinux. Could you describe the steps needed to accomplish this, or perhaps direct me to some good reading resource, since from what I've found there aren't too many.


title: Fritz WLAN USB stick - Xlib/Xfree86 dev packages for installing Wine

text: I have installed Ubuntu 10.4 and want to install the driver for my Fritz WLAN USB stick according to http://wiki.ubuntuusers.de/fritz!wlan_usb_stick (German site... sorry). Now I am trying to install Wine for using the Windows drivers. Because I do not have a cable connection to the router, I downloaded some packages on a windows PC and used an USB stick to install them on linux. But now when doing `./configure` in the Wine dir I get this: > configure: error: X development files not found. Wine will be built without > X support, which probably isn't what you want. You will need to install > development packages of Xlib/Xfree86 at the very least. Use the --without-x > option if you really want this. Which packages do I need… and is there an easier way to install Wine? Like a version I don't have to build before installing? I am completely new to Linux…


title: creating vim plugins

text: I would like to attempt my first VIM plugin and wondered where there are some good docs on this? From going threw the plugins I use it seems to me that it is a mix of BASH and some sorts of VIM api is this correct?


title: Reformat each two-line sequence into two columns

text: I would like to tab my printout:               1 2     3 4     5 6     7 8      to               1 2 5 6     3 4 7 8      How to adjust it using simple command line (`awk` or `sed`)??


title: Browser in Xwayland unresponsive (incl. video)

text: I use `wayland` with `xwayland` and `weston` and run `X11` applications from an `xserver` that is running in `wayland/weston`. This includes my browsers, Firefox and Chromium, as they currently cannot run natively on `wayland/weston` to my knowledge. The problem is that clicking on any menu item will not have any effect. E.g. in Chromium no new tab will be opened when I click on New Tab. In general no menu item has any kind of effect. I tried issuing               export GDK_BACKEND=wayland      to no avail. The problem affects both of my browsers, Firefox and Chromium. Other apps do not show this kind of behaviour. Can somebody provide an explanation and preferably a solution? Here is a link to a weston screencast that illustrates the problem.


title: How can I loop through lines of a file and find files matching each line?

text: In a BASH shell, I would like to take the lines of a file (eg _pattern.txt_ ) and find the files on my system whose names contain the patterns in each line of my file. So, I have the following for loop               for pp in `cat pattern.txt`; do find ./ -iname "*${pp}*" -print0; done      which doesn't find any files when if the first line in _pattern.txt_ doe exist. So how can I fix the above command line? Note: Each line in my file contains characters [a-zA-Z] only.


title: mount --no-canonicalize?

text: Neither `man` nor `info` page provide more information on this than: > `mount --no-canonicalize` Don't canonicalize paths. The mount command > canonicalizes all paths (from command line or fstab) and stores > canonicalized paths to the /etc/mtab file. This option can be used together > with the -f flag for already canonicalized absolut paths. In connection with `fuse`, I found that it was introduced to Linux Kernel 2.8.5 to prevent _… local users to bypass intended access restrictions and unmount arbitrary directories via a symlink attack_ [-> source]. **Question** : What is `mount --no-canonicalize` actually used for? Was this just a security issue or what else is this option used for? As I'm quite limited in my settings here, I was just able to mount USB Flash Drives with and without this option, with the exact same output in `/etc/mtab` and when using `mount --show-labels`in the minutest detail. This might be different with other file systems.    **Update 1** : `umount` also provides this option, where both `man` and `info` page tells one > `\--no-canonicalize` Don't canonicalize paths. _For more details about this > option see the mount(8) man page_


title: Lock to launcher/Pin to taskbar in Debian Wheezy/Gnome (was possible in Squeeze)

text: In Debian Squeeze, if I right clicked on something in the Applications menu I could lock it to the top bar. I upgraded to Debian Wheezy and now if I right click it just opens the program. I'm using Virtualbox, so maybe the right click just isn't working. I also said "debian gnome" because it looks different than the regular gnome I know. So how can I create shortcuts in gnome 3/debian wheezy? I don't care if it's pinning it to the "top bar", or locking it in the "task bar" (bottom). And while I'm at it, is there a way I can get a shortcut to the desktop (preferably a button, which I had in Debian squeeze). I've googled for all sorts of combinations of "debian (or gnome) shortcut to desktop" and "debian (or gnome) pin to taskbar"


title: Does zip's -u flag pay attention to deleted files?

text: This website about Linux's zip utility says this about the `-u` flag: > Replace (update) an existing entry in the zip archive only if it has been > modified more recently than the version already in the zip archive. For > example: >   >   >             zip -u stuff * >   >     will add any new files in the current directory, and update any files > which >   > > have been modified since the zip archive stuff.zip was last > created/modified. My question is, if a particular file has been removed since the last time it was zipped, whether `-u` will recognize that the file has been removed and thus remove it from the *.zip file? Or, lacking timestamp information (since the file is now removed), it will leave the backed up file in *.zip, since there is no "newer" file?


title: delete subfolders without deleting parent folder

text: For this type of dir structure :               /config/filegroups/filegroupA/files/fileA1.txt     /config/filegroups/filegroupA/files/fileA2.txt     /config/filegroups/filegroupB/files/fileB1.txt     /config/filegroups/filegroupB/files/fileB2.txt     ...      I know that I can use `rm -rf /config/filesgroups` to delete parent folder and all sub-folders ... but I want to delete only `/filegroupA` , `/filegroupB` , etc. , and not delete `/config/filegroups`


title: how to get exit status from command in expect script

text: Below is an shell script I have written to automate entering the password for the `vpnc` command. The expect works fine and vpnc activated automatically after password entered, but I need to get the exit status of the `vpnc` command. How can I get the exit status of `vpnc`?               VPNC=/bin/vpnc          expect_ACTIVATE=`cat << EOF     set timeout -1     spawn  $VPNC      expect    :            {send Pass123\r}     expect eof     EOF`          expect -c  "$expect_ACTIVATE"      I've tried doing the following to get the exit status into `STATUS`, but it's not quite right:               expect_ACTIVATE=`cat << EOF     set timeout -1     spawn  $VPNC      expect    :            {send Pass123\r}     STATUS=` echo $? `     expect eof     EOF`


title: How to monitor outgoing http requests per user?

text: I'd like to know how to monitor users' outgoing http requests. I've got a FreeBSD 8.1 server, and I would like to get an output like this for http requests: > source MAC address or IP address → destination IP address. I don't need any other information, just the source of the request and the destination.


title: Can tr work with regex?

text: I have a file like this:               AAAA       BBBB       CCCC        DDDD        etc        Words in separate lines. I want to add them quotes using `tr`.   So I tried the following: 1) To add a quote in the start of each word i.e. `'AAAA`   * `tr '^\w$' '\'\w$' <file.txt` Does not work    * `tr '^\w$' ''\w$' <file.txt` Does not work  Both of the above make the command line stuck. 2) To add quote to the end I tried: `tr '\n' ''\n' <file.txt` But this does not work and the command line gets stuck. Why don't these regex work with `tr`?


title: Remapping Ctrl-l in bash

text: Can one remap `Ctrl`-`l` in bash to execute more than just clear? I know normally it just clears the screen. I'm looking to change that to clear the screen and list my `pwd` like so: `Ctrl`-`l`:`clear;ls;`


title: Unable to delete a directory even as root

text: I am unable to delete a directory even as root. The command `rm -rf kdyiyv.pif` returns nothing. Then I tried the command, `touch kdyiyv.pif` for which there was an error: `touch: setting times of 'kdyiyv.pif/': Input/output error` I also tried, `strace rm -rf kdyiyv.pif` Output of the "strace" is:               execve("/bin/rm", ["rm", "-rf", "/media/Kira/kdyiyv.pif"], [/* 38 vars */]) = 0     brk(0)                                  = 0x8f2f000     access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)     mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7786000     access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)     open("/etc/ld.so.cache", O_RDONLY)      = 3     fstat64(3, {st_mode=S_IFREG|0644, st_size=53732, ...}) = 0     mmap2(NULL, 53732, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7778000     close(3)                                = 0     access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)     open("/lib/libc.so.6", O_RDONLY)        = 3     read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0@n\1\0004\0\0\0"..., 512) = 512     fstat64(3, {st_mode=S_IFREG|0755, st_size=1421892, ...}) = 0     mmap2(NULL, 1431976, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x110000     mprotect(0x267000, 4096, PROT_NONE)     = 0     mmap2(0x268000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x157) = 0x268000     mmap2(0x26b000, 10664, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x26b000     close(3)                                = 0     mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7777000     set_thread_area({entry_number:-1 -> 6, base_addr:0xb77778d0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0     mprotect(0x268000, 8192, PROT_READ)     = 0     mprotect(0x8053000, 4096, PROT_READ)    = 0     mprotect(0xb86000, 4096, PROT_READ)     = 0     munmap(0xb7778000, 53732)               = 0     open("/usr/lib/locale/locale-archive", O_RDONLY|O_LARGEFILE) = 3     fstat64(3, {st_mode=S_IFREG|0644, st_size=8580848, ...}) = 0     mmap2(NULL, 2097152, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7577000     mmap2(NULL, 4096, PROT_READ, MAP_PRIVATE, 3, 0x82e) = 0xb7785000     brk(0)                                  = 0x8f2f000     brk(0x8f50000)                          = 0x8f50000     close(3)                                = 0     ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0     lstat64("/", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0     fstatat64(AT_FDCWD, "/media/Kira/kdyiyv.pif", {st_mode=S_IFDIR|0700, st_size=0, ...}, AT_SYMLINK_NOFOLLOW) = 0     openat(AT_FDCWD, "/media/Kira/kdyiyv.pif", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY) = 3     fcntl64(3, F_GETFD)                     = 0     fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0     fstat64(3, {st_mode=S_IFDIR|0700, st_size=0, ...}) = 0     fcntl64(3, F_GETFL)                     = 0x18800 (flags O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY)      fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0     fcntl64(3, F_DUPFD, 3)                  = 4     fcntl64(4, F_GETFD)                     = 0     fcntl64(4, F_SETFD, FD_CLOEXEC)         = 0     getdents64(3, /* 2 entries */, 32768)   = 48     getdents64(3, /* 0 entries */, 32768)   = 0     close(3)                                = 0     unlinkat(AT_FDCWD, "/media/Kira/kdyiyv.pif", AT_REMOVEDIR) = -1 ENOENT (No such file or directory)     close(4)                                = 0     close(0)                                = 0     close(1)                                = 0     close(2)                                = 0     exit_group(0)                           = ?


title: SSH Login doesn't work using a key Without Password?

text: # Agent admitted failure to sign using the key I'm working on centos6.5(32bit) and I have tried to ssh log in without Password Using ssh-keygen & ssh-copy-id? the steps that I have done: first I created the key:               [root@dd ~]# ssh-keygen -t rsa     Generating public/private rsa key pair.     Enter file in which to save the key (/root/.ssh/id_rsa):      /root/.ssh/id_rsa already exists.     Overwrite (y/n)? y     Enter passphrase (empty for no passphrase):      Enter same passphrase again:      Your identification has been saved in /root/.ssh/id_rsa.     Your public key has been saved in /root/.ssh/id_rsa.pub.     The key fingerprint is:     8f:48:0b:04:3a:e1:90:f4:9f:de:2a:33:63:ea:a8:82 root@dd.hiast.com     The key's randomart image is:     +--[ RSA 2048]----+     |+o.              |     |+o..             |     |o. ..            |     | . .. .          |     |    .o. S        |     |    .o.o o       |     |.    .o.. .      |     |E  *  .          |     |*oo =.           |     +-----------------+      then I copy the key to the remote host:               [root@dd ~]# ssh-copy-id -i /root/.ssh/id_rsa.pub 192.168.1.3     root@192.168.1.3's password: My_Password     Now try logging into the machine, with "ssh 'root@192.168.1.3'", and check in:          .ssh/authorized_keys          to make sure we haven't added extra keys that you weren't expecting.      then I try to login but it fails (with key):               [root@dd ~]# ssh 192.168.1.3     Agent admitted failure to sign using the key.     root@192.168.1.3's password:       and as a verbose logging:               [root@dd ~]# ssh -v root@192.168.1.3     OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013     debug1: Reading configuration data /etc/ssh/ssh_config     debug1: Applying options for *     debug1: Connecting to 192.168.1.3 [192.168.1.3] port 22.     debug1: Connection established.     debug1: permanently_set_uid: 0/0     debug1: identity file /root/.ssh/identity type -1     debug1: identity file /root/.ssh/identity-cert type -1     debug1: identity file /root/.ssh/id_rsa type 1     debug1: identity file /root/.ssh/id_rsa-cert type -1     debug1: identity file /root/.ssh/id_dsa type -1     debug1: identity file /root/.ssh/id_dsa-cert type -1     debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3     debug1: match: OpenSSH_5.3 pat OpenSSH*     debug1: Enabling compatibility mode for protocol 2.0     debug1: Local version string SSH-2.0-OpenSSH_5.3     debug1: SSH2_MSG_KEXINIT sent     debug1: SSH2_MSG_KEXINIT received     debug1: kex: server->client aes128-ctr hmac-md5 none     debug1: kex: client->server aes128-ctr hmac-md5 none     debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent     debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP     debug1: SSH2_MSG_KEX_DH_GEX_INIT sent     debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY     debug1: Host '192.168.1.3' is known and matches the RSA host key.     debug1: Found key in /root/.ssh/known_hosts:1     debug1: ssh_rsa_verify: signature correct     debug1: SSH2_MSG_NEWKEYS sent     debug1: expecting SSH2_MSG_NEWKEYS     debug1: SSH2_MSG_NEWKEYS received     debug1: SSH2_MSG_SERVICE_REQUEST sent     debug1: SSH2_MSG_SERVICE_ACCEPT received     debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password     debug1: Next authentication method: gssapi-keyex     debug1: No valid Key exchange context     debug1: Next authentication method: gssapi-with-mic     debug1: Unspecified GSS failure.  Minor code may provide more information      Cannot determine realm for numeric host address          debug1: Unspecified GSS failure.  Minor code may provide more information     Cannot determine realm for numeric host address          debug1: Unspecified GSS failure.  Minor code may provide more information               debug1: Unspecified GSS failure.  Minor code may provide more information     Cannot determine realm for numeric host address          debug1: Next authentication method: publickey     debug1: Offering public key: /root/.ssh/id_rsa     debug1: Server accepts key: pkalg ssh-rsa blen 277     Agent admitted failure to sign using the key.     debug1: Trying private key: /root/.ssh/identity     debug1: Trying private key: /root/.ssh/id_dsa     debug1: Next authentication method: password     root@192.168.1.3's password:


title: How to read the in-memory (kernel) partition table of /dev/sda?

text: I accidentally overwrote my /dev/sda partition table with GParted (full story on AskUbuntu). Since I haven't rebooted yet and my filesystem is still perfectly usable, I was told I might be able to recover the partition table from in-kernel memory. Is that possible? If so, how do I recover it and restore it? ![enter image description here](http://i.stack.imgur.com/B20LK.png)


title: /var House Keeping

text: Does anyone have any general advice or links for doing some house keeping on the /var filesystem on Unix and Linux servers? I have searched the issue quite a bit but can find no real concrete information on what I can/cannot do when I need to free up some space under /var (which happens a lot where I work).


title: How to execute a script in shell when a shortcut key is pressed

text: How could I execute a script in Shell when a shortcut key is pressed. Essentially what I need is when a shortcut key is pressed the script should read from a file and display that content in the terminal.


title: View List of Sudoers with No Sudo Priviledges

text: * If I'm not a sudoer, is it possible to view the list sudoers?   * Does `/etc/group` show this information?


title: Unable to mount cgroup

text: I've been searching for a solution to this problem but none was working. I would like to start my LXC container but i need to mount cgroup before.               [root@stag-devCentOs ~]# lxc-start -n debianLxc     lxc-start: cgroup is not mounted     lxc-start: failed to spawn '/sbin/init'     lxc-start: cgroup is not mounted      I've read that i need to add the followind line to my `/etc/fstab`               cgroup                  /sys/fs/cgroup          cgroup  defaults        0 0      and then i had to enter `mount /sys/fs/cgroup` or `mount -a`. I've done everything but i'm still getting this error:               mount: wrong fs type, bad option, bad superblock on cgroup,         missing codepage or other error         In some cases useful info is found in syslog - try         dmesg | tail or so      I'm using CentOS 5.10 with a 3.2.60-1.el5.elrepo kernel. Here is what i get when i'm using dmesg | tail:               [root@stag-devCentOs ~]# dmesg | tail     Bluetooth: RFCOMM ver 1.11     Bluetooth: HIDP (Human Interface Emulation) ver 1.2     br0: no IPv6 routers present     SELinux: initialized (dev autofs, type autofs), uses genfs_contexts     SELinux: initialized (dev autofs, type autofs), uses genfs_contexts     SELinux: initialized (dev autofs, type autofs), uses genfs_contexts     SELinux: initialized (dev mqueue, type mqueue), uses transition SIDs     SELinux: initialized (dev proc, type proc), uses genfs_contexts     SELinux: initialized (dev mqueue, type mqueue), uses transition SIDs     SELinux: initialized (dev proc, type proc), uses genfs_contexts      If you want to see my `/etc/fstab` content, here it is:               LABEL=/                 /                       ext3    defaults        1 1     /dev/vglxc/lvhome       /home                   ext3    defaults        1 1     /dev/vglxc/lvopt        /opt                    ext3    defaults        1 1     tmpfs                   /dev/shm                tmpfs   defaults        0 0     devpts                  /dev/pts                devpts  gid=5,mode=620  0 0     sysfs                   /sys                    sysfs   defaults        0 0     proc                    /proc                   proc    defaults        0 0     LABEL=SWAP-sda2         swap                    swap    defaults        0 0     cgroup                  /sys/fs/cgroup          cgroup  defaults        0 0      I have to keep using LVM with `/home` and `/opt` like this and i need to keep lxc version on 0.6.4. Do you have any idea on how to solve those issues or maybe explain what is wrong ?


title: Authentication failed

text: You have no controlling tty and no DISPLAY.  Cannot read passphrase.     warning: Authentication failed.     Disconnected (local); authentication cancelled by user (Authentication cancelled by user.).     Disconnect reason 13, exit code = 77     scp: warning: ssh2 client failed to authenticate. (or you have too old ssh2 installed, check with ssh2 -V)      I get this error when I run my script. ssh is working in both ways between the servers


title: Limit max connections per IP address and new connections per second with iptables

text: We have an Ubuntu 12.04 server with httpd on port 80 and we want to limit:   * the maximum connections per IP address to httpd to 10   * the maximum new connections per second to httpd to 150 How can we do this with iptables?


title: what is the etymology of `loop device`

text: What is the etymology of the term loop device Description: Wikipedia: loop device


title: cross compile embedded arm

text: I have the android 4.2.2 code in directory `/home/sghPhone2` which compiles normal with `make menuconfig` but I need to compile a 4.4 kernel and possibly patch it but when I download the source from google, nothing in it looks normal:               darknet064tokyo WORKING_DIRECTORY # ls /home/WORKING_DIRECTORY/     Makefile  bootable  developers   external    libcore          packages   system     abi       build     development  frameworks  libnativehelper  pdk        tools     art       cts       device       hardware    ndk              prebuilts     bionic    dalvik    docs         kmake       out              sdk      then command `ANDROID_JAVA_HOME=/home/jdk1.8.0/ make menuconfig` ends with:               including ./tools/external/fat32lib/Android.mk ...     make: *** No rule to make target `menuconfig'.  Stop.      and pointing crosscompile from my 4.4.2 directory               /home/WORKING_DIRECTORY/gcc: No such file or directory      I acquired the source from here, and I am really confused how to compile this new kernel. I followed the direction on building, but of course the device failed to boot when flashed. because of incorrect drivers. Where is the kernel config?


title: CentOS can't remove user from group

text: Asked and answered many times, but I can't get it working!!! (On CentOS) I have the user userA and I want to remove it from group `sftponly`.               #groups userA     userA : sftponly     #id -Gn userA     sftponly     #gpasswd -d userA sftponly     Removing user userA from group sftponly     gpasswd: unknown member userA          #tail /etc/group     userA:x:509:     sftponly:x:510:     #tail /etc/passwd     userA:x:509:510::/home/userA:/bin/bash/      so gpasswd not working. Also:               usermod -G fourpoints fourpoints       No result. I don't know really what to do, I'm not sure about editing /etc/group either...


title: Amazon EC2 MySQL Failed to Start

text: I'm having issues starting MySQL after it randomly stopped working a few minutes ago. I'm getting this error while trying to connect:               Connect failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)      So I tried to restart MySQL (this had worked for me before) and I got this:               Stopping mysqld:                                           [  OK  ]     MySQL Daemon failed to start.     Starting mysqld:                                           [FAILED]      Here's my error log:               130414 20:03:45 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql     130414 20:03:45 [Note] Plugin 'FEDERATED' is disabled.     130414 20:03:45 InnoDB: The InnoDB memory heap is disabled     130414 20:03:45 InnoDB: Mutexes and rw_locks use GCC atomic builtins     130414 20:03:45 InnoDB: Compressed tables use zlib 1.2.5     130414 20:03:45 InnoDB: Using Linux native AIO     130414 20:03:45 InnoDB: Initializing buffer pool, size = 128.0M     130414 20:03:45 InnoDB: Completed initialization of buffer pool     InnoDB: The first specified data file ./ibdata1 did not exist:     InnoDB: a new database to be created!     130414 20:03:45  InnoDB: Setting file ./ibdata1 size to 10 MB     InnoDB: Database physically writes the file full: wait...     130414 20:03:46  InnoDB: Log file ./ib_logfile0 did not exist: new to be created     InnoDB: Setting log file ./ib_logfile0 size to 5 MB     InnoDB: Database physically writes the file full: wait...     130414 20:03:46  InnoDB: Log file ./ib_logfile1 did not exist: new to be created     InnoDB: Setting log file ./ib_logfile1 size to 5 MB     InnoDB: Database physically writes the file full: wait...     InnoDB: Doublewrite buffer not found: creating new     InnoDB: Doublewrite buffer created     InnoDB: 127 rollback segment(s) active.     InnoDB: Creating foreign key constraint system tables      Can anyone offer some tips? I'm pretty noobish at this server stuff :P


title: Can I extract the full command line from an atop 1.23 data file?

text: My production servers have `atop` version 1.23, and I have a data file written by it from which I need to extract the full command line of a process. Unfortunately:   * this version of `atop` won't display data beyond the 80th column of the display   * horizontal scrolling was only introduced in 1.27   * newer versions refuse to read data files written by older versions   * the file itself is compressed, so a simple `strings` search won't work Is there any way I can recover the full command line from my data file?


title: How do I redirect output from the find command (that uses grep) to a log file?

text: Consider the code to search for all files containing the pattern "search string":               bash-3.2$ # The below find works fine..     bash-3.2$ find . -type f -exec grep -il "search string" {} \;     bash-3.2$ # But I am unable to redirect output to a log file..     bash-3.2$ find . -type f -exec grep -il "search string" {} \ > log.txt     find: incomplete statement     bash-3.2$      * * * From the man pages for Solaris find: > >     -exec command   True if the executed command returns a  zero >                     value  as  exit  status.   The end of command >                     must be punctuated by an  escaped  semicolon. >                     A  command  argument  {}  is  replaced by the >                     current path name. >   So it seems an escaped semicolon is compulsory. Is there another way to go about this?


title: Grub error 21 unless both sd card and live-usb are present

text: I'm not sure exactly how my EEE PC got to this point, but I have Backtrack (an Ubuntu-based distro) on the SD card, and a few different Ubuntu LiveUSB distros on different USB memory sticks. If both the SD card and any of the USB sticks are present, the system will present a GRUB boot menu which seems to be the built-in EEE PC one--it has the "reset to factory defaults" option--but all options will boot Backtrack, even after claiming to reset to factory defaults. If either the USB stick, the SD card, or both are missing, I get a Grub error 21 at boot. Not sure quite how to un-hose this; I'd just like to put a conventional netbook Ubuntu on the built-in SSD, but I can't trivially do that from Backtrack 4.


title: How to connect two machines via wifi and no other hardware?

text: Without using any other hardware, I want to connect two machines that have wifi, so that I can transfer files between them, for example.


title: Dynamically growing swap file on Debian

text: I know how to create a swap file and use it as swap. But I have to configure the size of the file beforehand and the space is used on the disk, if the swap is used or not. How do I create a swap that has an initial size of 0 and grows on demand?


title: How do I install postfix with MariaDB 10.1? ...Or mailserver...?

text: I'm using CentOS 7 x64. Log: There isn't mariadb-libs for 10.1, not that I'm aware of. There is MariaDB-compat which as I found out seems to provide the same functionality and I have it installed, but it still doesn't work. End-goal: I'm looking to install a mailserver using as little resources as possible under Centos 7 x64 LEMP + MariaDB 10.1. postfix x86_64 2:2.10.1-6.el7 base                   2.4 M     Installing for dependencies:      mariadb-libs                x86_64                1:5.5.37-1.el7_0                   updates                752 k          Transaction Summary     ===================================================================================================================     Install  1 Package (+1 Dependent package)          Total size: 3.2 M     Installed size: 17 M     Is this ok [y/d/N]: y     Downloading packages:     Running transaction check     Running transaction test               Transaction check error:       file /etc/my.cnf from install of mariadb-libs-1:5.5.37-1.el7_0.x86_64 conflicts with file from package MariaDB-common-10.1.0-1.el6.x86_64       file /usr/share/mysql/czech/errmsg.sys from install of mariadb-libs-1:5.5.37-1.el7_0.x86_64 conflicts with file from package MariaDB-server-10.1.0-1.el6.x86_64       file /usr/share/mysql/danish/errmsg.sys from install of mariadb-libs-1:5.5.37-1.el7_0.x86_64 conflicts with file from package MariaDB-server-10.1.0-1.el6.x86_64       file /usr/share/mysql/dutch/errmsg.sys from install of mariadb-libs-1:5.5.37-1.el7_0.x86_64 conflicts with file from package MariaDB-server-10.1.0-1.el6.x86_64       file /usr/share/mysql/english/errmsg.sys from install of mariadb-libs-1:5.5.37-1.el7_0.x86_64 conflicts with file from package MariaDB-server-10.1.0-1.el6.x86_64       file /usr/share/mysql/estonian/errmsg.sys from install of mariadb-libs-1:5.5.37-1.el7_0.x86_64 conflicts with file from package MariaDB-server-10.1.0-1.el6.x86_64       file /usr/share/mysql/french/errmsg.sys from install of mariadb-libs-1:5.5.37-1.el7_0.x86_64 conflicts with file from package MariaDB-server-10.1.0-1.el6.x86_64       file /usr/share/mysql/german/errmsg.sys from install of mariadb-libs-1:5.5.37-1.el7_0.x86_64 conflicts with file from package MariaDB-server-10.1.0-1.el6.x86_64       file /usr/share/mysql/greek/errmsg.sys from install of mariadb-libs-1:5.5.37-1.el7_0.x86_64 conflicts with file from package MariaDB-server-10.1.0-1.el6.x86_64       file /usr/share/mysql/hungarian/errmsg.sys from install of mariadb-libs-1:5.5.37-1.el7_0.x86_64 conflicts with file from package MariaDB-server-10.1.0-1.el6.x86_64       file /usr/share/mysql/italian/errmsg.sys from install of mariadb-libs-1:5.5.37-1.el7_0.x86_64 conflicts with file from package MariaDB-server-10.1.0-1.el6.x86_64       file /usr/share/mysql/japanese/errmsg.sys from install of mariadb-libs-1:5.5.37-1.el7_0.x86_64 conflicts with file from package MariaDB-server-10.1.0-1.el6.x86_64       file /usr/share/mysql/korean/errmsg.sys from install of mariadb-libs-1:5.5.37-1.el7_0.x86_64 conflicts with file from package MariaDB-server-10.1.0-1.el6.x86_64       file /usr/share/mysql/norwegian-ny/errmsg.sys from install of mariadb-libs-1:5.5.37-1.el7_0.x86_64 conflicts with file from package MariaDB-server-10.1.0-1.el6.x86_64       file /usr/share/mysql/norwegian/errmsg.sys from install of mariadb-libs-1:5.5.37-1.el7_0.x86_64 conflicts with file from package MariaDB-server-10.1.0-1.el6.x86_64       file /usr/share/mysql/polish/errmsg.sys from install of mariadb-libs-1:5.5.37-1.el7_0.x86_64 conflicts with file from package MariaDB-server-10.1.0-1.el6.x86_64       file /usr/share/mysql/portuguese/errmsg.sys from install of mariadb-libs-1:5.5.37-1.el7_0.x86_64 conflicts with file from package MariaDB-server-10.1.0-1.el6.x86_64       file /usr/share/mysql/romanian/errmsg.sys from install of mariadb-libs-1:5.5.37-1.el7_0.x86_64 conflicts with file from package MariaDB-server-10.1.0-1.el6.x86_64       file /usr/share/mysql/russian/errmsg.sys from install of mariadb-libs-1:5.5.37-1.el7_0.x86_64 conflicts with file from package MariaDB-server-10.1.0-1.el6.x86_64       file /usr/share/mysql/serbian/errmsg.sys from install of mariadb-libs-1:5.5.37-1.el7_0.x86_64 conflicts with file from package MariaDB-server-10.1.0-1.el6.x86_64       file /usr/share/mysql/slovak/errmsg.sys from install of mariadb-libs-1:5.5.37-1.el7_0.x86_64 conflicts with file from package MariaDB-server-10.1.0-1.el6.x86_64       file /usr/share/mysql/spanish/errmsg.sys from install of mariadb-libs-1:5.5.37-1.el7_0.x86_64 conflicts with file from package MariaDB-server-10.1.0-1.el6.x86_64       file /usr/share/mysql/swedish/errmsg.sys from install of mariadb-libs-1:5.5.37-1.el7_0.x86_64 conflicts with file from package MariaDB-server-10.1.0-1.el6.x86_64       file /usr/share/mysql/ukrainian/errmsg.sys from install of mariadb-libs-1:5.5.37-1.el7_0.x86_64 conflicts with file from package MariaDB-server-10.1.0-1.el6.x86_64


title: Monitor connected via displayport to DVI adapter won't sleep properly

text: I have a monitor connected to my machine that displays odd behavior when entering power saving sleep mode. When entering sleep, the monitor will alternate between blanking and displaying a default desktop wallpaper (the KDE 4 default, which is not what I'm using). This monitor is connected to my machine via an active displayport to DVI single link adapter and a DVI cable. The monitor did not have this issue when previously connected directly to DVI or via an HDMI->DVI cable. I wan't to fix this so that the displayport monitor properly sleeps with the others. To illustrate what I'm seeing, here is my normal desktop: ![Desktop](http://i.stack.imgur.com/7SpEB.png) The monitor in question is the rightmost 25% of this image.   This is what I see when the displays sleep: ![Sleeping displays](http://i.stack.imgur.com/B1oiu.jpg) What you are seeing here are the middle two monitors sleeping properly, the TV complaining about no signal (proper) and the right-most monitor displaying the default KDE wallpaper. This monitor will alternate between blanking and displaying this wallpaper. It wakes up normally when it is supposed to. It does not matter which monitor is connected here -- this monitor behaves when connected via HDMI or DVI and any of the other monitors misbehave when connected to the displayport adapter. I'm suspecting this issue is related to KDE and its interaction with the nvidia driver. Supporting this speculation is the state of the display configuration app in KDE. I manually set it to this state: ![monitor setup in KDE](http://i.stack.imgur.com/JjC58.png) But after sleeping it always ends up in this state: ![bad monitor setup in KDE](http://i.stack.imgur.com/UewBh.png) The differences here are that the positions of the right-most (DP) monitor and the 2nd left monitor (DVI-D-0) are misrepresented. Notable the DP monitor is marked as a clone of another. Nothing changes with the actual displays or usability though, which is good, but a bit confusing. Oddly, no matter what this tab is showing, the other display tab in the app is always the same: ![Good](http://i.stack.imgur.com/WwwyZ.png) A bit about this setup:   * Nvidia proprietary driver 340.17   * Xorg 7.4-r2   * KDE 4.13.2   * KWin 4.11.10-r1   * Nvidia GeForce GTX 770 with 4 attached monitors      * 2xDVI, 1xHDMI, 1xDP (converted to DVI with active adapter) Here is the part of the xorg config generated by the `nvidia-settings` app:               Section "Screen"         Identifier     "Screen0"         Device         "Device0"         Monitor        "Monitor0"         DefaultDepth    24         Option         "Stereo" "0"         Option         "nvidiaXineramaInfoOrder" "DFP-0"         Option         "metamodes" "DVI-I-1: nvidia-auto-select +3840+0, HDMI-0: nvidia-auto-select +0+0, DVI-D-0: nvidia-auto-select +1920+0, DP-1: nvidia-auto-select +5760+0"         Option         "SLI" "Off"         Option         "MultiGPU" "Off"         Option         "BaseMosaic" "off"         SubSection     "Display"             Depth       24         EndSubSection     EndSection      * * * I want this display to sleep properly. I am out of phyiscal ports on the video card so one of the monitors must be connected via displayport and as none of my monitors support displayport, I must use an (active) adapter. Because of this, I am not looking for answers that just tell me to use a different port or to buy a displayport monitor. What I am looking for is any information on what may be causing this display to not sleep and anything I can do to fix it.


title: How to generate initramfs image with busybox links?

text: Having been directed to initramfs by an answer to my earlier question (thanks!), I've been working on getting initramfs working. I can now boot the kernel and drop to a shell prompt, where I can execute busybox commands, which is awesome. Here's where I'm stuck-- there are (at least) two methods of generating initramfs images:   1. By passing the kernel a path to a prebuilt directory hierarchy to be compressed   2. By passing the kernel the name of a file that lists the files to be included. The second method seemed a little cleaner, so I've been using that. Just for reference, here's my file list so far:               dir /dev 755 0 0     nod /dev/console 644 0 0 c 5 1     nod /dev/loop0 644 0 0 b 7 0     dir /bin 755 1000 1000     slink /bin/sh busybox 777 0 0     file /bin/busybox /home/brandon/rascal-initramfs/bin/busybox 755 0 0     dir /proc 755 0 0     dir /sys 755 0 0     dir /mnt 755 0 0     file /init /home/brandon/rascal-initramfs/init.sh 755 0 0      Unfortunately, I have learned that busybox requires a long list of links to serve as aliases to all of its different commands. Is there a way to generate the list of all these commands so I can add it to my file list? Alternatively, I could switch to method 1, using the prebuilt directory hierarchy, but I'm not sure how to make the /dev nodes in that case. Both of these paths seem messy. Is there an elegant solution to this?


title: View contents of magnet URL via command line?

text: Is there any way to view the contents of a magnet URL using command line? I've tried `aria2c` which can view the contents of a torrent file but doesn't seem to show contents of magnet URLs.


title: Submitting jobs with sequential completion

text: If I have numerous jobs that rely on environment variables, how can I submit them sequentially? Here is my attempt that has not been working, week 6 is always submitted (and finishes) before week 5.                   #!/bin/sh              (export id=me;          export pass=welcome;          export week=5;          sas -log $HOME/logs/log$week.log sasjob.sas > /dev/null;          export week=6;          sas -log $HOME/logs/log$week.log sasjob.sas > /dev/null;         ) &      I need the statements to run in exact sequential order on **completion**.


title: Know which partitions are primary and which logical

text: I have Windows and Ubuntu installed on the same laptop. How can I know which partitions are logical or primary using the command line?


title: How to install GRUB to a whole ext4 disk without partition table?

text: Currently I have the entire disk `/dev/sda` formatted as ext4, and installed Gentoo. (There is no MBR, no partition at all. ) But finally, I can't install GRUB on it, because it seems like GRUB needs to write to MBR.               # grub-install /dev/sda     Unknown partition table signature     Unknown partition table signature     Unknown partition table signature     Unknown partition table signature     Unknown partition table signature     The file /boot/grub/stage1 not read correctly.       neither does `grub` work,               # grub     grub> root (hd0)      Filesystem type unknown, using whole disk          grub> setup (hd0)      Error 17: Cannot mount selected partition      Any way can I install GRUB into the /dev/sda without MBR? P.S. The `/boot` directory and `grub.conf` files:               # tree /boot      /boot     |-- boot -> .     |-- grub     |   |-- default     |   |-- device.map     |   |-- e2fs_stage1_5     |   |-- fat_stage1_5     |   |-- ffs_stage1_5     |   |-- grub.conf     |   |-- iso9660_stage1_5     |   |-- jfs_stage1_5     |   |-- menu.lst -> grub.conf     |   |-- minix_stage1_5     |   |-- reiserfs_stage1_5     |   |-- splash.xpm.gz     |   |-- stage1     |   |-- stage2     |   |-- stage2_eltorito     |   |-- ufs2_stage1_5     |   |-- vstafs_stage1_5     |   `-- xfs_stage1_5     `-- kernel-2.6.36-gentoo-r5          # cat /boot/grub/grub.conf     default 0     timeout 30     splashimage=(hd0)/boot/grub/splash.xpm.gz          title Gentoo Linux 2.6.36-r5     root (hd0)     kernel /boot/kernel-2.6.36-gentoo-r5 root=/dev/sda          title Gentoo Linux 2.6.36-r5 Rescue     kernel /boot/kernel-2.6.36-gentoo-r5 root=/dev/sda init=/bin/bb          # cat /boot/grub/devices     (fd0)   /dev/fd0     (hd0)   /dev/sda


title: OTG musb and full speed bulk endpoint throughput

text: We are developing an application on an OMAP3 device (DM3730 ti). An acquisition board gets samples and sends them to the OMAP board via USB. This acquisition board does a 16KHz sampling which results in ~4000 bytes sent every 8ms to the OMAP board; that gives a necessary throughput of ~0.5MB/s. This acquisition board device is a full-speed one, and the transfers are done in bulk endpoints, so 64B maximum packet size. Given the 1.5 MB/s max _theoretical_ throughput of a full-speed device, it should be enough. And it is if we connect it on an EHCI external Host. The problem comes when we try to use the MUSB OTG configured as host. In that case we get ~300KB/s so the host and the device became desynchronized and a great mess happens :). That could be resolved if we use the EHCI Host Controller with the full-speed device or the MUSB with a high speed device. Unfortunately, we cannot do any of that. So, my suspicions are that we are sending too small packets (64B, so big overhead) and that combines with the interrupt latencies and the degraded performance of a software intensive controller (MUSB vs ECHI, the latter i've read has more functions implemented on HW, i.e queue scheduling). If my assumptions are right (and i'm definitely not an usb expert) we could only resolve the problem by reducing the time spent on the OMAP micro (interrupt service and driver performance) or by increasing the packet size, which would force us, maybe, to use an isochronous inteface instead of a bulk, with the risk of packet lossing. So the question is, given the restraints we face, are there any other options we could consider to reach the .5 MB/s ? Thanks.


title: What does “batch mode” mean for the top command?

text: I was reading about the `top` command and I came across something I don't quite understand: > top options: > > **-b** Run in **_batch mode_**. This is useful for sending output from top > to other programs or to a file. It executes the number of iterations > specified with the -n option and terminates. What is batch mode? ### Otherwise : How `-b` option is useful in the following command which iterates 5 times:               top -b -n 5 > file1      What is the difference between the command above and the following command which get rid of `-b` option:               top -n 5 > file1


title: How to provision software across multiple laptops

text: I've got a bunch of laptops for my classroom and I'm using Ubuntu. I want to be able to add/update/remove software across them as easily as possible and I'm not sure how to go about it. I was thinking of editing the `/etc/profile` file on each machine to `curl` pipe `sh` a script that I would host on github. That script would include mostly `apt-get`s. I don't even know if that will work, but what I _imagine_ it will do is run the script each time someone logs on with _any_ account on the laptop (first question: _is that true?_ ) I added `nautilus ~` to the end of `/etc/profile` to test this approach out. I thought that was harmless, but upon login it opens the home directory and the rest of the startup seems to fail... no menu bar or launcher, just a mouse and desktop image. I'm kinda f***ed there and may end up asking a separate question! Before I go too far down this rabbit-hole, I was hoping that some super users on here would be able to give me some tips on how to manage software on all the laptops in this kind of setting in the most time-efficient way.


title: Broken history search after upgrade of oh-my-zsh

text: I did the auto-upgrade of oh-my-zsh a few days ago. Now my filtered history (type a few letters and up arrow) no longer works. I did not realize how dependent I became on it. * * * **EDIT:** For example, I used to type a few letters of the command and press up arrow to search my history:               ➜  scratch git:(develop) up   # press ↑ arrow key      Prompt changes to:               ➜  scratch git:(develop) upupdowndownleftrightleftrightbabastartselect # 3 key presses      * * * I don't know how to what version I was running. Currently:               ➜  scratch git:(develop) echo $ZSH_VERSION     5.0.2      Here are the lines I have in my .zshrc file that I thought were making the incremental search work:               # Set bindkeys to start search from last word     bindkey '\e[A' history-beginning-search-backward     bindkey '\e[B' history-beginning-search-forward


title: Delete files that are not included with `rsync --files-from`

text: I copy files to another location using `rsync` with the option `\--files- from`. Sometimes, a file gets deleted and is not included in that list of files any more. I tried to use `\--delete`, but that would not delete any files that are not in the list any more. How could I delete the files using this approach? * * * The point is that I only want to copy all the PDF files, files that end in `.pdf`. I could do that with `\--exclude` and `\--include` but that would require me to exclude all files, then re-include sub-directories and the PDF files. I thought that using `find -name '*.pdf'` as input for `rsync --files- from` would be a more sensible approach, until I hit that delete issue above.


title: Metin2 server on FreeBSD error

text: I have private metin2 server on FreeBSD 9.1 32 bit and I installed packet filter PF. In pf.conf, I wrote metin2 ports (open for public) and my IP Which can be connected to the server. Everything is good but in syslog in metin2 folder on server I have the error message. Every channel has a number of processes and one of these processes isn't functional (It's process with the port 28001) Message:               **SYSERR: May  7 15:13:26 :: socket_connect: HOST 178.238.41.86:28001, could not connect.**          **178.238.41.86 ..Server IP**          **28001 ..One of the metin2 ports.**      I don't know why It shows the error message. **There is my pf.conf**               ext_if="em0"          service_ports="{ 22 }"     game_ports="{ 11002, 28101, 28011, 14003, 18001, 18002, 14001, 13001, 13002, 19001, 29001, 29101, 28301, 28001, 13003, 13004, 19002, 29301, 29011, 13099 }"          table <trusted_hosts> const { 46.33.103.86, 178.238.41.86 }     table <abusive_hosts> persist          set block-policy drop     set loginterface $ext_if     set skip on lo          scrub on $ext_if reassemble tcp no-df random-id          antispoof quick for { lo0 $ext_if }          block in          pass out all keep state     pass out on $ext_if all modulate state          pass in quick from <trusted_hosts>     block in quick from <abusive_hosts>               pass in inet proto icmp all icmp-type echoreq               pass in on $ext_if proto tcp to any port $service_ports flags S/SA keep state \         (max-src-conn 30, max-src-conn-rate 15/5, overload <abusive_hosts> flush)          pass in on $ext_if proto {tcp,udp} to any port $game_ports flags S/SA keep state \         (max-src-conn 30, max-src-conn-rate 15/5, overload <abusive_hosts> flush)      **And there metin2 channel config**               HOSTNAME: channel1 core4          CHANNEL: 1          PORT: 29001          P2P_PORT: 28001          DB_PORT: 15000          DB_ADDR: localhost


title: List out strings which are substrings of other strings in the list

text: I have a list of names like so:               dog_bone     dog_collar     dragon     cool_dragon     lion     lion_trainer     dog      I need to extract out names that appear in other names like so:               dragon     lion     dog      I looked through the `uniq` man page, but it seems to compare entire lines, not strings. Is there a way to do this with a bash function?


title: How to list all files in the size order

text: I would like to list all files in the order of big to small in size and the files could be present anywhere in a certain folder.


I have couchdb on Sabayon running               # couchdb -version     getopt: invalid option -- 'v'          Try `couchdb -h' for more information.     kernel-poll not supported; "K" parameter ignored     Apache CouchDB 1.5.0 (LogLevel=info) is starting.     Apache CouchDB has started. Time to relax.     [info] [<0.32.0>] Apache CouchDB has started on http://127.0.0.1:5984/      However, I can not use systemctl:               # systemctl enable couchdb     Failed to issue method call: No such file or directory          # systemctl start couchdb     Failed to issue method call: Unit couchdb.service failed to load: No such file or directory.      How is it possible to fix?


title: PinguyOS latest version - networking problem

text: I installed PinguyOS on a friends computer. This computer is now displaying the following strange behaviour:   1. Unable to set custom network. There seems to be only a provision for DHCP based networking.   2. While custom network was set using `/etc/network/interfaces` using a fixed IP address, gateway and netmask, the network monitor shows data inflow and outflow, but `ping www.google.com` results in `Unable to resolve www.google.com`   3. It was verified that the IP address was working with the Internet functioning, on another computer (No! Two computers are not using the same IP address, I am just changing cables.).   4. The IP address was pinged and was found that one can ping from one computer to the computer having PinguyOS. It was also possible to ping the internal IPs from this computer.   5. All settings for IP address, netmask, gateway and DNS servers were checked and rechecked again. What could be the problem?


title: Is it possible for bash completion to cycle through the alternatives?

text: When using bash completion and an a number of characters have been entered, tabbing ceases to work then the prefix you have typed is matched by more than one of the possibilities. Is there a way to cycle through the alternatives of the prefix you have entered?


title: Error installing Grub

text: I'm trying to install grub but I'm getting the error:               Warning This GPT partition label contains no BIOS boot partition:      embedding won't be possible      I'm using GPT to partition, and the file system is ext3. When I ran `gdisk -l` it shows the first partitions start sector on the SSD (which is /sda) is 2040. Am I getting this error because the disk doesn't start on the first 512 bytes? If not, what else could be causing this error? I'm trying to get this to work to complete Arch installation. `parted -l` :               Warning: /dev/sda contains GPT signatures, indicating that it has a GTP table.     However, it does not have a valid fake msdos partition table, as it should.     Perhaps it was corrupted -- possibly by a program that doesn't understand GTP     partition tables. Or prehaps you deleted the GPT table, and are now using an     msdos partition table. Is this a GPT partition table?     Yes/No: yes     Error: The backup GPT table is not at the end of the disk, as it should be. This might mean that another operating system believes the disk is smaller. Fix, by moving the backup to the end (and removing the old backup)?     Fix/Ignore/Cancel? Fix     Warning: Not all of the space available to /dev/sda appears to be used, you can fix the GPT to use all of the sapce (an extra 6576128 blocks) or continue with the current setting?     Fix/Ignore/Cancel? Fix     Error: Unable to satisfy all constraints on the partition.     Model: Verbatim (scsi)     Disk /dev/sda: 3932MB     Sector size (logical/physical): 512B/512B     Partition Table: unknown     Disk Flags:          Model: ATA TOSHIBA THNSNH12 (scsi)     Disk /dev/sdb: 120GB     Sector size (logical/physical): 512B/512B     Partition Table: loop     Disk Flags:          Number   Start   End   Size   File system   Flags      1       0.00B   120GB 120GB  ext3      My drive is now `/dev/sdb`. I've just had to wipe it all and start the install again.


title: Are there any Linux distros that protect against "self-mutilation"?

text: Over the past week I have installed and reinstalled Linux several times (Mint 15 in all but one case; Ubuntu 13.04 is too slow on my laptop), and after a mishap with QT today I completely gave up in anger. I installed the default qt-sdk, qtcreator qt-dev-tools, and maybe another through Mint's package system. I tried compiling an IDE using QT made only 3 years ago, and it complained about QT needing to be no higher than 4.*. So I uninstalled QT, and built QT from scratch, which took about 4 hours over two days. After this, the program said QT_MOC_EXECUTABLE and a couple others could not be found, even though qmake was there. So I did `make uninstall` and used the Synaptic manager to download QT. After this, even after selecting the qtchooser package, qtchooser was nowhere to be found. So, I `sudo apt-get autoremove`, which promptly deleted many system critical files, like `sudo`! First off, why in the world would QT be allowed to permanently delete these system critical files? And why do package managers delete dependencies when uninstalling a single program? Those dependencies are still needed by other things, but for some reason the developers of those package managers don't realize that. So, my question is, is there any distro that protects against this, or any program that stops the distro from obliterating itself from the inside-out? From what little I've read of Gentoo, it seems it at least attempts to do this.


title: Installing Linux distros manually from live cd without installer

text: I am trying to install a debian based linux and I think its installer is broken. The live cd works fine, but the setup process always gets stuck at 9% and shows an error ("can't complete setup"). Is there any manual way to install a Linux distro from live CD (specifically debian)? I mean making partitions, copy/pasting all files, updating grub, then general config like root password and adding users. I have googled but couldn't find a guide. I have found this question here: How to install manually from live CD? [closed] but not a proper guide. Can anyone please help me with this or direct me to any specific documentation?


title: Launching shell script from SSH and disconnect

text: I have a script which I run from SSH that launches several processes which I would like to keep open when I disconnect from my session. Is that feasible? Launching the script in background is not a solution.... **UPDATE** My script launches a java process with a different classpath and calls other 4 scripts, each of them launching different java processes with different classpaths.


title: Install newer version of application in $HOME without root access and linking to installed app

text: I am new to installing application from source and just learning the best practices to do so. I have this linux box without root access with a quite old emacs, so I downloaded the latest version and built as follows:   * download to `$HOME/SRC`   * configure and build in `$HOME/BLD` with `\--prefix=$HOME`   * `make` and `make install` So this creates a `bin` folder in my home directory which is what I expected. Now when I type emacs directly from terminal, it still opens the old one (as expected). So, I have to do `~/bin/emacs`. I added this `alias emacs=$HOME/bin/emacs` to my `.bash_profile` which works. But I could have also added `~/bin` to `$PATH`. However, not quite sure which one is recommended. And would the 2 versions of emacs work without any conflict e.g. both sharing and overwriting `~/.emacs` each time a different version is opened. Which is the best way to install new applications without root access where an older version is already present, and if the steps I followed are right.


title: Toggle border with key combination in xmonad

text: How can I define a key combination which toggles between my default borderwidth (for example 2) and disabled borders (borderwidth=0) in xmonad. Compare this related question: Change the red border between windows in xmonad


title: Bluetooth pairing hangs up the system in debian

text: Whenever I try to pair bluetooth in debian using bluetooth-agent command, the system hangs up and I am unable to do anything with it. When I ask for access from my remote laptop it gives the message of Authorizing xx:xx:xx:xx device and again nothing happens. Just when I remove the bluetooth dongle from my usb port the system returns to the normal state saying agent-released. I have not installed gnome on the system. What could be the problem?


title: Resize window to half screen width in KDE 3.5

text: I am using a legacy version of Red Hat that uses KDE 3.5.4. I do not have the ability to install additional software. I have become rather addicted to the modern windowing feature of snapping to half-screen; it utilizes widescreen monitor resources well. Is there a way I can achieve this in KDE 3 other than manually dragging them to fit half-screen every time? (I have already figured out how to make the windows fill the screen only vertically.) Related...   * ...but for Gnome   * ...but for Kubuntu 11.10


title: How to increase the system CPU load/utilization in Solaris 10 to test nagios?

text: I want to increase the system CPU load in Solaris 10 in order to test this scenario in Nagios. I'm running following command to get the CPU utitlization in Solaris:               bash-3.00# sar -s 10 60          SunOS unknown 5.10 Generic_139556-08 i86pc    08/19/2013          16:10:49    %usr    %sys    %wio   %idle     16:11:50      93       5       0       2      I want to make 30 to 35% on `%sys` field. And how to do that?


title: unixODBC documentation / manpage?

text: Just wondering if there is any official documentation for unixODBC, e.g. how the configuration files have to look like and what parameters they expect? (I am using only a shell, no GUI) Even http://www.unixodbc.org/doc/ doesn't look very promising. I somehow have the impression, the best information are 3rd party pages, but can this be true?


title: Suppress output unless non-zero exit code

text: What's the best way to suppress output (stdout and stderr) unless the program exits with a non-zero code? I'm thinking:               quiet_success()     {       file=/tmp/suppressed       if ! ( "$@" > "$file" 2>&1 ); then         cat "$file"       fi     }      And run `quiet_success my_long_noisy_script.sh` but I'm not sure if there's a better way. I feel like this has to be something other people have needed to do. For the record, I'm looking to add this to my cron scripts, so that I get emailed with everything if they fail, but not if they don't.


title: Options to sync 16GB+ KVM images

text: Is there a software that sync KVM images in real time on ArchLinux? i have 2 HDD that configured as RAID-0 (for performance reason) and 1 HDD for backup i want to have a `real-time backup` images on raid0 to that backup partition


title: Rule for invoking subshell in Bash?

text: I seem to misunderstand the Bash rule for creating a subshell. I thought parentheses always creates a subshell, which runs as its own process. However, this doesn't seem to be the case. In Code Snippet A (below), the second `sleep` command does not run in a separate shell (as determined by `pstree` in another terminal). However, in Code Snippet B, the second `sleep` command _does_ run in a separate shell. The only difference between the snippets is that the second snippet has two commands within the parentheses. Could somebody please explain the rule for when subshells are created? **CODE SNIPPET A:**               sleep 5     (     sleep 5     )      **CODE SNIPPET B:**               sleep 5     (     x=1     sleep 5     )


title: Terminal commands equivalent to NetworkManager's "Use as Hotspot" option

text: I'm making a gui application which will control my laptop in order to make it act as a wifi hotspot. I may change distributions so I want to find a solution which will work generally for all distributions. I am currently doing this on Fedora 17. Using NetworkManager's "Use as Hotspot" button works very well to create an ad-hoc hotspot: ![enter image description here](http://i.stack.imgur.com/7clAP.png) I want to recreate this functionality with terminal commands.      Below are two methods I tried to accomplish this but I havn't found a solution yet. * * * **Method 1: iwconfig**   Using research from accross the web, I tried the following command:               # ifconfig wlan0 10.42.0.1 netmask 255.555.255.0 broadcast 10.42.0.255 up     # iwconfig wlan0 essid my-lappy mode ad-hoc key 0123456789     # iptables-restore < saved-hotspot-iptables     # echo 1 > /proc/sys/net/ipv4/ip_forward     # dhclient wlan0      where `saved-hotspot-iptables` is a file which I generated with `iptables-save > saved-hotspot-iptables` with the iptables set by the "Use as Hotspot" function. **Method 1 Problem**   Devices can see the SSID but are unable to connect. Running `ip a` reveals the following about wlan0:               ...     3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state DORMANT qlen 1000     ...      Notice `NO-CARRIER` is present, and the state is `DORMANT` instead of `UP`.      Running `ifconfig wlan0` shows the following:               ...     wlan0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500     ...      Notice that `RUNNING` is missing as one of the flags. * * * **Method 2: nmcli**   If NetworkManager's "Use as Hotspot" button is pressed at least once on the system, `/etc/sysconfig/network-scripts/ifcfg-Hotspot` is created and I can use the following command to start a working hotspot:               # ifconfig wlan0 up     # nmcli con up id Hotspot     # iwconfig wlan0 essid my-lappy key 0123456789      **Method 2 Problem**   If the user has never pressed "Use as Hotspot" on NetworkManager before, `nmcli con up id Hotspot` won't work. I've looked at `nm-connection-editor --create` but couldn't find much information. I've also looked into manually creating `/etc/sysconfig/network-scripts/ifcfg-Hotspot` but this method does not seem elegant or extendible to other distributions.


title: Run an application with different TimeZone

text: I have an windows application (Under Wine) that only works when I change timezone to NewYork's TimeZone.   with Any other zone it doesn't start!!   So, Is it possible in Linux to run an application with different TimeZone than system configured TimeZone? I'm using Ubuntu 10.04


title: How can I get crontab to use a different PHP installation location?

text: I have a MAMP setup which runs PHP 5.3.5 on my Mac OS X 10.5 computer. I am trying to install a crontab that executes a PHP script, which is located on my MAMP server. I can only get the crontab to execute if I use the php installation from /usr/bin/php, which is version 5.2.15. In other words, this is the pre-installed MAC OS X installation of PHP. How can I use my MAMP's version of PHP when executing the crontab? I am not knowledgeable enough with unix to install a new version of PHP at /usr/bin/php, though would this work? I want crontab to execute my PHP script using **MAMP's** version of PHP; this is because I know that the script runs successfully, and I get the desired output. However, when I try executing the crontab using the system default PHP installation at /usr/bin/php, I get Fatal PHP errors. -- In case this might be useful, here is the outcome of /usr/bin/php vs. MAMP's version. The first code example executes my php script successfully:               $  MAMP_PHP_PATH="/applications/mamp/bin/php5.3/bin/php"     $  $MAMP_PHP_PATH -f /path/to/my/script.php      Now, here's what happens when I simply run the following command:               $  # whereis php in this case returns usr/bin/php     $  php -f /path/to/my/script.php      Results in the following error (formatting mine):               Fatal error: require_once():      Failed opening required '/path/to/includes/initialize.php'      (include_path='.:') in /path/to/my/script.php on line 3      Finally, this is what my crontab file looks like (with MAMP's php):               15 * * * * /Applications/MAMP/bin/php5.3/bin/php /path/to/my/script.php      And without MAMP's php:               15 * * * * php /path/to/my/script.php      Thanks


title: kdm cannot authorize my user?

text: I've upgraded my virtual machine from Opensuse 12.2 M3 to 12.2 Beta 1 and it hangs at the startup after the mysqld. However I can manually access a terminal and start kdm as root but kdm doesn't recognize my user? I have double checked the password and it's not a typo? I don't have special character like here http://www.kubuntuforums.net/showthread.php?58623-Can-t- login-via-KDM-after-upgrading-to-Precise/page1, too.


title: How do I switch from Ubuntu desktop to Ubuntu server?

text: I'm currently setting up a home server using a very, very old PC. It has Ubuntu 11.10 installed on it, but it can't actually handle the GUI. I want to install the server edition of Ubuntu, which is command line only, but have no idea how to do so. What can I do?


title: Network Copy File With Low Overhead

text: We're trying to find a system to keep a pair of servers in sync, and I've looked at a million solutions. I came across incron, which seems like it would be perfect. Now, I just need a low overhead way of copying the files that have changed to the other server. It's a local network, so encryption isn't necessary, and it's a gigabit connection, so compression is out as well. Rsync might work, but it seems a little hefty for this task. nc seems like it would be great, but I don't know of a way to signify to the other server where the file should go from the first server. Suggestions?


title: Vmware Xorg error compiling keymap?

text: I've upgraded from Opensuse 12.2 M3 to 12.2 Beta 1 and X is broken. Startup hangs after mysqld with a black screen. But I can use a console and when I try to manually start X it gives me the error compiling keymap? I have already tried to reinstall xkbcomp to no avail. Running Xorg -configure doesn't help either. It gives error message numbers of screens not the same like numbers of devices? How can I fix this problem?


title: How to send part of the data through the pipe/file and later interactively?

text: I have a command I want to run, let's call it `program`. It is an interactive program similar to bash or python REPL. I want to start this program with some predefined input. I tried `program << "some_commands"`. But after executing `some_commands` it finishes and I cannot continue interacting manually. If this program was bash I would use `.bashrc` for this purpose. What is the correct way to use such a program with the predefined starting input?


title: Unresolved dependencies though the packages are installed (Debian 6 Sqeeze)

text: I'm working with a VirtualBox 4.2.14 VM and Debian 6 Sqeeze as guest system and want to install some PHP modules:               root@devmv:~# apt-get install php5-fpm     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 to resolve the situation:          The following packages have unmet dependencies:      php5-fpm : Depends: php5-common (= 5.4.17-1~dotdeb.0) but 5.4.17-1~dotdeb.1 is to be installed     E: Broken packages      What I'm not getting: `php5-fpm : Depends: php5-common (=` **`5.4.17`**`-1~dotdeb.0) but` **`5.4.17`**`-1~dotdeb.1 is to be installed` So, for the installation a package / package version is needed, that is already installed. What is the problem? Why is it a dependency issue?


title: TERM variable in chroot

text: I've created a chroot with the help of jailkit and now I'm trying to install some other libraries and tools. First I tried to install `clear` library. I've copied the file from the `/bin` folder and copied the dependencies to the chroot. However, when I entered the `clear` command, it says: > TERM environment variable not set. So, when I'm logged in as root, the value of `TERM` is `xterm-256color`. But when I enter `export TERM=xterm-256color`, it says unknown terminal type. Can anyone explain me what to do? Thanks!


title: Bit-shifting a file

text: I wonder if there is an utility to read and print a (binary) file, shifted by some amount of bits (i mean, it should accept amounts, which are not divisible by 8). .. something like `dd` (and its `skip` option), but bit-wise, instead of byte- wise. (If you think that there is no such thing, and are going to implement it here, please use C.. i have my own bit-shifting thing for strings, written in Python, but it is surely relatively slow as hell)


title: Table or list of system call failure modes?

text: I am wondering if there is a table or list of system call failure modes. A few examples: Can exit() fail due to the system being out of memory? Can open() fail due to the system reaching the max open files limit? Can system calls simply time out? What would various hardware failures look like manifested in system call failures? Thanks!


title: Grep in couple thousands files

text: I have directory with cca 26 000 files and I need to grep in all these files. Problem is, that I need it as fast as possible, so it's not ideal to make script where grep will take name of one file from find command and write matches to file. Before "arguments list too long" issue it took cca 2 minutes to grep in all this files. Any ideas how to do it? edit: there is a script that is making new files all the time, so it's not possible to put all files to different dirs.


title: How to preserve the logind session in Arch Linux?

text: I got audio working in Arch Linux without problems yesterday, but at some point it stopped working again:               $ alsamixer      cannot open mixer: No such file or directory     $ vlc foo.mp4     ...     [0x7f1388006be8] alsa audio output error: cannot open ALSA device "default": No such file or directory      `alsamixer` runs fine as `root`, so it seems to be a permission problem. All the audio devices are owned by `root:audio`:               $ ls -l /dev/snd     total 0     drwxr-xr-x 2 root root       80 Aug  6 22:54 by-path     crw-rw---- 1 root audio 116,  7 Aug  6 22:54 controlC0     crw-rw---- 1 root audio 116, 10 Aug  6 22:54 controlC1     crw-rw---- 1 root audio 116,  6 Aug  6 22:54 hwC0D0     crw-rw---- 1 root audio 116,  9 Aug  6 22:54 hwC1D0     crw-rw---- 1 root audio 116,  5 Aug  6 22:54 pcmC0D0c     crw-rw---- 1 root audio 116,  4 Aug  6 22:54 pcmC0D0p     crw-rw---- 1 root audio 116,  3 Aug  6 22:54 pcmC0D1p     crw-rw---- 1 root audio 116,  2 Aug  6 22:54 pcmC0D2c     crw-rw---- 1 root audio 116,  8 Aug  6 22:54 pcmC1D3p     crw-rw---- 1 root audio 116,  1 Aug  6 22:54 seq     crw-rw---- 1 root audio 116, 33 Aug  6 22:54 timer     $ getfacl /dev/snd/*     getfacl: Removing leading '/' from absolute path names     # file: dev/snd/by-path     # owner: root     # group: root     user::rwx     group::r-x     other::r-x          # file: dev/snd/controlC0     # owner: root     # group: audio     user::rw-     group::rw-     other::---          # file: dev/snd/controlC1     # owner: root     # group: audio     user::rw-     group::rw-     other::---          # file: dev/snd/hwC0D0     # owner: root     # group: audio     user::rw-     group::rw-     other::---          # file: dev/snd/hwC1D0     # owner: root     # group: audio     user::rw-     group::rw-     other::---          # file: dev/snd/pcmC0D0c     # owner: root     # group: audio     user::rw-     group::rw-     other::---          # file: dev/snd/pcmC0D0p     # owner: root     # group: audio     user::rw-     group::rw-     other::---          # file: dev/snd/pcmC0D1p     # owner: root     # group: audio     user::rw-     group::rw-     other::---          # file: dev/snd/pcmC0D2c     # owner: root     # group: audio     user::rw-     group::rw-     other::---          # file: dev/snd/pcmC1D3p     # owner: root     # group: audio     user::rw-     group::rw-     other::---          # file: dev/snd/seq     # owner: root     # group: audio     user::rw-     group::rw-     other::---          # file: dev/snd/timer     # owner: root     # group: audio     user::rw-     group::rw-     other::---      I'm _not_ in the `audio` group, as recommended by the ALSA instructions:               $ groups     wheel users      A discussion pointed me to an explanation of why adding the group is unnecessary and sometimes harmful. From there the user groups info said > None of these groups is needed for standard desktop permissions like sound, > 3D, printing, mounting, etc. as long as the _`logind`_ session isn't broken. Following directions to session permission troubleshooting, I finally found a discrepancy - it says the output of `loginctl show-session $XDG_SESSION_ID` should contain `Remote=no` and `Active=yes`, but I get the following:               $ loginctl show-session $XDG_SESSION_ID     ControlGroupHierarchy=/user     ResetControllers=cpu     NAutoVTs=6     KillExcludeUsers=root     KillUserProcesses=no     IdleHint=yes     IdleSinceHint=0     IdleSinceHintMonotonic=0     InhibitDelayMaxUSec=5s     HandlePowerKey=poweroff     HandleSuspendKey=suspend     HandleHibernateKey=hibernate     HandleLidSwitch=suspend     IdleAction=ignore     IdleActionUSec=30min     PreparingForShutdown=no     PreparingForSleep=no      From there I found info on preserving the session, which doesn't seem to be applicable - my `/etc/X11/xinit/xserverrc` is unmodified since the installation:               $ ls -l /etc/X11/xinit/xserverrc     -rw-r--r-- 1 root root 132 Oct 31  2012 /etc/X11/xinit/xserverrc      SLiM seems to be running fine:               $ systemctl status slim.service     slim.service - SLiM Simple Login Manager        Loaded: loaded (/usr/lib/systemd/system/slim.service; enabled)        Active: active (running) since Sat 2013-08-10 00:00:39 CEST      Main PID: 258 (slim)        CGroup: name=systemd:/system/slim.service                ├─ 258 /usr/bin/slim -nodaemon                ├─ 292 /usr/bin/X -nolisten tcp vt07 -auth /var/run/slim.auth                ├─ 416 /usr/bin/gnome-keyring-daemon --daemonize --login                ├─ 418 awesome                ├─ 423 /usr/bin/dbus-daemon --fork --print-pid 5 --print-address 7 --session                ├─ 472 xscreensaver -no-splash                ├─ 479 firefox                ├─ 481 java -Xmx192M -jar /usr/share/java/jedit/jedit.jar -reuseview                ├─ 483 pidgin                ├─ 485 xterm                ├─ 500 bash                ├─ 581 /usr/lib/at-spi2-core/at-spi-bus-launcher                ├─ 641 xterm                ├─ 643 bash                ├─1006 git gui                ├─1007 wish /usr/lib/git-core/git-gui --                ├─1367 dbus-launch --autolaunch e943bbb765d74fceb0393a55ceebfd1d --binary-syntax --close-stderr                ├─1368 /usr/bin/dbus-daemon --fork --print-pid 5 --print-address 7 --session                ├─1403 ekiga                ├─1405 /usr/lib/GConf/gconfd-2                ├─1476 thunar                ├─1478 /usr/lib/xfce4/xfconf/xfconfd                └─1589 systemctl status slim.service      **What do I need to do to fix the logind session, and thus (presumably) the audio permissions?**


title: can something besides the shebang set the interpreter?

text: I'm running a script (in tmuxinator) that tries to source another script (rvm). rvm explicitly does not allow sourcing from sh. I didn't think that would be a problem, because the shebang in the tmuxinator script is               #!/bin/bash      but when I insert the code suggested by the rvm people to source rvm from a script,               if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then       source "$HOME/.rvm/scripts/rvm"     fi      -I get               sh: 6: [[: not found      Why is sh being used as the interpreter there? I've also used #!/usr/bin/zsh (which is the value of $SHELL in the interactive shell from which I called the script) and #!/usr/bin/env zsh, but they give the same complaint.


title: Invoking shell script with -option and parameters

text: I need to invoke a shell script `test.sh` in the following manner:               ./test.sh -run/-rerun  username password      How to check if they have passed `-run` or `-rerun` option inside my shell script?


title: Cannot create new service with xinetd in RHEL6

text: I've installed the Nagios on My RHEL 6.4(x64) machine. and i added one more module name called "NSCA" for some central monitoring solution.so the setup required add **NSCA** service detail under **xinetd**. I've installed the **xinetd** package using yum on RHEL6 server. I added the NSCA file under **_/etc/xinet.d_** directory as per the setup. find the below,               # default: on     # description: NSCA (Nagios Service Check Acceptor)     service nsca     {             flags           = REUSE             socket_type     = stream             wait            = no             user            = nagios             group           = nagios             server          = /usr/local/nagios/bin/nsca             server_args     = -c /usr/local/nagios/nsca.cfg --inetd             log_on_failure  += USERID             disable         = no             only_from       = 127.0.0.1 129.221.8.95     }      also I added port detail in **_/etc/service_** like below               nsca            5667/tcp                # NSCA      when I restart the **_xinetd_** service, I'm getting following error message in **/var/log/message** like below,               Aug  7 11:52:54 rhel6 xinetd[13140]: Reading included configuration file: /etc/xinetd.d/nsca [file=/etc/xinetd.d/nsca] [line=67]     Aug  7 11:52:54 rhel6 xinetd[13140]: bind failed (Address already in use (errno = 98)). service = nsca     Aug  7 11:52:54 rhel6 xinetd[13140]: Service nsca failed to start and is deactivated.      Can someone tell me what is wrong with my setup?


title: Resetting USB device without root permissions

text: I'm getting a strange behavior on an Android system when quickly plugging and unplugging usb devices from a usb hub. What happens is that after some quick plug/unplug of a device on the hub, I start getting:               <6>[18121.010764] usb 2-1: new low speed USB device number 8 using tegra-ehci     <3>[18121.253237] hub 2-0:1.0: cannot reset port 1 (err = -110)     <3>[18121.478006] hub 2-0:1.0: cannot reset port 1 (err = -110)     <3>[18121.702795] hub 2-0:1.0: cannot reset port 1 (err = -110)     <3>[18121.927899] hub 2-0:1.0: cannot reset port 1 (err = -110)     <3>[18122.153156] hub 2-0:1.0: cannot reset port 1 (err = -110)     <3>[18122.153272] hub 2-0:1.0: Cannot enable port 1.  Maybe the USB cable is bad?     <3>[18122.378371] hub 2-0:1.0: cannot reset port 1 (err = -110)     <3>[18122.603889] hub 2-0:1.0: cannot reset port 1 (err = -110)      After this, anything I plug into the hub does not work until the hub itself is unplugged/plugged again. I've been able to fix this non-responsiveness by sending an ioctl with USBDEVFS_RESET. Unfortunately this requires root permissions, am I correct? Is there any other possible way to fix this without requiring root permissions?


title: Error `No protocol specified` when running from remote machine via ssh

text: I have a script, simply to run my Graphical (GUI) Application, as below.               #cat gui.sh     #!/bin/bash      ./gui -display 127.0.0.1:0.0          When I run it from local machine (`./gui.sh`) it runs perfectly fine. But when I am trying to run it from remote machine via ssh, I got following error.               [root@localhost]# ssh -f 192.168.3.77 "cd /root/Desktop/GUI/ && "./gui.sh""        No protocol specified       gdm: cannot connect to X server 192.168.3.77:0.0        [root@localhost]#          I don't know, which protocol it is asking or am I missing anything? I tried directly by starting the application, without script [`ssh -f 192.168.3.77 "cd /root/Desktop/GUI/ && "./gui""`], but the result is same. I have tried various combinations like `ssh -Y`, `ssh -fY` and more but the result is same!   Secondly for my application, there is a must condition that, we have to first go into the directory where the program is located.   Any Solutions?


title: SSH connection freezes after bigger output when inactive for a while

text: I have a problem with an SSH session freezing after using it again when it was idle for a while. The problem is that the session doesn't freeze immediately, I can still use it. But as soon as a command sends more data, it freezes before any output arrives, and I have to restart the terminal. If have read earlier solutions about MTU, but there, the session freezes everytime. Here it only happens after a period of inactivity. Note that I have set `ServerAliveInterval 120` in .ssh/ssh_config Any clues about how I can solve this?


title: How to sort the string which combined with string + numeric using bash script?

text: This is the data what I want to sort. But `sort` treats the numeric to string, the data it no sorted as I expected. > /home/files/profile1   >  /home/files/profile10   >  /home/files/profile11   >  /home/files/profile12   >  /home/files/profile14   >  /home/files/profile15   >  /home/files/profile16   >  /home/files/profile2   >  /home/files/profile3   >  /home/files/profile4   >  /home/files/profile5   >  /home/files/profile6   >  /home/files/profile7   >  /home/files/profile8   >  /home/files/profile9 I want to sort this to, > /home/files/profile1   >  /home/files/profile2   >  /home/files/profile3   >  /home/files/profile4   >  /home/files/profile5   >  /home/files/profile6   >  /home/files/profile7   >  /home/files/profile8   >  /home/files/profile9   >  /home/files/profile10   >  /home/files/profile11   >  /home/files/profile12   >  /home/files/profile14   >  /home/files/profile15   >  /home/files/profile16 Is there a good way by bash script? I can't use ruby or python script in here.


title: Running uinput code on DM368 board

text: I am using DM368 TI board. I want to send keystrokes to gstplayer in ubuntu 10.10 For that purpose i used uinput function in C code. My code works properly on console but not on the hardware. I even generated uinput.o file on the board. Please give suitable suggestion Here's my code :               #include <string.h>     #include <stdio.h>     #include <sys/types.h>     #include <sys/stat.h>     #include <fcntl.h>     #include <linux/input.h>     #include <linux/uinput.h>     #include <stdio.h>     #include <sys/time.h>     #include <sys/types.h>     #include <unistd.h>     #include <errno.h>     /* Globals */     int uinp_fd;     struct uinput_user_dev uinp;       // uInput device structure     struct input_event event; // Input device structure     /* Setup the uinput device */     int setup_uinput_device()     {         // Temporary variable         int i=0;         // Open the input device         uinp_fd = open("/dev/uinput", O_WRONLY | O_NONBLOCK);         if (uinp_fd<0)         {             printf("Unable to open /dev/uinput\n");             //die("error: open");                return -1;         }              // Setup the uinput device         if(ioctl(uinp_fd, UI_SET_EVBIT, EV_KEY)<0)             printf("unable to write");         if(ioctl(uinp_fd, UI_SET_EVBIT, EV_REL)<0)             printf("unable to write");         if(ioctl(uinp_fd, UI_SET_RELBIT, REL_X)<0)             printf("unable to write");         if(ioctl(uinp_fd, UI_SET_RELBIT, REL_Y)<0)             printf("unable to write");         for (i=0; i < 256; i++) {             ioctl(uinp_fd, UI_SET_KEYBIT, i);         }         //ioctl(uinp_fd, UI_SET_KEYBIT, BTN_MOUSE);         //ioctl(uinp_fd, UI_SET_KEYBIT, BTN_TOUCH);         //ioctl(uinp_fd, UI_SET_KEYBIT, BTN_MOUSE);         //ioctl(uinp_fd, UI_SET_KEYBIT, BTN_LEFT);         //ioctl(uinp_fd, UI_SET_KEYBIT, BTN_MIDDLE);         //ioctl(uinp_fd, UI_SET_KEYBIT, BTN_RIGHT);         //ioctl(uinp_fd, UI_SET_KEYBIT, BTN_FORWARD);         //ioctl(uinp_fd, UI_SET_KEYBIT, BTN_BACK);                   memset(&uinp,0,sizeof(uinp)); // Intialize the uInput device to NULL         snprintf(uinp.name, UINPUT_MAX_NAME_SIZE, "uinput-sample");         uinp.id.bustype = BUS_USB;         uinp.id.vendor  = 0x1;         uinp.id.product = 0x1;         uinp.id.version = 1;              /* Create input device into input sub-system */         if(write(uinp_fd, &uinp, sizeof(uinp))< 0)             printf("Unable to write UINPUT device.");                   if (ioctl(uinp_fd, UI_DEV_CREATE)< 0)         {             printf("Unable to create UINPUT device.");             //die("error: ioctl");             return -1;         }         return 1;          }     void send_click_events( )     {         // Move pointer to (0,0) location         memset(&event, 0, sizeof(event));         gettimeofday(&event.time, NULL);         event.type = EV_REL;         event.code = REL_X;         event.value = 100;         write(uinp_fd, &event, sizeof(event));         event.type = EV_REL;         event.code = REL_Y;         event.value = 100;         write(uinp_fd, &event, sizeof(event));         event.type = EV_SYN;         event.code = SYN_REPORT;         event.value = 0;         write(uinp_fd, &event, sizeof(event));         // Report BUTTON CLICK - PRESS event         memset(&event, 0, sizeof(event));         gettimeofday(&event.time, NULL);         event.type = EV_KEY;         event.code = BTN_LEFT;         event.value = 1;         write(uinp_fd, &event, sizeof(event));         event.type = EV_SYN;         event.code = SYN_REPORT;         event.value = 0;         write(uinp_fd, &event, sizeof(event));         // Report BUTTON CLICK - RELEASE event         memset(&event, 0, sizeof(event));         gettimeofday(&event.time, NULL);         event.type = EV_KEY;         event.code = BTN_LEFT;         event.value = 0;         write(uinp_fd, &event, sizeof(event));         event.type = EV_SYN;         event.code = SYN_REPORT;         event.value = 0;         write(uinp_fd, &event, sizeof(event));     }     void send_a_button()     {         // Report BUTTON CLICK - PRESS event         memset(&event, 0, sizeof(event));         gettimeofday(&event.time, NULL);         event.type = EV_KEY;         event.code = KEY_ENTER;         event.value = 1;         write(uinp_fd, &event, sizeof(event));         event.type = EV_SYN;         event.code = SYN_REPORT;         event.value = 0;         write(uinp_fd, &event, sizeof(event));         // Report BUTTON CLICK - RELEASE event         memset(&event, 0, sizeof(event));         gettimeofday(&event.time, NULL);         event.type = EV_KEY;         event.code = KEY_ENTER;         event.value = 0;         write(uinp_fd, &event, sizeof(event));         event.type = EV_SYN;         event.code = SYN_REPORT;         event.value = 0;         write(uinp_fd, &event, sizeof(event));     }     /* This function will open the uInput device. Please make        sure that you have inserted the uinput.ko into kernel. */     int main()     {         // Return an error if device not found.         if (setup_uinput_device() < 0)         {             printf("Unable to find uinput device\n");             return -1;         }         sleep(1);              send_a_button();           // Send a "A" key         // send_click_events();       // Send mouse event         /* Destroy the input device */         ioctl(uinp_fd, UI_DEV_DESTROY);         /* Close the UINPUT device */         close(uinp_fd);     }