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

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.


How to generate initramfs image with busybox links?

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?


View contents of magnet URL via command line?

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.


Submitting jobs with sequential completion

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**.


Know which partitions are primary and which logical

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


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

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


OTG musb and full speed bulk endpoint throughput

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.


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

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


How to provision software across multiple laptops

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.


Broken history search after upgrade of oh-my-zsh

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


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

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.


Metin2 server on FreeBSD error

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


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

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?


How to list all files in the size order

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?


PinguyOS latest version - networking problem

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?


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

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?


Error installing Grub

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.


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

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.


Installing Linux distros manually from live cd without installer

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?


Launching shell script from SSH and disconnect

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.


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

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.


Toggle border with key combination in xmonad

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


Bluetooth pairing hangs up the system in debian

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?


Resize window to half screen width in KDE 3.5

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


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

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?


unixODBC documentation / manpage?

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?


Suppress output unless non-zero exit code

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.


Options to sync 16GB+ KVM images

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


Rule for invoking subshell in Bash?

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     )


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

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.


Run an application with different TimeZone

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


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

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


kdm cannot authorize my user?

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.


How do I switch from Ubuntu desktop to Ubuntu server?

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?


Network Copy File With Low Overhead

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?


Vmware Xorg error compiling keymap?

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?


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

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?


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

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?


TERM variable in chroot

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!


Bit-shifting a file

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)


Table or list of system call failure modes?

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!


Grep in couple thousands files

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.


How to preserve the logind session in Arch Linux?

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?**


can something besides the shebang set the interpreter?

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.


Invoking shell script with -option and parameters

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?


Cannot create new service with xinetd in RHEL6

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?


Resetting USB device without root permissions

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?


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

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?


SSH connection freezes after bigger output when inactive for a while

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?


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

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.


Running uinput code on DM368 board

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);     }


Installing pyside on Fedora 19

I'm trying to install pyside from source on Fedora 19. Running `sudo python setup.py bdist_egg --version=1.2.0 --qmake=/usr/lib64` gives:               HEAD is now at 92062bc... Version bump to 0.2.14     Checking out submodule pyside-examples to branch master     Running process: git checkout master     Already on 'master'     Removing /home/andreas/pyside-setup/pyside_package     running bdist_egg     running build     Python architecture is 64bit     error: Permission denied      And without sudo:               Traceback (most recent call last):       File "setup.py", line 228, in <module>         rmtree(d)       File "/home/andreas/pyside-setup/utils.py", line 280, in rmtree         shutil.rmtree(dirname, ignore_errors=False, onerror=handleRemoveReadonly)       File "/usr/lib64/python2.7/shutil.py", line 247, in rmtree         rmtree(fullname, ignore_errors, onerror)       File "/usr/lib64/python2.7/shutil.py", line 256, in rmtree         onerror(os.rmdir, path, sys.exc_info())       File "/home/andreas/pyside-setup/utils.py", line 276, in handleRemoveReadonly         os.chmod(path, stat.S_IRWXU| stat.S_IRWXG| stat.S_IRWXO) # 0777     OSError: [Errno 1] Operation not permitted: '/home/andreas/pyside-setup/pyside_package/PySide'


File encryption and decryption on Linux using ucrypt

A few years back, I was using the `ucrypt` utility on CentOS 5. Now I am using Fedora 11 and need `ucrypt` for file encryption and decryption, but I don't have a backup of the old system. Where can I find `ucrypt` now?


wget to get all the files in a directory only returns index.html

I'm new to using bash, and I have been trying to `wget` all the files from a website to the server I have been working on. However all I'm getting back is an `index.html` file. I let it run for 15 minutes and the index.html file was still downloading so I killed it. Might my files be download after the `index.html` file? Here is the code I have been trying:               wget --no-parent -R index.html -A "Sample" -nd --random-wait -r -p -e robots=off -U Mozilla --no-check-  certificate http://somewebsite.com/hasSamples/Sample0      I'm trying to download all the files in a subdirectory that starts with Sample. I have searched quite a bit on the internet to find a resolution, and at this point I'm stumped. I probably just haven't found the right combinations of options, but any help would be much appreciated. Here is my understanding of the code: `\--no-parent` means don't search parent directories   `-R index.html` means reject downloading the index.html file, I also tried "index.html*", but it still downloaded it anyway   `-A "Sample"` kind of acts like a Sample* would in bash   `-nd` means download the files and not any of the directories   `\--random-wait` to make sure you don't get blacklisted from a site   `-r` recursively downloads   `-p` not sure really   `-e robots=off` ignores robot.txt files   -`U Mozilla` makes the user look like its Mozilla I think   The `\--no-check-certificate` is just necessary for the website.


How do I import wifi passwords into Fedora 19 (gnome3.8)

I've upgraded from Fedora 17 to Fedora 19 and would like to transfer my wifi passwords. In Fedora 17 they were stored in `~/.gnome2/keyrings/` whereas in Fedora 19 they are stored in `~/.local/share/keyrings/`. Can I just copy the `login.keyring` and `user.keystore` files to the new location or is there more involved?


How do I make my laptop sleep when it reaches some low battery threshold?

I'm using Ubuntu, but I have i3 as my window manager. Under i3, when my battery reaches 0%, the computer will just abruptly shut down, no warning or anything. Is there a simple script or configuration I can set up so that it goes to sleep at, say 4% battery?


Debian Squeeze apt-get update issue with HWRAID repositories

I'm running an inherited Debian Squeeze server (read: I just got this new job and the server was setup by the last guy), and I'm having an issue on the `apt-get`. The error at the end that comes up when doing a `sudo apt-get update` is `W: GPG error: http://hwraid.le-vert.net squeeze Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6005210E23B3D3B4`. I already referred to "no public key available" on apt-get update, but that solution did not work for me (`sudo aptitude install debian-keyring debian-archive-keyring`). What else can I try? Where should I look next?


Environment of another user in a child process

I have a parent process running as 'root' user. After `fork()`, `execl()` and `setuid()/setgid()`, the child process is started as another OS user (say user1). Printing the environment shows that this is same as the root environment (as if logging in as root) and not as if logging in as user1. Why? Is there a way to read the environment of user1 in the child process?


print last field from line + alternative for awk

Due to technical reason on my Solaris machine, I can't use `awk` in order to print the last field in line. What are the other alternatives to `awk` that print the last field from line (using `cut` or `tr` ...etc)? Example 1:               /usr/bin/hostname     machine1b     /usr/bin/hostname  | /usr/bin/sed 's/\(.\{1\}\)/\1 /g' |  /usr/bin/awk  '{print $NF}'     b      Example2               echo 1 2 3 4 5 | /usr/bin/awk  '{print $NF}'          5


how to make logstash read kannel log

I got logstash installed on ubuntu 12.04 using the apt repository. But logstash is not reading any document. In logstash log there are teh following:               {:timestamp=>"2014-08-01T22:06:09.722000+0000", :message=>"failed to open /var/log/kannel/smsbox.log: Permission denied - /var/log/kannel/smsbox.log", :level=>:warn}      I have checked the permissions on the file :               $ ls -lh /var/log/kannel/smsbox.log     -rw-r----- 1 kannel adm 42M Aug  2 00:14 /var/log/kannel/smsbox.log      So I have added logstash user to adm group `usermod -a -G root logstash` and that didn't change anything. I have even added it to root but it still doesn't work. I am actually out to question.


zone delegation in Bind

I have a lot of zones defined in my DNS server. I need to delegate one particular zone to a foreign DNS server and I don't have access to my domain- registrar control panel, currently. Is there a way in Bind to delegate the resolution of a whole zone to another DNS server? I thought it was possible to just name the foreign server `ns1.delegatenameserver.com` in the zone file but it's not working.               $TTL 3600     @               IN SOA ns1.delegatednameserver.com. hostmaster.ariel.org. (                             2013120904      ;serial                             3600            ;refresh                             360             ;retry                             86400           ;expire                             3600            ;minimum                     )                          IN NS           ns1.delegatednameserver.com.


Linux flavor for beginners

I bought a new notebook (HP Probook 4530s - i5, 4gb RAM) which has just DOS on it. The idea is to install a flavor of Linux which can serve as an alternative to Windows for my regular work (software development and net surfing) plus gives me a chance to learn the "coolest OS ever", as a kid in my company calls it (he's suggesting that I go for Debian, BTW). What distro should a beginner use?


Udev rule is not being used?

I'm setting up `udev` to handle my external USB hard drive when it gets plugged in and removed (no mounting yet). So far, I've made two new rules in `/etc/udev/rules.d/10-local.rules` to log adding/removing the disk to a file:               SUBSYSTEM=="block", ATTRS{model}=="2AS", ACTION=="add", RUN+="/bin/echo 'inserted lacie' >> /home/herman/udev_file"     SUBSYSTEM=="block", ATTRS{model}=="2AS", ACTION=="remove", RUN+="/bin/echo 'removed lacie' >> /home/herman/udev_file"      I have started the `udevd` daemon and re-plugged the hard drive several times, but `/home/herman/udev_file` is never created . In the rules I've used keys from the command `udevadm info -a -n /dev/sdb` which is the hard drive in question. What am I doing wrong here? The disk is being detected and I'm able to `mount` it just fine. Any help appreciated.


DD with a specific pattern

I was watching this Defcon video and around 4:30 he shows a custom pattern of drive wiping — the drive is filled with a constant text pattern. Whether he is joking or not, is this possible? How would it be done using Linux's `dd` command?


Understanding partition table with sda1 sda2 sda5

I just inherited a system and I am trying to understand it's partition table for the hard drive. (I'm new to this)               machine:~# fdisk -l /dev/sda          Disk /dev/sda: 250.0 GB, 250000000000 bytes     255 heads, 63 sectors/track, 30394 cylinders     Units = cylinders of 16065 * 512 = 8225280 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x00000080             Device Boot      Start         End      Blocks   Id  System     /dev/sda1   *           1       30064   241489048+  fd  Linux raid autodetect     /dev/sda2           30065       30394     2650725    5  Extended     /dev/sda5           30065       30394     2650693+  fd  Linux raid autodetect      Why does the numbering go from 1 to 2 to 5. "What is on" sda2 and sda5?


How to run Emacs nnrss-* commands

Specifically, I want to run `nnrss-opml-import` command, which should import an OPML file. Trying to run the command with `M-x nnrss-opml-import` tells me the command doesn't exist. I want to experience reading RSS feeds from Emacs. This is Debian, running Emacs 24.


How to boot after RAID failure (software RAID)?

Previously I had a software raid set up using (`mdadm`) of drives `sda` and `sdb`. `sdb` failed and the only way to reboot the system was by unplugging the second hard drive. Now I've added fresh `sdb` and `sdc` to my RAID setup. `sda` is the oldest (so most likely to fail) and it is the drive from which we boot (I think, how can I check?). How can I ensure and test (through GRUB configuration, etc.) that if `sda` fails, I will still be able to boot my machine. `fdisk -l`:               Disk /dev/sda: 250.0 GB, 250000000000 bytes     255 heads, 63 sectors/track, 30394 cylinders     Units = cylinders of 16065 * 512 = 8225280 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x00000080             Device Boot      Start         End      Blocks   Id  System     /dev/sda1   *           1       30064   241489048+  fd  Linux raid autodetect     /dev/sda2           30065       30394     2650725    5  Extended     /dev/sda5           30065       30394     2650693+  fd  Linux raid autodetect          Disk /dev/sdb: 500.1 GB, 500107862016 bytes     255 heads, 63 sectors/track, 60801 cylinders     Units = cylinders of 16065 * 512 = 8225280 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes     Disk identifier: 0x00000000             Device Boot      Start         End      Blocks   Id  System     /dev/sdb1   *           1       30064   241489048+  fd  Linux raid autodetect     Partition 1 does not start on physical sector boundary.     /dev/sdb2           30065       30394     2650725    5  Extended     /dev/sdb5           30065       30394     2650693+  fd  Linux raid autodetect     Partition 5 does not start on physical sector boundary.          Disk /dev/sdc: 500.1 GB, 500107862016 bytes     255 heads, 63 sectors/track, 60801 cylinders     Units = cylinders of 16065 * 512 = 8225280 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes     Disk identifier: 0x00000000             Device Boot      Start         End      Blocks   Id  System     /dev/sdc1   *           1       30064   241489048+  fd  Linux raid autodetect     Partition 1 does not start on physical sector boundary.     /dev/sdc2           30065       30394     2650725    5  Extended     /dev/sdc5           30065       30394     2650693+  fd  Linux raid autodetect     Partition 5 does not start on physical sector boundary.          Disk /dev/md0: 247.3 GB, 247284695040 bytes     2 heads, 4 sectors/track, 60372240 cylinders     Units = cylinders of 8 * 512 = 4096 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes     Alignment offset: 512 bytes     Disk identifier: 0x00000000          Disk /dev/md0 doesn't contain a valid partition table          Disk /dev/md1: 2714 MB, 2714238976 bytes     2 heads, 4 sectors/track, 662656 cylinders     Units = cylinders of 8 * 512 = 4096 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes     Alignment offset: 512 bytes     Disk identifier: 0x00000000          Disk /dev/md1 doesn't contain a valid partition table


How do you create a file with an empty name?

I don't know how, but I created a file with an empty file name, I doubt there was a whitespace there (I'll explain why at the end):               chaouche@karabeela /mnt/ubuntu/storage $ ls     total 352K     drwx------  3 chaouche chaouche 4.0K Feb 12 11:00     drwxr-xr-x  4 chaouche chaouche 4.0K Apr 14 23:13 AUDIO     drwxr-xr-x  5 chaouche chaouche 4.0K Jul 20 22:25 BACKUPS     -rw-r--r--  1 chaouche chaouche 310K Jun 15 13:00 cv_yassine_chaouche_2012.pdf     drwxr-xr-x  2 chaouche chaouche 4.0K Jun 10 22:16 Mageia-3-i586-DVD     drwxr-xr-x  5 chaouche     1001 4.0K Oct 12  2012 MUSIQUE     drwxr-xr-x 15 chaouche chaouche 4.0K Oct 27  2012 PARISVIII     drwxr-xr-x  6 chaouche chaouche 4.0K Jun 12 18:33 SABAYON     drwxr-xr-x  5 chaouche chaouche 4.0K Jun 15 13:23 SIFTECH     drwxr-xr-x  5 chaouche chaouche 4.0K Feb  6 15:11 TOILES     drwxr-xr-x  4 chaouche chaouche 4.0K Jul 17 17:21 VIDEOS     chaouche@karabeela /mnt/ubuntu/storage $      I asked on #linux how to remove the file and a person suggested I moved all other files away then use the tab completion, which gave a very interesting behaviour :               # with tab completion     chaouche@karabeela /mnt/ubuntu/storage $ ls /     total 45M     -rwxr-xr-x  1 chaouche chaouche  34M Jan 16  2013 inkscape-0.48.4-1-win32.exe     -rwxr-xr-x  1 chaouche chaouche 8.6M Feb  4 11:42 mypaint-1.0.0-win32-installer.exe     -rwxr-xr-x  1 chaouche chaouche 2.7M Jan 17  2013 pdftkb_setup.exe          # without tab completion, wrote "/" by hand     chaouche@karabeela /mnt/ubuntu/storage $ ls /     total 212K     -rw-r--r--   1 root root    0 Apr 15  2012 1     drwxr-xr-x   2 root root 4.0K Dec  9  2012 bin     drwxr-xr-x   3 root root 4.0K Jun 15 12:10 boot     -rw-------   1 root root  74K Jul  1  2011 dead.letter     drwxr-xr-x  19 root root 4.2K Jul 20 20:14 dev     drwxr-xr-x 117 root root  12K Jul 20 21:30 etc     drwxr-xr-x   4 root root 4.0K Jun 12 18:40 home     drwxr-xr-x   2 root root 4.0K Jun  8  2011 initrd     drwxr-xr-x  20 root root  12K Dec  9  2012 lib     drwx------   2 root root  16K Jun  7  2011 lost+found     drwxr-xr-x   4 root root 4.0K Jul  3 01:56 media     drwxr-xr-x   9 root root 4.0K Apr 15 00:06 mnt     drwxr-xr-x   8 root root 4.0K Jun 30 23:19 opt     dr-xr-xr-x 198 root root    0 Jun 15 13:10 proc     drwxr-x---  28 root root 4.0K Jul 20 21:42 root     drwxr-xr-x   2 root root  12K Dec  9  2012 sbin     drwxr-xr-x   2 root root 4.0K Apr  3  2011 srv     drwxr-xr-x  12 root root    0 Jun 15 13:10 sys     -rw-r--r--   1 root root    0 Jun 12 18:40 thisismageia     drwxrwxrwt  69 root root  36K Jul 20 22:04 tmp     drwxr-xr-x  14 root root 4.0K Nov  6  2011 usr     drwxr-xr-x  18 root root 4.0K Jul  2  2011 var     chaouche@karabeela /mnt/ubuntu/storage $      If there was a whitespace in the filename it would have been replaced by \" " when I hit the tab key, but it didn't.


How does one install a camera driver from a c file, and what is this driver doing?

I need to install a driver for a MT9M032 CMOS Image Sensor USB machine vision camera made by Aptina (formerly Micron). I am working on a Macintosh running OS X 10.9.1 and am new to Linux/Unix when it comes to this sort of thing. When one comes across a c-file for a camera driver (see driver below), how does one go about installing it? What exactly is the driver doing to my system such that it will now recognize the camera? https://github.com/dorimanx/Dorimanx-SG2-I9100-Kernel/blob/master-jelly-cm- aokp/drivers/media/i2c/mt9m032.c Please also see the conversation below regarding a patch of the driver: https://linuxtv.org/patch/10062/ The bottom line is my computer does not recognize the camera, and I know that drivers have been written (i.e. see above driver for MT9M032 CMOS Image Sensor from Micron). If you think there is a better approach I should be taking please let me know.


Vim - Get Current Directory

I'm currently adding a little bit of Git functionality to my menu.vim file, and for using a certain command (Gitk) I need to find out Vim's current directory. How does one do that and include it in a command? (i.e. `:!echo "%current- directory"`) * * * I'll admit here that I asked the wrong question - but I figured it out. I'm currently using these in my menu.vim:               function g:Gitk()       :!cd $(dirname %); gitk     endfun          function g:GitGui()       :!cd $(dirname %); git gui     endfun


How to get hashed password in /etc/shadow using getpwnam()?

Apparently there is a function (getpwnam) that given a username, will return the appropriate entry in `/etc/passwd` with the other details for that user (shell, uid, gid, etc.). However, I have no idea how to get that function working with the shadow password file (`/etc/shadow`). Is this possible? If it helps, the application will be running as `root`.


Setenv error message

When I opened up the Gnome command prompt, several lines of the message: > No command 'setenv' found, did you mean command 'netenv' from package > 'netenv' (command) However, I have never used such command before. It's just I installed a software through Gnome.


How to restrict internet access for a particular user on the lan using iptables in Linux

Let's say there are two users on the LAN, A and B. How do I restrict user A from internet access using iptables rules and saving the rules so that after reboot, they are still effective. And suppose I want to grant that user access at some point, How to enable it again. I am using Ubuntu Linux 10.04. It would be nice if anybody show me how to do it from the command line, as I often login to the machine using a local ssh login. thanks in advance.


How to create a new user with restricted network access

I want to create a new user (or group), so that any application running with this user can't connect to the network. @Michael Kjörling I have followed your suggestion(with Ubuntu 12.04 64bit) and got some error information:               $ sudo iptables -A OUTPUT -m owner --uid-owner xyz ! -i lo -j REJECT --reject-with network-unreachable     iptables v1.4.12: unknown reject type "network-unreachable"     Try `iptables -h' or 'iptables --help' for more information.          $ sudo iptables -A OUTPUT -m owner --uid-owner xyz ! -i lo -j REJECT      iptables v1.4.12: Can't use -i with OUTPUT          Try `iptables -h' or 'iptables --help' for more information.     $ sudo iptables -A OUTPUT -m owner --uid-owner xyz ! -j REJECT      iptables v1.4.12: cannot have ! before -j     Try `iptables -h' or 'iptables --help' for more information.      Finally, the following one works. But I'm not sure if there is anything wrong.               $ sudo iptables -A OUTPUT -m owner --uid-owner xyz -j REJECT      $


How to block all the network traffic from my running user

How to block all the network traffic from one user? But other users are alive to the network that the blocked user is able to connect to other users who have the permission to the internet.


What is the point of ls -f (or, why is this hanging?)

I've got a directory with about 100,000 files in it. ls -f hangs for over a minute. I ran strace, and immediately started seeing getdents, so ls is clearly reading the directory. I also see a lot of calls to brk, so ls is clearly buffering things in memory. I wrote a simple program that calls readdir and outputs filenames, and it responds immediately. But ls -f does not provide output. What gives? I thought the whole point of -f is that it causes ls to do nothing more than readdir. Is there a portable, reliable way to list the contents of a directory? (Note, this is ls from gnu's coreutils on Linux.) -EDIT- There was an alias in place, but "/bin/ls -1f > /dev/null" takes 8 to 15 seconds, "/bin/ls -1fx > /dev/null" takes 4 to 11 seconds, but a simple program that just does readdir takes .011 seconds. What do I need to do to make gnu ls not suck?


How do I create web pages in my home directory and have the web server serve them in my web browser?

I have recently installed the Apache web browser in my Debian Squeeze (using command `tasksel` and selecting `[ ] Web server`). Now I get it to start via `sudo /etc/init.d/apache2 start` and then I go to my browser and key in `http://localhost` and the " **It works!** " page shows up indicating that I have installed and started the web server successfully. Now I know that the HTML file for the " **It works!** " page is in `/var/www` and I am led to beleive that if I do create new pages, I need to stuff them into this directory. Creating pages would be easy but in doing so, I need to issue the `sudo` command each and every time I create/edit a file under the `/var/www` directory. I would like to know how I can create a directory in my HOME e.g. `~/html/test/index.html` and have that page displayed when I enter the address `http://localhost/html/test` in my browser address?


Need Advice: What Linux distro should I install on an old PowerPC Mac

I'm trying to set up my brother (who has a PPC Mac, with 1 ghz processor and 256 ram) with a Linux distro that would allow him to surf the web on the device. Support has faded for the new browsers, rendering the device essentially useless when it comes to the web. Ideally I would have installed jolicloud, but alas, it is only Intel Mac compatible. Which distros still continue support for PowerPC?


How can I disable /proc pseudo-filesystem on a shared Linux environment?

Is it possible to disable the `/proc` pseudo-filesystem to prevent `w`, `ps`, `top`, etc, from showing what other users are doing? Of course, I still want "everything else" to work correctly. Is there a workable way to do this?


File system CRC check

I know that before running the kernel, u-boot (the boot loader) will check the kernel image CRC. Only if it is correct it will go further, else it will give a `"Bad CRC"` error. I want to do same thing for file system too.   1. Is there any way to do that?   2. Does the kernel check whether file system is proper or not before loading it? If yes, where is this check done? **Update:** I am using jffs2 file system. Is it possible to check CRC of this type of file system? Or any other way to make sure that the jffs2 file system is not corrupted ?


Console based torrent client supporting magnet link?

https://en.wikipedia.org/wiki/Magnet_URI_scheme OS: OpenBSD/Linux. Are there any torrent clients that support magnet links? It's an important thing that they need to be console-based only!


Bash: split list of files into different files?

I have several files in a directory like:               data1.dat     data2.dat     ....     data24678.dat          To run another code, I need to have a text file with the names of the files but I need to split in 50 files per text file, like: File1.txt :               /PATH/OF/FILE/data1.data     /PATH/OF/FILE/data2.data     /PATH/OF/FILE/data3.data     ......     /PATH/OF/FILE/data50.data      File2.txt :               /PATH/OF/FILE/data51.data     /PATH/OF/FILE/data52.data     /PATH/OF/FILE/data53.data     ......     /PATH/OF/FILE/data100.data      any idea?? I was trying like:               ls -1 | xargs -n 50 >> File1.txt      but I don't know who to select each "item" in the xargs command. Thanks!!


How to alter stored procedure in a MySQL database using the Linux command prompt?

I want to alter the stored procedure in my server machine. I'm uploading the codes via SSH Linux command prompt, I need to alter an existing stored procedure in my server. I don't have c-panel or phpMyAdmin access. I have to update it via a command prompt. ### stored procedure               DELIMITER $$          USE `dbname`$$          DROP PROCEDURE IF EXISTS `add_data`$$          CREATE DEFINER=`root`@`localhost` PROCEDURE `add_data`(         f_id INT(11),          f_guild_parent_id INT(11),OUT lastid INT         )     BEGIN          INSERT INTO tablename              (              id,              character_detail_id,              media_id,              )              VALUES               (               f_id,              f_character_detail_id,              f_media_id,              NOW() ,              NOW()                );               SET lastid = LAST_INSERT_ID();         END$$          DELIMITER ;      I need the command to perform this. Can any one give me the command with an example?


Failed to load VMMR0.r0 (VERR_SUPLIB_OWNER_NOT_ROOT)

when I try to start a `vm` in `Virtualbox`, I get the error in the title message. I have already checked `/usr/lib/virtualbox/VMMR0.r0` and the permissions are               -rw-r--r-- 1 root root 785K Sep 21  2013 /usr/lib/virtualbox/VMMR0.r0      What other things will cause this error, and what other things can I try?


Installing multiple packages with one yum command

Is there a way to install 2 or more packages using one yum command               yum install mysql php vsftp


Why won't my bash script exit after execution?

I compiled a short bash one-liner to focus a running application or launch it if it isn't running:               #!/bin/bash     #intellilaunch.sh          wmctrl -a $1 || $1 & disown     exit 1      The command exits perfectly fine when run directly from the command line:               :~$ wmctrl -a firefox || firefox & disown     [1] 32505      A quick check with the system monitor shows that only firefox is running. However, when I launch firefox via the script (`./intellilaunch.sh firefox`) it spawns a persisting new process called `intellilaunch.sh firefox`, which only exits after closing firefox. What am I doing wrong? **Edit** : I modified my script according to michas' suggestion:               #!/bin/bash          program=$(basename $1)          if ! wmctrl -a "$program"; then       "$1"&     fi      Not a one-liner anymore but it works perfectly fine now!


When to use BIND vs internal DNS for Samba 4 backend

The docs say, "Bind as DNS backend is recommended, if you plan setup a complexer DNS setup, than the Samba **4** internal DNS currently made possible." What exactly is the threshold for "a complexer DNS setup"? I plan to use this on a small business network's CentOS 6.4 server for Internet access and to allow the main server to be accessed via http by a few different names and IP addresses. (We currently have a Windows server set up to do this task and are migrating.) Does this count as complex enough to require Samba's internal DNS, or would it be better to install BIND? For the record I am using Samba 4 as an AD DC with NetBIOS disabled, as I have it in Windows.


Kernel can't find /dev/sda file during boot

I configured a gentoo kernel (kernel-2.6.36-gentoo-r5), but when I boot it can't mount `/dev/sda1`:               ALERT! /dev/sda1 does not exist . Dropping to a shell .      I use the shell to go to the `/dev` directory, and I find that it have no `sda*` or `hd*` files. However, when I boot into my Debian kernel (vmlinuz-2.6.32-5-686), it can find and mount the `/dev/sda1` partition. What's the problem? How can I fix it? I didn't add any module names to `/etc/modules.autoload.d/kernel-2.6` file to let them auto-load during boot -- is that the cause of the problem?


kernel compilation error

> **Possible Duplicate:**   >  Kernel can't find /dev/sda file during boot I got the following errors after new kernel compilation (linux-2.6.25.tar.bz2) > mount: could not find filesystem '/dev/root'   >  setuproot: moving /dev failed: no such file or directory   >  setuproot: error mounting /proc: No such file or directory   >  setuproot: error mounting /sys: No such file or directory   >  switchroot: mount failed: No such file or directory   >  kernel panic - not syncing: Attempted to kill init! How to troubleshoot?


Make `rm` move to trash

Is there a Linux script / application which, instead of deleting files, moves them to a special “trash” location? I’d like this as a replacement for `rm` (maybe even aliasing the latter; there are pros and cons for that). By “trash” I mean a special folder. A single `mv $* ~/.trash` is a first step, but ideally this should also handle trashing several files of the same name without overwriting older trashed files, and allow to _restore_ files to their original location with a simple command (a kind of “undo”). Furthermore, it’d be nice if the trash was automatically emptied on reboot (or a similar mechanism to prevent endless growth). Partial solutions for this exist, but the “restore” action in particular isn’t trivial. Are there any existing solutions for this which don’t rely on a trash system from a graphical shell? (As an aside, there have been endless discussions whether this approach is justified, rather than using frequent backups and VCS. While those discussions have a point, I believe there’s still a niche for my request.)


how to change `rm` to as a command like `mv ~/ .trash`

I like to use rm but I often made mistakes so that I remove something mistakenly so I want to make somthing like `mv .trash` so that                rm file       is equal to                mv file ~/.trash      besides, I also want to periodically empty the ~/.trash folder then if I have made rm as `mv`, how to empty the ~/.trash folder thanks


Dual Boot Linux and Windows 7 with GRUB

My Vaio already has Windows 7 and I want to dual boot it with Linux. I was advised to use GRUB (non-legacy). I already created an extended partition aimed at Arch Linux. I am going to install Arch there. As I am a newbie, I had this idea to avoid breaking my system.   1. I install Arch on the extended partition from an external USB Hard Drive. Windows partitions and hard disk MBR should not be touched.    2. I install GRUB onto the MBR of a USB flash drive stick, so I can start my notebook from the USB device and run GRUB menu from there (with the possibility of choosing between Windows or Arch).    3. I make a backup of HDD MBR using `dd`.   4. I copy GRUB onto the hard disk MBR. If I break something I will still boot with method sub 2 and I could restore the MBR backup.  For point 2 I need to store all GRUB config files on the USB stick. Possible? For point 3, I could to start a live Arch from an external USB Hard Drive and the command should be (including partition table):               # dd if=/dev/sdb of=/tmp/mbr.bak bs=512 count=1      Before studying GRUB manual I'd like to know if my strategy is correct or if there are better alternatives.


If I `nano` two files, one of which reads 'this' without me entering a newline, and one of which reads 'is' without me entering a newline, I want to be able to then `cat` the two files together into something like 'thisis'. Instead, the newlines are inserted automatically.               alec@ROOROO:~/$ cat test1 test2 > test3     alec@ROOROO:~/$ cat test3     this     is      So, how can I concatenate two files without adding a newline?


Securely allowing users to create accounts

1) I'm struggling to find a secure way to allow new users to create accounts without granting them admin rights to do so. If you already have an account on my system and can work UNIX command line, then you can use programs such as puTTY to access it. I'm currently making a program that lets you visually transfer files back and forth, with a layout similar to dropbox. However, I'd like to add a "Create new user" feature and I'm not sure how to securely do it. Sure, I can have the program execute something like "sudo adduser jim" and supply the sudo password, but this would require me to include an administrative password within the jar file. I know there are obfuscation programs out there, but it doesn't necessarily make it more secure. I'd prefer to create users with ssh, but I'm open to whatever works and is secure. 2) I just thought of something. What if I created an administrative user with a their sudo ability limited to only creating new users? Does this sound like a reasonably secure solution? If so, how should I go about doing this? If not, what are the cons of this method? EDIT: This is my solution so far: assuming I have sanitized inputs I'll make a script that will take the first argument as a username, and the second as the password, then set it's permissions (setuid bit) to be non-writable, and when non-root accounts run it, they are allowed to run this and ONLY this with root privileges. Here is the most basic code so far:               adduser --disabled-password --gecos "" "$1"     echo "$1":"$2" | chpasswd      What do you think? How do you think I can improve it?


eee pc 1025c shows black screen after booting on Ubuntu 10.04 It does work in recovery mode, but not in default mode


Skype - not using GTK+

I am on a x64 Archlinux running openbox DE and have been strugling for some time now to configure Skype to use my GTK+ theme which i set to Oxygen. I have tried following this wiki as well as this thread and none has worked out for me. I have already installed lib32-gtk-engines package from Archlinux AUR packages site. Still Skype wont change its appearance. The GTK+ theme is set as you can see: ![enter image description here](http://i.stack.imgur.com/8GdGo.png)


Why is od calculating decimal values wrong?

This question is related to the answer from enzotib to the question: How could I use Bash to find 2 bytes in a binary file, increase their values, and replace? This converts the two bytes into its hex value:               $ echo -n $'\x1b\x1f' | od -tx2     0000000 1f1b     0000002      But now, this should give me the decimal value:               echo -n $'\x1b\x1f' | od -tu2     0000000  7963     0000002      But if I convert the hex value into decimal it should be               $ printf "%d" 0x1b1f     6943      Why is that? Am I using `od` wrong for decimal output?


How to create an installable liveCD backup of my system (keep all installed packages but not home directories)

What tool should be used to do this? I have taken a look a remastersys but the image it generated wasn't installable. (I could just boot it, and login, although all my packages were installed). If anyone knows a way of getting this image installable please tell me. I also looked at live build which seemed to allow you to customize a liveCD, but not clone an installation. Can anyone reccomend tools to use or guide me through steps to take?


wlan is first brought to life when ethernet is plugged in

Endless timeouts...         Request timed out.         Request timed out.         Request timed out.         Request timed out.         Request timed out.         Reply from 192.168.1.11: bytes=32 time=105ms TTL=64         Reply from 192.168.1.11: bytes=32 time<1ms TTL=64         Reply from 192.168.1.11: bytes=32 time<1ms TTL=64         Reply from 192.168.1.11: bytes=32 time<1ms TTL=64         Reply from 192.168.1.11: bytes=32 time<1ms TTL=64         Reply from 192.168.1.11: bytes=32 time<1ms TTL=64         Reply from 192.168.1.11: bytes=32 time<1ms TTL=64         Request timed out.         Request timed out.         Reply from 192.168.1.11: bytes=32 time=105ms TTL=64         Reply from 192.168.1.11: bytes=32 time=26ms TTL=64         Reply from 192.168.1.11: bytes=32 time=48ms TTL=64         Reply from 192.168.1.11: bytes=32 time=71ms TTL=64         Reply from 192.168.1.11: bytes=32 time=5ms TTL=64         Reply from 192.168.1.11: bytes=32 time=17ms TTL=64         Reply from 192.168.1.11: bytes=32 time=39ms TTL=64         Reply from 192.168.1.11: bytes=32 time=61ms TTL=64         Reply from 192.168.1.11: bytes=32 time=87ms TTL=64      I'm having a small problem with my debian box (not running any gnome/kde...). I can get the wireless to work, but only if I connect the ethernet cable in for a second or two. Above is my ping result from my workmachine. I turned off the debian box, started the ping and turned the debian box on. I got a endlessly Request timed out untill i plugged in the ethernet. I've then removed the the ethernet cable (the two time outs in the middle there). Wireless is still up after ethernet is removed and I can putty my way in. I'm using `auto wlan0` but I've also tried `allow-hotplug` :-( /etc/network/interfaces)


Change server date using PHP

Is this possible to change Linux server date using php code? Is there any way to give necessary permissions to Apache to do this? What is the procedure to give root permissions to Apache?


Creating a new TLD for private network

I want to setup a new TLD (`foo.`) for my the private network so that I can host some child domains which will be accessible from within the network. For this purpose I have setup a DNS server (172.16.100.1) for `foo.`. For this I created a zone file `foo-zonedb.rr` with the following records:               $ORIGIN foo.     $TTL  100     @       IN  SOA ns1.tld.foo. hostmaster.tld.foo (                     2012030701                     900                     300                     300                     600             )     @    300 IN NS ns1.tld.foo.     @    300 IN  A 172.16.143.197     ns1.tld.foo.    300 IN A 172.16.143.197      And also I have added the following entries in `/etc/named.conf`               zone "foo." {                  type master;                  file "foo-zonedb.rr";                  notify explicit;         };      Now suppose every machine on the network uses `172.16.1.1` as their DNS server. What configuration should I have to do on `172.16.1.1` so that it won't redirect DNS request for `foo.` domain to root DNS servers?


Rename files by incrementing a number within the filename

I have a directory which contains numbered image files, something like this:               01.png     02.png     03.png     03.svg     04.png     05.png     06.jpg     07.png     08.png     09.png     09.svg     10.png      Sometimes there may be multiple versions of a file in different formats (eg. a `png` and `svg` version of the `03` and `09` files above) but the numbers are otherwise consecutive. Typically there are 40-80 such files in each directory. The numbers correspond to the order these images appear in a manuscript (a Word document, but that's not important). There is no other way to determine the order of the images. If I add a new image to the manuscript I need to place a copy of the image in this directory with the correct numbering. So if the new image is the fifth in the manuscript I need to rename the files in the directory to this in order to make room for it:               01.png     02.png     03.png     03.svg     04.png     06.png     07.jpg     08.png     09.png     10.png     10.svg     11.png      What is the most straightforward way from the command line, or from a script or macro to renumber all the files starting at a certain number? I have a standard Fedora Linux install using bash.


Making a progressbar with "dialog" from rsync output

I'm looking for a way to filter/redirect rsync output in a manner where it can be fed to the "dialog --gauge" command, so I can get a nice looking progressbar during file sync. Currently I have only tested it directly at the prompt, but I'm planning to do this in a (bash) shell script. I have looked around the internet and found bits and pieces, but I'm still missing something to make it work (Disclaimer: This might be a totally wrong approach, and is a redirect/piping monstrosity) What I have currently put together:               rsync -avz --progress -e "ssh" user@server:/home/user/data/ /home/user/data | awk -f /home/user/rsync.awk | sed 's/\([0-9]*\).*/\1/' | dialog --title "My Gauge" --gauge "Hi, this is a gauge widget" 20 70      First I have the actual rsync command with the --progress option Output from rsync is piped into awk and uses the followng awk filter:               {        if (index($0, "to-check=") > 0)        {             split($0, pieces, "to-check=")             split(pieces[2], term, ")");             split(term[1], division, "/");             print (1-(division[1]/division[2]))*100     }     #   else     #   {     #       print "#"$0;     #   }        fflush();     }      This filters out rsync output and provides the percentage in the following format:               53.7037     55.5556     57.4074     59.2593     61.1111     62.963      So to get rid of the decimal numbers, I feed the output to sed:               sed 's/\([0-9]*\).*/\1/'      Which gives the following output:               64     66     68     70     72     74     75     77      Those numbers are piped into dialog like this:               dialog --title "My Gauge" --gauge "Hi, this is a gauge widget" 20 70       As far as I know, "dialog --gauge" etc. should accept this, but it just displays progress to be 0% until it suddenly reaches 100% Can someone point me in the right direction here? Am I far away from a working progressbar? Is there a better way to achieve this? Regards, Christer **EDIT** : After taking @lynxlynxlynx' answer into account, the correct command line is:               rsync -avz --progress -e "ssh" user@server:/home/user/data/ /home/user/data \       | awk -f /home/user/rsync.awk \       | sed --unbuffered 's/([0-9]*).*/\1/' \       | dialog --title "My Gauge" --gauge "Hi, this is a gauge widget" 20 70


Installing Linux/NetBSD on an old Sky digibox?

I've just been updgraded to Sky+ and I've got an old Sky box (Thomson `286_544` aka Thomson `DSI4212C`). How would I go about installing NetBSD (compatible with nearly everything) on it? Has anyone ever done this?


Seperate messages of multiple sshds in syslog-ng

Is there a common way of distinguishing between the messages of multiple processes in syslog-ng beside setting different facilities? +1 if filtering and therefore logging in different files would be possible. I have a system setup with two running sshd instances. One is running in a chrooted environment. Since syslog is used, all messages end up in the same logfile. One possibility would be to change the facility of the jailed sshd to something like local0, but I wonder if there is some 'cleaner' way to do this. Installing other syslog daemon, for example rsyslog is not an option here. This question is somehow related to: http://stackoverflow.com/questions/20010873/syslog-process-specific-priority and syslog: process specific priority


Passing multiple directories to the -prune option in find

I am using `find` to locate and delete backup files but wish to exclude certain directories from the search. The backup filenames could terminate in `.bck`, `bak`, `~`, or `backup`. The Minimal Working Example (MWE) code with only three directories to exclude is:               #! /bin/bash     find . -type d \( -path "./.*" -o -path "./Music" -o -path "./Documents" \) -prune -o -type f \( -name "*.bck" -o -name "*.bak" -o -name "*~" -o -name "*.backup" \) -print0 | xargs -0 --no-run-if-empty trash-put      The syntax `\\( -path "dir1" -o -path "dir2" ... -o -path "dirN" \\) -prune` seems a little clunky, especially if there are around ten directories to exclude, although I have shown only three in the MWE. Is there a more elegant way using either an input file, with the list of excluded directories, or an array- or list-like construct, that could be pressed into service? I am sorry for not being more explicit when I wrote my original question. NB: `trash-put` is a utility that moves the files to the `Trashcan` instead of deleting them [1]. [1]. https://github.com/andreafrancia/trash-cli