Unable to receive data from /dev/ttyACM0 device

Using USB based CAN device connected on AR9350 mips processor based Atheros reference board with linux kernel 2.6.32.61. Which is coming up as `/dev/ttyACM0` device. In which Able to transmit data from application to the H/W device, but not able to receive data from the CAN device to the board. Tested this on Fedora12 with linux 2.6.31 kernel where every thing is working fine. Also tested on AR71xx mips based Atheros reference board with linux kernel 2.6.32.61, here also every thing is working fine. # Device entry output: `cat /proc/bus/usb/devices`               T:  Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#=  5 Spd=12   MxCh= 0     D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS= 8 #Cfgs=  1     P:  Vendor=04d8 ProdID=00df Rev= 1.01     S:  Manufacturer=Microchip Technology Inc.     S:  Product=MCP2200 USB Serial Port Emulator     S:  SerialNumber=0000472727     C:* #Ifs= 3 Cfg#= 1 Atr=80 MxPwr=100mA     A:  FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=02 Prot=01     I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=02 Prot=01 Driver=cdc_acm     E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=2ms     I:* If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_acm     E:  Ad=03(O) Atr=02(Bulk) MxPS=  32 Ivl=0ms     E:  Ad=83(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms     I:* If#= 2 Alt= 0 #EPs= 2 Cls=03(HID  ) Sub=00 Prot=00 Driver=(none)     E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=1ms     E:  Ad=01(O) Atr=03(Int.) MxPS=  16 Ivl=1ms      ### Device terminal settings: Below are the terminal settings used for `/dev/ttyACM0` device on both AR9350 and AR71xx boards,               [root@localhost /root]# stty -a < /dev/ttyACM0     speed 460800 baud; rows 24; columns 80; intr = ^C; quit = ^\; erase =     ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch =     <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;     lnext = ^V; flush = ^O; min = 1; time = 0;     -parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts     -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel     -opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0     -isig -icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke      ### Main Problem: When we open the device, `acm_rx_tasklet` is getting invoked but the list in acm `filled_read_bufs` is empty. And also `acm_read_bulk` function is not getting called for adding receive buffer into `filled_read_bufs` list. ### Note: Have observed the same problem as mentioned above in AR71xx board and Fedora12 system when baud-rate is other than 460800. ### Debug Log: Below is the debug log with enabling CONFIG_USB_DEBUG option in kernel and DEBUG option in `cdc-acm.c` file. Here `acm_read_bulk` function is not getting called which is needed.               drivers/usb/class/cdc-acm.c: Entering acm_tty_open.     ehci_urb_enqueue:910: LOCAL DEBUG: within PIPE_INTERRUPT     usb 1-1.1: link qh2-0601/83ae1b40 start 1 [1/2 us]     ehci_urb_enqueue:893: LOCAL DEBUG: PIPE_CONTROL     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0: submit_async 1.1 urb 82cd8200 ep0out len 0, qtd     a38d8ae0  [qh 83ae17c0]     submit_async:1125:MANOJ calling qh_link_async      ath-ehci ath-ehci.0: irq status cc089 Async Periodic FLR INT     ath-ehci ath-ehci.0: ehci_urb_done 1.1 urb 82cd8200 ep0out status 0     len 0/0     drivers/usb/class/cdc-acm.c: acm_control_msg: rq: 0x22 val: 0x3 len:     0x0 result: 0     drivers/usb/class/cdc-acm.c: Entering acm_rx_tasklet     acm_rx_tasklet:418:  calling filled read buf list empty. goto urbs     label.     LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0: submit_async 1.1 urb 82e1c300 ep3in len 128, qtd     a38d8b40 [qh (null)]     submit_async:1125:MANOJ calling qh_link_async      drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x82e1c300,     rcv 0x83a43b18, buf 0x83a43c58     LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0: submit_async 1.1 urb 82e1c280 ep3in len 128, qtd     a38d8ba0 [qh 83ae1bc0]     drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x82e1c280,     rcv 0x83a43b04, buf 0x83a43c44     LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0: submit_async 1.1 urb 82e1c200 ep3in len 128, qtd     a38d8c00 [qh 83ae1bc0]     drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x82e1c200,     rcv 0x83a43af0, buf 0x83a43c30     LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0: submit_async 1.1 urb 82e1c180 ep3in len 128, qtd     a38d8c60 [qh 83ae1bc0]     drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x82e1c180,     rcv 0x83a43adc, buf 0x83a43c1c     LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0: submit_async 1.1 urb 82e1c100 ep3in len 128, qtd     a38d8cc0 [qh 83ae1bc0]     drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x82e1c100,     rcv 0x83a43ac8, buf 0x83a43c08     LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0: submit_async 1.1 urb 82e1c080 ep3in len 128, qtd     a38d8d20 [qh 83ae1bc0]     drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x82e1c080,     rcv 0x83a43ab4, buf 0x83a43bf4     LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0: submit_async 1.1 urb 82e1c000 ep3in len 128, qtd     a38d8d80 [qh 83ae1bc0]     drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x82e1c000,     rcv 0x83a43aa0, buf 0x83a43be0     LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0: submit_async 1.1 urb 82c60700 ep3in len 128, qtd     a38d8de0 [qh 83ae1bc0]     drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x82c60700,     rcv 0x83a43a8c, buf 0x83a43bcc     LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0:submit_async 1.1 urb 82c60200 ep3in len 128, qtd     a38d8e40  [qh83ae1bc0]     drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x82c60200,     rcv 0x83a43a78, buf 0x83a43bb8     LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0: submit_async 1.1 urb 8390dd80 ep3in len 128, qtd     a38d8ea0 [qh 83ae1bc0]     drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x8390dd80,     rcv 0x83a43a64, buf 0x83a43ba4     LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0: submit_async 1.1 urb 8390d800 ep3in len 128, qtd     a38d8f00 [qh 83ae1bc0]     drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x8390d800,     rcv 0x83a43a50, buf 0x83a43b90     LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0: submit_async 1.1 urb 8390da00 ep3in len 128, qtd     a38d8f60 [qh 83ae1bc0]     drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x8390da00,     rcv 0x83a43a3c, buf 0x83a43b7c     LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0: submit_async 1.1 urb 83a77e80 ep3in len 128, qtd     a2e21000 [qh 83ae1bc0]     drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x83a77e80,     rcv 0x83a43a28, buf 0x83a43b68     LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0: submit_async 1.1 urb 839a2f80 ep3in len 128, qtd     a2e21060 [qh 83ae1bc0]     drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x839a2f80,     rcv 0x83a43a14, buf 0x83a43b54     LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0: submit_async 1.1 urb 839a2080 ep3in len 128, qtd     a2e210c0 [qh 83ae1bc0]     drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x839a2080,     rcv 0x83a43a00, buf 0x83a43b40     LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0: submit_async 1.1 urb 839a2c00 ep3in len 128, qtd     a2e21120 [qh 83ae1bc0]     drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x839a2c00,     rcv 0x83a439ec, buf 0x83a43b2c      ### Help needed: Please suggest some tips to debug this issue. May be some more terminal settings needed to make this working. Not able to understand why only RX is not happening but able to do TX from board to Device.


How to let networkmanager repeat trying to connect DSL until succeeded?

I'm using nm-applet to dial up DSL pppoe connections. As there are a great number of users in my local network, I sometimes have to try many times to establish a successful connection. I wonder is there some way to set nm-applet or network-manager repeat trying automatically until connecting successfully. My system is Gentoo and desktop environment is Gnome.


How do I enforce system-wide custom keyboard shortcuts / macros?

I would like to be able to apply the same custom key bindings and shortcuts I use on my text editors to my entire desktop environment. I want to basically remap my keyboard system-wide, not just in a specific application window. That is, when I remap `alt + j = Down`, I want pressing `alt + j` to be the same as pressing the "down" key, as far as my desktop environment is concerned. The shortcuts I use are optimised for keeping hands in a natural position close to the home row at all times:               # Note how     # system-wide remapping of *single* keys is possible with xmodmap.     Caps Lock           --> Escape     Escape              --> Caps Lock    # Switch caps lock with                                          # the more useful escape key.                                          # As far as *all* applications                                           # are concerned, pressing caps lock                                           # is actually pressing Escape.           # However, I've not found a good way do the same for multiple keys:     alt + space         --> Right Arrow     alt + Escape        --> Enter     shift + alt + h     --> Backspace     alt + x             --> Delete     shift + alt + l     --> Delete          ctrl + alt          --> Alt           # Default alt functionalities                                            # remapped to ctrl + alt      In my text editor, this has done wonders for my accuracy, speed, and has helped me tremendously with tendon pains I was having, since my hands now barely need to leave their natural resting position. ## First almost-successful attempt at a solution: Using xbindkeys to call up xvkbd (x virtual keyboard). This is a sample from my `.xbindkeysrc`:               # h-j-k-l Movement     ###################         "xvkbd -xsendevent -text "\[Down]""             alt + j              "xvkbd -xsendevent -text "\[Up]""             alt + k              "xvkbd -xsendevent -text "\[Left]""             alt + h              "xvkbd -xsendevent -text "\[Right]""             alt + l      ### Problems: The `alt` key is usually the default key for calling the menu of an application (for example, `alt + F` brings up the *F*ile dropdown menu in most applications). Also, this seems to work with some applications, while others seem to ignore it. xbindkeys isn't really remapping the keyboard, it's just telling xvkbd to send a signal, which can sometimes create conflicts with the active application (unlike xmodmap, which truly remaps the keyboard). ## Goal A system-wide remapping of my keyboard, implemented in a way that is easily portable (an rc file or something similar). `alt` is the optimal key of choice, since `ctrl` is heavily used across applications, and the mod key is taken up by my windows manager (Xmonad). ## My setup I'm running Ubuntu 12.10, with the Xmonad desktop environment. * * * Is this doable? I don't yet know much about OS-level stuff and how it processes input.


Gmake macro expansion: macro calls macro with variable in arguments

In the following makeffile one macro process it's arguments to call another macro. I expect that makefile below will generate two targets and correct list of the targets in $TARGETS. But in fact it only generates one target with correct list. How to do such macro call in correct way?               all: $TARGETS     define f2     .PHONY: target$(1)     target$(1):         echo "We are in $(1)"     TARGETS+=target$(1)     endef          define f1     VAR$(1)=ValueWith$(1)     $(eval $(call f2,$$(VAR$(1))))     endef          $(eval $(call f1,CallOne))     $(eval $(call f1,CallTwo))          $(warning Warning: $(TARGETS))      output of make:               test.mk:16: warning: overriding recipe for target `target'     test.mk:15: warning: ignoring old recipe for target `target'     test.mk:18: Warning: targetValueWithCallOne targetValueWithCallTwo     gmake: Nothing to be done for `all'.


Enable second monitor from shell

So... I have two monitors on my Ubuntu machine. And every time I launch some Windows OpenGL application under Wine it turns off the second monitor. And leaves it turned off when the application exits. I wonder, is there a shell command which will instantly turn the second monitor on?


tcpdump and nc with udp

I don't understand the behaviour of netcat. Let's say that I have one host acting as server:               [root@localhost tmp]# nc -u -l -p 670      Then I try to connect from a client:               root@debian:/tmp#  nc   -u   192.168.0.109 670      Meanwhile I try to capture those packages:               [root@localhost sergio]# tcpdump -nn -i wlp7s0 port 670      I see no packets at all, only when I issue something like:               root@debian:/tmp#  echo "Hola Mundo" | nc   -u   192.168.0.109 670          [root@localhost sergio]# tcpdump -nn -i wlp7s0 port 670     tcpdump: verbose output suppressed, use -v or -vv for full protocol decode     listening on wlp7s0, link-type EN10MB (Ethernet), capture size 65535 bytes     01:37:39.425276 IP 192.168.0.114.44287 > 192.168.0.109.670: UDP, length 12      I wonder if is it the proper behaviour of netcat. Why is the reason why it's not seen any packets except when I send something from stdin?


How to configure Exim to forward all incoming mail to new server?

I am moving servers, both of them running Debian (oldstable and stable). Both are running Exim4. When I switch the DNS entries over to the new server, I'd like the old server to still forward incoming mail to my new server for processing, so that users do not see any outage. How can I do this?


Cut a string- Catch: There is file with same name as string in the same path

Input               /in/archive/ABC/20140111_ABC_018_PART_001.dat      Desired Output:               20140111_ABC_018_PART_001.dat      Command used:               cut -d/ -f4 "/1a/ftproot/archive/ABC/20140111_PR1_018_SALESDOC_ITEM_001.dat"      Problem: Its actually opening the file `20140111_ABC_018_SALESDOC_ITEM_018.dat` in the path `/1a/ftproot/archive/ABC/` and displaying the result from file.


VIM: show all lines edited in session

Is there a command or plugin that I can use to show all the lines I have edited in a Vim session? I would like to be able to have all the changes I have made highlighted when working in co-workers projects and lost in lines of code.


tc don't see marked with -j MARK packets

Server has 2 network interfaces:   * eth1 with address 13.0.0.254/24   * eth0 with address 172.20.203.4/24. It's routing traffic between this two networks. Task is to limit bandwidth between this two networks to 1Vbit/sec, but not to limit bandwidth between server and network hosts(i. e. limit all packets going though FORWARD)               iptables -t mangle -A POSTROUTING -s 13.0.0.0/24 -d 172.20.203.0/24 -j MARK --set-mark 0x0001     iptables -t mangle -A POSTROUTING -s 172.20.203.0/24 -d 13.0.0.0/24 -j MARK --set-mark 0x0002          # eth1     tc qdisc add dev eth1 root handle 1:0 htb default 2          tc class add dev eth1 parent 1:0 classid 1:1 htb rate 1000mbps ceil 1000mbps     tc class add dev eth1 parent 1:1 classid 1:2 htb rate 999mbps ceil 1000mbps     tc class add dev eth1 parent 1:1 classid 1:3 htb rate 1mbps          tc qdisc add dev eth1 parent 1:2 handle 2:0 sfq perturb 10     tc qdisc add dev eth1 parent 1:3 handle 3:0 sfq perturb 10          tc filter add dev eth1 parent 1:0 handle 1 fw flowid 1:3     tc filter add dev eth1 parent 1:0 handle 2 fw flowid 1:3          # eth0     tc qdisc add dev eth0 root handle 1:0 htb default 2          tc class add dev eth0 parent 1:0 classid 1:1 htb rate 1000mbps ceil 1000mbps     tc class add dev eth0 parent 1:1 classid 1:2 htb rate 999mbps ceil 1000mbps     tc class add dev eth0 parent 1:1 classid 1:3 htb rate 1mbps          tc qdisc add dev eth0 parent 1:2 handle 2:0 sfq perturb 10     tc qdisc add dev eth0 parent 1:3 handle 3:0 sfq perturb 10          tc filter add dev eth0 parent 1:0 handle 2 fw flowid 1:3     tc filter add dev eth0 parent 1:0 handle 1 fw flowid 1:3      This doesn't work. If I use this at the beginning:               tc qdisc add dev eth1 root handle 1:0 htb default 3     tc qdisc add dev eth0 root handle 1:0 htb default 3      it works. So problem is in filter settings.               iptables -L -v -n -t mangle      shows, that packets are going though MARK rules. I tried to mark packets not in POSTROUTING, but in FORWARD or PREROUTING - this does not work too. What am I doing wrong? Here is some diagnostics:               # tc -s -d -r filter show dev eth0     filter parent 1: protocol [768] pref 49151 fw     filter parent 1: protocol [768] pref 49151 fw handle 0x1 classid 1:3     filter parent 1: protocol [768] pref 49152 fw     filter parent 1: protocol [768] pref 49152 fw handle 0x2 classid 1:3     # tc -s -d -r filter show dev eth1     filter parent 1: protocol [768] pref 49151 fw     filter parent 1: protocol [768] pref 49151 fw handle 0x2 classid 1:3     filter parent 1: protocol [768] pref 49152 fw     filter parent 1: protocol [768] pref 49152 fw handle 0x1 classid 1:3      Kernel config:               /boot # uname -a     Linux armada-sc-02 2.6.32-5-amd64 #1 SMP Sun May 6 04:00:17 UTC 2012 x86_64 GNU/Linux     /boot # grep CONFIG_IP_MULTIPLE_TABLES config-2.6.32-5-amd64     CONFIG_IP_MULTIPLE_TABLES=y     /boot # grep CONFIG_IP_ADVANCED_ROUTER config-2.6.32-5-amd64     CONFIG_IP_ADVANCED_ROUTER=y     /boot # grep CONFIG_IP_ROUTE_FWMARK config-2.6.32-5-amd64


less is always case-insensitive

Trying to find out how to use case-insensitive searches in `less` I found this on serverfault. That seems to perfectly answer my question. The problem is: It doesn't work like that here (openSUSE 13.1; less 458). I had aliased `less` to `less -WiNS` but I changed that. But even calling it as `command less file` does not change anything. I have checked with `ps` that there is no `-i` option in the command line any more. As the answer says the `less` help (pressing `h`) states that I can use `-i` within `less`, too. If I use that once then `less` tells me it had changed to case-insensitive search (that is kind of correct: nothing changes). If I use it twice then `less` tells me it had turned to case-sensitive search. And right, then it works as it should from the start. Giving `-i` twice on the command line does not work, though. What's up here?


MP3 tags Cyrillic chars

I have some `mp3` files with Cyrillic chars on file names and also on their tags. I'm using `audacious` to play them. See the file info below: ![enter image description here](http://i.stack.imgur.com/thlJo.png) Is it possible to change some encoding to show the contents correctly? **Âûñîêî** should be **Высоко** , I guess.


Why's my Evolution setup screen blank?

Trying to run Evolution on openSuSE 12.1 without success. It starts up (eventually, super slow even on this pretty beefy box) and gives me a window with "Evolution Setup Assistant" on the title bar and 2 buttons at the bottom right (one has a stop sign and the other a couple dots and an arrow). No text anywhere else on the window. Clicking the forward button just gives me another broken window with 3 buttons a check box and no text describing anything. Is there some component I'm missing that enable Evolution to display text so I can set it up?


Store all dates in a given date range into a variable

I want to store all possible dates between two user input dates. The input will be as like **20140605** and **20140830**. I want to store every date between the given dates into a variable using a loop so that I can use it. The date generated or calculated must be in the same format as the input.               startdate=20141030     starttime=165800          enddate=20141120     endtime=175050          day=`expr $startdate % 100`     month=`expr $startdate % 10000`     year=`expr $startdate % 100000000`     month=`expr $month / 100`     year=`expr $year / 10000`     echo "$year  $month  $day"          while [ $enddate -ge $cdate ]     do     var=$cdate          #using variable var          if  [ $day -eq 31 ]; then     cdate=`expr $cdate - $day`     day=1     ((month++))     cdate=`expr $cdate + 100 + $day`     #cdate=`expr $cdate + $day`         if  [ $month -eq 13 ]; then             #tmp=`expr $month \* 100`             cdate=`expr $cdate - $month \* 100`             month=1             ((year++))             cdate=`expr $cdate + 10100`             if [ $year -eq 2999 ]; then                 ((year++))                 echo $cdate                 cdate=30010100             fi         fi     else         ((day++))         ((cdate++))      fi          if [ $enddate == $cdate ]; then     check=1     fi     done      I have tried to implement my requirement this way. But on compilation it says: > unary operator expected What is the cause of this error, and how can I do this in a better way using a shell script?


How to make /etc/init.d script act like it's launched under X?

I'm trying to track down some quirkiness with a Java application that misbehaves when launched via a startup script in /etc/init.d , but runs fine when you open a GUI terminal window and run it through /etc/init.d/myapp start. (The quirkiness involves a portion of the app that does some hacky handwaving with X.) Since the app runs fine when launched via a terminal window, I'm looking at how it's launched before I dive into (admittedly delicate and not my) source code. The answer at this post gave me a clue that the Gnome terminal is running inside a window manager, which is somehow affecting (in a good way) the environment of the application I launch through a bash script. I was able to verify that launching the script through a tty terminal (ctrl-alt-f1 or via ssh) gives the same behavior as launching on startup. **My main question:** What can I do to start this application when the computer starts, but have it act like it's been started under X? We've gone the script route up 'til now because it also needs to start a Java VM with certain parameters. **The follow up question** (strictly to enhance my understanding): What is going on under the hood to make a script act differently when it's launched via something running in a window manager? Google has not enlightened me on this.


Error when running ntpd on openVZ host: cap_set_proc() failed to drop root privileges:

CentOS 6.x | OpenVZ I want to run a NTP server on a vps host of mine. Is this possible? When I try to start ntpd, it fails immediately and gives the following error:               Mar 14 22:47:44 ev1 ntpd[3456]: cap_set_proc() failed to drop root privileges: Operation not permitted      I've localized it to a setting in /etc/sysconfig/ntpd               # Drop root to id 'ntp:ntp' by default.     OPTIONS="-u ntp:ntp -p /var/run/ntpd.pid -g"      When this line is enabled, it fails (presumably because the shared kernel refuses to allow the privileges change). If I comment it out, ntpd runs fine but runs as root which is A Bad Thing. Is there anyway to get ntpd to run as the ntp user on openVZ? Admittedly I know it's a great idea to have this running on a OpenVZ server but I'd still like to try.


Move command lost file

Did this once before but managed to find the file, however this time it seems to be gone or perhaps invisible? `mv foo.mpg /foo`


Why does copying from a script screw with my files?

I am at a loss here, trying to find out the reason why a shell script that is basically copying a couple of files and directories from one place to another will result in the content of two of the files (and only those two) being purged and replaced by `link ../../modules/[name_of_file]`.               APPFOLDER="/home/opt/ke"     CMD_APPCOPY="cp -fr _opt/ke/* $APPFOLDER"     [...]          echo "copying app-files to app-folder $APPFOLDER ..."     eval $CMD_APPCOPY     if [ $? -ne 0 ] ; then        echo "could not copy app-files to app-folder $APPFOLDER"        exit     fi      If I start the file copy by hand everything is fine.               cp -fr _opt/ke/* /home/opt/ke      But if I run the script the two files will be empty except for the `link ../../modules/[name_of_file]` part added on top of the empty file. The two files in question are neither very huge or very small in size, the only thing that differentiate them from the other files in that directory is that they are of the Perl-Module .pm type. Their actual source destination is `/home/xxx/xxx/deploy/KEB/_opt/ke/modules/` while the full target destination is `/home/opt/ke/modules/`. The script and the manual copy are run from `/home/xxx/xxx/deploy/KEB/` of course. Any idea/advice how this behaviour could be explained or what I should be looking for in order to fix the script is very much appreciated.


WebGL in Firefox - Debian Squeeze

I'm trying to get working WebGL on Firefox without success, I tried forcing WebGL in the Firefox configuration and updating the Mesa drivers, but it's still not working. It's working on Opera, so the problem isn't the driver... I have an integrated Intel HD Graphics... about:support:               Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Firefox/24.0     Adapter Description Tungsten Graphics, Inc -- Mesa DRI Intel(R) Ironlake Mobile x86/MMX/SSE2     Device ID   Mesa DRI Intel(R) Ironlake Mobile x86/MMX/SSE2     Driver Version  2.1 Mesa 7.10.3     GPU Accelerated Windows 0/1 Basic     Vendor ID   Tungsten Graphics, Inc     windowLayerManagerRemote    false     AzureCanvasBackend  cairo     AzureContentBackend none     AzureFallbackCanvasBackend  none      Graphic card info:               # lspci -v | grep VGA     00:02.0 VGA compatible controller: Intel Corporation Core Processor Integrated Graphics Controller (rev 02) (prog-if 00 [VGA controller])      OpenGL version               # glxinfo | grep OpenGL     OpenGL vendor string: Tungsten Graphics, Inc     OpenGL renderer string: Mesa DRI Intel(R) Ironlake Mobile  x86/MMX/SSE2     OpenGL version string: 2.1 Mesa 7.10.3     OpenGL shading language version string: 1.20     OpenGL extensions:      about:config (webgl properties):               webgl.can-lose-context-in-foreground;true     webgl.default-no-alpha;false     webgl.disable-extensions;false     webgl.disabled;false     webgl.enable-draft-extensions;false     webgl.force-enabled;true     webgl.force-layers-readback;false     webgl.lose-context-on-heap-minimize;false     webgl.max-warnings-per-context;32     webgl.min_capability_mode;false     webgl.msaa-force;false     webgl.prefer-16bpp;false     webgl.prefer-native-gl;false     webgl.shader_validator;true      I tried the WebGL test get.webgl.com, but it says that the browser support it but is not activated... Any suggestion??


bash readline: Key binding that executes an external command

(Background: I'm a long-time tcsh user, gradually transitioning to bash, and trying to find equivalents for some useful tcsh-specific features.) In tcsh, I can define a key binding that executes an external command. For example, given:               bindkey -c ^Gu uptime      I can type "Control-G u" in tcsh, and it will execute the `uptime` command. I don't have to type Enter, the command doesn't appear in my history, and I can do it in the middle of an input line (I find the latter particularly useful for certain commands). bash has a similar key binding mechanism via the GNU readline library, with bindings specified in `$HOME/.inputrc` (or elsewhere). But after reading the `info readline` documentation, I don't see a way for a key binding to execute an external command. The closest thing I've figured out is to add something like this to my `.inputrc` file:               "\C-gu": "uptime\n"      but that doesn't execute the command; rather, it acts as if I had typed `uptime` followed by the Enter key. The command appears in my history (that's ok), and it works only on an empty line; if I type `"echo control-Gu"`, then it prints `uptime` rather than executing the command. Another minor drawback is that the binding affects other commands that use GNU readline, such as the Perl debugger. Is there a way to simulate the effect of tcsh's `bindkey -c` in bash, by mapping a key sequence to the execution of a specified external command? If it matters, I'm using bash 4.2.24 on Ubuntu 12.04 beta 2.


How could all the GNOME keyboard shortcuts be removed in a script, in other words, NOT using gconf-editor?

I am developing custom software on a RHEL system, which tightly locks down every user on the system. I have implemented my own lock screen through `dbus`, user screen lock (`Alt`+`L`) through `xbindkeys`, and that's pretty much all I want them to be able to do. I have an installation script for root to perform but for now, unfortunately, for every user root creates he has to go to `gconf-editor` or through the `System->Keyboard Shortcuts->Disable, Disable, Disable,...` sequence. Is there a way to run a command to remove all keyboard mappings for a user? Maybe through `gconftool-2`?


mirror a site with wget that only response with gzip

I'm trying to mirror a site but the server only responses with gzip pages so wget won't recurse. I've searched around and there are some references to a patch to add gzip support to wget however they seem to be out of date. Is there anyway to do this? If not I was considering reverse proxying it through nginx.


Sunrise and other astronomical data from the command line

Is there a simple open-source, command-line program that can show the sunrise and sunset times at a given date and location, and perhaps moon and planet data as well? Browsing the Debian package database and Google searches, I can't find anything relevant. This surprises me — considering the number of people who are both astronomy geeks and unix geeks, I'd have expected a de-facto-standard `sunrise(1)` (or perhaps `sunrise(6)`). I am not interested in more complex programs that incidentally perform the calculations, such as sky maps (celestia, kstars, starplot, stellarium), earth maps (sunclock, xplanet), calendars/agendas (emacs, remind), clocks (glunarclock, wmsun), tide almanachs (xtide). There is perhaps `aa` (astronomical-almanac), but I don't see a simple way of asking it what time the sun will rise on this date at these longitude and latitude. What did I miss?


Which Bootloader is Used on a Chromebook?

I installed ChrUbuntu on an Acer C7 Chromebook, and I am able to dual boot Ubuntu 12.04 and ChromeOS and to control which OS loads by default. I tried to edit the `/etc/default/grub` file and did run `update-grub` successfully but saw no effects. I was trying to enable a "dmesg" style verbose system loading screen instead of the quiet splash screen (during the Ubuntu boot). I suspect that GRUB is not the bootloader on the machine or is functioning as a fairly late secondary bootloader only on the Linux partition. I realize that the Chromebook is a fairly closed system tightly controlled by Google, but since it is Linux at heart people may know the answer. I don't need the "dmesg" style verbose boot badly enough; but did became curious about the bootloading on this system. P.S. Just to clarify, I was trying to enable the verbose loading screen on the Ubuntu boot on the machine.


Understanding two flags and a dollar sign in a CURL command

I right clicked a post request in Chrome and selected Copy as cURL I got a cURL command that includes the following                --data-binary $'------WebKitFormBound      I am used to seeing cURL requests that have a single flag and string. Like this               $curl -0 "output.txt"      I understand that the `\--data-binary` command will post binary data (presumably after converting the string after the --databinary switch into binary). But what does the dollar sign mean? What does the curl request mean if it has two dashes and a dollar sign?


mount luks volume through pam with gdm

I'm on debian testing. I encrypted my /home with dm-crypt (luks). Following various tutorials I setup pam_mount to open it at login time. However when I try to login using gdm, it fails. The login screen disappears and reappears shortly after. In /var/log/auth.log I have:               Jul 11 00:18:20 yojik gdm-launch-environment]: pam_unix(gdm-launch-environment:session): session opened for user Debian-gdm by vic(uid=0)     Jul 11 00:18:20 yojik gdm-launch-environment]: (pam_mount.c:173): conv->conv(...): Conversation error     Jul 11 00:18:20 yojik gdm-launch-environment]: (pam_mount.c:477): warning: could not obtain password interactively either     Jul 11 00:18:20 yojik gdm-launch-environment]: (mount.c:72): Messages from underlying mount program:     Jul 11 00:18:20 yojik gdm-launch-environment]: (mount.c:76): NOTE: mount.crypt does not support utab (systems with no mtab or read-only mtab) yet. This means that you will temporarily need to call umount.crypt(8) rather than umount(8) to get crypto volumes unmounted.     Jul 11 00:18:21 yojik gdm-launch-environment]: (mount.c:76): crypt_activate_by_passphrase: Operation not permitted     Jul 11 00:18:21 yojik gdm-launch-environment]: (pam_mount.c:522): mount of /dev/disk/by-uuid/d79121a7-5fbd-4484-81d2-6cbdf1b95b5e failed      If I switch to a virtual terminal (ctrl-alt-f1) and login there, the /home volume is mounted as expected. I can then go back to gdm and login normally. So the problem is really in the interaction of gdm and pam_mount. I tried to tweak /etc/pam.d/gdm3 following various tutorials and threads... But no success. Most info is pretty old and the only one really updated (Arch linux wiki) seems to have a different implementation of gdm as the files and options have quite different names. Currently my file looks like this:               vic@yojik:~$ cat /etc/pam.d/gdm3     #%PAM-1.0     auth    requisite       pam_nologin.so     auth    required    pam_succeed_if.so user != root quiet_success     @include common-auth     auth    optional        pam_gnome_keyring.so     auth    optional        pam_mount.so          @include common-account          # SELinux needs to be the first session rule. This ensures that any      # lingering context has been cleared. Without this it is possible      # that a module could execute code in the wrong domain.     session [success=ok ignore=ignore module_unknown=ignore default=bad]       pam_selinux.so close     session optional    pam_mount.so     session required        pam_loginuid.so     # SELinux needs to intervene at login time to ensure that the process     # starts in the proper default security context. Only sessions which are     # intended to run in the user's context should be run after this.     session [success=ok ignore=ignore module_unknown=ignore default=bad]       pam_selinux.so open     session required        pam_limits.so     session required        pam_env.so readenv=1     session required        pam_env.so readenv=1 envfile=/etc/default/locale     @include common-session     session optional        pam_gnome_keyring.so auto_start          @include common-password      Question is: how should I modify the file to get the volume mounted with gdm? EDIT: Here is also `/etc/pam.d/common-auth` (minus the info at the top saying to run `pam-auth-update` to manage the file, which I also did)               # here are the per-package modules (the "Primary" block)     auth    [success=1 default=ignore]  pam_unix.so nullok_secure     # here's the fallback if no module succeeds     auth    requisite           pam_deny.so     # prime the stack with a positive return value if there isn't one already;     # this avoids us returning an error just because nothing sets a success code     # since the modules above will each just jump around     auth    required            pam_permit.so     # and here are more per-package modules (the "Additional" block)     auth    optional    pam_mount.so      auth    optional            pam_cap.so      # end of pam-auth-update config


understanding od -a option

In Linux, the `\--type a` option in `od` is explained as > `\--type=`   >        Select the format in which to output the file data   >  …   >  `a`   >       named character, ignoring **high-order bit**   >  …   >  Only the least significant seven bits of each byte is used; the high-order > bit is ignored. Now this answer here explains a lot, especially " _and words were two bytes long_ " - which leads to my specific **Question** : _What does **high-order bit** mean in connection with "named characters"_ Maybe I'm just missing something…


How to get sound intensity of an audio input through terminal?

I want to know the intensity of the sound being heard by an audio in source like a mic or Line-in through Command line. Kinda like the progressbar under the mouse but in CLI. ![enter image description here](http://i.stack.imgur.com/QZqCS.png)               audiointensity mic0     10      Kind of like connecting a mic with amplification circuit to Arduino through an analog pin 0 and doing a analogRead(0). So, you get a value within a particular like (0 to 1024) or (0 to 100) .


Status of adding Reiser4 to the Linux kernel

I used the Reiser4 fs for some time and would love to see it get into the mainline kernel. I would think the project can still go forward even if Hans is not able to contribute these days. Is there any mention on a mailing list or elsewhere of plans to get Reiser4 into the mainline kernel?


How do I install WINE in RHEL 6.3?

I'm a beginner in Linux and I'm having a problem installing wine I'm using RHEL 6.3 and when I use               yum install wine      it keeps giving me this               Blockquote Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: libxml2.so.2(LIBXML2_2.7.3)     Error: Package: wine-cms-1.4.1-1.el6.i686 (epel)                Requires: liblcms.so.1     Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: libz.so.1     Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: libxml2.so.2(LIBXML2_2.6.8)     Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: libxml2.so.2(LIBXML2_2.6.15)     Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: gnutls(x86-32)     Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: libxml2.so.2(LIBXML2_2.6.23)     Error: Package: wine-pulseaudio-1.4.1-1.el6.i686 (epel)                Requires: alsa-plugins-pulseaudio(x86-32)     Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: libxml2.so.2(LIBXML2_2.6.2)     Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: libxml2.so.2(LIBXML2_2.6.21)     Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: libglib-2.0.so.0     Error: Package: wine-alsa-1.4.1-1.el6.i686 (epel)                Requires: libasound.so.2(ALSA_0.9)     Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: libGLU.so.1     Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: libxml2.so.2(LIBXML2_2.5.8)     Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: libGL.so.1     Error: Package: wine-ldap-1.4.1-1.el6.i686 (epel)                Requires: libldap_r-2.4.so.2     Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: libgstreamer-0.10.so.0     Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: libX11.so.6     Error: Package: wine-alsa-1.4.1-1.el6.i686 (epel)                Requires: libasound.so.2     Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: libXext.so.6     Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: libSM.so.6     Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: libxml2.so.2(LIBXML2_2.5.7)     Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: libusb-0.1.so.4     Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: libgobject-2.0.so.0     Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: libICE.so.6     Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: libexif.so.12     Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: libgphoto2_port.so.0     Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: libxml2.so.2(LIBXML2_2.6.14)     Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: libXrender(x86-32)     Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: libxml2.so.2(LIBXML2_2.4.30)     Error: Package: wine-alsa-1.4.1-1.el6.i686 (epel)                Requires: libasound.so.2(ALSA_0.9.0rc4)     Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: freetype(x86-32)     Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: libgstapp-0.10.so.0     Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: libgthread-2.0.so.0     Error: Package: wine-ldap-1.4.1-1.el6.i686 (epel)                Requires: liblber-2.4.so.2     Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: libXcursor(x86-32)     Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: libgphoto2.so.2     Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: libgmodule-2.0.so.0     Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: libxml2.so.2(LIBXML2_2.6.0)     Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: libxml2.so.2     Error: Package: wine-core-1.4.1-1.el6.i686 (epel)                Requires: libgstbase-0.10.so.0      I'v tried many things I'v installed epel and updated yum I really could use some help guys thanks in advance


How to put backtrack on a partition with Windows XP

This is a similar question to my previous one. I now am trying to get Backtrack5 onto a separate partition of my main hard drive with windows but the site says that I need a clean hard drive. Is there anyway around this?


Why does Ubuntu use Debian "unstable"? How does it manage to be stable then?

Shouldn't Ubuntu use Debian "stable" for stability? How does it manage to stay stable by using Debian "unstable" ?


Scrolling on very long files (1M+ lines) on Emacs

I was wondering if besides the basic navigation commands:               C-p : Jump backwards one line.     C-n : Jump forward one line.     C-v : Jump forward one full screen.     M-v : Jump backwards one full screen.     M-a : Go to the previous paragraph beginnings.     M-e : Go to the next paragraph end.     M-g g: Jump to a specific line      emacs provides any commands to easily scroll thousands or millions of lines. More specifically, I am looking for example for a command that I could use to move forward (or backwards) `1%` of the file (maybe a command that can be combined with `C-u` and can be used to scroll an arbitrary `%` of the file?)


How to install Oracle on Arch Linux?

I tried going through the wiki I was able to complete until here.               wget --http-user "I accept www.opensource.org/licenses/cpl" --http-password "." http://www.research.att.com/~gsf/download/tgz/INIT.2011-02-08.tgz      Then, it says that the INIT package is not found. Not sure what to do next. I tried to go to Oracle and download and proceed anyways by untarring and trying to setup. It is showing many errors. I was wondering if anybody had successfully installed Oracle on Arch? **EDIT:** I tried the following in the above link:               [srikanth@myhost Downloads]$ tar -xvf oracle.tar.gz      oracle     oracle/PKGBUILD     oracle/oracle.install     oracle/ee.rsp.patch     oracle/oracledb     [srikanth@myhost Downloads]$ cd oracle     [srikanth@myhost oracle]$ ls     ee.rsp.patch  oracledb  oracle.install  PKGBUILD     [srikanth@myhost oracle]$ makepkg -s     ==> Making package: oracle 11gR1-1 (Thu Jan 19 21:54:20 CST 2012)     ==> Checking runtime dependencies...     ==> Installing missing dependencies...     Password:      error: target not found: ksh     ==> ERROR: 'pacman' failed to install missing dependencies.      and then I tried to install ksh via yaourt and aur                                                     ksh                        ---------------------------------------------------                     1) View/Edit PKGBUILD                   ---------------------------------------------------                   * b)  Build with makepkg and install with pacman.                     s)  Save build files and build.                     n)  Next package. Skip this package.                     q)  Quit without building.                   ---------------------------------------------------                        Enter a selection: [B] b     ==> Checking Buildtime Dependencies...           ==> Checking Runtime Dependencies...           ==> Making package: ksh 2011.02.08-1 (Fri Jan 20 16:38:02 CST 2012)     ==> Checking runtime dependencies...     ==> Checking buildtime dependencies...     ==> Retrieving Sources...     ==> ERROR: INIT.2011-02-08.tgz was not found in the build directory and is not a URL.     aurbuild: could not build ksh with makepkg.     Build directory retained at /var/tmp/aurbuild/build/ksh     You can visit the directory, fix the problem, and run makepkg.      [srikanth@myhost oracle]$ yaourt -S ksh               ==> Downloading ksh PKGBUILD from AUR...     x PKGBUILD          ( Unsupported package: Potentially dangerous ! )     ==> Edit PKGBUILD ? [Y/n] ("A" to abort)     ==> ------------------------------------     ==> n          ==> ksh dependencies:          ==> ksh conflicts:      - pdksh-5.2.14-6          ==> Continue building ksh ? [Y/n]     ==> -----------------------------     ==>      ==> Building and installing package     ==> Making package: ksh 2011.02.08-1 (Thu Jan 19 21:57:07 CST 2012)     ==> Checking runtime dependencies...     ==> Checking buildtime dependencies...     ==> Retrieving Sources...     ==> ERROR: INIT.2011-02-08.tgz was not found in the build directory and is not a URL.     ==> ERROR: Makepkg was unable to build ksh.     ==> Restart building ksh ? [y/N]      Please suggest. I came across this INIT package. Which package should I download for Arch Linux 64 bit?


Launching a terminal emulator without knowing which ones are installed

I need to write a script that will launch a terminal emulator and run a particular command in it. Since I don't know which terminal emulators have been installed on the target system, how could I find which terminal emulators have been installed? I've looked at this thread. However, I'm not really very inclined to make a hardcoded check, and I'm searching for a generic solution. I've come up this _very_ dirty hack, but I'm really not sure how this would fare: `termdetect`:               #!/bin/bash          IFS=:     for i in $PATH; do       find "$i" -type f -exec isterminal {} \;     done      `isterminal`:               #!/bin/bash          if [[ ! -z "$1" ]]; then       if [[ "$(head -c 4 "$1")" == $'\x7fELF' ]]; then         if ! grep editor "$1" > /dev/null; then           if grep -E '(vte_terminal_|libutempter|rxvt_)' "$1" > /dev/null; then             echo "$1"           fi         fi       fi     fi      Is there an easy generic solution that I'm perhaps missing? Or do I have no other way than to scour binaries for hints or use a hardcoded list?


Why is my ext4 filesystem recognizable only on the machine it was formatted on?

Xubuntu liveCD 11.04 running on "bad machine" with mdadm RAID1 array with an unrecognizable ext4 filesystem: To rescue some files, I installed a new hard drive and formatted it to ext4. I copied 300GB worth of files retrieved from bad machine data scraping onto the newly formatted ext4 drive. I powered down the machine and removed the HDD, connected HDD to an ubuntu "good machine". Good machine doesn't recognize the ext4 filesystem. Trying to mount, dmesg reports:               EXT3-fs (sdd1): error: can't find ext3 filesystem on dev sdd1.     EXT4-fs (sdd1): VFS: Can't find ext4 filesystem     EXT4-fs (sdd1): VFS: Can't find ext4 filesystem      So I put the drive back in the bad machine, and the filesystem is recognized and mountable. Experimenting, I formatted another new drive to ext4 on good machine, then installed the drive on bad machine. Bad machine doesn't recognize new drive formatted by good machine. What could cause bad machine to speak it's own ext4 language? Can the ext4 filesystem that bad machine is creating be corrected on good machine so the data can be copied onto good machine? ## Edit 0 As requested by @bersh, command output on "bad machine":               # cat /proc/filesystems     nodev   sysfs     nodev   rootfs     nodev   bdev     nodev   proc     nodev   cgroup     nodev   cpuset     nodev   tmpfs     nodev   devtmpfs     nodev   debugfs     nodev   securityfs     nodev   sockfs     nodev   pipefs     nodev   anon_inodefs     nodev   devpts             ext3             ext2             ext4     nodev   ramfs     nodev   hugetlbfs     nodev   ecryptfs     nodev   fuse             fuseblk     nodev   fusectl     nodev   pstore     nodev   mqueue             btrfs             iso9660     nodev   overlayfs             squashfs      and the next one:               # lsmod|grep ext     #      (no output) ## UPDATE 1 I realized I have been doing something wrong... The raid array is partitioned, I've been assembling the entire /dev/sda disk with mdadm when I should be assembling individual partitions: mdadm -A /dev/sda1 /dev/md5 and mdadm -A /dev/sda2... That doesn't answer the question though. because the non-raid ext4 partition was unrecognized on the good machine, and even if I correctly assemble the raid array, I might not be able to transfer it to a different machine and the different machine be able to recognize the ext4.


What are the pros/cons of deb vs. rpm?

For whatever reasons, I've always used RPM based distros (Fedora, Centos and currently openSUSE). I have often heard it stated that deb is better than rpm, but when asked why, have never been able to get a coherent answer (usually get some zealous ranting and copious amounts of spittle instead). I understand there may be some historical reasons, but for modern distros using the two different packaging methods, can anybody give the technical (or other) merits of one vs. the other?


Dispatcher script of network-manager no longer works

Soon after upgrading to networkmanager 0.9.8, I got the following message when it starts, > Dispatcher failed: (32) Unit dbus-org.freedesktop.nm-dispatcher.service > failed to load: No such file or directory. See system logs and 'systemctl > status dbus-org.freedesktop.nm-dispatcher.service' for details. And I noticed that all my dispatcher scripts (located in `/etc/NetworkManager/dispatcher.d`) are dead. The permission of each script is set to `700`, owned by root. I've already run the name with `pkgfile` and `locate`, no output. The file doesn't really exist, so where can I find it?


How to report number of files in all subdirectories?

I need to inspect all sub-directories and report how many files (without further recursion) they contain:               directoryName1 numberOfFiles     directoryName2 numberOfFiles


How can I configure grub (or a different bootloader) to use modifier keys?

To clarify, I am wanting to dual boot Windows and a Linux distribution. I already know how to set my laptop up to do that. However, I don't want the grub menu to display on boot. I would like for it to automatically boot Windows by default, unless a modifier key is pressed on boot (ctrl for instance). If the modifier key is pressed, it will boot the Linux distro. Is this possible?


How to handle a mass rpmbuild for a new distribution?

How could I define and initiate a mass rpmbuild for a coresystem of a new distro? Which requisites beyond rpmbuild-dir are needed?


Determine whether kernel built-in driver supports a device

I'm trying to find a way to accurately determine whether all the hardware on some system has a valid driver installed either via a kernel module or built- in to the kernel. I'm working with RHEL 5.5 on a Dell Optiplex 990. I know that lspci is a good starting point, but it's not reliable because it could be manually updated and new drivers don't always update it. I know that I can look look at /lib/modules/$(uname -r)/modules.pcimap to find out whether there is a driver module for the device base on the ID, but what about built- in drivers? I've installed a new kernel and I'm trying to find out whether the built-in agpgart-intel module supports the host bridge with vendor:device ID 8086:0100. Also, is there a proper procedure for updating the pci.ids list when updating the kernel? I know I could just update everything using update-pciids or by downloading the list from the internet, but doesn't it make more sense to only include IDs supported by the current install?


Downloading DeviantArt : Favourites, Groups, Gallery...

Is there any command-line Linux tool for downloading user favourites (including subfolders), selected users galleries, groups ? (Preferably with ability to run in incremental mode, to update rip from time to time with new entries without reloading all currently loaded stuff) I mean tool with DenvianArt web page parsing (web scraping) capabilities. So result will be a tree of direcotries with picture files in maximum available resolution:               userX_galleries/         gallery1/           pic_1_PICNAME.jpg           pic_2_PICNAME.png           (...)           pic_n_PICNAME.jpg         gallery2/           pic_1_PICNAME.jpg           pic_1_PICNAME.png           (...)           pic_n_PICNAME.png         (...)      Or something like that.


Recursively replace string in files

I want to replace the backslash in the string `page_path\example_filename.txt` with a forward slash. I also want to be able to run this on a large file system and have it recursively search all directories. I found someone on the web who said to use `grep`, `xargs`, and `sed` but I wasn't able to get it to work. I've been trying different variations on delimiters and escape characters, but didn't get it. Here is the command I was trying to run:   `grep -lr -e 'page_path\\\' * | xargs sed -i 's/page_path\/page_path//g'` Thanks in advance.


What is the difference between root and chroot?

Is there any different between `root` and `chroot` in Linux? Can anyone please explain them?


How do I get Wicd to use other drivers in Debian 7.2 Xfce?

I have an old laptop with Debian Xfce 7.2 with a wireless-n pcmcia card. NetworkManager and Wicd have the same issues with Wi-Fi, especially with authentication. The card works perfect on Ubuntu distros (though Ubuntu distros are too slow on this old laptop). I saw a post on Google+ where a guy copied a `/lib/firmware` from Arch Linux to his Debian machine and his Wi-Fi problems stopped. I tried the same thing except from Xubuntu to Debian, but it didn't work. Any way to make this work?


After upgrade, X button in titlebar no longer closes xterm

In theory, pressing the close button ![kwin close button](http://i.stack.imgur.com/oyC4x.png) should close an xterm. It did before I did an `aptitude upgrade`. (I'm running Debian testing). But now it doesn't—clicking the X does nothing—but only for _some_ xterms. In particular, if I launch an xterm from the KDE quicklaunch thing, or the K menu, those xterms are closeable. If, however, I launch it from a keyboard shortcut (khotkeys), then that xterm is not closeable. Further, this is recursive: if I launch an xterm from an xterm, its closeable if its parent is. This doesn't happen in general. It's only for xterm. I've tested starting these apps from an uncloseable xterm, and they are all closeable:   * gvim   * xclock   * xditview   * dolphin   * konsole Interspersing another program in there breaks the chain (e.g, starting an xterm from konsole):   * xterm (uncloseable) → xterm (unclosable) → xterm (uncloseable) → …   * xterm (uncloseable) → konsole (closable) → xterm (closable) → … I've checked my kwin Window Rules, I do not have any for xterm.


Why does pipe not work with cat and locate?

I am trying to perform this:               locate pg_type.h | cat      But this command simply does nothing different than locate pg_type.h What should I change ? I want to perform `cat pg_type.h` wherever `pg_type.h` may be.


Why does top report the incorrect CPU usage?

I have a machine with `Intel(R) Xeon(R) CPU E5520` visible as 16 logical cores (8 with HT). If I run something to eat CPU time (single threaded) top correctly reports 100% CPU usage for the process but only around 3-4% total usage.               Cpu(s):  3.6%us,  0.0%sy,  0.0%ni, 96.4%id,  0.0%wa,  0.0%hi,  0.0%si,  0.1%st            PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND      1567 www       20   0 65632   84    4 R  100  0.0   0:05.96 burnMMX      Surely the reported usage should be ~6.25% (1 of 16 cores).   * Is it incorrect because it's a virtual machine?    * How could I calculate a correct value?


not able to create xorg.conf file

I want to change my colour depth. I posted this, and got the following answer: > Create an `xorg.conf` file by running `Xorg -configure`. Then edit the > `Depth` entry in the `Display` subsection of the `Screen` section. > > You can start an X server with a non-default depth by running e.g. `startx > -- -depth 8`. So I run `sudo Xorg -configure`, but I get this error:               Fatal server error:     Server is already active for display 0             If this server is no longer running, remove /temp/.X0-lock             and start again.      So I run `sudo rm -rf /temp/.X0-lock`. And then I run `sudo Xorg -configure`, but get this:               _XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed     _XSERVTransMakeAllCOTSServerListeners: server already running          Fatal server error:     Cannot establish any listening sockets - Make sure an X server isn't already running      What do I do? I have a PowerBook G4 running XFCE Debian. `Ctrl` + `Alt` + `Backspace` doesn't (seem to) do anything. (?)


find top 10 latest modified files

How do I get the last 10 files that were modified on my system. I have a system where its disk usage is maxed out I am not sure which files is increasing rapidly. I have a mysql instance stored on a separate mounted device and I just created a softlink unto my /var/lib directory on my root device. I know symlinks does not affect disk usage.


Differentiate between Galaxy Nexus and Galaxy Tab in UDEV rule?

I love Samsung devices, I have a Samsung Series 9 Laptop, Galaxy Nexus Phone (SCH-i515), and a Galaxy Tab 8.9 (GT-P7310) Tablet. For the most part, they're all great products. Samsung made one major mistake though; the vendor and product IDs (as well as other attributes) of both Android devices are the SAME! I have a UDEV rule written which runs a script to mount (mtpfs) the Galaxy Nexus when plugged in, after which, it will automatically sync photos and use `notify-send` to create a nice little Gnome notification when the sync is done. I want something similar to happen when the tablet is plugged in, but with a different mount point, not syncing photos (I don't use the camera on the tab), etc. Unfortunately, I'm not sure where to turn at this point. `mtpfs` sees them as the same device as well. Any thoughts on where to turn next?


How to create backup from symbolic links?

I have a directory with symbolic links to other directories. I want to archive the symbolic links, not as links but as archives containing the files of directories they refer to, using tar command. How can I do this?


How do I get a Qt app running on MATE to open embedded URLs?

I'm running Linux Mint with the MATE desktop. I'm using Everpad, which is a Python app that uses Qt. When I click on an http URL in the text, nothing happens. I assume this is because Qt doesn't have the setting to find a handler for the link. How can I fix this so it opens it with Firefox?


Host domain name pointer in linux

I setup a Linux server and run a command, `host wan ip` in terminal and it shows `... domain name pointer mail.domain.com`. How do i replace current new `mail.domain.com` to `mail.newdomain.com`?


Transfer Ubuntu server 10.04 to another 13.04

I am totally new to Linux administration and now I have big problem. I have old server with some sites, databases, programs etc that is Ubuntu 10.04. Because of too much users I rented new better and faster server but with Ubuntu 13.04. So my question is: Does anyone know easy way to transfer all server data, sites, databases, mail server etc etc on new Ubuntu 13.04 server? My hosting provider will do IP changes when I ask them but I need to transfer everything else alone and they don't provide software support.


Does GPL mean that whole software is public?

I'm doing on one open-source application. Now I'm choosing it's license and I'm thinking about GPL. But there I've got few questions:   * Is anyone allowed to share modified program using same name?    * Do I have any ownership on software?   * Do I take any responsibility for program usage, unexpected behavior,...?


Encrypted Zorin 7 Partition HELP!

I had Zorin 7 Encrypted Harddrive option installed on my laptop. I accidentally deleted important GRUB data trying to make more room in the boot folder i think? So the computer would no longer boot up. Anyways, I installed a second Linux OS on the same laptop, but I am unable to access all of my important information that is still on the encrypted partition. When I go to mount it to access everything, it asks for the encryption password... however, it tells me the password is incorrect, which I know 100% that it is the correct password. Someone please help me! Inform me how I can access this encrypted partition or restore the data so that I can boot the computer in Zorin 7 again.


Can I see what HDD I have installed?

I use `lspci` for pci devices and `lsusb` to list the usb hardware devices, is there something similar to list my SATA HDD model ?


How do I determine the make & model of my storage devices?

> **Possible Duplicate:**   >  How do I find out what hard disks are in the system? I'm running a CentOS 5.5 system. This system has 4 disks and a 3ware RAID controller. How can I determine the make and model of my drives? `/proc/scsi/scsi` and `parted --list` shows the RAID controller (3ware 9650SE-4LP):               # cat /proc/scsi/scsi      Attached devices:     Host: scsi0 Channel: 00 Id: 00 Lun: 00       Vendor: AMCC     Model: 9650SE-4LP DISK  Rev: 4.06       Type:   Direct-Access                    ANSI SCSI revision: 05          # parted --list          Model: AMCC 9650SE-4LP DISK (scsi)     Disk /dev/sda: 2000GB


Compiling for Red Hat 5.9

I need to compile a C++ application to run on Red Hat 5.9, but I don't have access to a development server that runs Red Hat 5.9. My current executable compiled on Ubuntu 10.04 produces the error message > `/lib/libc.so.6: version`GLIBC_2.11' not found` which probably means that RedHat is using an older libc. Which free Linux distribution should I use to compile for Read Hat 5.9 ? I read that Red Hat is based on Fedora and RHEL 5.x is based on Fedora Core 6. Do I really have to use such an old system to compile for a rather recent RHEL 5.9?


Terminate dropped SSH sessions

My SSH sessions seem to be dropping though that is not my major problem - the major problem is my previous sessions are still alive, worse yet one of them is running `visudo` preventing me from accessing it! `who` shows a number of sessions all except my current one I know have disconnected, how can I terminate the old ones so the release their resources?


"tail -f" show old file after file has been rotated

I have a script running continuously, reading `tail -f /var/log/daemon.log` The problem is, when the file `/var/log/daemon.log` gets rotated by `logrotate`, tail still has "file handle" for the old (rotated) file and no longer displays the contents of the new `/var/log/daemon.log` file Is there any way to fix this, so that `tail` shows the contents of the new file, if the file was rotated ?


Which command would you use if you want to remove the password assigned to a group

Suppose I have one or more groups (as in the user database as backed by `/etc/group` or LDAP or NIS+...) configured with a password (for the `sg` or `newgrp` commands). Which command would you use to remove the password assigned to such a particular group? Does it depend on which kind of user database is used (`/etc/passwd,shadow`, NIS+, LDAP...) or on the system? I'm on Linux, but knowing the method on other systems would also be interesting.


Why does PAM prevent root from using useradd?

I'm using Arch Linux on a single-user workstation with LXDE and lxde-session autologin to the regular user. I then "su" or "sudo" to root privileges, and try to run "useradd." useradd fails on my system. This system was re-installed from scratch less than a year ago, and has had regular "pacman -Syu" run on it. I don't do much custom system administration; mainly run LXDE and vim/gcc/make as my regular user account. useradd also fails when pacman tries to run it. I recently ran into a problem where both mariadb and percona-server would fail to start on the system after installation, and tracked it down to the mysql user not being properly created. Trying to run useradd manually, I find that that utility has broken. Googling around, people suggest this might be a problem with /etc/shadow or confg files in /etc/pam.d/, so I looked into that. The error I get is: useradd: PAM: Authentication service cannot retrieve authentication info Running strace on useradd, it seems quite capable of opening /etc/shadow and /etc/passwd, and getuid() returns 0 for "root":               open("/etc/pam.d/other", O_RDONLY)      = 3     fstat(3, {st_mode=S_IFREG|0644, st_size=127, ...}) = 0     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1a7c0eb000     read(3, "#%PAM-1.0\nauth\t\trequired\tpam_uni"..., 4096) = 127     read(3, "", 4096)                       = 0     close(3)                                = 0     munmap(0x7f1a7c0eb000, 4096)            = 0     getuid()                                = 0     getuid()                                = 0     open("/etc/login.defs", O_RDONLY)       = 3     fstat(3, {st_mode=S_IFREG|0644, st_size=5519, ...}) = 0     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1a7c0eb000     read(3, "#\n# /etc/login.defs - Configurat"..., 4096) = 4096     read(3, "gular users using chfn - use\n# a"..., 4096) = 1423     read(3, "", 4096)                       = 0     close(3)                                = 0     munmap(0x7f1a7c0eb000, 4096)            = 0     open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 3     fstat(3, {st_mode=S_IFREG|0644, st_size=610, ...}) = 0     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1a7c0eb000     read(3, "root:x:0:0:root:/root:/bin/bash\n"..., 4096) = 610     close(3)                                = 0     munmap(0x7f1a7c0eb000, 4096)            = 0     geteuid()                               = 0     open("/etc/shadow", O_RDONLY|O_CLOEXEC) = 3     fstat(3, {st_mode=S_IFREG|0600, st_size=413, ...}) = 0     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1a7c0eb000     read(3, "root:x::::::\nbin:x:14871::::::\nd"..., 4096) = 413     read(3, "", 4096)                       = 0     close(3)                                = 0     munmap(0x7f1a7c0eb000, 4096)            = 0     write(2, "useradd: PAM: Authentication ser"..., 73useradd: PAM: Authentication service cannot retrieve authentication info     ) = 73      The config files look fine:               [root@robot1 jwatte]# cat /etc/pam.d/useradd      #%PAM-1.0     auth        sufficient  pam_rootok.so     auth        required    pam_unix.so     account     required    pam_unix.so     session     required    pam_unix.so     password    required    pam_permit.so          [root@robot1 jwatte]# cat /etc/pam.d/other      #%PAM-1.0     auth        required    pam_unix.so     account     required    pam_unix.so     password    required    pam_unix.so     session     required    pam_unix.so     [root@robot1 jwatte]#       How do I take the next step in resolving and debugging this issue? Is there any debug I can find anywhere about why PAM decides this should fail? Good-old /var/log/auth.log doesn't exist anymore, and journalctl -b is not very helpful:               May 17 09:52:15 robot1 sudo[676]: pam_unix(sudo:session): session opened for user root by jwatte(uid=0)     May 17 09:52:15 robot1 useradd[677]: Authentication service cannot retrieve authentication info     May 17 09:52:15 robot1 useradd[677]: failed adding user 'mysql', data deleted      I still can't get much information out of PAM -- specifically, which module fails, at what step? I've read the code for useradd, and the code for PAM (AAAUUGH! THE GOGGLES! THEY DO NOTHING!) I ended up adding pam_warn.so to "others" and "useradd" for the "account" action, and I got one (1) more line into the journalctl:               May 17 11:04:54 robot1 useradd[29944]: pam_warn(useradd:account): function=[pam_sm_acct_mgmt] service=[useradd] terminal=[<unknown>] user=[root] ruser=[<unknown>] rhost=[<unknown>]      Does it matter that terminal, ruser, and rhost are unknown? How would I found out?


Do I have PCLMUL instruction set support?

Here are the `flags` from `/proc/cpuinfo`: `fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid` I clearly have a `pclmulqdq` flag, but I'm not sure if it means PCLMUL instruction set support. How can I find what the flag means, or what flag PCLMUL corresponds to?


Preventing tar from using too much CPU and disk (old laptop crashes if 100%)

I want to backup 1 terabyte of data to an external disk. I am using this command: `tar cf /media/MYDISK/backup.tar mydata` PROBLEM: My poor laptop freezes and crashes whenever I use 100% CPU or 100% disk _(if you want to react about this pleasewrite here)_. So I want to stay at around 50% CPU and 50% disk max. My question: How to throttle CPU and disk with the `tar` command? Rsync has a --bwlimit option, but I want an archive because 1) there are many small files 2) I prefer to manage a single file rather a tree. That's why I use `tar`.


Installing Maya 2014 : "./setup" returns "/Setup is a directory" instead of running installer?

I hope this is posted on the right site, if not I apologize. Im currently installing (or trying to install) my Autodesk 3d Packages on my new LinuxMint installation. Im brand-new to linux, but so far I always managed to get everything done without greater distractions. Now however, I fear my limited knowledge has found its limits. Im following the Guide for installing Autodesk Maya provided by Autodesk (as found here), but I'm stuck at step 3:   * Type ./setup and press Enter.  Which returned this:                   gh057@JARVIS ~/Downloads/Maya_2014 $ su -         Password:          JARVIS ~ # ./setup         -su: ./setup: No such file or directory         JARVIS ~ # cd /home/gh057/Downloads/Maya_2014         JARVIS Maya_2014 # ./setup         -su: ./setup: No such file or directory         JARVIS Maya_2014 # ./Setup         -su: ./Setup: Is a directory         JARVIS Maya_2014 #       at which point I go: "You don't say?!" and cluelessly stare at the screen. Im confident this is just the result of my limited knowledge of the system, so I would appreciate any help you can throw my way :)


GRUB no longer can boot the machine (different error messages)

When I boot from GRUB, I get various error messages from GRUB, apparently at random : "invalid arch independent ELF magic" or "incompatible license" or "file not found". I can boot from the rescue DVD and then the main disk, /dev/sda, seems OK. I can fsck it (no error), I can mount, it can even use it as root (from the rescue DVD, boot with root=/dev/sda1). But the machine cannot reboot without the DVD rescue. What I tried (without any success):   * `grub-install /dev/sda` No error but the problem stays the same   * Boot repair no error message but not better aftwerwards. You can check its report   * removing the kernel and reinstalling it   * removing GRUB, moving /boot/grub and reinstalling it Debian stable "wheezy". I am not aware of any external recent event (no upgrade, no physical problem on the hardware). The PC has a few years, no UEFI, a regular Dell BIOS. Versions of grub:               % dpkg -l 'grub*'     Desired=Unknown/Install/Remove/Purge/Hold     | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend     |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)     ||/ Name                   Version          Architecture     Description     +++-======================-================-================-==================================================     un  grub                   <none>                            (no description available)     ii  grub-common            1.99-27+deb7u1   i386             GRand Unified Bootloader (common files)     un  grub-coreboot          <none>                            (no description available)     un  grub-doc               <none>                            (no description available)     un  grub-efi               <none>                            (no description available)     un  grub-efi-amd64         <none>                            (no description available)     un  grub-efi-ia32          <none>                            (no description available)     un  grub-emu               <none>                            (no description available)     un  grub-ieee1275          <none>                            (no description available)     un  grub-legacy            <none>                            (no description available)     un  grub-legacy-doc        <none>                            (no description available)     un  grub-linuxbios         <none>                            (no description available)     ii  grub-pc                1.99-27+deb7u1   i386             GRand Unified Bootloader, version 2 (PC/BIOS versi     ii  grub-pc-bin            1.99-27+deb7u1   i386             GRand Unified Bootloader, version 2 (PC/BIOS binar     un  grub-yeeloong          <none>                            (no description available)     un  grub2                  <none>                            (no description available)     ii  grub2-common           1.99-27+deb7u1   i386             GRand Unified Bootloader (common files for version


How can I run gdb in one machine and run kgdb kernel in another machine?

I want to run two machine:   1. debugged machine: compiled kernel with kgdb option.   2. debugger machine: for running gdb How can I debug machine 1 from machine 2?


How to mount an NTFS drive as utf8 over NFS

### Question How to mount a nfs share (NTFS formatted fileystem) as `utf8` in `CentOS 6.5`? ### What I tried               mount -o iocharset=utf8       mount -o nfs=utf8       mount -o utf8=1     mount -o utf8      ### Problem: When I create a file on my unix drive containing umlauts(äöü) and export that file to my NFS share I see _broken_ characters in Windows (e.g. `A¼`) The broken characters are only in the filename - not in the content. Is it possible that the locale settings are wrong?   `LC_* = "en_US.UTF-8"`   Tried also `de_DE.UTF-8` When I create a file on windows in the share with umlauts, it is displayed as `?` in unix. I guess there is a problem with the locale settings. ### Default LC Settings               LANG=en_US.UTF-8     LC_CTYPE="en_US.UTF-8"     LC_NUMERIC="en_US.UTF-8"     LC_TIME="en_US.UTF-8"     LC_COLLATE="en_US.UTF-8"     LC_MONETARY="en_US.UTF-8"     LC_MESSAGES="en_US.UTF-8"     LC_PAPER="en_US.UTF-8"     LC_NAME="en_US.UTF-8"     LC_ADDRESS="en_US.UTF-8"     LC_TELEPHONE="en_US.UTF-8"     LC_MEASUREMENT="en_US.UTF-8"     LC_IDENTIFICATION="en_US.UTF-8"     LC_ALL=      ### locale -a | grep de_DE               de_DE     de_DE@euro     de_DE.iso88591     de_DE.iso885915@euro     de_DE.utf8      Tried all - no improvement.


Why, still in modern GUI-based Linux distros, is it common to use the command line?

Is the command line a popular choice thing, or do I have something wrong here? In modern Linux there's dozens of fresh, robust, 3-D rendered GUIs, graphical- based APIs, and desktop interfaces that could easily implement the commands entered in to the command interpretor text-based UI on the GUI through a more robust featured program that encompasses GUI elements better. What I am trying to say is, why is the command-line still so popularly used in 2013? I mean I can agree that before both the memory in computers was so minimal that a fancy GUI would be starving the main memory, but nowadays memory DOES come cheap, GUIs are 3-D, we have mobile power machines getting better every day so to speak, so why are we still punching commands in to interpretor parsing terminal UI emulations? Why isn't there a more robust and graphical way to implement the commands, only through a more modern GUI? For example, how about "ls" or "list" as a button that will generate a table view of data, or "umount" implemented in a button that generates a table view of current mount points? Overall, why doesn't a more modern implementation of the command interpretor come in to play, featuring the exact same control and capabilities just in a more convenient decor? PS: I should add this here as well ... I'm not saying **every** command should be implemented with a GUI-based program with fancy widgets and such. I'm just saying that I figured we'd have a makeover of the command-line, or maybe that some ideas can be better expressed, optimized, managed, or cycled through easier with visual aspects than just "words". No means to start an argument, but to find out why nothing has diverted this way over so many years and advancements of graphics in operating systems/software.


How can I run byobu from xterm at starting?

I set up byobu auto run with the command `byobu-enable`. It's great when I log in from terminal or ssh, but how can I make xterm attach to it automatically ? (mate-terminal from Linux mint especially)


Cron task starts at 5:30 and runs every 5 mins once

I want to run a crontab cron job which start at 5:30 AM and runs every 5 mins. How do i set it up in Linux? I am able to give like below. But how do i make it 5:30 ?               */05 5-16 * * *


Reporting cpu hogs

Once in a while some program (ok, usually it's firefox) will start eating up nearly 100% of a processor's cpu time, heating up the processor and driving down by laptop's battery life. Since it's not bad enough to impact performance, I usually don't notice for a while, so I'd like to change this: Is there a utility that **monitors process cpu usage and popus up an alert** if some process is using a lot of cpu time for an extended period of time (e.g., more than 30 seconds)? I can probably rig something up with ps or top, sed and a bunch of pipes, but I'm hoping there's a more direct way to do it. **Edit:** On second thought, what I'm really after is power usage. So any instrumentation specifically targeted at estimating power consumption is of particular interest. I'm on OS X 10.8, but welcome Linux-specific solutions as well.


Show output on another "screen" and return to normal when done

I want a similar behavior as `less` `vim` `nano` etc. uses. Is this possible to achieve with bash?


LIRC does not start after reboot

If I compile LIRC with `this patched lirc` followed by install using `make install` it works fine and launches without any error. However, after a reboot the same command fails with following error :               root@NAS:~# lircd --device=/dev/ttyACM0 --driver=usb_irtoy     lircd: can't open or create /var/run/lirc/lircd.pid     lircd: No such file or directory     root@NAS:~#      Any ideas what could be the reason for this ?


Difference between 'cd' and 'cd ~'

I am wondering, if **cd** alone sends me to my home folder and **cd ~** does the same, why was the ~ added in the first place then? Is it something specific to BASH or would they behave differently in another Shell?


Is there any tool to view live statistics about a Radeon GPU?

I've checked out GPU usage monitoring (CUDA), but are there similar tools for AMD/ATI cards? Or kind of universal tools? I want to check out if my applications use the 256 MB of RAM of the video card at all, since I've seen applications that uses lots system memory, while they should rather use the video cards. `glxinfo` does not provide the information I'm looking for, but maybe you will ask if I have HW Acceleration:               $ glxinfo | grep render     direct rendering: Yes     OpenGL renderer string: Gallium 0.4 on ATI RV515      The info about the card:               03:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] RV515 [Radeon X1300/X1550] (prog-if 00 [VGA controller])         Subsystem: VISIONTEK Device 2352         Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-         Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-         Latency: 0, Cache Line Size: 16 bytes         Interrupt: pin A routed to IRQ 19         Region 0: Memory at d0000000 (64-bit, prefetchable) [size=256M]         Region 2: Memory at bffe0000 (64-bit, non-prefetchable) [size=64K]         Region 4: I/O ports at e000 [size=256]         Expansion ROM at bffc0000 [disabled] [size=128K]         Capabilities: [50] Power Management version 2             Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)             Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-         Capabilities: [58] Express (v1) Endpoint, MSI 00             DevCap: MaxPayload 128 bytes, PhantFunc 0, Latency L0s <4us, L1 unlimited                 ExtTag+ AttnBtn- AttnInd- PwrInd- RBE- FLReset-             DevCtl: Report errors: Correctable- Non-Fatal- Fatal- Unsupported-                 RlxdOrd+ ExtTag- PhantFunc- AuxPwr- NoSnoop+                 MaxPayload 128 bytes, MaxReadReq 128 bytes             DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr- TransPend-             LnkCap: Port #0, Speed 2.5GT/s, Width x16, ASPM L0s L1, Latency L0 <64ns, L1 <1us                 ClockPM- Surprise- LLActRep- BwNot-             LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- Retrain- CommClk-                 ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-             LnkSta: Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-         Capabilities: [80] MSI: Enable- Count=1/1 Maskable- 64bit+             Address: 0000000000000000  Data: 0000         Kernel driver in use: radeon      I know there is Process Explorer in Windows, and it works with my card so the thing is Linux Kernel - driver/module - tool.


Schemes for linux tty and xterm

I actually prefer the font and colorscheme used when I'm in a tty terminal. After I start up a window manager, the colorscheme and font are completely different when I'm in xterm -- which is expected. I just don't know how to make xterm look like a tty. I diffed the results from printenv for when I'm using a tty and when I'm using xterm:               1,3c1,3     < XDG_VTNR=2     < MANPATH=:/usr/local/texlive/2013/texmf-dist/doc/man     < XDG_SESSION_ID=c15     ---     > XDG_VTNR=1     > MANPATH=:/usr/local/texlive/2013/texmf-dist/doc/man:/usr/local/texlive/2013/texmf-dist/doc/man     > XDG_SESSION_ID=c1     5c5     < TERM=linux     ---     > TERM=xterm     7c7,8     < rvm_stored_umask=0022     ---     > WINDOWID=33554445     > XTERM_SHELL=/bin/bash     14,15c15     < rvm_loaded_flag=1     ---     22a23,24     > XTERM_LOCALE=en_US.UTF-8     > XTERM_VERSION=XTerm(303)     24c26     < SHLVL=1     ---     > SHLVL=4     29c31,33     < INFOPATH=:/usr/local/texlive/2013/texmf-dist/doc/info     ---     > WINDOWPATH=1     > INFOPATH=:/usr/local/texlive/2013/texmf-dist/doc/info:/usr/local/texlive/2013/texmf-dist/doc/info     > DISPLAY=:0     32d35     < rvm_user_install_flag=1     33a37


umask changes to 0002 after cd

I've noticed an odd behavior on my Ubuntu 12.04 LTS system. This is my first experience with Ubuntu; previously I used Fedora and never had this problem. I have set my umask in .bashrc to 0027. But it automatically changes to 0002 every time I cd into another directory. It doesn't matter what directory I go in to; every directory change results in the umask changing.               bbrown@cs:~$ umask     0027     bbrown@cs:~$ cd /     bbrown@cs:/$ umask     0002     bbrown@cs:/$ umask 027     bbrown@cs:/$ cd /var/log     bbrown@cs:/var/log$ umask     0002      It even happens if I just use `cd` without a directory:               bbrown@cs:/var/log$ cd     bbrown@cs:~$ umask 027     bbrown@cs:~$ umask     0027     bbrown@cs:~$ cd     bbrown@cs:~$ umask     0002      I've searched through some other discussion boards. A similar question was asked on Stack Overflow with no resolution. I have no special ACLs on any of these directories.               bbrown@cs:/var/log$ getfacl /     getfacl: Removing leading '/' from absolute path names     # file: .     # owner: root     # group: root     user::rwx     group::r-x     other::r-x          bbrown@cs:/var/log$ getfacl /var/log     getfacl: Removing leading '/' from absolute path names     # file: usr/bin     # owner: root     # group: root     user::rwx     group::r-x     other::r-x      Filesystems are ext4 with no ACL mounting options:               bbrown@cs:/var/log$ more /etc/fstab     # <file system> <mount point>   <type>  <options>       <dump>  <pass>     proc            /proc           proc    nodev,noexec,nosuid 0       0     /dev/mapper/vg0-root /               ext4    errors=remount-ro 0       1     # /boot was on /dev/vda1 during installation     UUID=0da490ac-183d-45cd-a490-5d7ac3663337 /boot           ext2    defaults        0       2     /dev/mapper/vg0-export /export         ext4    defaults        0       2     /dev/mapper/vg0-home /home           ext4    defaults        0       2     /dev/mapper/vg0-var /var            ext4    defaults        0       2     /dev/mapper/vg0-mysql /var/lib/mysql  ext4    defaults        0       2     /dev/mapper/vg0-pgsql /var/lib/postgresql ext4    defaults        0       2     /dev/mapper/vg0-swap none            swap    sw              0       0      The csh does not exhibit this behavior; it's bash only as far as I can tell. What's going on and how do I disable this? ## Update I copied bash from my Fedora 13 system and put it in my home directory. That version does not exhibit the problem.               bbrown@cs:~$ /bin/bash --version     GNU bash, version 4.2.24(1)-release (x86_64-pc-linux-gnu)     Copyright (C) 2011 Free Software Foundation, Inc.     License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>          This is free software; you are free to change and redistribute it.     There is NO WARRANTY, to the extent permitted by law.     bbrown@cs:~$ ls -l /bin/bash     -rwxr-xr-x 1 root root 955024 Apr  3 08:58 /bin/bash     bbrown@cs:~$ ls -l ./bash     -rwxr-xr-x 1 bbrown bbrown 904664 Sep 11 13:02 ./bash     bbrown@cs:~$ ./bash --version     GNU bash, version 4.1.7(1)-release (x86_64-redhat-linux-gnu)     Copyright (C) 2009 Free Software Foundation, Inc.     License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>          This is free software; you are free to change and redistribute it.     There is NO WARRANTY, to the extent permitted by law.     bbrown@cs:~$ exec ./bash     bbrown@cs:~$ umask     0027     bbrown@cs:~$ cd /     bbrown@cs:/$ umask     0027      As requested, here's the output of `type cd`:               bbrown@cs:~$ type cd     cd is a function     cd ()      {          if builtin cd "$@"; then             [[ -n "${rvm_current_rvmrc:-}" && "$*" == "." ]] && rvm_current_rvmrc="" || true;             __rvm_do_with_env_before;             __rvm_project_rvmrc;             __rvm_after_cd;             __rvm_do_with_env_after;             return 0;         else             return $?;         fi     }      That's telling. RVM has taken control of the `cd` command. That's annoying, but it certainly explains what's going on.


Mounting a multi-partition (GPT/HFS+) USB 2.0 harddrive on Debian

I have a 3TB USB 2.0 hard-drive which has two HFS+ (Mac) partitions using GUID partition table for the partition records. It was partitioned with Mac OS Disk Utility. How can I mount these partitions on a Debian system, specifically a Netgear ReadyNAS? Running `mount -t hfsplus /dev/sda1 /mnt/usbtemp/` reports the following: _mount: /dev/sda1 is not a valid block device_ Running `fdisk -l` raises the following issue: _WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted._ Running `parted /dev/sda print` reports the following: _Error: Unable to open /dev/sda - unrecognised disk label.   Information: Don't forget to update /etc/fstab, if necessary._ Is it possible to mount these partitions on my Debian system?


How do I properly re-install an OS to the same partitions after failing for the first time?

I have Ubuntu installed. I created 2 more partitions for Linux Arch and failed to install it due to choosing the wrong packages via package manager. It will work on my computer for sure (it already did). So I'm going to re-install it. The reason I created 2 partitions (/boot and main /) for Arch is that I'm on UEFI system and it's x64 also. That's a must. So do I have to remove all the files from these 2 partitions before re- installing Arch or can I just re-install it without it? If case I have to remove them, how would I do that? Just `mount` them (partitions) while I'm on Ubuntu and remove via `rm -r` all the files in them?


Linux + how to verify mirror configuration on linux red-hat

I have an IBM blade server and we've installed _RedHat Linux_ on the machine. How can we check if we have both disks running as a mirror, or if everything is only running on a single disk? What commands can I use to discover this?


Give user permissions to all files and folders

I want to have a user who has access to all the files and folders on the system. This is for the purpose of using RSYNC on a local machine to backup a remote machine. At the moment we are using the user `backups` and although we have added this user to the groups `sudo` and `admin` rsync still returns messages like: > rsync: opendir "/location/to/folder" failed: Permission denied (13) > > rsync: send_files failed to open "/location/to/file": Permission denied (13) Any idea how we give the user `backups` permission to access everything (short of adding the user to all groups ever - the remote server we are trying to backup is a dedicated hosting server where every account has its own user on the system). Thanks for any help.


How do I run uTorrent?

I just downloaded the uTorrent archive from their website and unpacked it. Inside were:   * docs   * utserver   * webui.zip `utserver` is an executable, so I'm guessing that's what I'm supposed to run, but when I double-click it nothing happens. What should I do? I'm using Fedora 15


/boot too small to upgrade

Trying to upgrade from F15 to F17. I need to find a way to increase /boot size without destroying data. Details: I tried upgrading using preupgrade process and via booting from Net iso on USB and both lead to the same thing: and 'Error' message in the first package (filesystem) transaction indicating the installer needs (about) 1GB more on / Cannot proceed with the install. I also tried the trick of reducing the avail space in /boot to < 100M to trigger a network load of the installer image... but that leads to a series of mirror http/404 messages and no progress. I'd like to not have to nuke everything, yet again, just to do an upgrade. I would have thought that, by now, this issue would have drawn a more elegant solution than continually trying to guess how big /boot will have to be for the next upgrade. (unsnark) I have 4GB freespace on /dev/sdb but it is not contiguous with sdb1 (/boot): the process of shrinking the LVM volume released space at the end and not the beginning of sdb:               > df -kl | grep boot:      /dev/sdb1 3064704 300520 2764184 10% /boot      (note that what is now in /boot is irrelevant since 1G > 300 MB: I have to increase the volume size) fdisk:               /dev/sdb1   *        2048     6146047     3072000   83  Linux     /dev/sdb2         6146048   612354047   303104000   8e  Linux LVM      cfdisk:                                      Pri/Log   Free Space                           1.05*        sdb1        Boot        Primary   ext4                              3145.73*        sdb2                    Primary   LVM2_member                     310378.50*                                Pri/Log   Free Space                        4474.28*      Edit: After attempting to use gparted, watching it crash in horror, and eventually yanking and replacing the drive, I created a 15 GB boot partition (FCS!), reinstalling F15 and all my files. _Then_ preupgrade to F17 succeeded. I accepted the preferred answer assuming that it would have worked had it not destroyed my harddrive ;)


Accidentally removed dev-libs/mpc from Gentoo

It seems I accidentally removed `dev-libs/mpc` instead of `media-sound/mpc`. Now I can't compile anything (including a replacement `dev-libs/mpc`) because in doing so I apparently murdered GCC. How does one fix something like this?


Looking for tools to build minimal linux desktop

Increasingly I am dissatisfied by the fact, that configuring my linux _desktop_ usually means removing bloat instead of adding and tweaking features. I have come to the conclusion that I would rather begin with something very minimal and then add packages I learn about that provide additional functionality. So I am **looking for either a very minimal desktop distribution or even better a tool to build such a distribution**. Or in other words I want to **replace the package manager with a pre-runtime build tool**. A package manager won't hurt but I am looking for a distribution that focuses on advanced upfront configuration instead of a huge package repository I have looked at various minimal desktop distributions but they all appear to solve different problems, e.g. are designed to run on older hardware or run from cd/stick/ramfs. But I don't want a minimal distribution because my I have old hardware but because I want to know what purpose the various parts play. Running from main memory doesn't help there either, I want something minimal _and_ simple. Since it appears there are no distributions that are designed for the kind of minimalism I have in mind an obvious choice would be to build Linux From Scratch. However while I want the build process to be highly customization it also has to be automated because I will have to run it quite a few times until I have a system I am satisfied with. While a tool for lfs exists that can automate the build process it's not really integral part. Basically it extracts the steps required to build the system from the documentation and then does it automatically. I am looking for something a little more robust and advanced and also don't feel like editing xml. After a bit of searching I found Buildroot which is intended to build _embedded_ distributions but also allows the installation of X11. Before building a toolchain and then a rootfs the build can be configured using `make menuconfig` just like Linux. This looks exacly like what I had in mind, except that it is intended for cross compiling for embedded systems. What I currently have in mind is using buildroot but first ripping out all the embedded specific part replacing them with the respective parts from lfs. Lot's of work. Also there are some problems with buildroot most importantly (as it appears from my limiting testing) just enabling an additional package results in the hole thing being rebuild from scratch, but for trivial changes I would like to avoid that. Before I make that time investment I will continue my search for a desktop distribution with a _pre-installation_ build tool like buildroot, are an alternative to/fork of buildroot intended for building desktop distributions. **Edit:** The answers so far point me to distributions like e.g. Gentoo, which is what I am currently using. But I am _looking for an alternative_ to distributions like Gentoo, Arch, Debian etc. as these distributions are not minimal enough. Also one has to customize these distributions after installation. I want something that can be customized before installation. While all of the mentioned distributions are fine distribution they are not what I am looking for. What I am looking for is **"buildroot for desktop"**. If you do not know what buildroot is then you probably won't be able to provide an answer which satisfies me. Also I don't think that this question is subjective. I simply can not find anything that comes close to my needs and am therefor asking you to point me to projects that might provide at least parts of what I need.