title: "Memory corruption detected in low memory" kernel messages?

text: I have some _memory corruption detected in low memory_ messages. I have read about it here, but I'm afraid I can't really make anything out of the discussion. It does indeed happen when I suspend/resume, but unlike others who had similar problems, I do not have a broadcom wifi card. This is all marvell ethernet and no wifi. This is a desktop tower with: > Linux gentoomyuser3x86_64 3.10.25-gentoo #1 SMP 2014 x86_64 Intel(R) > Core(TM)2 Quad CPU Q6600 @ 2.40GHz GenuineIntel GNU/Linux Here is the log output:               [12960.735034] Corrupted low memory at ffff88000000fff0 (fff0 phys) = 40000000000000     [12960.735035] Corrupted low memory at ffff88000000fff8 (fff8 phys) = 250c60840020     [12960.735036] ------------[ cut here ]------------     [12960.735042] WARNING: at arch/x86/kernel/check.c:140 check_for_bios_corruption+0x10f/0x120()     [12960.735043] Memory corruption detected in low memory     [12960.735056] Modules linked in: nouveau cfbfillrect cfbimgblt video mxm_wmi wmi cfbcopyarea ttm fbcon bitblit softcursor font tileblit drm_kms_helper backlight fb fbdev fuse     [12960.735060] CPU: 0 PID: 9096 Comm: kworker/0:1 Not tainted 3.10.25-gentoo #1     [12960.735061] Hardware name: System manufacturer Maximus Formula/Maximus Formula, BIOS 1403    09/10/2009     [12960.735064] Workqueue: events check_corruption     [12960.735068]  0000000000000009 ffff8801165fdcf8 ffffffff8157431b ffff8801165fdd38     [12960.735070]  ffffffff81045e9b 0000000000000000 0000000000000000 ffff880000010000     [12960.735073]  ffffffff819b20b0 0000000000000001 ffff880000000000 ffff8801165fdd98     [12960.735074] Call Trace:     [12960.735079]  [<ffffffff8157431b>] dump_stack+0x19/0x1b     [12960.735082]  [<ffffffff81045e9b>] warn_slowpath_common+0x6b/0xa0     [12960.735085]  [<ffffffff81045f71>] warn_slowpath_fmt+0x41/0x50     [12960.735087]  [<ffffffff8102bc2f>] check_for_bios_corruption+0x10f/0x120     [12960.735090]  [<ffffffff8102bc49>] check_corruption+0x9/0x40     [12960.735094]  [<ffffffff81061f8f>] process_one_work+0x17f/0x420     [12960.735096]  [<ffffffff81062679>] worker_thread+0x119/0x370     [12960.735099]  [<ffffffff81062560>] ? rescuer_thread+0x2f0/0x2f0     [12960.735102]  [<ffffffff81068c4b>] kthread+0xbb/0xc0     [12960.735105]  [<ffffffff81068b90>] ? kthread_create_on_node+0x120/0x120     [12960.735109]  [<ffffffff815819ac>] ret_from_fork+0x7c/0xb0     [12960.735111]  [<ffffffff81068b90>] ? kthread_create_on_node+0x120/0x120     [12960.735113] ---[ end trace a3687665afd39e38 ]---      And verbose `lspci -v` and some `lshw` output to better understand my setup, if required:               00:00.0 Host bridge: Intel Corporation 82X38/X48 Express DRAM Controller (rev 01)         Subsystem: ASUSTeK Computer Inc. Device 8295         Flags: bus master, fast devsel, latency 0         Capabilities: [e0] Vendor Specific Information: Len=0c <?>          00:06.0 PCI bridge: Intel Corporation 82X38/X48 Express Host-Secondary PCI Express Bridge (rev 01) (prog-if 00 [Normal decode])         Flags: bus master, fast devsel, latency 0         Bus: primary=00, secondary=01, subordinate=01, sec-latency=0         I/O behind bridge: 0000d000-0000dfff         Memory behind bridge: fd000000-feafffff         Prefetchable memory behind bridge: 00000000f0000000-00000000f9ffffff         Capabilities: [88] Subsystem: Intel Corporation Device 0000         Capabilities: [80] Power Management version 3         Capabilities: [90] MSI: Enable+ Count=1/1 Maskable- 64bit-         Capabilities: [a0] Express Root Port (Slot+), MSI 00         Capabilities: [100] Virtual Channel         Capabilities: [140] Root Complex Link         Kernel driver in use: pcieport          00:1a.0 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #4 (rev 02) (prog-if 00 [UHCI])         Subsystem: ASUSTeK Computer Inc. P5K PRO Motherboard         Flags: bus master, medium devsel, latency 0, IRQ 16         I/O ports at c800 [size=32]         Capabilities: [50] PCI Advanced Features         Kernel driver in use: uhci_hcd          00:1a.1 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #5 (rev 02) (prog-if 00 [UHCI])         Subsystem: ASUSTeK Computer Inc. P5K PRO Motherboard         Flags: bus master, medium devsel, latency 0, IRQ 21         I/O ports at c880 [size=32]         Capabilities: [50] PCI Advanced Features         Kernel driver in use: uhci_hcd          00:1a.2 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #6 (rev 02) (prog-if 00 [UHCI])         Subsystem: ASUSTeK Computer Inc. P5K PRO Motherboard         Flags: bus master, medium devsel, latency 0, IRQ 18         I/O ports at cc00 [size=32]         Capabilities: [50] PCI Advanced Features         Kernel driver in use: uhci_hcd          00:1a.7 USB controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #2 (rev 02) (prog-if 20 [EHCI])         Subsystem: ASUSTeK Computer Inc. P5K PRO Motherboard         Flags: bus master, medium devsel, latency 0, IRQ 18         Memory at fcfffc00 (32-bit, non-prefetchable) [size=1K]         Capabilities: [50] Power Management version 2         Capabilities: [58] Debug port: BAR=1 offset=00a0         Capabilities: [98] PCI Advanced Features         Kernel driver in use: ehci-pci          00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 02)         Subsystem: ASUSTeK Computer Inc. Device 8277         Flags: bus master, fast devsel, latency 0, IRQ 45         Memory at fcff8000 (64-bit, non-prefetchable) [size=16K]         Capabilities: [50] Power Management version 2         Capabilities: [60] MSI: Enable+ Count=1/1 Maskable- 64bit+         Capabilities: [70] Express Root Complex Integrated Endpoint, MSI 00         Capabilities: [100] Virtual Channel         Capabilities: [130] Root Complex Link         Kernel driver in use: snd_hda_intel          00:1c.0 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 1 (rev 02) (prog-if 00 [Normal decode])         Flags: bus master, fast devsel, latency 0         Bus: primary=00, secondary=03, subordinate=03, sec-latency=0         I/O behind bridge: 00001000-00001fff         Memory behind bridge: fa000000-fa3fffff         Prefetchable memory behind bridge: 00000000fbf00000-00000000fbffffff         Capabilities: [40] Express Root Port (Slot+), MSI 00         Capabilities: [80] MSI: Enable+ Count=1/1 Maskable- 64bit-         Capabilities: [90] Subsystem: ASUSTeK Computer Inc. P5K PRO Motherboard         Capabilities: [a0] Power Management version 2         Capabilities: [100] Virtual Channel         Capabilities: [180] Root Complex Link         Kernel driver in use: pcieport          00:1c.2 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 3 (rev 02) (prog-if 00 [Normal decode])         Flags: bus master, fast devsel, latency 0         Bus: primary=00, secondary=02, subordinate=02, sec-latency=0         I/O behind bridge: 0000e000-0000efff         Memory behind bridge: feb00000-febfffff         Prefetchable memory behind bridge: 00000000fa400000-00000000fa5fffff         Capabilities: [40] Express Root Port (Slot+), MSI 00         Capabilities: [80] MSI: Enable+ Count=1/1 Maskable- 64bit-         Capabilities: [90] Subsystem: ASUSTeK Computer Inc. Device 8277         Capabilities: [a0] Power Management version 2         Capabilities: [100] Virtual Channel         Capabilities: [180] Root Complex Link         Kernel driver in use: pcieport          00:1d.0 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #1 (rev 02) (prog-if 00 [UHCI])         Subsystem: ASUSTeK Computer Inc. P5K PRO Motherboard         Flags: bus master, medium devsel, latency 0, IRQ 23         I/O ports at c080 [size=32]         Capabilities: [50] PCI Advanced Features         Kernel driver in use: uhci_hcd          00:1d.1 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #2 (rev 02) (prog-if 00 [UHCI])         Subsystem: ASUSTeK Computer Inc. P5K PRO Motherboard         Flags: bus master, medium devsel, latency 0, IRQ 19         I/O ports at c400 [size=32]         Capabilities: [50] PCI Advanced Features         Kernel driver in use: uhci_hcd          00:1d.2 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #3 (rev 02) (prog-if 00 [UHCI])         Subsystem: ASUSTeK Computer Inc. P5K PRO Motherboard         Flags: bus master, medium devsel, latency 0, IRQ 18         I/O ports at c480 [size=32]         Capabilities: [50] PCI Advanced Features         Kernel driver in use: uhci_hcd          00:1d.7 USB controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #1 (rev 02) (prog-if 20 [EHCI])         Subsystem: ASUSTeK Computer Inc. P5K PRO Motherboard         Flags: bus master, medium devsel, latency 0, IRQ 23         Memory at fcfff800 (32-bit, non-prefetchable) [size=1K]         Capabilities: [50] Power Management version 2         Capabilities: [58] Debug port: BAR=1 offset=00a0         Capabilities: [98] PCI Advanced Features         Kernel driver in use: ehci-pci          00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev 92) (prog-if 01 [Subtractive decode])         Flags: bus master, fast devsel, latency 0         Bus: primary=00, secondary=04, subordinate=04, sec-latency=32         Capabilities: [50] Subsystem: ASUSTeK Computer Inc. P5K PRO Motherboard          00:1f.0 ISA bridge: Intel Corporation 82801IR (ICH9R) LPC Interface Controller (rev 02)         Subsystem: ASUSTeK Computer Inc. P5K PRO Motherboard         Flags: bus master, medium devsel, latency 0         Capabilities: [e0] Vendor Specific Information: Len=0c <?>          00:1f.2 SATA controller: Intel Corporation 82801IR/IO/IH (ICH9R/DO/DH) 6 port SATA Controller [AHCI mode] (rev 02) (prog-if 01 [AHCI 1.0])         Subsystem: ASUSTeK Computer Inc. Device 8277         Flags: bus master, 66MHz, medium devsel, latency 0, IRQ 43         I/O ports at bc00 [size=8]         I/O ports at b880 [size=4]         I/O ports at b800 [size=8]         I/O ports at b480 [size=4]         I/O ports at b400 [size=32]         Memory at fcffe800 (32-bit, non-prefetchable) [size=2K]         Capabilities: [80] MSI: Enable+ Count=1/16 Maskable- 64bit-         Capabilities: [70] Power Management version 3         Capabilities: [a8] SATA HBA v1.0         Capabilities: [b0] PCI Advanced Features         Kernel driver in use: ahci          00:1f.3 SMBus: Intel Corporation 82801I (ICH9 Family) SMBus Controller (rev 02)         Subsystem: ASUSTeK Computer Inc. P5K PRO Motherboard         Flags: medium devsel, IRQ 18         Memory at fcfff400 (64-bit, non-prefetchable) [size=256]         I/O ports at 0400 [size=32]          01:00.0 VGA compatible controller: NVIDIA Corporation GF119 [GeForce GT 610] (rev a1) (prog-if 00 [VGA controller])         Subsystem: Gigabyte Technology Co., Ltd Device 3546         Flags: bus master, fast devsel, latency 0, IRQ 16         Memory at fd000000 (32-bit, non-prefetchable) [size=16M]         Memory at f0000000 (64-bit, prefetchable) [size=128M]         Memory at f8000000 (64-bit, prefetchable) [size=32M]         I/O ports at dc00 [size=128]         Expansion ROM at fea00000 [disabled] [size=512K]         Capabilities: [60] Power Management version 3         Capabilities: [68] MSI: Enable- Count=1/1 Maskable- 64bit+         Capabilities: [78] Express Endpoint, MSI 00         Capabilities: [b4] Vendor Specific Information: Len=14 <?>         Capabilities: [100] Virtual Channel         Capabilities: [128] Power Budgeting <?>         Capabilities: [600] Vendor Specific Information: ID=0001 Rev=1 Len=024 <?>         Kernel driver in use: nouveau         Kernel modules: nouveau          01:00.1 Audio device: NVIDIA Corporation GF119 HDMI Audio Controller (rev a1)         Subsystem: Gigabyte Technology Co., Ltd Device 3546         Flags: bus master, fast devsel, latency 0, IRQ 17         Memory at feafc000 (32-bit, non-prefetchable) [size=16K]         Capabilities: [60] Power Management version 3         Capabilities: [68] MSI: Enable- Count=1/1 Maskable- 64bit+         Capabilities: [78] Express Endpoint, MSI 00         Kernel driver in use: snd_hda_intel          02:00.0 Ethernet controller: Marvell Technology Group Ltd. 88E8056 PCI-E Gigabit Ethernet Controller (rev 12)         Subsystem: ASUSTeK Computer Inc. Motherboard         Flags: bus master, fast devsel, latency 0, IRQ 44         Memory at febfc000 (64-bit, non-prefetchable) [size=16K]         I/O ports at e800 [size=256]         Expansion ROM at febc0000 [disabled] [size=128K]         Capabilities: [48] Power Management version 3         Capabilities: [50] Vital Product Data         Capabilities: [5c] MSI: Enable+ Count=1/1 Maskable- 64bit+         Capabilities: [e0] Express Legacy Endpoint, MSI 00         Capabilities: [100] Advanced Error Reporting         Kernel driver in use: sky2          lshw                  gentoomyuser3x86_64                       description: Desktop Computer             product: Maximus Formula (To Be Filled By O.E.M.)             vendor: System manufacturer             version: System Version             serial: System Serial Number             width: 64 bits             capabilities: smbios-2.4 dmi-2.4             configuration: boot=normal chassis=desktop family=To Be Filled By O.E.M. sku=To Be Filled By O.E.M. uuid=00020003-0004-0005-0006-000700080009           *-core                description: Motherboard                product: Maximus Formula                vendor: ASUSTeK Computer INC.                physical id: 0                version: Rev 1.xx                serial: MB-1234567890                slot: To Be Filled By O.E.M.              *-firmware                   description: BIOS                   vendor: American Megatrends Inc.                   physical id: 0                   version: 1403                   date: 09/10/2009                   size: 64KiB                   capacity: 1984KiB                   capabilities: isa pci pnp apm upgrade shadowing escd cdboot bootselect socketedrom edd int13floppy1200 int13floppy720 int13floppy2880 int5printscreen int9keyboard int14serial int17printer int10video acpi usb ls120boot zipboot biosbootspecification              *-cpu                   description: CPU                   product: Intel(R) Core(TM)2 Quad CPU    Q6600  @ 2.40GHz                   vendor: Intel Corp.                   physical id: 4                   bus info: cpu@0                   version: Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz                   serial: To Be Filled By O.E.M.                   slot: LGA775                   size: 2394MHz                   capacity: 3800MHz                   width: 64 bits                   clock: 266MHz                   capabilities: fpu fpu_exception wp 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 x86-64 constant_tsc arch_perfmon pebs bts rep_good nopl aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm lahf_lm dtherm tpr_shadow vnmi flexpriority cpufreq                 *-cache:0                      description: L1 cache                      physical id: 5                      slot: L1-Cache                      size: 128KiB                      capacity: 128KiB                      capabilities: internal write-back data                 *-cache:1                      description: L2 cache                      physical id: 6                      slot: L2-Cache                      size: 8MiB                      capacity: 8MiB                      capabilities: internal write-back instruction      This is Gentoo but on Arch, I can find this. There is mention somewhere of a `powerdown` package on Arch which allows "graceful" suspend/resume. I suspend with:               echo -n "mem" > /sys/power/state      So should I worry about anything and is there anything wrong with the way I suspend my system? As suggested, I have run one full pass with memtest86+ (15mins, 12 tests I think) and no errors came out. This is 2x2gb Corsair. This rig is burnt in and very stable. I have compiled over 1000 Gentoo packages on this. * * * **Further testing** After a community member identified a kernel patch which had been deployed to solve exactly this error(Revert "epoll: use freezable blocking call"), I tried to apply the patch to my sources. It turns out I already have the patch installed!? I also installed the `suspend` package which contains `s2ram` etc. This utility seemingly does nothing different in the way it suspends the computer. I compared logs of suspend and wake up events from using s2ram and then from using the command I use and there is no difference. I conclude that in that respect there is nothing wrong in using `echo -n "mem" > /sys/power/state`. I also validated with `ethtool` that wake on lan is disabled (supports wake on: pg / wake on: d) so it should not interfere with power events if I understand correctly. Maybe a setting in the bios? Or that bios is no longer updated and will trigger that exception and we'll have to live with that.


title: Generate man page in realtime?

text: I'm working on a command line scripting framework. We would like to generate man pages for our commands. However they are quite dynamic depending on your installation. So ideally we could intercept the man call and write the man page at that time or simply pipe it to the man display directly. I'm quite new to man pages and how they work. Is this even possible?


title: Running xen inside VirtualBox , possible?

text: Can i run a Linux system inside VirtualBox or VMware , with xen kernel ? It's not intended for a real server or production workplace , just to learn the configuration of XEN. BTW: target computer supports Intel VT feature


title: How do I read an acpidump in OpenBSD?

text: The `acpidump` utility used to provide human-readable decoding of the DSDT data, however, it seems like this is no longer available in the recent version of OpenBSD. It looks like the last release with this functionality was 4.7, with 4.8 no longer having the `-f` option. What gives? How is one supposed to see what's in ACPI DSDT now? (I see there's an acpica port, but it doesn't seem to have an `acpidump` command.)


title: Build xfreerdp 1.1

text: I have found instructions on how to build xfreerdp 1.0.1, but can't find anything about how to build version 1.1 instead. Can someone please point me to the right direction?


title: Disable cronjob after reboots

text: How can I prevent cronjobs from automatically starting after my server has rebooted? Every time I reboot my server the cronjobs start up again, which I'd like to prevent. These servers are running Ubuntu 12.04 x32


title: Stop vim from messing up my indentation on comments

text: For some reason Vim thinks all of my comments should have all indentation removed. If I add `#` to the beginning of a line, suddenly all leading whitespace is removed. How can I stop this? I have Janus and NERDtree installed, in case it's relevent, along with copious other personal configurations in my `.vimrc`, but none that (as far as I know) would cause such behavior.


title: Root access that can't change root password?

text: We are having a little problem on a server. We want that some users should be able to do e.g. `sudo` and become root, but with the restriction that the user can't change root password. That is, a guarantee that we still can login to that server and become root no matter of what the other users will do. Is that possible?


title: How are system commands like ls created?

text: I'm a *nux newbie and I have some doubts regarding *nix.   * I don't know which type of executable file is `ls`, whether it is .sh or .ksh or any other kind of system executable if it is, what is that?   * when I tried to see what is the source code of `ls` command looks like, it shows something unreadable, what method does *nix use to create these types of unreadable files and can I make my files similar to these files (like `ls` - unreadable).


title: What's the easiest way to resize an ext4 partition from the command line?

text: What's the easiest way to resize an ext4 partition (or any type partition depending on the method) from the command line (potentially with the fewest commands, but also the easiest to understand)? Using a tool like Gparted is obviously easy in a GUI, but what about in the command line? I guess text-based GUIs can count for the answer too since it's technically still in the command line. It just needs to be easy. By partition I mean a simple partition on a single disk of a personal computer (e.g. on a laptop). For example, I want to resize `/dev/sda4`. There's no RAIDs, there's not more than one disk drive, there's not anything complicated here. Just a simple partition on a single disk (/dev/sdaX on /dev/sda).


title: Is this task freeze related to ReiserFS (v3)? (or: is ReiserFS getting so old that it should be actively replaced?)

text: I just had a weird system freeze that I resolved using alt-sysrq-e. Here's my dmesg: https://gist.github.com/1609263 I was wondering whether it might be some kind of deadlock in the reiserfs3 code since it's mentioned so many times (and in nearly all the call traces)? Or would it look the same with any other file system? I just want to know if ReiserFS v3 is getting so old that I should bother reformatting, just to get rid of this. If this call trace would be produced with other filesystems too, I guess it's not resolvable by changing FS. I've been running this system for years now daily, and I never had this problem before. Not running a bleeding edge kernel either, just the standard Ubuntu 10.10 (3.0.0-14).


title: Filezilla: GnuTLS error when using FTPES

text: Response:   220-This is a private system - No anonymous login     Response:   220 You will be disconnected after 60 minutes of inactivity.     Command:    AUTH TLS     Response:   234 AUTH TLS OK.     Status: Initializing TLS...     Error:  GnuTLS error -50: The request is invalid.     Error:  Failed to initialize TLS.     Error:  Could not connect to server      I'm trying to connect to a site using FTPES. It worked before on Fedora/Filezilla. But now I'm using Scientific-Linux with Filezilla, and it gives this. What am I missing?


title: How to partition 22TB disk?

text: I have a 22TB disk on `/dev/sdb`. How do I create a 22TB partition? Don't really care about the file system - `ext4` or `zfs` is fine. Running CentOS 6.2 - Partition will be used as a data dump. Only a single stream of data so being picky/choosy over what file system isn't really a concern right now. The disk is formed from 12x2TB nearline sas drives and a Dell Perc controller. I just want a 22tb partition.


title: Audio file as an audio input device

text: I want to play an audio file over VoIP in order that people can listen to it with a phone call. One way to do this would be to set up the audio file as an audio device where the audio starts playing at a specified time. There are better ways of playing my file over VoIP, but I'm still curious as to how you would set up the audio device that I discuss. What would I do? You can see this as the reverse of this question.


title: creation time attribute on CIFS

text: I have a linux server which captures network pcap files and save it to a CIFS shared drive. I have found out that the creation time and modified time of the pcap files seems to be the same. Which shouldn't be, as each file has 10 seconds of data so the creation time should be 10 seconds older than the modified time. If I'm correctly understanding the time attributes. I need this difference as the software with which I extract the files from the shared drive fixes the time span with start time as creation time of first file and end time as "last write /modified time" of the last file. Is this happening because of a linux bug? I know there will be a difference in the creation time and modified time as I have seen it before on the system few months ago.


title: How to reattach USB thing after safely ejecting?

text: So, you just ejected your SD card with the 'safely eject' option (in my case in palimpsest GUI). Then you proceed with your deeds that required the device out of the computer, and are ready to insert it again. You plug it in... and nothing happens. What should I do for the system to recognize the device again _in software_? I know I can attach to another USB port, but that's just dumb. Specially if you are talking about a card reader permanently attached and just safely ejected a media. In steps, for the worst scenario:   1. insert card reader   2. insert SD card   3. linux mount card   4. use card.   5. safely eject card   6. use card in another device   7. reinsert card in linux box   8. nothing happens. Workaround includes   1. remove card reader   2. attach card reader on another usb port   3. insert sd card and go back to step 4 above.


title: Confused about when to escape metacharacters in pathnames

text: I'm pretty confused about under which circumstances do I need to escape metacharacters in pathnames. Consider the following example: I'm in the following working directory:               $ echo $PWD     /home/helpermethod/foo[b]ar/foo/bar      Now I want to strip off everything behind `foo[b]ar`. I'm using parameter substitution to perform this task:/home/helpermethod/foo[b]ar               $ path=$PWD     $ basename=foo[b]ar     $ stripped_path=${path%$basename/*}/$basename      This doesn't seem to work because the basename string needs to be properly escaped:               $ basename=foo\[b\]ar     $ stripped_path=${path%$basename/*}/$basename      Okay, now I have the `stripped_path` I was looking for               $ echo "$stripped_path"     /home/helpermethod/foo[b]ar      But if I now test if this is a valid directory               $ [[ -d $stripped_path ]]      the `test` command always returns false (i.e. a return value != 0). What's the problem here? Do I need to unescape the `stripped_path`?


title: Autocomplete server names for SSH and SCP

text: I have a few servers configured in `~/.ssh/config`, such as `alpha` and `beta`. How might I configure Bash such that the commands `ssh al<tab>` and `scp file.tgz al<tab>` autocomplete the names of the configured servers? I don't want to add the servers to _another_ file (i.e. a Bash array) each time one is added, as we add and remove servers regularly and the list is quite large.


title: Program to upgrade configuration files

text: When upgrading Ubuntu (and probably other *nixes), the upgrade process will show a diff of changed configuration files and ask whether I'd like to replace them, keep the old version, or manually merge them. I couldn't find any such programs with Google or searching through the Ubuntu packaging documentation. Do you know of any such programs which have the following features?   * Few or no dependencies (ideally a single shell script).   * Shell only (ideally without curses).   * Does _not_ try to be "clever," for example by automatically merging. Edit: I've written this small thing to do some preliminary checks and ask the user what to do, but it's not very flexible or nice:               for path     do         if [ ! -e "${path}.new" ]         then             # No new revision; skip             continue         fi              if [[ $(diff "${path}"{,.new} | grep '^[<>]' | grep -v '^[<>][[:space:]]*\(#\|START=\)' | wc -l) -eq 0 ]]         then             # No interesting lines; skip             continue         fi              clear         diff -u "${path}"{,.new}              unset action         while [[ ! "${action-}" =~ ^[sr]$ ]]         do             echo "Do you want to replace $path with ${path}.new?"             read -s -n 1 -p $'[s]kip, [r]eplace: \n' action         done              case "$action" in             s)                 continue                 ;;             r)                 cp -v "${path}"{,.new}                 ;;             *)                 echo "Invalid action ${action}!"                 exit 2         esac     done


title: When mounting, when should I use a loop device?

text: According to the following question:   What is a "loop device" when mounting?   A loop device is a file that acts as a block-based device. While I can understand that conceptually, how is this different from mounting any other file? For example, if I take a dd image of an ext2 filesystem and then mount it, I don't have to use the loop option- `mount -t ext2 file.dd /mnt/mount- point` succeeds. When should I use the loop option and what difference is there between mounting using the loop option and mounting without it?


title: User policy for a *nix system

text: I would like to create a document that specifies the policies that rule the use of a *nix system from the user perspective, something like TOS (Terms Of Service) / Privacy Policy you find these days on many websites. Has anyone drafted a document like this?


title: Set login shell if /etc/shells is missing

text: On a server which thousands of users loginto the admins seem to have neglected some basics. My default shell is csh I would like to use bash, but `chsh` errors because /etc/shells does not exist. To make things worse my second thought was usermod, which is unavailable on the machine. The obvious solution is to create /etc/shells but I am not an admin and they seem to be unresponsive to such matters. Is there a way to set my default shell other than using chsh or usermod? If not is there something better than running `/usr/bin/bash -l` every time I log in?


title: Fresh installation of debian and raid10 array with SSD and HDD

text: I have one 120Gb SDD and four 2Tb HDD at disposal. I would like to install Debian Squeeze on the SSD and create a software RAID10 array with the four HDD.   According to your experience, how to "distribute" the different areas (boot, home, swap, etc) on the five disks ?   * is only one ssd useful or shall I envisage two ssd in RAID1 ?    * the Debian updates grow up the SSD: in spite of that, is it a good idea to use this kind of disks ?  You should note that my experience is very limited ... I will appreciate simple answers and/or tutorials addresses.


title: How to add a custom timezone clock to an XFCE panel?

text: My local time is CET (Prague, EU), I also need to see UTC and, some times, MSK time. Can I add multiple clocks with different zones to a panel in XFCE? I know how to add multiple clocks, actually, but how to customize time zone of each of them?


title: Troubles installing php with MySQL support

text: So I wasn't sure if this question would go best here or on Overflow or Server Fault, but decided to try here first. I'm installing LAMP on a VPS, and am running into issues configuring and building PHP. I've got MySQL installed, and it seems to be running fine. I'm trying to just go for a basic install of PHP with MySQL support as instructions are given here: http://www.php.net/manual/en/install.unix.apache2.php Here's the configure command I was running:               ./configure –with-apxs2=/usr/local/apache2/bin/apxs –with-mysql       I was getting this error:               configure: error: Cannot find MySQL header files under yes.     Note that the MySQL client library is not bundled anymore!      I just had a basic, default MySQL install with yum install mysql-server mysql. After some Googling, I installed mysql-devel to get rid of that error:               yum install mysql-devel       Then I started getting this error:               configure: error: Try adding –with-zlib-dir=<DIR>. Please check config.log for more   information.       Okay. So I changed my command to:               ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-zlib      Now I just get this:               configure: error: mysql configure failed. Please check config.log for more information.       Honestly kind of lost at this point. I'm looking at the config.log, but not exactly sure what I need to be looking for. Here's the sections I think may be relevant:               configure:60061: gcc -o conftest -I/usr/include -g -O2 -fvisibility=hidden-Wl,-rpath,/usr/lib/mysql -L/usr/lib/mysql -L/usr/lib  conftest.c -lmysqlclient  -lz -lrt -lm -ldl -lnsl  -lxml2 -lz -lm -lxml2 -lz -lm 1>&5     /usr/bin/ld: skipping incompatible /usr/lib/mysql/libmysqlclient.so when searching for -lmysqlclient     /usr/bin/ld: skipping incompatible /usr/lib/mysql/libmysqlclient.a when searching for -lmysqlclient     /usr/bin/ld: cannot find -lmysqlclient     collect2: ld returned 1 exit status     configure: failed program was:     #line 60050 "configure"     #include "confdefs.h"      Any thoughts? Or should I be looking at something else in config.log?


title: Why does it makes sense to cache swap?

text: It sounds quite counter-productive to me to cache pages that are swapped out. If you swap pages in, what is the advantage to first cache them in memory, only to have to than move them to the right place? Even if pages are swapped in proactively, doesn't it make more sense to "just" swap them in? Doesn't in fact caching swap is just a waste of resources?


title: Filtering the keyboard input

text: I have a program that takes input from the keyboard and presents a nice visualization. The purpose of the program is so that my infant can mash on the keyboard and get the computer to do something. However, I would like to write a keyboard input sanitizer that is disjoint from the main program. Conceptually, I would want the program have the functionality:                 sanitize_keyboard_input | my_program      Where `my_program` thinks it is getting input from the keyboard but it is really getting input from `sanitize_keyboard_input`. Is there a way to do this? I am running Ubuntu linux if that helps.


title: How do you free up resources in Ubuntu?

text: What steps do you take to make a vanilla Ubuntu system run faster and use less memory? I'm using Ubuntu as the OS for my general purpose PC, but it's on slightly older hardware and I want to get as much out of it as I can. Short of leaner distros, what things do you do to make it run a bit faster for basic web browsing and word processing?


title: locale not found/setting locale failed - what should I do?

text: I've installed Debian 7 i386 on my VPS (OpenVZ). Everything works fine, except locales - any attempt to install anything shows:               [...]     perl: warning: Setting locale failed.     perl: warning: Please check that your locale settings:         LANGUAGE = (unset),         LC_ALL = (unset),         LANG = "pl_PL.UTF-8"         are supported and installed on your system.     perl: warning: Falling back to the standard locale ("C").     locale: Cannot set LC_CTYPE to default locale: No such file or directory     locale: Cannot set LC_MESSAGES to default locale: No such file or directory     locale: Cannot set LC_ALL to default locale: No such file or directory     [...]      What I've tried:   1. Generating locales myself - update-locale LC_ALL="pl_PL.UTF-8" - shows: http://www.wklej.org/id/1248438/   2. `apt-get install --reinstall locales` http://www.wklej.org/id/1248442/   3. The same with `dpkg-reconfigure locales` + setting pl_PL.UTF-8, pl_PL.ISO-8859-2 or even en_US: http://www.wklej.org/id/1248446/   4. `export LC_ALL=pl_PL.UTF-8` (even on root): -bash: warning: setlocale: LC_ALL: cannot change locale (pl_PL.UTF-8) Here is what shows locale:               root:~# locale     locale: Cannot set LC_CTYPE to default locale: No such file or directory     locale: Cannot set LC_MESSAGES to default locale: No such file or directory     locale: Cannot set LC_ALL to default locale: No such file or directory     LANG=pl_PL.UTF-8     LANGUAGE=     LC_CTYPE="pl_PL.UTF-8"     LC_NUMERIC="pl_PL.UTF-8"     LC_TIME="pl_PL.UTF-8"     LC_COLLATE="pl_PL.UTF-8"     LC_MONETARY="pl_PL.UTF-8"     LC_MESSAGES="pl_PL.UTF-8"     LC_PAPER="pl_PL.UTF-8"     LC_NAME="pl_PL.UTF-8"     LC_ADDRESS="pl_PL.UTF-8"     LC_TELEPHONE="pl_PL.UTF-8"     LC_MEASUREMENT="pl_PL.UTF-8"     LC_IDENTIFICATION="pl_PL.UTF-8"     LC_ALL=      Nothing interesting found in /var/log. Even changing repo to official + purge and manual installation locales doesn't solve my problem, which manifests itself on each fresh installation of Debian 7.


title: Can anybody recommend an HTTP debugging proxy?

text: I would like something that allows me to:   1. Inspect all HTTP(S) traffic between my computer and the Internet, including 127.0.0.1   2. Modify incoming or outgoing data   3. It would also be nice if it had a scripting subsystem for setting rules and events   4. I prefer it be a GUI application. Please do not answer with WireShark. I am aware of WireShark and I have used it many many times and it's a great app. I would like something that restricts it's captures to the application layer and HTTP(S) traffic only and ignores the other Internet Protocol Suite layers. Also, it doesn't have some of the features I listed above.


title: How do I add MP3/etc support to my *nix desktop?

text: Almost every desktop *nix seems to ship without support for MP3 or other popular codecs that you really need. What is the easiest way to add support for these codecs?


title: Process management and pkill

text: I've been studying process management using shell scripts and I'm starting to realise how difficult it is to make sure that it's done right. For example, you can record the PID of a program to a file, `wait` on it, and clean up the PID file after the program exits. If you were to try and `kill` this daemon from an init script, for example, you might think of doing something like this:               do_stop() {       kill $(</var/run/program.pid)     }      This obviously doesn't work. Between obtaining the PID and sending the kill signal, another process could have died and taken its place. The correct way seems to require using IPC in the parent of the program to send a kill signal to its child. This will ensure that the PID of the process hasn't been reused by another. I've been trying to write my own init scripts that are as correct as possible. In this case, I've been writing one for NRPE. NRPE unfortunately daemonizes and disowns itself to init, which means I can't `wait` on it. Instead, I came up with the following solution:               do_stop() {       echo "Stopping (sending SIGTERM to) nrpe"       pkill -u nrpe || { echo >&2 "nrpe isn't running"; exit 1; }     }      The only process that the `nrpe` user runs is NRPE itself, and considering the system is under my control I consider this a relatively sane solution. What I'm curious about is the atomicity of `pkill` (if that's the right word to use). I assume `pkill` follows these steps:   1. Looks up the PID in the process table after parsing the arguments for the process criteria.   2. Sends `SIGTERM` (by default) to the obtained PID Let's say `pkill -u nrpe` gives a PID of 42 in step 1. Is it possible that `nrpe`'s process could die and another one could spawn in its place before step 2 occurs?


title: network device module equivalent to ping

text: I have made a module which is transmitting but I don't know whether the packet which I am transmitting is a ping packet or not. Code is shown below:                icmp.type = 8;      icmp.code = 0;      icmp.un.echo.sequence = i;      ip4.protocol = 1; //for icmp protocol      ip4.frag_off = 0;      ip4.daddr = in_aton(procfs_buffer);      ip4.saddr = in_aton(ifr->ifr_addr.sa_data);           len = sizeof(data);           skb = dev_alloc_skb(1500);      skb->dev = __dev_get_by_name(&init_net,"wlan0");      skb_reserve(skb,NET_IP_ALIGN); // header of 2 bytes; increments tail and                                      // data pointer      skb->data = skb_put(skb,sizeof(len)); // increments all pointer or adds data      memcpy(data,skb->data,len);           skb->transport_header =skb_push(skb,sizeof(icmp));      memset(skb->transport_header,0,sizeof(struct icmphdr));      memcpy(skb->transport_header,&icmp,sizeof(struct icmphdr));           skb->network_header=skb_push(skb,sizeof(ip4));      memset(skb->network_header,0,sizeof(struct iphdr));      memcpy(skb->network_header,&ip4,sizeof(struct iphdr));           // printk("i::%d\n",i);      // skb->mac_header = skb_push(skb,6*sizeof(0xFF));      // memset(skb->mac_header,0xFF,6*sizeof(0xFF));      dev_queue_xmit(skb);      kfree(skb);      How can I know that it is a ping packet which I am creating and transmitting? Further I want to receieve the ping packet in response to my ping packet which I have transmitted. I would like to use napi but wont mind any other suggestions. please read a topic : reception napi mode herei couldn't understand what to do from the link above


title: Replace CD number in MP3 ID3 tag

text: I have a library of MP3 files where in some files the "CD number" tag (TPOS) contains "CDx" values, e.g. "CD1" or "CD2". The ID3 spec says that TPOS values shall be numerical strings. Processing these files breaks some tag editors, specifically eyeD3 ignores the values. What would be a smart way to replace these ID3 tags with numeric strings, via command line? I have a solution which comes with some command line magic, I am looking for something simpler:               find . -name "*.mp3" -exec id3v2 -R {} \; |awk -F": " '/^Filename/ {f=$2};/^TPOS/ {print f, "\t", $2}'|grep CD1|awk -F" \t" '{print $1}'|xargs -L 1 -d "\n" -I{} id3v2 --TPOS "1" {}      In a nutshell: find mp3 files, extract the ID3 tags with id3v2, extract filename and TPOS with awk, grep for "CD1", cut out the filename and apply id3v2 to set the disc number to "1".


title: Does tar -x Extract to Current Directory or Does it Extract to the Source of the Archive?

text: Does `tar -x` by default just extract to the current directory or does it try to reproduce the original directory structure including overwriting the original source? I know I can specify a folder to extract to by using `-C directory/` but I am asking about it's default behavior. So if I used `tar -cvpjf ~/backup.tar.bz2 /` to make a backup of my root directory and I then extract the `backup.tar.bz2` (assuming I had root privileges) from within my home directory would it recreate `/` in my home directory or would it actually try to overwrite `/`?


title: Change keyboard layout using Cyryllic character

text: I'm using Lubuntu 11.10. I tried the keyboard layout applet from `lxpanel` but it does not work and I don't know why. I can change the layout to Russian using               $ setxkbmap ru      and it works! Nice! But the problem is: **how to set it back to`br` using the Russian characters?** That is, what should I type on a Russian keyboard to get the same result as               $ setxkbmap br


title: What's the difference between /etc/rc.d/rc*.d and /etc/rc*.d

text: I know that rc*.d directories are used at startup, or reboot, or so on time, for starting or stopping programs. Can anybody explain me what's the difference between the rc*.d folders placed under the `/etc/` path and the other placed under the `/etc/rc.d/` path. Also, what's the difference between `/etc/init.d` and `/etc/rc.d/init.d`? Thanks. N.B. I'm running CentOS 6.2.


title: Most lightweight distro that runs LibreOffice Writer

text: I've got an old PC with a 400 Mhz CPU and 256 Mb RAM. I just need to run LibreOffice Writer on it (or another word processor that opens .doc just as good, no Abiword). I'm looking for a light distro that offers it through its repos, or that can install it easily as a standalone. EDIT: It has to run a DE with graphical mounting/unmounting of thumb drives. It is for linux newbies in a workplace.


title: issue with terminal/prompt

text: I have an issue where if I type in very long commands in bash the terminal will not render what I'm typing correctly. I'd expect that if I had a command like the following: ` username@someserver ~/somepath $ ssh -i /path/to/private/key myusername@something.someserver.com ` the command would render on two lines. Instead it will often wrap around and start writing over the top of my prompt, somewhat like this: ` myreallylongusername@something.somelongserver.comh -i /path/to/private/key ` If I decide to go back and change some argument there's no telling where the cursor will show up, sometimes in the middle of the prompt, but usually on the line _above_ where I'm typing. Additional fun happens when when I up arrow to a previous command. I've tried this in both gnome-terminal and terminator and on i3 and Cinnamon. Someone suggested it was my prompt, so here that is: ` \\[\033[01;32m\\]\u:\\[\033[01;34m\\] \W\033[01;34m \$\\[\033[00m\\] ` `Ctrl^l`, `reset`, and `clear` all do what they say, but when I type the command back in or up arrow the same things happens. I checked and `checkwinsize` is enabled in bash. This happens on 80x24 and other window sizes. Is this just something I learn to live with? Is there some piece of magic which I should know? I've settled for just using a really short prompt, but that doesn't fix the issue.


title: cURL for loop variable

text: Is there a way to write a for loop with a URL and change the URL each time? I want to append &skip= ** _XX_** with different numbers to skip, is there a way to write it so that the variable is in the URL?


title: Alias in .bashrc doesn't seem to accept an argument

text: > **Possible Duplicate:**   >  In Bash, when to alias, when to script, and when to write a function? I'm trying to setup an alias in my .bashrc file, but it's not working as expected. I have this alias which works:               alias lolcat='python /home/martyn/Dropbox/Applications/Scripts/logcat-viewer/unixcoloredlogcat.py'      and I normally use this command as such:               adb logcat SomeValue:* *:e | lolcat      But I want to put that in to an alias so that I can write:               logcat SomeValue      but my alias below isn't working - it seems that the $1 isn't coming through - can anyone help me fix this?               alias logcat="adb lolcat $1:* *:E | lolcat"      ** FIX **               alias lolcat='python /home/martyn/Dropbox/Applications/Scripts/logcat-viewer/unixcoloredlogcat.py'          function logcat(){          adb lolcat $1:* *:E | lolcat      }


title: sticky alias command

text: I want to have the alias `inst` to be used instead of `installpkg /tmp/` and then install packages by `inst <pkg name>`. But in normal alias define, We can not stick alias name to the package name and it gives: `installpkg /tmp/ <pkg name>` That have space between /tmp/ and There is a way to use `alias inst="cd /tmp/; installpkg"`; That changes the directory too. But is there any way to have sticky alias?


title: How do I decide whether to make a command a shell script or an alias?

text: > **Possible Duplicate:**   >  In Bash, when to alias, when to script, and when to write a function? If I want to make a command like `gsb` that will expand to something like `git show-branch -a | more` or something even longer, what are the pros and cons of using a bash shell alias vs making a bash script and putting it on your PATH? Are there any performance considerations? For instance, does creating a lot of aliases create more overhead than adding a lot of commands to a directory on your PATH?


title: How do I set default brightness after boot?

text: Linux Mint 12 (64bit), on an Acer Aspire 7730g. Upon every boot, the screen brightness is set very _very_ low. Easily fixed via the function keys, but still a very annoying thing to do after every boot. Is there a way to set the brightness permanently? NB: Interestingly, I had the same problem when Ubuntu was installed on the same laptop, so I'm a bit perplexed about how did this setting survive a complete OS reinstall? `dmesg` output available here. Another update: I don't know if this is related, but everytime I reboot, my wireless is off, bluetooth is on and num lock is off; all three the exact opposite I want them to be. If this is not related, it may become another question.. :-(


title: Network interface preference

text: How does Linux determine which network interface to use, when both are connected to the same network? Note that this isn't a question on routing. I'm familiar with how that works. This is if, say, I have my laptop connected to my wireless router through both my ethernet card and my wireless card, or if I have two ethernet cards both connected to the same router. I can say from experience that in my case, my laptop seems to favor the ethernet card (eth0) over the wireless (eth1--I know that's not a typical name for a wireless interface, but that's what I have), but I was wondering, how does it decide that? If it just picks from the lowest numbered interface, what if the two choices are, say, eth0 and wlan0? Edit: @Nils has pointed out that this is still a matter of routing, and the routing table provides the answer (see his answer). This still leaves my original question, but in a different form. What determines the order of entries in the routing table in Linux? For example, here is my routing table while connected to both interfaces:               Kernel IP routing table     Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface     0.0.0.0         192.168.4.1     0.0.0.0         UG        0 0          0 eth0     169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth0     192.168.4.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0     192.168.4.0     0.0.0.0         255.255.255.0   U         0 0          0 eth1      It's clear that eth0 is higher priority in the table than eth1 for destinations in the local network, but is that decided in Linux from link latency, link throughput, even the interface name, or what? (The same question could go for why eth0 is the interface for the default route.)


title: Scroll % in Vim cmd line?

text: I apologize for the n00bish question, however it's one of those where the key terms are too generic to find an answer very easily. Basically on all my Linux installations, opening any file in Vim displays the vertical scroll % in the bottom right corner of the cmd line. I'm currently running Windows, and I've installed the vanilla Vim 64bit installation. (I'm using console Vim rather than gVim). Currently there is no information in my cmd line besides a mode indicator when I switch from normal mode. How can I get the scroll % there? Thanks!


title: What does the last column in this IP table mean?

text: From a tutorial, I run               $sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT     $ sudo iptables -L      and get               target     prot opt source               destination               ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED      The man page just says that -L "lists the rules in the chain." I understand the first 5 columns -- but what about the last? What do these mean?


title: SSH not terminated after exit when there is X Forward program

text: After running X programs over SSH, SSH doesn't terminate after shell exit (have to use e.g. `Ctrl``C` to kill it). My guess is although the X program already exit, there is still some "connection" left (not freed). The exceptions I have found now are `gtk-demo` and `acroread`. Does anyone know the reason? Is this a problem with ssh{,d} configuration?


title: Unable to boot the operating system

text: I installed `Lubuntu 11.10` and it run without problems. I decided to install `Ubuntu 11.10 mini` instead of `Lubuntu 11.10`. After the installation the operating system didn't boot. I only saw the black screen. I used `sysresccd` and tried to repair `grub` according to this guide and I tried `solution 2`. It didn't help. I tried to repair it with `lilo`. I remembered that at some time in the past I repaired `mbr` with `lilo` and everything was OK. After using the command: `lilo -M /dev/sda mbr` I restarted the laptop and a message appeared (I don't remember what it said). I understood that I had to install `grub` again and repeated the procedure with `sysresccd`, which didn't help. EDIT: `fdisk -l /dev/sda` EDIT: content of /boot directory of sda1 partition EDIT: I used `google` and found this link. It seems that this is my problem. It was only sufficient to press `ctrl+alt+F1` and Ubuntu started booting. After commenting the line containing `vt.handoff` in `/etc/grub.d/10_linux` everything was OK. How to close this question?


title: Bluetooth card all of a sudden disappears?

text: I'm on a 2011 8,3 MacBook Pro running Ubuntu 11.10 amd64. I've been using the Bluetooth card in my machine perfectly for a long time. All of sudden, for no apparent reason, the Bluetooth device is gone. `hcitool dev` shows no devices at all. What on earth happened? How can I find my Bluetooth card and get it working again? The only thing I did was install `b43` from a compat-wireless, as I had to compile it myself. Is there something I did wrong there? How can I tell what the problem is and fix it?


title: Debian install fails on USB-HDD

text: After my internal HDD broke in my laptop, I've tried to install Debian 6.0.6 on my external HDD. Please note that everything runs great when installing Ubuntu, but for some reason while the Grub stage installation occurs in Debian I get an error telling me that there was a fatal error while installing it. On my second attempt I skipped the Grub installation and later tried to install it from a LiveCD, but it seems to still fail as the problem is that when I run the boot command my external HDD reboots and the whole booting process halts.


title: Is it possible to use split to make character chunks out of Chinese unicode bytes?

text: For a while, I've been dealing with Chinese unicode text. Of course, the usual rules apply. I can `grep` for characters the same way I'd do so for words. This is very useful to me. But there's one thing I haven't figured out yet. And I don't know if it's even possible. It stands to reason that CJK would not be amenable to all kinds of splitting. But line splitting works, of course, using `split -l`. What I want to do is be able to `split` an arbitrary number of characters, though. My understanding of Chinese unicode is that every glyph is the same number of bytes in size. As such, there should be some magic number of bytes, a least common multiple, which would allow me to use `split -b`, right? I used trial and error once, hoping to arrive at that number, but was not able to do so. Instead, the characters themselves were split, such that splitting CJK a file in two. For instance, given a file called 'dunting' which contains only the string 洞庭湖, using `split` ends up yielding what is essentially nonsense. One of the characters even becomes 溭 during the `split`...


title: How to setup ATI/Intel dual graphics-card driver in Debian

text: I have searched it from the Internet, but there is only a solution for Ubuntu. > Visit: **_http://xpressrazor.wordpress.com/2013/01/13/how-to-setup-amdintel- > hybrid-graphics-cards-in-linux-ubuntu/_** I think that might not suit Debian, so can anyone tell me how to set it up? > Distributor ID: Debian   >  Description: Debian GNU/Linux 7.4 (wheezy)   >  Release: 7.4   >  Codename: wheezy


title: Amarok2 "Search Collection" shortcut?

text: Is there a way to make a shortcut for amarok2 that would put focus on the search collection box?


title: Network monitoring tool

text: I'm basically looking for a utility that displays which processes are using how much bandwidth, similar to how `top` displays which processes use how much resources.


title: "lshw -C disk" returns but prints nothing

text: I am using an ubuntu live cd to help me recover some data off of a hard drive. I used `lshw -C disk` to find out which device I need to copy, `/dev/sda` in this case. I am using `ddrescue -n` to try and recover some data from a failing hard drive. It stops at 100GB of a 500GB hard drive. After it finishes `sudo lshw -C disk` does not print anything. The next step in using `ddrescue` is to use `sudo ddrescue -r 1 /dev/sda`, but it reports there is no such file or directory. What is going on; why is `lshw` failing to report anything? Edit: Added sudo to relevant places.


title: Are there any differences between mounting a /proc filesystem inside a chroot compared to mounting it from the outside?

text: Compare the following:               mount -t proc none ./my_chroot/proc      and:               chroot ./mychroot mount -t proc none /proc


title: Store gnome keyring on a flash-drive?

text: I was wondering - is there a way to store my gnome key-ring on a usb drive?


title: OpenVPN problem

text: I've Configure an OpenVPN (2.0.9) on a CentOS 6.2 (2.6.32-358.2.1.el6.x86_64) to accept OpenVPN client connection. But when I try to connect from Windows 7 by OpenVPN client tool it return me some error: Server side OpenVPN Config Client Side OpenVPN Config Client Side OpenVPN Log Windows firewall is off   iptables (server) is off any idea?


title: Am getting a blank screen during installation stage of Arch Linux

text: I used `dd if=archlinux-2010.05-core-x86_64.iso of=/dev/sdb` to create an installation image on a USB stick and I'm getting a blank screen soon after boot-up. The last message I saw is:               Waiting for UDev UEvents to be processed...      What am I to do? [ **note** ] Am using a TravelMate 6592: Core 2 Duo T7500 2.2GHz processor.


title: Is it possible to run ganglias gmetad and ganglia-monitor not demonized on debian?

text: I wonder is it possible to run ganglias gmetad and ganglia-monitor not demonized, under my own user (me, sudo) on debian? Because while `gmond.conf` contains something like `demonize` option I see no such in `gmetad.conf`...


title: How to configurate ganglia-monitor on a single debian machine?

text: Here is what I currently have online, as you can see there is no information about my debian server. (While was installing I tried to follow next instructions) What I have changed in default `gmond.conf`:               cluster {       name = "dspproc"       owner = "unspecified"       latlong = "unspecified"       url = "dspproc"     }          udp_send_channel {       mcast_join = 127.0.0.1       port = 8649       ttl = 1     }          udp_recv_channel {       mcast_join = 127.0.0.1       port = 8649       bind = 127.0.0.1     }      And this is what I changed in `gmetad.conf`:               data_source "dspproc" 10 127.0.0.1     authority "http://195.19.243.13/ganglia/"     trusted_hosts 127.0.0.1 195.19.243.13     case_sensitive_hostnames 0      My question is: what I do wrong , and how to make ganglia show info about current machine its installed on? _**Update_** Following this answer Changed to:                  udp_send_channel {           host = 127.0.0.1           port = 8649           ttl = 1         }              /* You can specify as many udp_recv_channels as you like as well. */         udp_recv_channel {           host = 127.0.0.1 /* line 41 */           port = 8649           bind = 127.0.0.1         }      got this on restart:               Starting Ganglia Monitor Daemon: /etc/ganglia/gmond.conf:41: no such option 'host'      and still `Hosts up: 0` in web ui. _**Upadate 2:_** So... when I read the answer again and went on to the link made next changes into configuration and all worked out!) Thank you noffle! Now that block of gmod.conf looks like                   udp_send_channel {           host = 127.0.0.1           port = 8649           ttl = 1         }            udp_recv_channel {         port = 8649         family = inet4       }       udp_recv_channel {         port = 8649         family = inet6       }      and all seems to work...


title: Preserve scroll on Linux console switch

text: > **Possible Duplicate:**   >  How do I ensure that a terminal remains scrollable? I've configured really sweet keystrokes for switching between, and scrolling in, a tty (the Linux console). But, as soon as I change from one tty to another (or, from X to a tty), I cannot scroll anymore! But, scrolling still "works", since, if I enter a new command, I can scroll that output (in addition to the output not "lost" when I returned to the tty, i.e., what was left on the screen when I changed in the first place).


title: What Linux utility can split a large file into a multi-file archive that can be opened on Windows?

text: I have a 6GB file which I need to transport on DVDs. I have a Linux system, while the recipient has a Windows system. Is there any way for me to make a multi-part archive to spread the file across two DVDs that can be opened by a Windows user?


title: ChrUbuntu (Acer): How to load kernel 3.8.0-16 instead 3.4.0?

text: I have Acer C7 Chromebook with Intel CPU, and I had installed there ChrUbuntu. I had updated (Chr)Ubuntu to 13.04 daily version using dist-upgrade. But I found that I still use google v.3.4.0 linux kernel, not Canonical v.3.8.0. So how I can change kernel? I found how to do it on normal computers with GRUB, but it is Chromebook, so there is NO Grub.


title: Is there a command to see where a disk is mounted?

text: Is there a simple command that takes a disk's device node as input, and tells me where (and whether) that disk is mounted? Is it possible to get the mount point by itself, so I can pass it to another command? I'm working on a Debian Squeeze live system with a minimal install (I can install extra packages if need be).


title: Communicating from bash with grunt shell

text: I'm tired of the slow startup time of `hadoop fs` just to query HDFS. This isn't a problem with HDFS itself though, because using HDFS file system commands within the Pig "grunt shell" is pretty fast. But it's impractical to always startup the grunt shell when I just want to issue some HDFS commands. So I wrote this script to startup a grunt shell instance in the background for me and keep it open for succeeding calls:               #!/bin/bash          in=/tmp/grunt_in     out=/tmp/grunt_out     err=/tmp/grunt_err          if [ ! -p $in ]     then         mkfifo $in         mkfifo $out         ( pig <>$in >$out 2>$err; rm $in $out ) &         disown     fi          >$err # Truncate errors     echo "fs $*" >$in     echo >$in     echo "-- end" >$in     sed -n '/^grunt> -- end/q;/^grunt>/d;p' $out     cat $err >&2      Of course not only the input has to be send to the script, but also the output from the script has to be redirected to my current bash session. I use the `/tmp/grunt_in` and `/tmp/grunt_out` FIFOs here to accomplish that. To figure out when `pig` processed the command I send a `"-- end"` comment and detect that in the `sed` command which is listening on the output to make it quit when encountering the `end` token and only output the relevant part by skipping all `grunt>` prompts. Note that I have to attach the input FIFO with `<>$in` even though I redirect the output to `$out` to prevent pig from quitting after the first command. I don't know exactly why, but I figured it works this way. This actually works already quite nice. E.g.               $ time hadoop fs -ls     Found 38 items     [ skipped output ]          real    0m1.828s     user    0m3.160s     sys 0m0.137s          $ time dfs -ls          [apollo@dc1-had03-clusterutil01 reporting-APO-5394]$ time dfs -ls     Found 38 items     [ skipped output ]          real    0m0.149s     user    0m0.003s     sys 0m0.006s      (I called my script `dfs` here.) There are only two problems left which I can't figure out currently:   1. When I call the script the first time (that is when the fifo `/tmp/grunt_in` isn't existing yet and the pig instance is started in the background) my terminal settings are somehow messed up. I don't get an echo of my input anymore, so I have to type a `reset` blindly to get a sane terminal back. Succeeding calls work fine though.   2. When I try to output file contents on HDFS with `-cat` or `-text` the output gets arbitrarily truncated. E.g.:              $ hadoop fs -text some-medium-size.gz|wc -l     3606     $ dfs -text some-medium-size.gz|wc -l     text: Unable to write to output stream.     9      Note the error message `text: Unable to write to output stream.` here which is not coming from `pig` but from the `fs -text` command from `hadoop`. Sometimes it's truncated at the first 9 or 10 lines as here or sometimes somewhere at the middle. It's quite strange. I also tried to send the command manually to `/tmp/grunt_in` and reading `/tmp/grunt_out` with `cat`, with the same result, but this confirms that my parsing with `sed` can't be the issue here. This also doesn't seem to be a problem with big outputs in general, e.g. for long directory listings it just works fine:              $ dfs -ls -R|wc -l     10686      (Which gives the same result as `hadoop fs -ls -R|wc -l`) Maybe the last problem is a problem with `hadoop fs -text` and `hadoop fs -cat` itself? Or do I something wrong with my use of named pipes?


title: How to configure SVN/SSH with SSH on non standard port?

text: I have configured SSH to be on port 20000. When I try:               svn co svn+ssh://server.com:20000/home/svn/proj1 proj1 --username jm      I get > `svn: To better debug SSH connection problems, remove the -q option   >  from 'ssh' in the [tunnels] section of your Subversion configuration   >  file. svn: Network connection closed unexpectedly` I think I need to tell SVN to use port 20000 also? I am on Ubuntu 11.10


title: Samba 3 file sharing access permission problem onWindows

text: I'm trying to set permissions on a server RHEL v5 whith Samba v3. The configuration of `/etc/samba/smb.conf` is   > `[project] valid users = proyecto, admin writeable = yes path = > /home/project ; browseable = yes ; browseable = yes ; browseable = yes` From then when I try to access the shared folder Windows asks me the authentication of the user with the password and gives an error of login and I can not access!![enter image description here](http://i.stack.imgur.com/59WPV.png) What is the possible problem?


title: How to cycle through reverse-i-search in BASH?

text: In the terminal, I can type `CRTL+R` to search for a matching command previously typed in BASH. E.g., if I type `CTRL+R` then `grep` is lists my last `grep` command, and I can hit enter to use it. This only gives one suggestion though. Is there any way to cycle through other previously typed matching commands?


title: How to log all the events performed on directory?

text: How can I log all the events performed on a particular directory? I want to log the entry of each directory modified within some time duration. I am using `find . -type d -mmin -5` command. In addition to this, I want to put more details, when any directory is moved to another place, I need to add the below log details, eg., > directory "xyz" moved from "home/usr/xyz" => to "home/usr/documents/xyz"


title: Allow setuid on shell scripts

text: The `setuid` permission bit tells Linux to run a program with the effective user id of the owner instead of the executor:               > cat setuid-test.c          #include <stdio.h>     #include <unistd.h>          int main(int argc, char** argv) {         printf("%d", geteuid());         return 0;     }          > gcc -o setuid-test setuid-test.c     > ./setuid-test          1000          > sudo chown nobody ./setuid-test; sudo chmod +s ./setuid-test     > ./setuid-test          65534      However, this only applies to executables; shell scripts ignore the setuid bit:               > cat setuid-test2          #!/bin/bash     id -u          > ./setuid-test2          1000          > sudo chown nobody ./setuid-test2; sudo chmod +s ./setuid-test2     > ./setuid-test2          1000      * * * Wikipedia says: > Due to the increased likelihood of security flaws, many operating systems > ignore the setuid attribute when applied to executable shell scripts. Assuming I'm willing to accept those risks, is there any way to tell Linux to treat the setuid bit the same on shell scripts as it does on executables? If not, is there a common workaround for this problem? My current solution is to add a `sudoers` entry to allow `ALL` to run a given script as the user I want it run as, with `NOPASSWD` to avoid the password prompt. The main downsides to that is the need for a `sudoers` entry every time I want to do this, and the need for the caller to `sudo some-script` instead of just `some- script`


title: How to let a user execute a script owned by root? Setuid doesn't seem to work anymore

text: I have some bash scripts that I use with the user 'root' to manage iptable rules. The problem is that I want these things at the same time:   * The script must be owned by root   * Permissions must be 700   * I want to have an executable binary that certain user can execute. This executable will run the mentioned script as root. This used to work, and is still what I use in older distributions:               #include <stdio.h>     #include <stdlib.h>     #include <sys/types.h>     #include <unistd.h>          int main()     {        setuid(0);        system("/root/iptables/my-iptables-script.sh");             return 0;     }      So I compile this and then use `sudo chown root` and `sudo chmod 4777`. This way the user can now execute the binary and run the script owned by root. But now I installed Ubuntu 13.10 and when I run that binary I get "permission denied" for the script. Is it possible that something changed in this respect since 12.04? What can I do?


title: Finding the number of time a particular number in a file where range also specified

text: I have a file with numbers separated by `,`(comma). In between it also contains a number range like `300-400`. Say for example I have a text file, namely `testme.txt` which looks like,               200,300,234,340-350,400,360,333-339     409-420     4444-31231231     348      I want to find out whether number `348` is present or not. 348 is present in 2 places:   * 340-350    * In last line. How to find it?. I tried using `regex` in sed,awk, but I am not able to completely write the script to capture the number range. Is there any other way to find it? UPDATE: Found 1 brute force solution & it's working only for range.               count=0;     num1=348;     for i in `sed 's/\([0-9]\+\-[0-9]\+\)/:&:/g' testme.txt  |          awk -F: '{ for(i=1; i<=NF; i++) if($i ~/[0-9]+-[0-9]+/){print $i} }'`;           do          lh=`echo $i | awk -F\- '{print $1}'`;          rh=`echo $i | awk -F\- '{print $2}'`;           if [ $lh -le $num1 -a $rh -ge $num1 ];          then               count=`expr $count + 1`;          fi;      done     echo $count;


title: Where are linux packages hosted? (Debian in particular)

text: I'm trying to understand some things about package managers Debian wheezy packages, like when you do `apt-get install example` and suppose you never added sources. Where does `apt` look for the package On launchpad and debian site only? if so, where exactly on launchpad, i tried to find my way but i was lost, this site is huge, does aptitude search the same host? suppose there's no `apt` and you have to go download it, you go to launchpad? supposing that the developer didn't have a site. Does yum and pacman also search launchpad? What else? And last question, about pip, does it only search PYPI.python.org?


title: How to override port settings when connecting to a public wifi?

text: I am connecting to a free public wifi, I want to connect or use other ports like FTP and SSH. What are the possibility to override it? In order to connect to the internet, They are requiring me to add their proxy on my HTTP and HTTPS settings, under network (Mac OSX). I've asked them why I can't use other ports and they told me that their internet setting is only open for HTTP and HTTPS port. Is using VPN be able to override their settings? Please advice some way around if your connecting to a public wifi and you want to use other ports. Just FYI, I need to use the other ports like SSH and FTP to manage my FTP server. I am using a MacOSX environment. **Edit:** * * * I'll try to add detail as much as I can, I'm not really sure about their network structure as i'm not good at networking and I haven't seen their setup. But I know they have wireless router in every corner where you can get signal from it. I think it's also the same setup as public libraries are setup, you can only browse that are related to research and some sites like p2p, hacking, etc are being blocked. I've looked some tutorial (youtube) how to use VPN to bypass restriction, And most of them needs to connect through SSH first. Unfortunately, the port for SSH is already block. Am I on the right track? Thanks for you responses! :)


title: Change/fix cygprefix to / (corrrect/updated way?)

text: Ive seen and done as suggested on this question but am still unable to get ride of the /cygdrive/c prefix.               :pwd     /cygdrive/c/Users/myname     :ls     file1     file2     ...          :cat /etc/fstab     # For a description of the file format, see the Users Guide     # http://cygwin.com/cygwin-ug-net/using.html#mount-table          # This is default anyway:     none /cygdrive cygdrive binary,posix=0,user 0 0      As a matter of fact, when I add the answer from that question, my `~` directory is no longer my actual home directory!               :cat /etc/fstab     # For a description of the file format, see the Users Guide     # http://cygwin.com/cygwin-ug-net/using.html#mount-table          # This is default anyway:     none /cygdrive cygdrive binary,posix=0,user 0 0     #none / cygdrive binary 0 0          :ls     .bashrc     .zshrc      and those are empty/not my real ones! What can I do?


title: RTL8191SE wireless card not working in Debian Squeeze

text: I'm having trouble getting my wireless card seen in debian squeeze. `iwconfig` only shows `eth0` and `l0` but no `wlan0`. `ifconfig wlan0 up` says theres no such device.   I compiled a backport kernel and I now have "2.6.39-bpo.2-686-pae". I downloaded the `rtl8191se` driver from the Realtek site. It said it needs kernel version 2.6.35 or above. So now that I have 2.6.39 all should be fine. However when I run `make` in the firmware driver it says               make entering directory lib/modules/2.6.39-bpo.2-686-pae/build     no rule to make target 'modules'     Stop.      Is there a problem with my `make`? I installed i386 packages as theres no i686 packages on the Debian site. However, my kernel is i686 it seems. Is that a problem?


title: How to pass parameters to an alias?

text: For bash script, I can use `"$@"` to access arguments. What's the equivalent when I use an alias?


title: How to create an alias, but so I can enter in different info with the command

text: Hi I was wondering I have to run some rather long commands all day. I know how to create aliases for the commands, but the problem I am having is each command contains different IP address in the middle of the command. Is there a way to create an alias so that it runs the command and all I would have to do is enter an IP?


title: how to make alias to make grep command shorter

text: In my coding, I always do `grep -rnIi "abcabc" . --color` But, how to make an alias that can let me type only one word with my search string? Is that possible?


title: Create alias that can interact with arguments

text: My ultimate goal is to simplify routine task of compilation and run. Now I've following commands                1. g++ foo.cpp -o foo --std=c++11      2. chmod foo +x #this may be overkill      3. ./foo      So, my question if this can be done like               compile foo      with alias or something like that * * * I've tried               alias compile='g++ $1.cpp -o $1 --std=c++11'      with no luck


title: create an alias that runs a command with string replacement from arguments

text: I'm trying to write a couple of shortcut aliases to quickly navigate to the httpdocs folders of the various domains and subdomains on my server. basically so I can type something like:               $ pwd     /     $ # Go to the 'site.com' domain:     $ goto site.com     $ pwd     /var/www/vhosts/site.com/httpdocs     $ # Go to the 'subsite' subdomain:     $ gotosub site.com subsite     $ pwd     /var/www/vhosts/site.com/subdomains/subsite/httpdocs      I'm pretty green when it comes to Linux commands and I've tried to research this but failed at putting together search terms that have helped. I've tried using printf and backticks like this:               $ alias goto='`printf "cd /var/www/vhosts/%s/httpdocs"`'     $ alias gotosub='`printf "cd /var/www/vhosts/%s/subdomains/%s/httpdocs"`'      but that doesn't replace in the arguments. If I remove the backticks:               $ alias goto='printf "cd /var/www/vhosts/%s/httpdocs"'     $ alias gotosub='printf "cd /var/www/vhosts/%s/subdomains/%s/httpdocs"'      Then it works but I need to run them like so:               $ `goto site.com`     $ `gotosub site.com subsite`      ...Which seems ugly and inefficient. What's the best approach to achieve this?


title: How to create an alias that takes an argument in KornShell

text: I am trying to create an alias which when given some argument will look for the folder with contains the argument as pattern. Let the alias name be `gohf`. Now, I will be using this alias like `gohf <some-pattern>`, for eg. `gohf testing`. Now this should look for a folder that contains “testing” in its name and take me to that folder in the last step. Following is what I could think of.               alias gohf='cd `find . -type d | grep testing`';      The above alias works when the pattern is always “testing”. How can I modify so that if the alias is used as say `gohf game`, then the alias should take me to the folder that contains game in its name. **Note** : Shell: ksh I am assuming that there is only one folder for each pattern I input.


title: Is it possible to use a parameter within an alias command

text: > **Possible Duplicate:**   >  How to pass parameters to an alias? As answered in Can less retain colored output? I want to use   `git diff --color=always filename | less -r` to get a colored output of my git diffs. Since I use this a lot it would be nice to set up an alias for this. But how to include the `filename` in this command? I tried the following without success:               alias gdiff='git diff --color=always $1 | less -r'      Typing `gdiff example.php` displays the content of `example.php` with `less` but ignores the diff part. Any ideas?


title: Unix alias with parameters

text: > **Possible Duplicate:**   >  How to pass parameters to an alias? I'm wondering if it is possible to define an alias with parameters. For example, when I have to compile a tex file I execute pdflatex and then I have to open the pdf:               $ pdlatex Main.tex     $ Open Main.pdf      Is there a way for defining an alias like this:               alias buildPdf="pdflatex x.tex && Open x.pdf"      Where x is a parameter?


title: Command substitution in alias resolved in bash profile?

text: I want to make an alias for randomly changing my mac address               alias chrandmac="sudo ifconfig en0 ether $(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//')"      but the command substitution part is already resolved when executing the profile.               alias chrandmac='sudo ifconfig en0 ether 83:3a:bf:fc:4e:29'      Any thoughts as to why this occurs?


title: Error creating an alias for the find command

text: > **Possible Duplicate:**   >  How to pass parameter to alias? I am trying to shorten the `find` command, but getting an error:               $ alias f='find . -name $1 -print'     $ f JobConf.java      > find: paths must precede expression: JobConf.java   >  Usage: find [-H] [-L] [-P] [-Olevel] [-D > help|tree|search|stat|rates|opt|exec] [path...] [expression] How can I make this work?


title: Bash alias arguments

text: > **Possible Duplicate:**   >  How to pass parameters to an alias? I am trying to make a bash alias that will allow me to quickly make an archive of the current git repo. My current alias is: `alias gitarch="git archive master --format=tar | gzip >$@"` This works great if I supply a destination file exactly like `gitarch ~/Desktop/MyArchive.tar.gz` but I want to be able to just type a filename and it will always save to the desktop with the tar.gz extension. I tried doing: `alias gitarch="git archive master --format=tar | gzip >~/Desktop/$@.tar.gz"` But it doesnt seem to work correctly. Can anyone tell me the secret to getting this working?


title: Alias for redirecting both standard output and standard error, as well as sending to background

text: I am trying to create an `alias` for redirecting both standard output and standard error of `gedit` to `/dev/null`, whilst sending the command to background. This works:               $ alias gedit='gedit $1 > /dev/null 2>&1'     $ gedit file.txt &      However, adding the background instruction `&` to the `alias` string fails to work because it gets immediately interpreted:               $ alias gedit='gedit $1 > /dev/null 2>&1 &'     [1]+  Done                    gedit > /dev/null 2>&1      How should I add this `&` background instruction to the `alias` command?


title: What steps can I use to recover a RAID 1 array with LVM and EXT3 on it?

text: Someone handed me a drive that used to be part of a RAID 1 (mirror) array. The drive apparently has LVM (1?) on it and EXT3 (I believe). What steps can I take to regain access to this drive? Additional info:   * The drive was a RAID array from a circa Fedora 6 system, so I'm assuming that it was of the era that it was still using LVM1 and EXT3.   * I only have 1/2 of the RAID.   * Drive is USB based. My current Fedodra 14 system is able to identify the drive fine (/dev/sdb1) and I can run commands such as:              $ mdadm -A --force /dev/md2 /dev/sde1     $ mdadm --detail /dev/md2      The first seems to have added the array device onto my system since I can successfully run the 2nd command which show the array as clean, but in a degraded state (as expected).              $ mdadm --detail /dev/md2     /dev/md2:             Version : 0.90       Creation Time : Mon Jan 15 15:20:44 2007          Raid Level : raid1          Array Size : 156288256 (149.05 GiB 160.04 GB)       Used Dev Size : 156288256 (149.05 GiB 160.04 GB)        Raid Devices : 2       Total Devices : 1     Preferred Minor : 2         Persistence : Superblock is persistent              Update Time : Fri Sep 27 16:50:13 2013               State : clean, degraded      Active Devices : 1     Working Devices : 1      Failed Devices : 0       Spare Devices : 0                     UUID : 0266bb35:6fcac8b4:12f56e39:0f78dafb              Events : 0.19624              Number   Major   Minor   RaidDevice State            0       8       65        0      active sync   /dev/sde1            1       0        0        1      removed      I'm getting stuck when I attempt to bring the LVM pieces back up. ### EDIT #1: Follow-up Questions   1. What does the command `file -s /dev/{sde1,md2}` yield?              $ file -s /dev/{sde1,md2}     /dev/sde1: LVM2 (Linux Logical Volume Manager) , UUID: ZK8IfBzUHPH5befvm5CZ81oIXHm11TG     /dev/md2:  LVM2 (Linux Logical Volume Manager) , UUID: ZK8IfBzUHPH5befvm5CZ81oIXHm11TG        2. What does the command `vgscan` yield?              $ vgscan       Reading all physical volumes.  This may take a while...       Found volume group "kodak_vg" using metadata type lvm2        3. Is there a physical LVM volume on `/dev/md2`? Yes there is a physical LVM volume on the RAID array /dev/md2.   4. What does `pvs` yield?              $ pvs        PV         VG         Fmt  Attr PSize   PFree        /dev/md2   kodak_vg   lvm2 a--  149.00G    0         5. Is there an encrypted partition or DOS partition table present? No there definitely is not either. It's a basic software RAID (md raid1) -> LVM -> EXT3. ### EDIT #2 At this point the RAID seemed intact, but no LVM device mappers were present, also the Logical Volume (LV) seemed to be in an INACTIVE state.               $ lvscan       inactive          '/dev/kodak_vg/lvm0' [149.00 GB] inherit      So I ran this command to activate it:               $ vgchange -ay       1 logical volume(s) in volume group "kodak_vg" now active      Re-running `lvscan` showed the LV as active now:               $ lvscan       ACTIVE            '/dev/kodak_vg/lvm0' [149.00 GB] inherit      ### Mounting So at this point I thought I'd be OK with mounting the LVM mapper, `/dev/kodak_vg/lvm0`.               $ mount -t ext3 /dev/kodak_vg/lvm0 /mnt     mount: wrong fs type, bad option, bad superblock on /dev/kodak_vg/lvm0,            missing codepage or other error            In some cases useful info is found in syslog - try            dmesg | tail  or so      Here's the output from `dmesg | tail`:               $ demsg | tail     Buffer I/O error on device md2, logical block 48     usb 1-4: reset high speed USB device using ehci_hcd and address 5     usb 1-4: reset high speed USB device using ehci_hcd and address 5     usb 1-4: reset high speed USB device using ehci_hcd and address 5     usb 1-4: reset high speed USB device using ehci_hcd and address 5     usb 1-4: reset high speed USB device using ehci_hcd and address 5     sd 22:0:0:0: scsi: Device offlined - not ready after error recovery     sd 22:0:0:0: SCSI error: return code = 0x07050000     end_request: I/O error, dev sde, sector 387     EXT3-fs: unable to read superblock      Does this mean the drive medium may be failing or has failed? ### EDIT #3: Follow-up Questions Previous mounting attempt left the device in an inaccessible state. I initially power cycled the USB device, which was then redetected as `/dev/sdf1`. I then for the heck of it rebooted the system, but now the device is showing up in `dmesg` as `/dev/sdj1`. Not sure how to move it back, does it really matter? Repeated steps above substituting in `/dev/sdj1` for `/dev/sde1` going forward for now. At this point the device is being reported in `lvscan` as ACTIVE, but I've not yet attempted to mount the LVM mapper.   1. What does the command `smartctl -x /dev/sdj` yield? This command didn't appear to work correctly:              $ smartctl -x /dev/sdj     smartctl 5.42 2011-10-20 r3458 [i686-linux-2.6.18-238.19.1.el5.centos.plus] (local build)     Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net          /dev/sdj: Unknown USB bridge [0x0bc2:0x0503 (0x300)]     Smartctl: please specify device type with the -d option.          Use smartctl -h to get a usage summary      This command did however yield some additional information:              $ smartctl -x /dev/sdj1     smartctl 5.42 2011-10-20 r3458 [i686-linux-2.6.18-238.19.1.el5.centos.plus] (local build)     Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net          Vendor:               Seagate     Product:              External Drive     User Capacity:        160,041,885,696 bytes [160 GB]     Logical block size:   512 bytes     Serial number:              Device type:          disk     Local Time is:        Sat Sep 28 07:58:50 2013 EDT     Device does not support SMART          Error Counter logging not supported     Device does not support Self Test logging     Device does not support Background scan results logging     scsiPrintSasPhy Log Sense Failed [unsupported scsi opcode]        2. What does the command `file -s /dev/kodak_vg/lvm0` yield?              $ file -s /dev/kodak_vg/lvm0     /dev/kodak_vg/lvm0: symbolic link to `/dev/mapper/kodak_vg-lvm0'      Attempted to run the command `file -s` against the mapper device:              $ file -s /dev/mapper/kodak_vg-lvm0      /dev/mapper/kodak_vg-lvm0: ERROR: cannot read `/dev/mapper/kodak_vg-lvm0' (Input/output error)        3. What next? I'm going to take @Gilles advice and `dd_rescue` the drive to another device to see if we can't tease apart device issues with RAID/LVM issues. Any other advice before continuing? ### References   * How to get an inactive RAID device working again?   * Removing vg and lv after physical drive has been removed   * mount: unknown filesystem type ‘LVM2_member’


title: Can i transfer files using ssh?

text: I am using PuTTY on Windows 7 to ssh to my school computer lab. Can I transfer files from my windows machine to my user on the school machines using ssh?


title: Is there a reason why 'owner' permissions exist? Aren't group permissions enough?

text: I think I rather understand how file permissions work in linux. However, I don't really understand why they are split into three levels and not into two. I'd like the following issues answered:   * Is this deliberate design or a patch? That is - was the owner/group permissions designed and created together with some rationale or did they come one after another to answer a need?   * Is there a scenario where the user/group/other scheme is useful but a group/other scheme will not suffice? Answers to the first should quote either textbooks or official discussion boards. Use cases I have considered are:   * private files - very easily obtainable by making a group per-user, something that is often done as is in many systems.   * allowing only the owner (e.g. system service) to write to a file, allowing only a certain group to read, and deny all other access - the problem with this example is that once the requirement is for a _group_ to have write access, the user/group/other fails with that. The answer for both is using ACLs, and doesn't justify, IMHO, the existence of owner permissions. NB I have refined this question after having the question closed in superuser.com and stackoverflow.com **EDIT** corrected "but a group/owner scheme scheme will not suffice" to "...group/other...".


title: Using a minimal linux host for OSX and W7 VMs

text: I am a 3d artist (animation/modeling/sculpting) and I have a dream. I have licenses of zBrush the Autodesk and Adobe suites. My zBrush is a mac only licence; maya is both (I think), Adobe is for Windows, and my prefered OS is windows 7 (it would be linux if I can make this work). What I would like to do is run a minimal linux host for a variety of reasons - security, stability, being able to use zbrush on more capable hardware - that will allow me to run Windows and OSX without rebooting to switch. What I would want: --Linux boots first from there I boot either OSX or Windows OR both(?) --I need the ability to run the aforementioned programs at full strength/speed as a native install would be. --Move files from any of the 3 OSs to any of the others seamlessly. --Eliminate any reboot need. Other than restarting the particular VM for OS updates etc. The hardware I have: i7 4820k 16gb of ram(mb has max of 64gb which I will be getting to as money allows) 1TB hdd 640GB hdd and 140GB WD velociraptor split in half (I was planning on linux dual booting never finished) What I would like to do: -- Get smaller sdd's for each of the os's and dedicate them to that os. -- use the larger HDD's as communal storage. -- Max system ram. -- GUI for linux (but i'd be fine with a CLI to make room for the other two) -- Play games in windows or OSX. This is more of a perfect world point. I'd be ok booting native for this. I know of wine for linux but that doesn't get the support for the newest programs (that I currently have licenses for) and I'd rather not befoul my workflow with opensource alternatives until I have a job. Not to mention most of the work in my field uses either proprietary or in-house software. I know that what I am really looking for is a VM host but I am not sure if that will fully support the things I want it to do and if I need better hardware before it really will work the way I want. TL;DR -- I want to run a mac zBrush license, Adobe and Autodesk windows licenses all on one machine with no reboots.


title: Easiest way to find/replace in a file using a list?

text: I have a file, foo.txt, and a regexp I want to find in that file. Each time I find the regexp, I want to take a line from another file, bar.txt, and substitute it in for the regexp match I found in foo.txt. Basically I want to do find/replace, but each time I replace I want the next replacement text to come from the next line in bar.txt. Is there any easy shell magic to do this?


title: Samba server 3.6.3 crashes on simple setup on Linux Mint 13

text: I try to get smbd running on Linux Mint 13 on kernel 3.6.3-030603-generic. This is what I do: `sudo apt-get install samba`, then install this minimal /etc/samba/smb.conf:               [global]          workgroup = wkb         security = user         browsable = yes          local master = yes      [temp]          path = /tmp          public = yes       Then I type: `smbclient -L localhost -U%` and get the following error:               Domain=[WKB] OS=[Unix] Server=[Samba 3.6.3]     tree connect failed: NT_STATUS_PIPE_BROKEN      What am I doing wrong? How can I debug it further? I can't find the reference to this error message on the Net. Update: I put `sudo smbpasswd -U Adam` and filled in some password. Then, when I connect to the share from Windows, after filling in username "Adam" and the same password, first I do see the correct share list: ![share list](http://i.stack.imgur.com/jCpuZ.png) But then, when I try to enter the share "tmp" (to which the user "Adam", spelled with capital "A") has all read/modify rights, I've got the following error message: ![error message](http://i.stack.imgur.com/Pqr0Z.png) It is interesting, that when I subsequently try to refresh the share list this message persists, as if samba had crashed. But the `service status smbd` insists, that `smbd start/running, process 27309`... But it must be a crash of some sort, since at the end of `/var/log/samba/log.smbd` I can find:               [2012/11/13 10:01:35.281800,  0] lib/fault.c:372(dump_core)       dumping core in /var/log/samba/cores/smbd     [2012/11/13 10:01:35.296359,  0] lib/util.c:1117(smb_panic)       PANIC (pid 29359): sys_setgroups failed     [2012/11/13 10:01:35.303973,  0] lib/util.c:1221(log_stack_trace)       BACKTRACE: 21 stack frames:        #0 smbd(log_stack_trace+0x1a) [0x7ff64ea37aea]        #1 smbd(smb_panic+0x25) [0x7ff64ea37bc5]        #2 smbd(+0x163be6) [0x7ff64e782be6]        #3 smbd(set_sec_ctx+0x8f) [0x7ff64e782f0f]        #4 smbd(+0x152db5) [0x7ff64e771db5]        #5 smbd(+0x17ae2b) [0x7ff64e799e2b]        #6 smbd(+0x17b76e) [0x7ff64e79a76e]        #7 smbd(make_connection+0x1ea) [0x7ff64e79aaea]        #8 smbd(reply_tcon_and_X+0x1dc) [0x7ff64e74b82c]        #9 smbd(+0x176fa4) [0x7ff64e795fa4]        #10 smbd(+0x1773bb) [0x7ff64e7963bb]        #11 smbd(+0x1777d3) [0x7ff64e7967d3]        #12 smbd(run_events_poll+0x34e) [0x7ff64ea478ae]        #13 smbd(smbd_process+0x812) [0x7ff64e797f42]        #14 smbd(+0x68666f) [0x7ff64eca566f]        #15 smbd(run_events_poll+0x34e) [0x7ff64ea478ae]        #16 smbd(+0x428a4a) [0x7ff64ea47a4a]        #17 smbd(_tevent_loop_once+0x90) [0x7ff64ea485d0]        #18 smbd(main+0xed0) [0x7ff64e716030]        #19 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7ff64b5c176d]        #20 smbd(+0xf7515) [0x7ff64e716515]     [2012/11/13 10:01:35.305623,  0] lib/fault.c:372(dump_core)       dumping core in /var/log/samba/cores/smbd


title: Starting NetworkManager before gdm.service with systemd

text: In arch linux I would like to have `NetworkManager` service available at `gdm` login page. I enabled the two services like this:               systemctl enable gdm.service     systemctl enable NetworkManager      The issue is that the wifi connects after I log in into gnome 3. As a result, any startup program / script (e.g. weather extension) relying to internet connection to do their stuff will fail as the connection is not yet available. How can tell NetworkNamager to stat as soon as possible?


title: How extend linux partition with?(after success to extend : fail to boot computer)

text: I have Ubuntu and I want to enlarge the disk space of /dev/sda1 from 10GB to 90GB. gparted Ubuntu 9.04 live cd show:                Partition    File System   Size      /dev/sda1    ext4          10GB      /dev/sda2    linux-swap    4GB      unallocated  unallocated   146000      I would like to get this disk map:                Partition    File System   Size      /dev/sda1    ext4          90GB      /dev/sda2    linux-swap    4GB      unallocated  unallocated   56000      I click on /dev/sda1 and option resize only gives the option to reduce and not enlarge disk. If gparted cannot handle this, are there other tools that would? (I think that I should merge /dev/sda1 with unallocated but I don't know how to do it.) * * * **Update:failing boot** - unable to enter to my ubuntu OS, infinite loop in begining(solve the problem to enlarge partition but blocked to enter to my partition OS): What I done:   1. delete /dev/sda2   2. resize /dev/sda1 to 160GB   3. create /dev/sda2 with size 4GB primary partition and make it linux-swap   4. restart PC and remove ubuntu live cd - result: unable to access to my installed before ubuntu OS. my current map according gparted ubuntu live cd:                Partition    File System   Size      /dev/sda1    ext4          156GB      /dev/sda2    linux-swap    4GB      **Update2:** reinstall bootloader(Mat idea - thank you very much) https://help.ubuntu.com/community/Grub2#Reinstalling_GRUB2 Thanks,