title: Linux - Only first virtual interface can ping external gateway

text: I created 3 virtual interfaces with different MAC addresses all linked to the same physical interface. I see that they can successfully `arp` for the gateway (gw) and they can `ping` (the request is coming in the packet capture in Wireshark). However the `ping` utility does not count the responses. Does anyone knows the issue? I'm running Ubuntu 14.04 in a VMware. _ip link info_               root@ubuntu:~# ip link sh     1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default          link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00     2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000         link/ether 00:0c:29:bc:fc:8b brd ff:ff:ff:ff:ff:ff      _ip address info_               root@ubuntu:~# ip addr sh     1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default          link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00         inet 127.0.0.1/8 scope host lo            valid_lft forever preferred_lft forever         inet6 ::1/128 scope host             valid_lft forever preferred_lft forever     2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000         link/ether 00:0c:29:bc:fc:8b brd ff:ff:ff:ff:ff:ff         inet6 fe80::20c:29ff:febc:fc8b/64 scope link             valid_lft forever preferred_lft forever      _ip route info_               root@ubuntu:~# ip route sh      _add virtual interfaces_               root@ubuntu:~# ip link add link eth0 eth0.1 addr 00:00:00:00:00:11 type macvlan     root@ubuntu:~# ip link add link eth0 eth0.2 addr 00:00:00:00:00:22 type macvlan     root@ubuntu:~# ip link add link eth0 eth0.3 addr 00:00:00:00:00:33 type macvlan      _confirm they were added_               root@ubuntu:~# ip -4 link sh     1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default          link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00     2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000         link/ether 00:0c:29:bc:fc:8b brd ff:ff:ff:ff:ff:ff     18: eth0.1@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default          link/ether 00:00:00:00:00:11 brd ff:ff:ff:ff:ff:ff     19: eth0.2@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default          link/ether 00:00:00:00:00:22 brd ff:ff:ff:ff:ff:ff     20: eth0.3@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default          link/ether 00:00:00:00:00:33 brd ff:ff:ff:ff:ff:ff      _ip IPv4 address & route info_               root@ubuntu:~# ip -4 addr sh     1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default          inet 127.0.0.1/8 scope host lo            valid_lft forever preferred_lft forever          root@ubuntu:~# ip -4 route sh      _get DHCP IP for eth0.1_               root@ubuntu:~# dhclient -v eth0.1     Internet Systems Consortium DHCP Client 4.2.4     Copyright 2004-2012 Internet Systems Consortium.     All rights reserved.     For info, please visit https://www.isc.org/software/dhcp/     Listening on LPF/eth0.1/00:00:00:00:00:11     Sending on   LPF/eth0.1/00:00:00:00:00:11     Sending on   Socket/fallback     DHCPDISCOVER on eth0.1 to 255.255.255.255 port 67 interval 3 (xid=0x568eac05)     DHCPREQUEST of 192.168.1.145 on eth0.1 to 255.255.255.255 port 67 (xid=0x568eac05)     DHCPOFFER of 192.168.1.145 from 192.168.1.254     DHCPACK of 192.168.1.145 from 192.168.1.254     bound to 192.168.1.145 -- renewal in 1473 seconds.      _get DHCP IP for eth0.2_               root@ubuntu:~# dhclient -v eth0.2     Internet Systems Consortium DHCP Client 4.2.4     Copyright 2004-2012 Internet Systems Consortium.     All rights reserved.     For info, please visit https://www.isc.org/software/dhcp/     Listening on LPF/eth0.2/00:00:00:00:00:22     Sending on   LPF/eth0.2/00:00:00:00:00:22     Sending on   Socket/fallback     DHCPDISCOVER on eth0.2 to 255.255.255.255 port 67 interval 3 (xid=0x21e3114e)     DHCPREQUEST of 192.168.1.146 on eth0.2 to 255.255.255.255 port 67 (xid=0x21e3114e)     DHCPOFFER of 192.168.1.146 from 192.168.1.254     DHCPACK of 192.168.1.146 from 192.168.1.254     bound to 192.168.1.146 -- renewal in 1366 seconds.      _get DHCP ip for eth0.3_               root@ubuntu:~# dhclient -v eth0.3     Internet Systems Consortium DHCP Client 4.2.4     Copyright 2004-2012 Internet Systems Consortium.     All rights reserved.     For info, please visit https://www.isc.org/software/dhcp/     Listening on LPF/eth0.3/00:00:00:00:00:33     Sending on   LPF/eth0.3/00:00:00:00:00:33     Sending on   Socket/fallback     DHCPDISCOVER on eth0.3 to 255.255.255.255 port 67 interval 3 (xid=0x11dc5f03)     DHCPREQUEST of 192.168.1.147 on eth0.3 to 255.255.255.255 port 67 (xid=0x11dc5f03)     DHCPOFFER of 192.168.1.147 from 192.168.1.254     DHCPACK of 192.168.1.147 from 192.168.1.254     bound to 192.168.1.147 -- renewal in 1657 seconds.      _ip link info for interfaces_               root@ubuntu:~# ip -4 link sh     1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default          link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00     2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000         link/ether 00:0c:29:bc:fc:8b brd ff:ff:ff:ff:ff:ff     18: eth0.1@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default          link/ether 00:00:00:00:00:11 brd ff:ff:ff:ff:ff:ff     19: eth0.2@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default          link/ether 00:00:00:00:00:22 brd ff:ff:ff:ff:ff:ff     20: eth0.3@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default          link/ether 00:00:00:00:00:33 brd ff:ff:ff:ff:ff:ff      _ip address info for interfaces_               root@ubuntu:~# ip -4 addr sh     1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default          inet 127.0.0.1/8 scope host lo            valid_lft forever preferred_lft forever     18: eth0.1@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default          inet 192.168.1.145/24 brd 192.168.1.255 scope global eth0.1            valid_lft forever preferred_lft forever     19: eth0.2@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default          inet 192.168.1.146/24 brd 192.168.1.255 scope global eth0.2            valid_lft forever preferred_lft forever     20: eth0.3@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default          inet 192.168.1.147/24 brd 192.168.1.255 scope global eth0.3            valid_lft forever preferred_lft forever      _ip route info_               root@ubuntu:~# ip -4 route sh     default via 192.168.1.254 dev eth0.1      192.168.1.0/24 dev eth0.1  proto kernel  scope link  src 192.168.1.145      192.168.1.0/24 dev eth0.2  proto kernel  scope link  src 192.168.1.146      192.168.1.0/24 dev eth0.3  proto kernel  scope link  src 192.168.1.147       _arpping test eth0.1_               root@ubuntu:~# arping -c 5 -I eth0.1 192.168.1.254     ARPING 192.168.1.254 from 192.168.1.145 eth0.1     Unicast reply from 192.168.1.254 [58:98:35:57:a0:70]  6.936ms     Unicast reply from 192.168.1.254 [58:98:35:57:a0:70]  2.986ms     Unicast reply from 192.168.1.254 [58:98:35:57:a0:70]  0.654ms     Unicast reply from 192.168.1.254 [58:98:35:57:a0:70]  5.137ms     Unicast reply from 192.168.1.254 [58:98:35:57:a0:70]  2.426ms     Sent 5 probes (1 broadcast(s))     Received 5 response(s)      _arpping test eth0.2_               root@ubuntu:~# arping -c 5 -I eth0.2 192.168.1.254     ARPING 192.168.1.254 from 192.168.1.146 eth0.2     Unicast reply from 192.168.1.254 [58:98:35:57:a0:70]  5.665ms     Unicast reply from 192.168.1.254 [58:98:35:57:a0:70]  3.753ms     Unicast reply from 192.168.1.254 [58:98:35:57:a0:70]  16.500ms     Unicast reply from 192.168.1.254 [58:98:35:57:a0:70]  3.287ms     Unicast reply from 192.168.1.254 [58:98:35:57:a0:70]  32.438ms     Sent 5 probes (1 broadcast(s))     Received 5 response(s)      _arpping test eth0.3_               root@ubuntu:~# arping -c 5 -I eth0.3 192.168.1.254     ARPING 192.168.1.254 from 192.168.1.147 eth0.3     Unicast reply from 192.168.1.254 [58:98:35:57:a0:70]  4.422ms     Unicast reply from 192.168.1.254 [58:98:35:57:a0:70]  2.429ms     Unicast reply from 192.168.1.254 [58:98:35:57:a0:70]  2.321ms     Unicast reply from 192.168.1.254 [58:98:35:57:a0:70]  40.423ms     Unicast reply from 192.168.1.254 [58:98:35:57:a0:70]  2.268ms     Sent 5 probes (1 broadcast(s))     Received 5 response(s)      _tcpdump eth0.1 - test ping_               root@ubuntu:~# tcpdump -n -i eth0.1 -v &     [1] 5317     root@ubuntu:~# ping -c5 -q -I eth0.1 192.168.1.254     PING 192.168.1.254 (192.168.1.254) from 192.168.1.145 eth0.1: 56(84) bytes of data.     tcpdump: listening on eth0.1, link-type EN10MB (Ethernet), capture size 65535 bytes     13:18:37.612558 IP (tos 0x0, ttl 64, id 2595, offset 0, flags [DF], proto ICMP (1), length 84)         192.168.1.145 > 192.168.1.254: ICMP echo request, id 5318, seq 2, length 64     13:18:37.618864 IP (tos 0x68, ttl 64, id 14493, offset 0, flags [none], proto ICMP (1), length 84)         192.168.1.254 > 192.168.1.145: ICMP echo reply, id 5318, seq 2, length 64     13:18:37.743650 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.1.87 tell 192.168.1.86, length 46     13:18:38.134997 IP (tos 0x0, ttl 128, id 23547, offset 0, flags [none], proto UDP (17), length 229)         192.168.1.86.138 > 192.168.1.255.138: NBT UDP PACKET(138)     13:18:38.614580 IP (tos 0x0, ttl 64, id 2596, offset 0, flags [DF], proto ICMP (1), length 84)         192.168.1.145 > 192.168.1.254: ICMP echo request, id 5318, seq 3, length 64     13:18:38.793479 IP (tos 0x68, ttl 64, id 14495, offset 0, flags [none], proto ICMP (1), length 84)         192.168.1.254 > 192.168.1.145: ICMP echo reply, id 5318, seq 3, length 64     13:18:39.151282 IP6 (class 0x68, hlim 255, next-header ICMPv6 (58) payload length: 32) fe80::5a98:35ff:fe57:e070 > ff02::1:ff6b:e9b4: [icmp6 sum ok] ICMP6, neighbor solicitation, length 32, who has 2001:818:d812:da00:8ae3:abff:fe6b:e9b4           source link-address option (1), length 8 (1): 58:98:35:57:a0:70     13:18:39.615612 IP (tos 0x0, ttl 64, id 2597, offset 0, flags [DF], proto ICMP (1), length 84)         192.168.1.145 > 192.168.1.254: ICMP echo request, id 5318, seq 4, length 64     13:18:39.746981 IP (tos 0x68, ttl 64, id 14496, offset 0, flags [none], proto ICMP (1), length 84)         192.168.1.254 > 192.168.1.145: ICMP echo reply, id 5318, seq 4, length 64     --- 192.168.1.254 ping statistics ---     5 packets transmitted, 5 received, 0% packet loss, time 4008ms     rtt min/avg/max/mdev = 2.793/67.810/178.934/73.108 ms      _cleanup tcpdump_               root@ubuntu:~# killall tcpdump >> /dev/null 2>&1     9 packets captured     12 packets received by filter     0 packets dropped by kernel     [1]+  Done                    tcpdump -n -i eth0.1 -v      _tcpdump eth0.2 - test ping_               root@ubuntu:~# tcpdump -n -i eth0.2 -v &     [1] 5320     root@ubuntu:~# ping -c5 -q -I eth0.2 192.168.1.254     PING 192.168.1.254 (192.168.1.254) from 192.168.1.146 eth0.2: 56(84) bytes of data.     tcpdump: listening on eth0.2, link-type EN10MB (Ethernet), capture size 65535 bytes     13:18:41.536874 ARP, Ethernet (len 6), IPv4 (len 4), Reply 192.168.1.254 is-at 58:98:35:57:a0:70, length 46     13:18:41.536933 IP (tos 0x0, ttl 64, id 2599, offset 0, flags [DF], proto ICMP (1), length 84)         192.168.1.146 > 192.168.1.254: ICMP echo request, id 5321, seq 1, length 64     13:18:41.539255 IP (tos 0x68, ttl 64, id 14507, offset 0, flags [none], proto ICMP (1), length 84)         192.168.1.254 > 192.168.1.146: ICMP echo reply, id 5321, seq 1, length 64     13:18:42.127715 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.1.87 tell 192.168.1.86, length 46     13:18:42.511725 IP (tos 0x0, ttl 64, id 2600, offset 0, flags [DF], proto ICMP (1), length 84)         192.168.1.146 > 192.168.1.254: ICMP echo request, id 5321, seq 2, length 64     13:18:42.514385 IP (tos 0x68, ttl 64, id 14527, offset 0, flags [none], proto ICMP (1), length 84)         192.168.1.254 > 192.168.1.146: ICMP echo reply, id 5321, seq 2, length 64     13:18:42.743856 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.1.87 tell 192.168.1.86, length 46     13:18:43.511727 IP (tos 0x0, ttl 64, id 2601, offset 0, flags [DF], proto ICMP (1), length 84)         192.168.1.146 > 192.168.1.254: ICMP echo request, id 5321, seq 3, length 64     13:18:43.513768 IP (tos 0x68, ttl 64, id 14528, offset 0, flags [none], proto ICMP (1), length 84)         192.168.1.254 > 192.168.1.146: ICMP echo reply, id 5321, seq 3, length 64     13:18:43.637598 IP (tos 0x0, ttl 128, id 23551, offset 0, flags [none], proto UDP (17), length 225)         192.168.1.86.17500 > 255.255.255.255.17500: UDP, length 197     13:18:43.641185 IP (tos 0x0, ttl 128, id 23552, offset 0, flags [none], proto UDP (17), length 225)         192.168.1.86.17500 > 192.168.1.255.17500: UDP, length 197     13:18:43.641201 IP (tos 0x0, ttl 128, id 23553, offset 0, flags [none], proto UDP (17), length 225)         192.168.1.86.17500 > 255.255.255.255.17500: UDP, length 197     13:18:43.743890 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.1.87 tell 192.168.1.86, length 46     13:18:44.510758 IP (tos 0x0, ttl 64, id 2602, offset 0, flags [DF], proto ICMP (1), length 84)         192.168.1.146 > 192.168.1.254: ICMP echo request, id 5321, seq 4, length 64     13:18:44.512892 IP (tos 0x68, ttl 64, id 14538, offset 0, flags [none], proto ICMP (1), length 84)         192.168.1.254 > 192.168.1.146: ICMP echo reply, id 5321, seq 4, length 64     13:18:45.510794 IP (tos 0x0, ttl 64, id 2603, offset 0, flags [DF], proto ICMP (1), length 84)         192.168.1.146 > 192.168.1.254: ICMP echo request, id 5321, seq 5, length 64     13:18:45.519701 IP (tos 0x68, ttl 64, id 14539, offset 0, flags [none], proto ICMP (1), length 84)         192.168.1.254 > 192.168.1.146: ICMP echo reply, id 5321, seq 5, length 64     13:18:49.287554 IP6 (class 0x68, hlim 255, next-header ICMPv6 (58) payload length: 32) fe80::5a98:35ff:fe57:e070 > ff02::1:ff6b:e9b4: [icmp6 sum ok] ICMP6, neighbor solicitation, length 32, who has 2001:818:d812:da00:8ae3:abff:fe6b:e9b4           source link-address option (1), length 8 (1): 58:98:35:57:a0:70     13:18:50.013463 IP (tos 0x0, ttl 255, id 50737, offset 0, flags [DF], proto UDP (17), length 73)         192.168.1.146.5353 > 224.0.0.251.5353: 0 [2q] PTR (QM)? _ipps._tcp.local. PTR (QM)? _ipp._tcp.local. (45)     13:18:50.218874 IP6 (class 0x68, hlim 255, next-header ICMPv6 (58) payload length: 32) fe80::5a98:35ff:fe57:e070 > ff02::1:ff6b:e9b4: [icmp6 sum ok] ICMP6, neighbor solicitation, length 32, who has 2001:818:d812:da00:8ae3:abff:fe6b:e9b4           source link-address option (1), length 8 (1): 58:98:35:57:a0:70     13:18:51.129961 IP6 (class 0x68, hlim 255, next-header ICMPv6 (58) payload length: 32) fe80::5a98:35ff:fe57:e070 > ff02::1:ff6b:e9b4: [icmp6 sum ok] ICMP6, neighbor solicitation, length 32, who has 2001:818:d812:da00:8ae3:abff:fe6b:e9b4           source link-address option (1), length 8 (1): 58:98:35:57:a0:70     13:18:52.197074 IP6 (hlim 255, next-header UDP (17) payload length: 53) 2001:818:d812:da00:200:ff:fe00:22.5353 > ff02::fb.5353: [udp sum ok] 0 [2q] PTR (QM)? _ipps._tcp.local. PTR (QM)? _ipp._tcp.local. (45)     13:18:54.128240 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.1.87 tell 192.168.1.86, length 46     --- 192.168.1.254 ping statistics ---     5 packets transmitted, 0 received, 100% packet loss, time 4000ms      _cleanup tcpdump_               root@ubuntu:~# killall tcpdump >> /dev/null 2>&1     13:18:54.657731 IP6 (class 0x68, hlim 255, next-header ICMPv6 (58) payload length: 32) fe80::5a98:35ff:fe57:e070 > ff02::1:ff6b:e9b4: [icmp6 sum ok] ICMP6, neighbor solicitation, length 32, who has 2001:818:d812:da00:8ae3:abff:fe6b:e9b4           source link-address option (1), length 8 (1): 58:98:35:57:a0:70     13:18:54.743174 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.1.87 tell 192.168.1.86, length 46     25 packets captured     26 packets received by filter     0 packets dropped by kernel     [1]+  Done                    tcpdump -n -i eth0.2 -v      _tcpdump eth0.3 - test ping_               root@ubuntu:~# tcpdump -n -i eth0.3  icmp &     [1] 5324     root@ubuntu:~# ping -c5 -q -I eth0.3 192.168.1.254      PING 192.168.1.254 (192.168.1.254) from 192.168.1.147 eth0.3: 56(84) bytes of data.     tcpdump: verbose output suppressed, use -v or -vv for full protocol decode     listening on eth0.3, link-type EN10MB (Ethernet), capture size 65535 bytes     13:18:56.373434 IP 192.168.1.147 > 192.168.1.254: ICMP echo request, id 5325, seq 1, length 64     13:18:57.372116 IP 192.168.1.147 > 192.168.1.254: ICMP echo request, id 5325, seq 2, length 64     13:18:57.381263 IP 192.168.1.254 > 192.168.1.147: ICMP echo reply, id 5325, seq 2, length 64     13:18:58.371141 IP 192.168.1.147 > 192.168.1.254: ICMP echo request, id 5325, seq 3, length 64     13:18:58.373275 IP 192.168.1.254 > 192.168.1.147: ICMP echo reply, id 5325, seq 3, length 64     13:18:59.371165 IP 192.168.1.147 > 192.168.1.254: ICMP echo request, id 5325, seq 4, length 64     13:18:59.373259 IP 192.168.1.254 > 192.168.1.147: ICMP echo reply, id 5325, seq 4, length 64     13:19:00.371211 IP 192.168.1.147 > 192.168.1.254: ICMP echo request, id 5325, seq 5, length 64     13:19:00.373278 IP 192.168.1.254 > 192.168.1.147: ICMP echo reply, id 5325, seq 5, length 64     --- 192.168.1.254 ping statistics ---     5 packets transmitted, 1 received, 80% packet loss, time 4001ms     rtt min/avg/max/mdev = 13.666/13.666/13.666/0.000 ms      _cleanup tcpdump_               root@ubuntu:~# killall tcpdump >> /dev/null 2>&1     9 packets captured     10 packets received by filter     0 packets dropped by kernel     [1]+  Done                    tcpdump -n -i eth0.3 icmp      _check arp cache_               root@ubuntu:~# arp -n     Address                  HWtype  HWaddress           Flags Mask            Iface     192.168.1.254            ether   58:98:35:57:a0:70   C                     eth0.1     192.168.1.254            ether   58:98:35:57:a0:70   C                     eth0.2     192.168.1.254            ether   58:98:35:57:a0:70   C                     eth0.3


title: How do you route to secondary interface on the same physical port?

text: INTERNET<->(wan)BRIDGED_DEVICE(lan)<->ETH_ROUTER<->LAN _Problem:_   Need to access web server on BRIDGED_DEVICE's LAN from INTERNET via ROUTER (BRIDGED_DEVICE web server cannot be accessed form INTERNET since it has no Public management IP). _Attempt:_   Create a secondary/alias WAN Interface on ETH_ROUTER (e.g Primary: eth0.1 (for internet access) and Secondary: eth0.2 (for accessing web server on BRIDGED_DEVICE), (No VLANs).   * eth0.1 has a public IP;   * eth0.2 has a static private IP in the BRIDGED_DEVICE's subnet (e.g 10.0.X.Y). Iptables on ETH_ROUTER: Added a port forward (DNAT) from eth0.1 to eth0.2:               iptables -t nat -I PREROUTING -i eth0.1 -p tcp --dport 80 -j DNAT --to-destination 10.0.X.Y     iptables -t nat -I POSTROUTING -o eth0.2 -s 10.0.X.0/24 -j MASQUERADE      Stateful firewall w/ overall drop policy on FORWARD chain, hence:                iptables -I FORWARD -i eth0.1 -d 10.0.X.Y -p tcp --dport 80 -j ACCEPT      Can ping from ETH_ROUTER to BRIDGED_DEVICE but unable to reach the web server from Internet. I see packet cont increasing for the DNAT rule but not sure where it disappears in the ETH_ROUTER after that. ETH_ROUTER is the only device that can be configured to achieve this. If familiar with this scenario, please suggest what I may be missing or doing wrong here or suggest techniques to debug?


title: How do I see the contents of a drive in Debian command line?

text: I want to see what is on a drive so I can satisfy myself that it can be disconnected (unmounted?). This is a vm on ESXi with 3 datastores - first is the ESXi local storage, second is a nfs share on a NAS drive (that I want to remove), third is another nfs share on a 2nd NAS drive. I have found that the Debian vm will run fine with the 1st NAS drive disconnected from the network, but will not reboot in that state. I assume I need to unmount the drive concerned then remove datastore2 from the ESXi server. However I don't want to do this to find I have to retrace my steps. I expect to fing that datastore2 contains nothing but redundant data that was copied to datastore3 when it was added, but I would like to be able to 'browse' it first. Cheers, Gordon


title: How to determine what user was used to start Apache Tomcat last (or last few times)

text: On a Mac, or a Linux Tomcat install, how do I determine what user was used last to start Tomcat? Is there information in the logs somewhere to that effect? Assume that startup.sh and shutdown.sh are being used to control Tomcat. My best guess is the user(s) who have write access to Catalina.out are the most plausible suspects, but I wanted a hard and fast rule for determining who it is. Also it isn't currently running so don't say `ps -ef|grep -i Tomcat`


title: securely automating a script which requires a key to do its task

text: I have a script that downloads bank transactions to store in a database. To get these transactions requires a password for each account. The database is encrypted and requires a key to access it. All these keys and passwords are themselves encrypted and require a master key to retreive. The script prompts for the master key, uses this to retrieve all the necessary passwords and keys, and then does its work. Right now this script is being called manually. Automating it to run periodically is easy, except for the part of securing the master key. Simply storing it in a file in plaintext does not seem very secure, as anybody who manages to get read access to the file now has wide open access to a lot of sensitive information. Storing it in a way that the script has it (for example obfuscating it in a binary called by the script) won't work either, because then anyone who can execute the script has an attack vector there. I have read this question, the answer there appears to be "store it in a file" with added comments suggesting not in plain text. But even if the password is not plain text, it still seems like we have to communicate to the script how to read the file somehow, such as a decryption key or something, and we are back at square one.


title: Change terminal type for screen over a serial connection

text: I am connecting to an embedded Linux board using `screen` over a serial link and trying to change the terminal type, as the default `vt100` is pretty restrictive in terms of colours and scrolling etc. The `screen` manual suggests the configuration option `termcapinfo` but using that doesn't fix the issue. On the host machine, `TERM` is set to `xterm-256color` and when I connect to the target, using the `termcapinfo` setting in my `.screenrc`, `TERM` is still set to `vt100`. I am thinking maybe I should set something on the target machine?


title: Is there a right way to use one VPS backup file to build a clone VPS with it?

text: I tried many times to restore a tar ball from a different server to a fresh installed VPS with the same Linux Debian version (exactly the same) but every time when I restore the tar ball on a different fresh VPS, that VPS would reboot with no problem (at least if the tar ball from a VPS that uses the same virtualization system as the new one), but once it boots back on, I can't use the ssh terminal and even the site won't show up when I call the IP address. I simply use the following commands for backup and restore (taken from Ubuntu official help page):               sudo tar -cvpzf backup.tar.gz --one-file-system --exclude=/home/user/Backup_Files/backup.tar.gz /     tar -xvpzf backup.tar.gz -C /      The reason I wanna clone vps is that in case something happens to my vps, I'll be able to rebuild the server from scratch quickly without going through 4 hours of installing and configuration and forgetting something or losing configurations that I've built for years **So, can you anyone tell me the right way to fully backup a running vps on openvz?** +mind that no rescue mode in my openvz panel_


title: How to use the Cinnamon panel when using Awesome Window Manager in Cinnamon?

text: I am using `cinnamon 2.2.16-1`, `awesome 3.5.5-1` and awesome-cinnamon from the Arch Linux AUR. The `awesome-cinnamon` package basically just creates the `.desktop` and `.session` files to load `cinnamon` with `awesome wm` as the window manager. This is almost perfect for me, but I would like to experiment with using the `cinnamon` panel in addition to or instead of the `awesome` `wibox`, because the `cinnamon` panel has attractive icons for the audio, wifi and power controls. I can't seem to find any way to start the `cinnamon` panel. I am left thinking that the `cinnamon` panel must be part of `cinnamon's` window manager. It seems from googling that there used to be a program `gnome-panel` and `cinnamon-panel`, but these don't seem to exist anymore. Does anyone know of a way to get this working? cat /usr/share/xsessions/awesome-cinnamon.desktop:               [Desktop Entry]     Name=Awesome Cinnamon     Comment=Dynamic window manager     TryExec=/usr/bin/cinnamon     Exec=cinnamon-session-cinnamon --session=awesome     Type=XSession      cat /usr/share/cinnamon-session/sessions/awesome.session:               [Cinnamon Session]     Name=Awesome session     RequiredComponents=cinnamon-settings-daemon;awesome;     RequiredProviders=windowmanager;notifications;     DefaultProvider-windowmanager=awesome     DefaultProvider-notifications=notification-daemon      $ cinnamon-`Tab``Tab`:               cinnamon-desktop-editor           cinnamon-screensaver-lock-dialog     cinnamon-extension-tool           cinnamon-session     cinnamon-json-makepot             cinnamon-session-cinnamon     cinnamon-launcher                 cinnamon-session-cinnamon2d     cinnamon-looking-glass            cinnamon-session-properties     cinnamon-menu-editor              cinnamon-session-quit     cinnamon-screensaver              cinnamon-settings     cinnamon-screensaver-command      cinnamon-settings-users


title: Ways to organize and access frequently visited directories and files?

text: In my Ubuntu, I have added some frequented directories to the bookmarks of Nautilus, for visiting them quicker. Nautilus can consume a lot of memory, when it has been kept open for long and there have been many tabs opened in it. Nautilus can also close itself unexpectedly, and makes me lose track of what dirs I was working with. So I am thinking about some alternatives to Nautilus (both GUI and CLI are fine). I guess that command line is the simplest option. But I will miss the bookmark convenience of Nautilus.   1. What are some good practices/ways to remember and organize frequented dirs?   2. What I have thought is to create a dir, and store links to frequented dirs there. Are there better ways?   3. Is it possible to convert the dir bookmarks in Nautilus to links?   4. I am looking for where the dir bookmarks of Nautilus are stored, but to no avail:              $ find ~ -name nautilus | less          ./.config/nautilus     ./.gconf/apps/nautilus     ./.gconf/apps/ubuntuone/nautilus     ./.gnome2/accels/nautilus      I checked the above locations, and content of the files there, but didn't find anything for bookmarks.


title: Find kernel with specific commit

text: I have recently bought an Acer Aspire E1-572 with NetXtreme BCM57786 Gigabit Ethernet network card. The problem is that currently I cannot see it in `ifconfig`, but I can see it with `lshw`:                 *-network UNCLAIMED            description: Ethernet controller            product: NetXtreme BCM57786 Gigabit Ethernet PCIe            vendor: Broadcom Corporation            physical id: 0            bus info: pci@0000:01:00.0            version: 01            width: 64 bits            clock: 33MHz            capabilities: pm vpd msi msix pciexpress bus_master cap_list            configuration: latency=0            resources: memory:b0410000-b041ffff memory:b0420000-b042ffff memory:b0430000-b04307ff      Shortly, I have found this bug: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1242610 and it seems to be exactly my problem. It seems to be solved in this commit http://git.kernel.org/cgit/linux/kernel/git/davem/net- next.git/commit/drivers/net/ethernet/broadcom/tg3.c?id=68273712a19e9107a498a371532b3b3eb6dbb14c I am using Ubuntu 12.04 so there's a probability that (at some point) the patch will be backported, but I would really like to find (if there is any) a [preferably] stable kernel version that would contain this patch so I would be able to use my eth0. **How would I find a kernel binary that contains a specific commit?** Or find whether a specific kernel binary has a given commit? **UPDATE**               # uname -a     Linux laptop 3.8.0-33-generic #48~precise1-Ubuntu SMP Thu Oct 24 16:31:16 UTC 2013 i686 i686 i386 GNU/Linux      I installed it using:               apt-get install linux-generic-lts-raring


title: get age of given file

text: How can I get the age of a given file in, at least, days? I'm well aware of `ls -lh` and similar commands. I want something that will work sort of like this:               getfage <FILE> # prints out '12d' (12 days)      Also, this needs to be somewhat cross-platform since I'd also like to use this under Mac OS X, but the primary use-case is on my Linux-box. **NOTE** Since Linux doesn't track creation time, I'm looking for two-fold solution: one for _mtime_ (linux)--that is _the last time said file was modified_ --and one for Mac OS X, which can either deal with _mtime_ or creation time.


title: How do I download and launch a JNLP file in CentOS?

text: I'm using Amazon's GPU cluster to experiment with some HPC java code on CentOS. The Java application is in JNLP format and has a GUI. I've followed Amazon's getting started video, but I'm not sure how to use a web browser or otherwise download the file. Secondly I'm not sure how to launch this file since it requires a GUI. Any assistance would be appreciated.


title: What are the differences between various VM software?

text: I have only ever used VirtualBox and I would like to know, for example, what could I be missing from other offerings. I have heard of KVM and VMWare and I'm sure there's others. Short of reading Wikipedia articles on each (phew!), how do they differ?


title: How to iterate through multiple file extension without caring about case sensitivity?

text: I've seen various topics on how to iterate through multiple file extensions but in most case, the list is defined. example:               for file in ${arg}/**/*.{txt,h,py}     do         ....     done      As can be seen, `.TXT` files would be ignored. And sadly, the guy who answered it says it only works for bash4. but my setup uses bash3.x. Any ideas on how it can be done?


title: show colors and disable line wrap

text: Using the `less` paginator, you can use the `-r` option to properly display colored input and the `-S` option to disable line wrap. However, when using `less -rS` or equivalently `less -r -S`, colors are diplayed but lines are wrapped. How can this be achieved?


title: Trigger a login by plugging in a USB drive

text: OS: Linux, Mint. I want to have a system where I can insert a flashdrive into a computer, and using UDEV rules, have the system login a user account. I can do the UDEV part, but what command should I run to login? Google has not helped, nor has poking around the computer.


title: Local, timestamped logging of all ssh commands?

text: How can I keep a local, timestamped record of all remote commands I use in `ssh` (command-line openssh client started through `bash`)? **Requirements:**   * _Essential:_     * 100% client-side without relying on server logging     * Configured or installed per-user with logs stored in the user's home directory.     * Support for distinguishing between multiple simultaneous sessions with various users and hosts.     * Non-intrusive (no need to activate it each time and does not interfere significantly with using ssh)   * _High priority:_     * Either output is not logged or filtered out as much as possible     * Either password entries are not logged or the file is encrypted     * Indicates the actual commands used (after tab/ history completion, backspaces, `CTRL`+`C`, etc... have been processed)   * _Nice to have:_     * Also logs commands in chained sessions (commands entered during remote `ssh` or `su <user>` sessions)     * Session start and end should be logged     * A simple `bash`-based, non-root solution would be best (perhaps an `alias` or `bash` wrapper script for the `ssh` command?) **My skill level:**   * I am not new to programming, but am still learning `bash` and the "Linux way", so code samples with brief explanations would be most appreciated. **Possible strategies**   * _keylogger_ -- Problem: logs passwords, does not log tab/ history completion (see glenn's answer)   * _`screen` with scrollback dumping once per second and `diff` between them to find new scrollback lines_ -- Problem: how can this be implemented in an useful automated way?   * `ssh "$@" | tee >(some_cleaner_function >> $logfile)` -- Problem: cannot handle multiline commands or history in chained sessions, careful cleanup needed (see my answer)   * A combination of some of the above **An example** The following SSH session:               user@local:~$ ssh user@remote     Last login: Tue Jun 17 16:34:23 2014 from local     user@remote:~$ cd test     user@remote:~/test$ ls     a  b     user@remote:~/test$ exit      Might result in a log at `~/logs/ssh.log` such as:               2014-06-17 16:34:50   [user@remote - start]     2014-06-17 16:34:51   [user@remote] cd test     2014-06-17 16:34:52   [user@remote] ls     2014-06-17 16:34:53   [user@remote] exit     2014-06-17 16:34:53   [user@remote - end]      Or, perhaps a separate log will be created for each session with the command line used to start the session at the top of the file.


title: Cannot install mysql-server-5.5/the following packages have unmet dependicies

text: I'm using ubuntu 14.04. I tried entering `mysql` with the following command:               mysql -u root -p      and I got the following message: The program `mysql` can be found on the following packages:   * `mysql-client-core-5.5`   * `mariadb-client-core-5.5`   * `mysql-client-core-5.6`   * `percona-xtrabd-cluster-client-5.5` I then typed in:               sudo apt-get install mysql-client-core-5.6      After this was installed, I tried connecting to `mysql` again using:               mysql -u root -p      I then got the error message:               ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)      After searching online, I found out I needed to install `mysql` server and so I wrote in the following command               sudo apt-get install mysql-server      I then got the message ;               Some packages could not be installed. This may mean that you have     requested an impossible situation or if you are using the unstable     distribution that some required packages have not yet been created     or been moved out of Incoming.     The following information may help to resolve the situation:          The following packages have unmet dependencies:      mysql-server : Depends: mysql-server-5.5 but it is not going to be installed      E: Unable to correct problems, you have held broken packages.      I've been looking on line for the past hour for a solution, but other people who had a similar error but had it from upgrading `mysql` and thus there solution were ineffective for me.


title: SELinux stops Google Chrome from executing

text: I can no longer start Google Chrome on Fedora 14 (using GNOME). ### strace               strace google-chrome     ...     readlink("/proc/self/exe", "/opt/google/chrome/chrome"..., 4096) = 25     socketpair(PF_FILE, SOCK_SEQPACKET, 0, [11, 12]) = 0     stat64("/opt/google/chrome/chrome-sandbox", {st_mode=S_IFREG|S_ISUID|0755, st_size=14008, ...}) = 0     access("/opt/google/chrome/chrome-sandbox", X_OK) = 0     socket(PF_FILE, SOCK_DGRAM, 0)          = 13     clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb452fae8) = 21093     recvmsg(11, 0xbfc79ac8, 0)              = ? ERESTARTSYS (To be restarted)     --- {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=21093, si_status=0, si_utime=0, si_stime=0} (Child exited) ---     sigreturn()                             = ? (mask now [])     recvmsg(11, /opt/google/chrome/chrome: error while loading shared libraries: cannot restore segment prot after reloc: Permission denied      ### logs               fgrep -i chrome /var/log/messages     Sep 17 20:37:08 a kernel: [ 2084.648737] type=1400 audit(1316284628.960:21895): avc:  denied  { execmod } for  pid=20664 comm="chrome" path="/opt/google/chrome/chrome" dev=dm-1 ino=3147775 scontext=unconfined_u:unconfined_r:chrome_sandbox_t:s0-s0:c0.c1023 tcontext=system_u:object_r:execmem_exec_t:s0 tclass=file     Sep 17 20:46:25 a kernel: [ 2641.204736] type=1400 audit(1316285185.516:21896): avc:  denied  { execmod } for  pid=21057 comm="chrome" path="/opt/google/chrome/chrome" dev=dm-1 ino=3147775 scontext=unconfined_u:unconfined_r:chrome_sandbox_t:s0-s0:c0.c1023 tcontext=system_u:object_r:execmem_exec_t:s0 tclass=file     Sep 17 20:46:33 a kernel: [ 2649.438209] type=1400 audit(1316285193.749:21897): avc:  denied  { execmod } for  pid=21069 comm="chrome" path="/opt/google/chrome/chrome" dev=dm-1 ino=3147775 scontext=unconfined_u:unconfined_r:chrome_sandbox_t:s0-s0:c0.c1023 tcontext=system_u:object_r:execmem_exec_t:s0 tclass=file     Sep 17 20:46:39 a kernel: [ 2655.533882] type=1400 audit(1316285199.845:21898): avc:  denied  { execmod } for  pid=21094 comm="chrome" path="/opt/google/chrome/chrome" dev=dm-1 ino=3147775 scontext=unconfined_u:unconfined_r:chrome_sandbox_t:s0-s0:c0.c1023 tcontext=system_u:object_r:execmem_exec_t:s0 tclass=file      ### info about system               # lsb_release -a     LSB Version:    :core-4.0-ia32:core-4.0-noarch     Distributor ID: Fedora     Description:    Fedora release 14 (Laughlin)     Release:    14     Codename:   Laughlin     # uname -a     Linux a 2.6.35.14-96.fc14.i686.PAE #1 SMP Thu Sep 1 12:31:46 UTC 2011 i686 i686 i386 GNU/Linux      ### package info               rpm -qa | fgrep google-chrome-stable     google-chrome-stable-14.0.835.163-101024.i386      I suspect that the issue is being caused by SELinux. How can I make it so that SELinux allows Google Chrome to start without issue?


title: How can I have 400% CPU occupied on 2 cores

text: I understand that `Σ(%CPU) ≤ logicalcores*(1+ε)` (where ε is measure and rounding error). But, how can I have on a 2 core system 2 different processes, each taking 200% of CPU (as measured by htop)? **EDIT** Cores in above equation means logical cores i.e. taking into account all hyperthreading, number of CPUs etc. **EDIT 2** Despite htop displays the number of processors I attach cpuinfo               processor   : 0     vendor_id   : GenuineIntel     cpu family  : 6     model       : 23     model name  : Intel(R) Core(TM)2 Duo CPU     T9600  @ 2.80GHz     stepping    : 10     cpu MHz     : 800.000     cache size  : 6144 KB     physical id : 0     siblings    : 2     core id     : 0     cpu cores   : 2     apicid      : 0     initial apicid  : 0     fpu     : yes     fpu_exception   : yes     cpuid level : 13     wp      : yes     flags       : 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 lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm ida dts tpr_shadow vnmi flexpriority     bogomips    : 5585.20     clflush size    : 64     cache_alignment : 64     address sizes   : 36 bits physical, 48 bits virtual     power management:          processor   : 1     vendor_id   : GenuineIntel     cpu family  : 6     model       : 23     model name  : Intel(R) Core(TM)2 Duo CPU     T9600  @ 2.80GHz     stepping    : 10     cpu MHz     : 800.000     cache size  : 6144 KB     physical id : 0     siblings    : 2     core id     : 1     cpu cores   : 2     apicid      : 1     initial apicid  : 1     fpu     : yes     fpu_exception   : yes     cpuid level : 13     wp      : yes     flags       : 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 lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm ida dts tpr_shadow vnmi flexpriority     bogomips    : 5586.38     clflush size    : 64     cache_alignment : 64     address sizes   : 36 bits physical, 48 bits virtual     power management:


title: Is it possible to save a KDE desktop configuration?

text: Is it possible to save a desktop configuration while using KDE Plasma Desktop? I mean, I have customized my desktop with a set of plasmoids, each with its own custom settings, and I'd like to save the state of the whole Desktop in order to restore it when I want to. For what I've seen, some of these plasmoids can have their preferences saved and restored, but each of these work on its own. I can't find any option from the Plasma GUI, it's just me or this is simply not possible? Anyway, even without the GUI, these setting should be saved somewhere in my system, I.E. to restore the Desktop to its current state whenever I boot up the system. Where can I find them?


title: Ctrl-C is ignored by pppd when put in a shell script

text: I'm trying to connect to GPRS network through a serial port connected GSM modem. When I call `/usr/sbin/pppd call <peer_name>` from the command line, it correctly receives and handles `Ctrl`+`C` from keyboard. But when I put the exact same command in an empty shell script (with or without the shebang `#!` at the top), `chmod +x` it and run it from the shell prompt, then `pppd` starts to run - But it totally ignores `Ctrl`+`C` key combination. `Ctrl`+`Z` works normally though. This is the contents of the `pppd` peer file               nodetach     dump     connect "connect_script"     disconnect "disconnect_script"     /dev/ttyS0     noauth      I tested another peer file which I had created to connect to a PPTP VPN server - with the same result. PPTP does not need a chat script, so I'm ruling out problems with `chat` command or serial port link properties. OS is debian 7. Any ideas what is happening here?


title: Dnsmasq white list for specific clients on network

text: I'd like to use dnsmasq to set up a white list for certain clients on my network. For instance, I'd like to have these rules for clients in the range 192.168.1.10 - 192.168.1.20:               no-resolv     server=/pbskids.org/192.168.0.1     server=/disney.go.com/192.168.0.1      This way, the only websites accessible from these clients are the ones that are whitelisted. Clients on the network outside of that range should be able to use whatever DNS server they want. How can I do this? **EDIT:** This is what I have in dnsmasq.conf so far:               bogus-priv     domain-needed     no-resolv          server=/pbskids.org/192.168.0.1     server=/disney.go.com/192.168.0.1      This has the intended result of denying upstream DNS lookups to all clients on the network. Now what I need is a way to allow certain clients to use upstream DNS instead. I don't think an option like this exists but maybe it will help get my idea across:               use-resolv --source 192.168.1.150      i.e., if the client's IP address is 192.168.1.150 then use upstream DNS servers. Alternatively, what I was originally looking for was something like this:               no-resolv --source 192.168.1.100      i.e., if the client's IP address is 192.168.1.100 then don't use upstream servers at all. I hope this helps clarify my question. If I can't do something like this, then maybe what I need is two separate networks.


title: Hard disk drive disappeared

text: Yesterday I performed a hard-reset while Linux was booting. This led to a hard issue with the HDD (UNC while recovering journal). I had to use `ddrescue` instead of `dd` because `dd` crashed on I/O error. I did the following:               # ddrescue -f /dev/zero /dev/sda      It went through the whole 250 GB of `/dev/sda`. After rebooting, both BIOS and LiveCD didn't see the HDD. When I launch a LiveCD, there is no `/dev/sda`, and no HDD in `/dev/disk/*`. SATA controller is fine:               $ lspci | grep -i sata     00:1f.2 SATA controller: Intel Corporation NM10/ICH7 Family SATA Controller [AHCI mode] (rev 02)      Question is: did I dg too deep? Is my HDD gone forever or is it fixable?


title: Where can I find the source code of Gnome-Shell 3.10 Status Indicator/Bar?

text: In Gnome Shell 3.10 indicators (sound, network,..) were merged in single status bar. I read that applications need to make gnome shell extensions to show an icon there. So I searched for default indicators in `gnome-shell- extensions`, but negative results. Where can I find the code of default indicators in Gnome source git repository? and In which package it has been built in Debian or Ubuntu repository? ![enter image description here](http://i.stack.imgur.com/KJfBd.png)


title: How can I find and/or print sudo's lecture file?

text: I'm using Ubuntu and I would like to find and/or print the sudo lecture that is printed to the screen the first time a user executes a sudo command. How can I do this? I'm unable to find the lecture file.


title: Set scroll speed and have a show desktop keyboard command on Mint 16

text: How can I change the scroll speed and have a show desktop keyboard command? I cannot figure out these two things. I have looked around, but cannot find any definitive or working advice. edit_ ** ___ __ ___ __ ___ __ ___ __ ___ __ ___ _** my props for my mouse:               me@me-mint ~/ $ xinput --list-props "USB Optical Mouse"     Device 'USB Optical Mouse':         Device Enabled (128):   1         Coordinate Transformation Matrix (130): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000         Device Accel Profile (265): 0         Device Accel Constant Deceleration (266):   1.000000         Device Accel Adaptive Deceleration (267):   1.000000         Device Accel Velocity Scaling (268):    10.000000         Device Product ID (247):    1121, 19812         Device Node (248):  "/dev/input/event5"         Evdev Axis Inversion (269): 0, 0         Evdev Axes Swap (271):  0         Axis Labels (272):  "Rel X" (138), "Rel Y" (139), "Rel Horiz Wheel" (264), "Rel Vert Wheel" (274)         Button Labels (273):    "Button Left" (131), "Button Middle" (132), "Button Right" (133), "Button Wheel Up" (134), "Button Wheel Down" (135), "Button Horiz Wheel Left" (136), "Button Horiz Wheel Right" (137)         Evdev Middle Button Emulation (252):    0         Evdev Middle Button Timeout (253):  50         Evdev Third Button Emulation (254): 0         Evdev Third Button Emulation Timeout (255): 1000         Evdev Third Button Emulation Button (256):  3         Evdev Third Button Emulation Threshold (257):   20         Evdev Wheel Emulation (258):    0         Evdev Wheel Emulation Axes (259):   0, 0, 4, 5         Evdev Wheel Emulation Inertia (260):    10         Evdev Wheel Emulation Timeout (261):    200         Evdev Wheel Emulation Button (262): 4         Evdev Drag Lock Buttons (263):  0


title: Delete every users from a group

text: I search **a clean way** to delete every users from the 'sudo' group. On several distributions the user created during the installation process has sudo rights, I don't want this. I search for an automated method working for (nearly) every situations. Basically, I want to empty a group. To remove every users : `GROUP=my_group; for u in $(getent group $GROUP | sed -e 's/^.*:.*:.*://' -e 's/,/ /g'); do echo gpasswd --delete $u $GROUP; done`   This command line works :   1. if the group doesn't exist   2. if the group is empty   3. if the group contains one user   4. if the group contains several users   So everything is okay. But is their something simplier ? Another way is to delete the group, and recreate it. Ugly ?


title: Running parallel bash jobs on a HPC cluster using GNU parallel

text: On an HPC cluster I am trying to run multiple bash scripts (`permute2.sh`) from 1 bash script using GNU parallel, however it doesn't complete every job. It randomly completes one job, while it is stuck doing the other. **permute1.sh:**               PROCS=144      permuations=1000     seq 1 $permuations | parallel -j $PROCS sh permute2.sh {}      **permute2.sh** (taking 100 random lines from a file and performs some actions on it for permutation)               id=$1     randomlines=100     awk 'BEGIN{srand();} {a[NR]=$0}     END{for(I=1;I<='$randomlines';I++){x=int(rand()*NR);print a[x];}}'     FILE.txt > results/randomlines.$id.txt          # do stuff with randomlines.$id.txt..       When I run `permute1.sh` I can see it creates 144 files, for each cpu 1 (randomlines.1.txt - randomlines.144.txt), but most of them are empty and stopped working, and some are completed. What am I doing wrong?


title: How I can get keycode and make multimedia keys usable?

text: I've an Asus N73S which have non-functional multimedia keys. I have "direct access" keys but also "indirect access" keys (via Fn + ...). The "Windows" key doesn't work either. These keys don't respond with xev or showkey and nothing appears in /var/log/messages How to make the buttons usable ? Another strange trick, only the two buttons for adjusting the brightness (Fn + F5 and Fn + F6) are functional. Where this thing is set? I'm on Fedora 15 (Lovelock).


title: Preventing ChromeOS from blanking the screen when working on a different tty

text: I am running Archlinux in a chroot alongside Chrome OS on a chromebook. The original project is there, my fork of it is here (mostly similar). The issue is that the display power management of Chrome OS only takes touchpad and keyboard input made in Chrome OS's X on tty1 into account to reset the screen blanking countdown. So, if I am working in my chroot, on tty3 (console) or on tty4 (Arch's own X server), the backlight turns off after 5 minutes, whether I am idle or active. I have to then come back to tty1 to register some input there and get powerd to reactivate the backlight. I don't want to deactivate powerd in Chrome OS, neither do I want to lengthen the default timeouts (which is what the original author or the chroot setup scripts did). I just want the screen backlight to turn off after a few minutes of inactivity, and to remain on when I am active in the chroot environment or in Chrome OS. Moreover, I want to minimally modify Chrome OS, as it's updated quite often and I want to keep the chroot reinstall script simple. So, my idea is that I will program a couple of daemons. Daemon A runs in the chroot and detects whether I make keyboard or mouse inputs in Arch. Daemon C runs in chrome OS, checks the output of daemon A and does whatever is most appropriate to reset the screen blanking and power saving counters. However, if user activity in the chroot can be figured out reading some /dev node, daemon A would not be necessary. **Can the age of the last user activity in the chroot (on /dev/tty3 and /dev/tty4) be somehow deduced from reading some /dev file, or by any other way from _without_ the chroot?** Secondly, commands such as `setterm -blank poke` seem to work from within the chroot, so daemon C may not be necessary if daemon A can alone reset the screen blanking countdown. Hence, the second question: **Can the age of last user activity in the chroot (on /dev/tty3 and /dev/tty4) be somehow deduced from reading some /dev file, or by any other way from _within_ the chroot?** If you think that resetting the counters requires daemon A and C to both exist and communicate: **How is modern IPC done in GNU/Linux in practice? System V? POSIX? /proc files read and write? What would best work in my case?** Finally, **do you know something else than`setterm -blank poke`, that the watchdog program should use to keep the backlight alive?** Sorry for the long question, I hope you didn't have to read it all :)


title: How to print from remote over SSH to local LAN printer?

text: OK, so it is fairly straight forward to to run apps from a remote server on my local X screen as though they were local apps. The question is, when trying to print, the remote app only sees printers on the remote side. Is it possible (surely it is) to port forward the local CUPS server to the remote session? If so, how? I have tried using the -L option and the printer (515) service, but to no avail.


title: Best way to use a shell with Cygwin in Windows 7

text: I installed Cygwin, to be disappointed that bash by default runs within "cmd.exe". I googled around and found Console2. It's not a particularly well- designed application, as doing adjustments is slightly painful, although most of the time it works well. I am still looking for a better way to survive in a Windows environment as even Console 2 occasionally crashes e.g. when trying to resize my terminal when editing in vim and there are plenty of other annoyances that I'm really not satisfied with. Any ideas? I tried using Cygwin via PuTTY and that was an equally bad user experience.


title: Delete a block of lines with a condition on the last line

text: I have a log-file where at the end of a series of lines you can see if this block is relevant. Now I'm looking for a command like sed to delete de blocks ending with "Content-Length: 0" and beginning with the last "--" before this line. I tried `sed -n "/--/,/Content-Length: 0/d"` but this takes the first "--" and the first "Content-Length: 0" and deletes it. ex :               line 1 "--"       line 2        line 3 "Content-Length: 20"       line 4 "--"       line 5       line 6 "Content-Length: 0"       i want to delete line 4,5 and 6 not line 1 to 6 how can i do this? The answer to work with `tac` instead of `cat` does the job! but ultimately i would like to use this in a `tail -f` construction


title: Whats the history behind the fork bomb?

text: I read other question about its work and other things that **Fork bombs** operate both by consuming CPU time in the process of forking, and by saturating the operating system's process table. A basic implementation of a fork bomb is an infinite loop that repeatedly launches the same process. but really i want to know whats the story of this command ? why this ? `:(){ :|:& };:` .


title: Linux process scheduling - Cap/Weight based?

text: I am just trying to understand the basics of Linux scheduler.   * Is Linux scheduler a Cap based or weight based scheduler? I was previously using Xen. Now I am moving from Xen to KVM. I read VMs are normal process and thus will follow the scheduling policies of the linux scheduler. I was previously using Xen's credit scheduler which had the capability to set cap/weight for vms. I am searching for equivalent capability and also basic understanding of the linux scheduler. I am using Centos 5.6 . Which still uses 2.6.18. I dont think CFS is present in the kernel I am using.


title: Restrict local website to selected users

text: Suppose I have two local websites under `/var/www/mysite1` and `/var/www/mysite2` via apache I can access them via `localhost/mysite1` and `localhost/mysite2`. The pages are for local use only and I have multiple users on my machine, say `user`, `user1` and `user2`. Is it possible, that `user` can view both sites, but `user1` only `mysite1` and `user2` only `mysite2`?


title: emacs: recognising the shebang line

text: How can I configure Emacs to recognise certain she-bang lines? it recognises the shebang line:               #!/usr/bin/env ruby      but not the shebang line of               #!/usr/bin/env ruby1.9      I figure there must be an alist somewhere with the list of scripting languages called by /usr/bin/env and the mode, but I can't find it.


title: What is the difference between these two SSHD configs?

text: # 1               Match Group GROUPNAME, User *,!root      # 2               Match Group GROUPNAME User !root      **My question:** What is the difference between #1 and #2 in the SSHD_CONFIG?


title: scp hardlocking my server (both ways)

text: I have this strange issue. `scp` is hard locking my server. I have tried `memcheck`, tried downloading big files using `wget`, tried `speed` test in `openssl` and everything works just fine, yet every time I try to copy something (from or to the machine) using `scp`, it hard locks the machine. Not even sysrq magic key combos work. What could be the cause of this? I have no idea where to look. Edit: I just managed to crash the system using nfs server.


title: How to remove duplicate lines inside a text file?

text: A huge (up to 2 GiB) text file of mine contains about 100 exact duplicates of every line in it (useless in my case, as the file is a CSV-like data table). What I need is to remove all the repetitions while (preferably, but this can be sacrificed for a significant performance boost) maintaining the original sequence order. In the result each line is to be unique. If there were 100 equal lines (usually the duplicates are spread across the file and won't be neighbours) there is to be only one of the kind left. I have written a program in Scala (consider it Java if you don't know about Scala) to implement this. But maybe there are faster C-written native tools able to do this faster?


title: How to "get" a HTTPS website running?

text: I have a website serving several pages that can be reachable via HTTP. How can I make these sites available via standard HTTPS? (not self-signed). What are the steps? (go to a CA, and then?) Can someone please describe the full process in steps?


title: What are the difficulties in importing features of Android, like Unity3D Player, to Linux in general?

text: We know that Android is an open source Linux-based distro. And we know some features developed for Android are required for the Linux community for many years, and are denied (like Unity3D Player). What are the difficulties in importing Android features to other Linux distributions, like Ubuntu, Fedora and others?


title: dhcpd on two network interface how to?

text: I have an embedded system that has Ethernet and wifi. I want to setit up in a way that it provides IP to both interfaces. The system uses BusyBox. and I an new in this area. can you provide a sample configuration that I can run to setup dhcpd for both of these interfaces? Should I run two instance of dhcpd to do this? The Linux is based on TI EZSDK ( for arm processors)


title: Running cron jobs under php ver. 5.4

text: My hosting company switched me to php version 5.4. I run a Drupal site (D7.) They say: _You'll want to make sure your crons use "/usr/php/54/usr/bin/php" instead, as otherwise it will use PHP 5.2._ How do I do that? Change the php.ini file? Create a new file? What is the exact syntax for it?


title: Does [[:space:]] work for sed patterns on all Linux distros?

text: Using `[[:space:]]` looks a little non-elegant and, quite frankly, Microsoft- ish for `sed` match patters. I was trying to extract "Last" out of "First Last" and either of the following worked:               echo "First Last" | sed s/First //     echo "First Last" | sed s/First\s//      What did work is               echo "First Last" | sed s/First[[:space:]]//      I was wondering:   1. Is there is a more minimalistic notation to match a whitespace in `sed`?    2. Does `[[:space:]]` work on all Linux distros?


title: Rolling back a file

text: I have a situation, a colleage of mine overwrote PHP files that I've made changes to , is it possible to roll back a file to a previous working version using the command line. No svn repositories are available and also not any backups.


title: How to merge two files with different number of rows in shell?

text: I have file1 like this:               CHR                     SNP     TEST   A1   A2                 GENO   O(HET)   E(HET)            P         0         AFFX-SNP-000541      ALL    0    0                0/0/0      nan      nan            1        0         AFFX-SNP-000541      AFF    0    0                0/0/0      nan      nan           NA        0         AFFX-SNP-000541    UNAFF    0    0                0/0/0      nan      nan           NA        0         AFFX-SNP-002255      ALL    0    0                0/0/0      nan      nan            1        0         AFFX-SNP-002255      AFF    0    0                0/0/0      nan      nan           NA        0         AFFX-SNP-002255    UNAFF    0    0                0/0/0      nan      nan           NA        1                 rs12103      ALL    C    T           55/250/317   0.4019   0.4113       0.5596        1                 rs12103      AFF    C    T                0/0/0      nan      nan           NA        1                 rs12103    UNAFF    C    T                0/0/0      nan      nan           NA        1         rs12103_1247494      ALL    C    T           55/250/321   0.3994   0.4097       0.5581        1         rs12103_1247494      AFF    C    T                0/0/0      nan      nan           NA        1         rs12103_1247494    UNAFF    C    T                0/0/0      nan      nan           NA      And file2 like:               CHR                     SNP   A1   A2          MAF  NCHROBS        0         AFFX-SNP-000541    0    0           NA        0        0         AFFX-SNP-002255    0    0           NA        0        1                 rs12103    C    T       0.2894     1244        1         rs12103_1247494    C    T       0.2875     1252      I would like to merge file2 with file1 based on the SNP name and the TEST==ALL and keep the CHR, SNP, P, and MAF in the output file3. Does anybody know the best way for that in terminal (Unix) shell? A desired output would be:                 CHR                     SNP  MAF        P        0         AFFX-SNP-000541   NA         1        0         AFFX-SNP-002255   NA         1        1                 rs12103   0.2894     0.5596        1         rs12103_1247494   0.2875     0.5581


title: Mailing out a customised content based on specific search in a logfile

text: Using below `test.sh`, I am getting result in `dump.txt` as below: **test.sh:**               #!/bin/bash          #"Maxl-script" zone starts.....     essmsh -l admin password -s localhost -i << EOF          spool on to 'dump.txt';     display session all;     spool off;          EOF     #"Maxl-script" zone ends.....      **dump.txt:**               user                session             login_time          application         database            db_connect_time     request             request_time        connection_source   connection_ip       request_state     +-------------------+-------------------+-------------------+-------------------+-------------------+-------------------+-------------------+-------------------+-------------------+-------------------+-------------------      admin                                 0                   9                                                           0 none                                  0 Not Requested*      a00:bf32::                          admin                         989855740                1335 DRRDEVMH            DRRPRODB                           1201 none                                  0 Not Requested       a00:8a45::                          admin                        1768947706                 932 test                test                                916 none                                  0 Not Requested       a00:94b6::                               WARNING - 1241024 - Possible string truncation in column 1.      WARNING - 1241028 - Output column defined with warnings.      WARNING - 1241024 - Possible string truncation in column 9.      WARNING - 1241028 - Output column defined with warnings.      WARNING - 1241024 - Possible string truncation in column 10.      WARNING - 1241028 - Output column defined with warnings.      OK/INFO - 1241044 - Records returned: [3].      As we can see in the last line of `dump.txt` there is a string `Records returned: [3]`. That digit 3 is my target, I want to send a email notification to users having following Lines as Email body:               Total Number of Sessions running = 3           NOTE: This is an automatically generated email, please don't reply to it.      After Googling, I have managed to get below method to get it done. Can anybody please help me out for how to use `sed` or any other method to meet my objective in above script?               $ var=Records returned :     echo "Total Number of Sessions running = $var | sed 's/.*://' " > file.tmp      echo -e "\n" >> file.tmp      echo "NOTE: This is an automatically generated email, please don't reply to it."  >>   file.tmp      fi          mailx -s "Subject" emailaddresses < file.tmp     rm file.tmp      **NOTE:** `Records Returned...` line will be always the last line in **dump.txt**.


title: Mount Google Drive in Linux?

text: Now that Google Drive is available, how do we mount it to a Linux filesystem? Similar solutions exist for Amazon S3 and Rackspace Cloud Files.


title: Is oops of kernel tainted by staging device less likely to be investigated?

text: I understand that kernels tainted by binary modules are less likely to be investigated by kernel maintainers. However what is the policy if kernel is tained by staging driver (if the staging driver is broken it is still problem in kernel hence some Linux developer might be interested). Does anyone knows the current policy (most resources I found simply states to "uninstall the binary ATI/NVidia drivers" - I guess it is the most popular way of tainting the kernel).


title: How to calculate values in a shell script?

text: I run this command in the terminal:               grep "bla bla blah" blah* | echo "Blah: $(wc -l) / $(ls | wc -l) * 100"      And I get this output:               Blah: 44 / 89 * 100      What I expect to see:               49.4      Is there a way to obtain the desired output using just the bash commands? I don't prefer scripts I am planning to pipe the output.


title: Faster alternative to ArchiveMount?

text: At the moment I am using `ArchiveMount` to mount a 123,000 kb archive that contains more then 3 million files inside. So far it has been mounting for 5+ hours and still isn't finished. Is there a better way to mount a `.tar.gz` file? I am trying to mount to a folder, and uncompressed it takes a few gigs. I don't even need write mode, just read-only is sufficient.


title: What is the most compatible Linux distribution for MacBook Pro?

text: Here's the minimal requirements:   1. two-fingers movement on touchpad for scroll   2. using the lower-powered GPU as default card   3. sleep on lid close   4. some key (control or command) + LMB for RMB Nice-to-have:   * "squeeze" gesture to zoom in   * working multimedia keys   * GPU switching on-the-fly If you know a distro that qualifies, can you also mention all extra features you know it supports.


title: Bash - test for newline?

text: In various places around the web I've found:               \015      \012     \x0a - hex     \n     \r      all as synonyms for various newlines / carriage returns... But in this small script I cannot recognise when I come across a newline - can someone tell me what I should be checking for in the if line ?               #!/bin/bash          test="this is a     test"          for a in "$test"; do                  if [[ "$a" == '\012' ]] ; then                     echo "FOUND NEWLINE"             fi          echo "$a"          done


title: string substitutions: all occurrences

text: A simple question, but I can't find the answer. the zsh documentation overwhelms me :-(               function z ()     {       echo ${1:s/the/THE}     }          $ z thethethe     THEthethe      ... How can I get _all_ 'the' to be replaced with 'THE', not just the first occurrence? With zsh it's the easiest things that seem to be the hardest to find examples for.


title: How can I access a remote Linux VM behind a firewall?

text: One of my customers runs a Linux VM on his PC and I need to access it remotely. This is a PC computer, not a server, so it is connected to the internet most of the time. It has a firewall too. I need to administer this Linux VM sometimes to install new software or access its database. What is the best way for me to get remote access? Note that this PC is on a normal at-home internet connection. Its IP address is not a server IP address, it's hidden behind the ISP provider. I am located at work in my office. If needed, I have a Linux PC server which has a fixed IP address at my disposal.


title: Which editor (or plugin) makes a version control workflow feel most first-class?

text: By "first class" I can just work by forking and merging my code willy-nilly, several times every minute, without ever thinking about the VCS.... I'm looking for an editor environment where the most common thing one does is fork!


title: How to reinstall grub to the EFI partition after initially installing it in Linux root. Do I have to start over?

text: My machine was running Mint 15 KDE 64-bit (GPT partitioning, EFI bootloader without 'secure boot'), and I wanted to try Mint 16 before committing to it. So I installed it into another partition and told it to put GRUB into `/dev/sda6` instead of `/dev/sda`. I then ran the Ubuntu boot-repair tool on my Mint 15 setup, which detected and added Mint 16 to 15's GRUB menu. So far, so good. I can boot 16 by selecting 15's GRUB from my EFI boot menu (I'm using rEFInd for that), and having that boot 16 for me. But now I want to make 16 directly bootable from rEFInd - so it won't rely on keeping 15 around. Is boot-repair still the tool for the job? Mint 16 seems to know how to handle EFI booting directly, so I would expect it to have its own tools for managing the boot process. There's a KDE GRUB2 bootloader tool, but that just seems to manage the grub menu entries in my partition. It does have an option on its 'Advanced' tab to 'Install/Recover Bootloader', but that tool just lists out my partitions - and doesn't show my EFI partition. I guess, because I didn't set up EFI booting at install time, I also don't have `/boot/efi` mounted. Any advice on how to proceed?


title: Microphone - static background noise suppression on Linux

text: My soundcard is Realtek ALC 892. On Windows 7 I use official Realtek drivers, on Linux I use PulseAudio (on Ubuntu 13.10). On both Windows and Linux, when I enable microphone boost +30db (required because my microphone is quiet), I get very annoying and loud background noise (I also confirmed the background noise with Audacity on both systems). However, Windows Realtek drivers have noise suppression option which works (after enabling it, Audacity shows no background noise and my ears also confirm that there is no background noise). ![Image showing noise suppression option](http://i.imgur.com/btvyDTM.png)      My question is how can I enable background noise suppression in ALSA/PulseAudio? Is there any module I can install or maybe there is a setting for it that can be enabled in config file? I can't find solution for it and this is the only thing that prevents me from switching to Linux completely - as I talk using microphone a lot and on Windows the Realtek software removes the background noise completely and PulseAudio doesn't remove it, which means the recorded voice on Linux is very bad. I know I could buy better soundcard and microphone, but as I said, Windows Realtek drivers remove the noise on software level in real time (ie no noise when talking on TeamSpeak3/Steam/whatever voip programme) so I hope that there is such option on Linux as well. This is also crossposted on Ask Ubuntu


title: Why do upgrades to KDM/KDE not preserve changes to configuration files?

text: The `kdebase-workspace` package on Arch Linux only preservers changes made to `/usr/share/config/kdm/kdmrc` when the package is updated. I need to edit `/usr/share/config/kdm/Xsetup` to get my monitors to rotate correctly, but the changes get lost every time `kdebase-workspace` gets updated. The Arch Wiki recommends copying `/usr/share/config/kdm/Xsession` to `/usr/share/config/kdm/Xsession.custom`. I could do this with `/usr/share/config/kdm/Xsetup`, but I thought files in `/usr/share/` are supposed to be managed by the package manager. It seems like this might be a bug in the package (i.e., should it be saving all the configuration files) or should I be making a change in `/usr/share/config/kdm/kdmrc` to tell it to look some place else and if so where?


title: How can I block select in Konsole?

text: In terminal emulators like GNOME terminal, I can hold the control key and use my mouse to select a block of text. Doing the same in Konsole has no effect -- the mouse simply selects one character after another, to the end of each line, wrapping around, as if I were using GNOME terminal and selecting text without holding the control key. How can I block select text in Konsole?


title: Two users, full access to same folder

text: I have a laptop running Arch Linux, and an owncloud-client. I have an owncloud server on my local network. When outside of my local network, I must use a dyn dns URL to get to my server. When on the local network, any queries to that same URL (Or just the IP address of the network as it appears on the WAN) are terminated (this is a network thing, not my computers). So. I want to have 2 owncloud clients. One for when I'm away, and one when I'm at home. But I want them to sync to the same folder. And I don't want them to require a breach of data security (aka opening my home folder to anybody) to do it. Can I? How?


title: How can memtest check all memory while it is still loaded?

text: Inspired by this question. If you're testing your memory, you have to test _all_ memory - you shouldn't trust any of it to be good. How can memtest effectively do this when memtest itself will consume memory while loaded?


title: Use mount options from /etc/fstab for autofs?

text: I am using `autofs` to automount some partitions that I had mounted based on fstab entries before.   I expected that I can apply the mount options defined in `/etc/fstab` to be used as options for the automount. It seems like the mount options are usually defined in a format that slightly differs from `/etc/fstab` in the files included from `/etc/auto.master`. Using the same set of options makes the configuration easier - but more importantly, it avoids lots of potential inconsistencies, which would surely arrise from two redundant definitions of options. Is there at least some partial integration of `autofs` with `fstab` available?


title: How to split long sed expression into multiple lines?

text: sed 's/[long1][long2]/[long3][long4]/' file.txt      I would like to split this command onto multiple lines - f.x. something like this:               sed 's/         [long1]         [long2]       /         [long3]         [long4]       /' file.txt      Using `\` or separating strings didn't work.


title: Error handling with tar and keep-old-files option

text: I am unpacking tar files with the option --keep-old-files so that I don't clobber files that are already there. The annoying thing is that this causes tar to produce an error code #2 (fatal error) when a file is already there. The reason it's important to me that this should not be considered an error is because my script logs when a file is successfully unpacked and then uses this log in order to not re-unpack that tar file. I could just ignore this error completely, not log, and trust that no files will be overwritten but there are two problems with this: it generates a lot of error messages, and there are many files, so it's inefficient for me to open tar once for every file. Is there any way I can use --keep-old-files, ignore the errors generated by existing files, and not ignore other errors?


title: Cross driver communication through sysfs or /dev/

text: I have two drivers I'm developing. One needs information from the other. Is there anything wrong with one driver reading from the sys attribute `/` or read/write through `/dev/drivername` of the driver it needs data from. If this is not appropriate (or impossible from whatever reason) what is the correct way to do this?


title: System Halt on REBOOT, Shutdown & Restarts as expected

text: Recently went from `Centos 6.4` to `Centos 6.5`. System is `Dell T410 Tower`. Whenever I reboot, system runs through post, passes IPv4 Settings, then announces: `PCIe Training Error: Slot 1` `system halted` When I `ctrl+alt+del` from here - I've received same error (pretty sure every time). **_Dell ESM Log shows: General failure after video._** When I hit power button, then power back on, system boots as expected. Slot 1 has a has the nic card the system is using. (After initial Centos 6.4 install, onboard Broadcom nics were giving me speed & latency issues, tried to resolve with drivers, but had no luck, so I added this other nic card (uses Realtek), which worked fine, no issues, until 6.5 update) I'm still somewhat of a linux noobie, I wouldn't have thought this would kernel related, because I didn't think kernel started loading till next screen. At this point, it seems like it must be the `kernel`. I'm running `2.6.32-431.5.1.el6.x86_64` now because I had same issue with `2.6.32-431.11.2.el6.x86_64` PLUS additional CIFS mount issues, which have gone away with downgrade.               uname -r     2.6.32-431.5.1.el6.x86_64          rpm -qa kernel      kernel-2.6.32-358.23.2.el6.x86_64      kernel-2.6.32-431.5.1.el6.x86_64      kernel-2.6.32-358.el6.x86_64      kernel-2.6.32-431.11.2.el6.x86_64      kernel-2.6.32-358.14.1.el6.x86_64      I was thinking about trying to go 1 further back to 6.4 kernel to see if reboot yields same result. I'm not sure what additional issues may arise trying to revert just the kernel to previous release (6.5 -> 6.4) & if there are other reasons I shouldn't. I think there may be an option in BIOS (somewhere) to continue after halt messages...but if I do that, and there is an error, seems like chances are nic won't work correctly. This server acts as a proxy server to the majority of our desktops on the network, so I only have limited timeframes I can power down and test theories. System seems to be running well now, and as long as I don't manually reboot, seems like we'll be ok in current state, but would like to know what the heck is going on. `dmesg` snippet:               udev: starting version 147     EDAC MC: Ver: 2.1.0 Feb 12 2014     bnx2: Broadcom NetXtreme II Gigabit Ethernet Driver bnx2 v2.2.3 (June 27, 2012)       alloc irq_desc for 36 on node -1       alloc kstat_irqs on node -1     bnx2 0000:01:00.0: PCI INT A -> GSI 36 (level, low) -> IRQ 36     bnx2 0000:01:00.0: setting latency timer to 64     bnx2 0000:01:00.0: firmware: requesting bnx2/bnx2-mips-09-6.2.1b.fw     bnx2 0000:01:00.0: firmware: requesting bnx2/bnx2-rv2p-09-6.0.17.fw     bnx2 0000:01:00.0: eth0: Broadcom NetXtreme II BCM5716 1000Base-T (C0) PCI Express found at mem da000000, IRQ 36, node addr a4:ba:db:12:39:24       alloc irq_desc for 48 on node -1       alloc kstat_irqs on node -1     bnx2 0000:01:00.1: PCI INT B -> GSI 48 (level, low) -> IRQ 48     bnx2 0000:01:00.1: setting latency timer to 64     bnx2 0000:01:00.1: firmware: requesting bnx2/bnx2-mips-09-6.2.1b.fw     bnx2 0000:01:00.1: firmware: requesting bnx2/bnx2-rv2p-09-6.0.17.fw     bnx2 0000:01:00.1: eth1: Broadcom NetXtreme II BCM5716 1000Base-T (C0) PCI Express found at mem dc000000, IRQ 48, node addr a4:ba:db:12:39:25     r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded       alloc irq_desc for 41 on node -1       alloc kstat_irqs on node -1     r8169 0000:02:00.0: PCI INT A -> GSI 41 (level, low) -> IRQ 41     r8169 0000:02:00.0: setting latency timer to 64       alloc irq_desc for 62 on node -1       alloc kstat_irqs on node -1     r8169 0000:02:00.0: irq 62 for MSI/MSI-X     r8169 0000:02:00.0: eth2: RTL8168c/8111c at 0xffffc90000c76000, 00:e0:4d:1a:12:76, XID 1c2000c0 IRQ 62     r8169 0000:02:00.0: eth2: jumbo features [frames: 6128 bytes, tx checksumming: ko]     ACPI Error: No handler for Region [IPMI] (ffff8801ad4ec420) [IPMI] (20090903/evregion-319)     ACPI Error: Region IPMI(7) has no handler (20090903/exfldio-295)     ACPI Error (psparse-0537): Method parse/execution failed [\_SB_.PMI0._GHL] (Node ffff8801ad4eb4c0), AE_NOT_EXIST     ACPI Error (psparse-0537): Method parse/execution failed [\_SB_.PMI0._PMC] (Node ffff8801ad4eb560), AE_NOT_EXIST     ACPI Exception: AE_NOT_EXIST, Evaluating _PMC (20090903/power_meter-759)


title: Append columns in a text file to after the final row

text: A smaller version of many data files I have looks like this:               0 0 0     0.05 9.6877884e-06 0.0024898597     0.1 4.2838688e-05 0.0049595502     0.15 0.00016929444 0.0074092494     0.2 0.00036426881 0.009839138     0.25 0.00055234582 0.012249394     0.3 0.00077448576 0.014640196     0.35 0.00082546537 0.017011717     0.4 0.0012371619 0.019364133     0.45 0.0013286382 0.02169761      I would like to end up with something like the following where the first column is repeated and the entries for the 2nd column comprise columns 2 & above from my original file.               0 0     0.05 9.6877884e-06     0.1 4.2838688e-05     0.15 0.00016929444     0.2 0.00036426881     0.25 0.00055234582     0.3 0.00077448576     0.35 0.00082546537     0.4 0.0012371619     0.45 0.0013286382     0 0     0.05 0.0024898597     0.1 0.0049595502     0.15 0.0074092494     0.2 0.009839138     0.25 0.012249394     0.3 0.014640196     0.35 0.017011717     0.4 0.019364133     0.45 0.021697611      I can generate it using `awk '{print $1 " " $2}' data > tmp` followed by `awk '{print $1 " " $3}' data >> tmp` but this becomes very tedious for the number of columns I have. Is there a smarter way of achieving what I need? **EDIT** I would like a solution for an arbitrary number of columns, n. The correct order of columns to rows is essential for my needs. Thus column 3 of input should be "moved" to underneath column 2 of input, column 4 underneath 2 and 3 etc. with column 1 being stacked underneath repeatedly. The first column should be in ascending numerical order for however many rows each column has i.e. 0, 0.05, ..., 0.45, 0, 0.05,..., 0.45, 0,0.05,...,0.45,etc.


title: tr complains of “Illegal byte sequence”

text: I'm brand new to UNIX and I am using Kirk McElhearn's "The Mac OS X Command Line" to teach myself some commands. I am attempting to use `tr` and `grep` so that I can search for text strings in a regular MS-Office Word Document.               $ tr '\r' '\n' < target-file | grep search-string      But all it returns is:               Illegal byte sequence.                    robomechanoid:Position-Paper-Final-Draft robertjralph$ tr '\r' '\n' < Position-Paper-Final-Version.docx | grep DeCSS     tr: Illegal byte sequence     robomechanoid:Position-Paper-Final-Draft robertjralph$       I've actually run the same line on a script that I created in `vi` and it does the search correctly.


title: How do I resize a disk image device?

text: I'm trying to reduce the size of a backup drive image. Original disk had these partitions:               Model: ST916082 1A (scsi)     Disk /dev/sde: 160GB     Sector size (logical/physical): 512B/512B     Partition Table: msdos          Number  Start   End     Size    Type      File system  Flags      1      32.3kB  65.7GB  65.7GB  primary   ntfs         boot      2      65.7GB  160GB   94.4GB  extended               lba      5      65.7GB  160GB   94.4GB  logical   ntfs      Image was created from the logical partition using the command               > sudo ddrescue /dev/sde5 datapartition logfile          Press Ctrl-C to interrupt     Initial status (read from logfile)     rescued:         0 B,  errsize:       0 B,  errors:       0     Current status     rescued:    94368 MB,  errsize:       0 B,  current rate:   23068 kB/s        ipos:    94368 MB,   errors:       0,    average rate:   28839 kB/s        opos:    94368 MB,     time from last successful read:       0 s     Finished      `ntfsresize -i -f datapartition` says:               ntfsresize v2012.1.15AR.5 (libntfs-3g)     Device name        : datapartition     NTFS volume version: 3.1     Cluster size       : 4096 bytes     Current volume size: 26999992832 bytes (27000 MB)     Current device size: 94368605184 bytes (94369 MB)     Checking filesystem consistency ...     100.00 percent completed     Accounting clusters ...     Space in use       : 26107 MB (96.7%)     Collecting resizing constraints ...     You might resize at 26106810368 bytes or 26107 MB (freeing 893 MB).     Please make a test run using both the -n and -s options before real resizing!      So it looks like I already resized the filesystem to fit the data, but did not resize the device? (This was 2 years ago, I forget.) And I need to resize the device using fdisk, right? But fdisk doesn't recognize the partition:               > fdisk -lu datapartition           Disk datapartition: 94.4 GB, 94368605184 bytes     255 heads, 63 sectors/track, 11472 cylinders, total 184313682 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x69205244          This doesn't look like a partition table     Probably you selected the wrong device.                  Device Boot      Start         End      Blocks   Id  System     datapartition1   ?   218129509  1920119918   850995205   72  Unknown     datapartition2   ?   729050177  1273024900   271987362   74  Unknown     datapartition3   ?   168653938   168653938           0   65  Novell Netware 386     datapartition4      2692939776  2692991410       25817+   0  Empty          Partition table entries are not in disk order      nor does cfdisk:               > cfdisk datapartition           FATAL ERROR: Bad primary partition 1: Partition begins after end-of-disk                           Press any key to exit cfdisk      I can mount the partition and copy files off of it, though. How do I resize the device?


title: Can entropy consumption at program start be prevented?

text: I use Knoppix (or other Live CDs/DVDs) as a secure environment for creating valuable crypto keys. Unfortunately entropy is a limited resource in such environments. I just noticed that each program start consumes quite some entropy. This seems to be due to some stack protection feature that needs address randomization. Nice feature but completely useless and - worse - destructive in my scenario. Is there any possibility to disable this feature? I would prefer one that allows me to continue using the original Knoppix (or whatever) image and just need some configuration at runtime. I read that this was caused by glibc. I am surprised that an `strace -p $PID -f -e trace=open` against bash does not show any accesses to /dev/random when I start programs. But I am not familiar with the interaction of execve() and the linker.


title: How to mount samba rw because everything fails

text: I'm trying to mount windows share on my laptop and everything mounts ok but somehow I get permission denied when I try to create new file inside mounted folder. I tried `noperm`, `uid`, `gid`, `noacl` etc. and nothing seems to work. Everyone who use windows mounts share with same credentials have full r/w access. Here is how I mount:               piotrek@piotrek-Vostro-2520:~/tmp$ sudo mount -v -t cifs -o username=***,password=***,uid=1000,gid=1000,rw,noperm,noacl,file_mode=0777,dir_mode=0777 //10.36.253.222/dysk\ f/ samba/          mount.cifs kernel mount options: ip=10.36.253.222,unc=\\10.36.253.222\dysk f,noperm,noacl,file_mode=0777,dir_mode=0777,uid=1000,gid=1000,user=***,pass=********     piotrek@piotrek-Vostro-2520:~/tmp$ cd samba/     piotrek@piotrek-Vostro-2520:~/tmp/samba$ ls -la     total 4     drwxrwxrwx 2 piotrek piotrek    0 mar 27 13:19 .     drwxrwxr-x 3 piotrek piotrek 4096 kwi  9 12:41 ..     drwxrwxrwx 0 piotrek piotrek    0 mar 18 11:50 AS-SET     drwxrwxrwx 0 piotrek piotrek    0 mar 27 13:29 EDUKACJA     drwxrwxrwx 0 piotrek piotrek    0 mar 18 11:52 RECYCLER     drwxrwxrwx 0 piotrek piotrek    0 cze  5  2012 System Volume Information     piotrek@piotrek-Vostro-2520:~/tmp/samba$ touch abc     touch: cannot touch `abc': Permission denied      What am I doing wrong? I'm using Ubuntu 12.10. **//EDIT** I've tried options that were suggested in comments but still no luck:               piotrek@piotrek-Vostro-2520:~/tmp$ sudo mount -v -t cifs -o username=***,password=***,uid=1000,gid=1000,rw,noperm,noacl,file_mode=0777,dir_mode=0777,sec=ntlm //10.36.253.222/dysk\ f/ samba/                                                                              [sudo] password for piotrek:                                                                                Sorry, try again.                                                                                [sudo] password for piotrek:                                                                                Sorry, try again.                                                                                [sudo] password for piotrek:                                                                                mount.cifs kernel mount options: ip=10.36.253.222,unc=\\10.36.253.222\dysk f,noperm,noacl,file_mode=0777,dir_mode=0777,sec=ntlm,uid=1000,gid=1000,user=***,pass=********                                                                                piotrek@piotrek-Vostro-2520:~/tmp$ touch samba/dddd     touch: cannot touch `samba/dddd': Permission denied                                                                                piotrek@piotrek-Vostro-2520:~/tmp$ sudo umount samba/     piotrek@piotrek-Vostro-2520:~/tmp$ sudo mount -v -t cifs -o username=***,password=***,uid=1000,gid=1000,rw,noperm,noacl,file_mode=0777,dir_mode=0777,sec=ntlmi //10.36.253.222/dysk\ f/ samba/     mount.cifs kernel mount options: ip=10.36.253.222,unc=\\10.36.253.222\dysk f,noperm,noacl,file_mode=0777,dir_mode=0777,sec=ntlmi,uid=1000,gid=1000,user=***,pass=********     mount error(95): Operation not supported     Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)     piotrek@piotrek-Vostro-2520:~/tmp$ sudo mount -v -t cifs -o username=***,password=***,uid=1000,gid=1000,rw,noperm,noacl,file_mode=0777,dir_mode=0777,sec=ntlmv2 //10.36.253.222/dysk\ f/ samba/     mount.cifs kernel mount options: ip=10.36.253.222,unc=\\10.36.253.222\dysk f,noperm,noacl,file_mode=0777,dir_mode=0777,sec=ntlmv2,uid=1000,gid=1000,user=***,pass=********     piotrek@piotrek-Vostro-2520:~/tmp$ touch samba/dddd     touch: cannot touch `samba/dddd': Permission denied     piotrek@piotrek-Vostro-2520:~/tmp$ sudo umount samba/     piotrek@piotrek-Vostro-2520:~/tmp$ sudo mount -v -t cifs -o username=***,password=***,uid=1000,gid=1000,rw,noperm,noacl,file_mode=0777,dir_mode=0777,sec=ntlmv2i //10.36.253.222/dysk\ f/ samba/     mount.cifs kernel mount options: ip=10.36.253.222,unc=\\10.36.253.222\dysk f,noperm,noacl,file_mode=0777,dir_mode=0777,sec=ntlmv2i,uid=1000,gid=1000,user=***,pass=********     mount error(95): Operation not supported     Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)     piotrek@piotrek-Vostro-2520:~/tmp$ sudo mount -v -t cifs -o username=***,password=***,uid=1000,gid=1000,rw,noperm,noacl,file_mode=0777,dir_mode=0777,sec=ntlmssp //10.36.253.222/dysk\ f/ samba/     mount.cifs kernel mount options: ip=10.36.253.222,unc=\\10.36.253.222\dysk f,noperm,noacl,file_mode=0777,dir_mode=0777,sec=ntlmssp,uid=1000,gid=1000,user=***,pass=********     piotrek@piotrek-Vostro-2520:~/tmp$ touch samba/dddd     touch: cannot touch `samba/dddd': Permission denied     piotrek@piotrek-Vostro-2520:~/tmp$ sudo umount samba/     piotrek@piotrek-Vostro-2520:~/tmp$ sudo mount -v -t cifs -o username=***,password=***,uid=1000,gid=1000,rw,noperm,noacl,file_mode=0777,dir_mode=0777,sec=ntlmsspi //10.36.253.222/dysk\ f/ samba/     mount.cifs kernel mount options: ip=10.36.253.222,unc=\\10.36.253.222\dysk f,noperm,noacl,file_mode=0777,dir_mode=0777,sec=ntlmsspi,uid=1000,gid=1000,user=***,pass=********     mount error(95): Operation not supported     Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)     piotrek@piotrek-Vostro-2520:~/tmp$      **//EDIT 2** Don't know why but today it suddenly started working with my first mounting command. Probably server restart was required to make it working but you can never be sure with windows...


title: While setting up SFTP between *nix servers, is the intial handshake optional?

text: I setup SFTP between *nix servers as follows:   1. Generate the Public key on the sending server by running the below command: `[user1@server1] $ /usr/local/bin/ssh-keygen -t rsa -b 1024`   2. Then copy "id_dsa.pub" file into the `/home/remote_user1/.ssh/authorized_keys` file on the remote machine server2.    3. Connect to server2: `$ sftp remote_user1@server2` I am then prompted to enter the password once to complete the handshake and then for all following SFTP connections it directly connects.. But recently another team was able to directly connect to our server without the initial handshake, generally I need to provide the remote_user1's password for handshaking.. So what configuration changes (if any) may have allowed for the handshake to be done without the password..? Any links that could help me better understand the SFTP handshaking process would be very helpful too, as I couldn't find much on this subject.


title: Setting up traffic router (proxy ?) for production

text: I am running a production server and my web application is running at port 8099. so if front end wants to access any backend endpoint, they make a call to this url:               http://production.server.com:8099/mainserver/some/get?xxxxxxx      I need to setup production.server.com:8099 to something like api.production- server.com, which will point to production.server.com:8099. What's the best approach to this? This is for ubuntu platform.


title: How long should I wait between keystrokes when doing SysRq + REISUB?

text: I read this from here: > The most useful combination is the `Alt`+`SysRq/Prnt Scrn` + R-E-I-S-U-B. > > The above basically means that while you press and hold `Alt`+`SysRq/Prnt > Scrn` and press R, E, I, S, U, B giving sufficient time between each of > these keys to ensure they perform the required job. My question is: How long should I wait to ensure "sufficient time" between each of these keys?


title: How to use nVIDIA drivers on Ubuntu 12.04?

text: I am using Ubuntu 12.04 x64 on my ASUS G75-VW with nVIDIA GTX670M. I have installed nvidia drivers via terminal and additional drivers, terminal says nothing to upgrade, additional drivers shows that current version of drivers are activated. But, while checking system properties I see that in front of video adapter shows "NO". What to do?


title: Reinstall XOrg with Yum - Fedora 18

text: Some how I messed up Xorg and need to reinstall it, with Yum. I can not find any Xorg packages, but it has to be out there right?


title: Open-source computer algebra systems for linux

text: Some years ago I used MuPAD as a free computer algebra system. However since 2005 it's not free anymore. So, are there any good free or even better open- source computer algebra systems for linux coming close to commercial products like mathematica or maple?