title: Cannot start xserver - "Failed to assign any connected display devices to X screen 0"

text: I'm using **RHEL 6.3 (2.6.32-279.el6.x86_64)**   VideoCard: **NVIDIA Quadro 410**   Installed Graphic Driver: **NVIDIA-Linux-x86_64-331.79**   I try to run Xserver, but it won't start. Here is a log file:               cat /var/log/Xorg.0.log     [   641.698]     X.Org X Server 1.10.6     Release Date: 2012-02-10     [   641.699] X Protocol Version 11, Revision 0     [   641.699] Build Operating System: x86-007 2.6.18-308.1.1.el5     [   641.699] Current Operating System: Linux mos120.cadence.com 2.6.32-279.el6.x86_64 #1 SMP Wed Jun 13 18:24:36 EDT 2012 x86_64     [   641.700] Kernel command line: ro root=UUID=af5b1128-71a2-4831-8b80-30c1fe45bcb8 intel_iommu=on rd_NO_LUKS rd_LVM_LV=vg00/lswap LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=130M@0M  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM     [   641.701] Build Date: 28 March 2012  03:02:14PM     [   641.701] Build ID: xorg-x11-server 1.10.6-1.el6     [   641.702] Current version of pixman: 0.18.4     [   641.702]    Before reporting problems, check https://www.redhat.com/apps/support/             to make sure that you have the latest version.     [   641.703] Markers: (--) probed, (**) from config file, (==) default setting,             (++) from command line, (!!) notice, (II) informational,             (WW) warning, (EE) error, (NI) not implemented, (??) unknown.     [   641.704] (==) Log file: "/var/log/Xorg.0.log", Time: Tue Jun 17 13:45:26 2014     [   641.707] (==) Using config file: "/etc/X11/xorg.conf"     [   641.708] (==) ServerLayout "X.org Configured"     [   641.708] (**) |-->Screen "Screen0" (0)     [   641.708] (**) |   |-->Monitor "Monitor0"     [   641.708] (**) |   |-->Device "Card0"     [   641.708] (**) |-->Screen "Screen1" (1)     [   641.708] (**) |   |-->Monitor "Monitor1"     [   641.708] (**) |   |-->Device "Card1"     [   641.708] (**) |-->Screen "Screen2" (2)     [   641.708] (**) |   |-->Monitor "Monitor2"     [   641.708] (**) |   |-->Device "Card2"     [   641.708] (**) |-->Screen "Screen3" (3)     [   641.708] (**) |   |-->Monitor "Monitor3"     [   641.708] (**) |   |-->Device "Card3"     [   641.708] (**) |-->Input Device "Mouse0"     [   641.708] (**) |-->Input Device "Keyboard0"     [   641.708] (==) Automatically adding devices     [   641.708] (==) Automatically enabling devices     [   641.708] (**) FontPath set to:             catalogue:/etc/X11/fontpath.d,             built-ins,             catalogue:/etc/X11/fontpath.d,             built-ins     [   641.708] (**) ModulePath set to "/usr/lib64/xorg/modules"     [   641.708] (WW) Hotplugging is on, devices using drivers 'kbd', 'mouse' or 'vmmouse' will be disabled.     [   641.708] (WW) Disabling Mouse0     [   641.708] (WW) Disabling Keyboard0     [   641.708] (II) Loader magic: 0x7d6960     [   641.708] (II) Module ABI versions:     [   641.708]    X.Org ANSI C Emulation: 0.4     [   641.708]    X.Org Video Driver: 10.0     [   641.708]    X.Org XInput driver : 12.2     [   641.708]    X.Org Server Extension : 5.0     [   641.708] (--) PCI:*(0:5:0:0) 10de:0fff:103c:094a rev 161, Mem @ 0xee000000/16777216, 0xd0000000/268435456, 0xe0000000/33554432, I/O @ 0x0000c000/128, BIOS @ 0x????????/524288     [   641.709] (II) "extmod" will be loaded. This was enabled by default and also specified in the config file.     [   641.709] (II) "dbe" will be loaded. This was enabled by default and also specified in the config file.     [   641.709] (II) "glx" will be loaded. This was enabled by default and also specified in the config file.     [   641.709] (II) "record" will be loaded. This was enabled by default and also specified in the config file.     [   641.709] (II) "dri" will be loaded by default.     [   641.709] (II) "dri2" will be loaded. This was enabled by default and also specified in the config file.     [   641.709] (II) LoadModule: "dbe"     [   641.714] (II) Loading /usr/lib64/xorg/modules/extensions/libdbe.so     [   641.714] (II) Module dbe: vendor="X.Org Foundation"     [   641.714]    compiled for 1.10.6, module version = 1.0.0     [   641.714]    Module class: X.Org Server Extension     [   641.714]    ABI class: X.Org Server Extension, version 5.0     [   641.714] (II) Loading extension DOUBLE-BUFFER     [   641.714] (II) LoadModule: "extmod"     [   641.714] (II) Loading /usr/lib64/xorg/modules/extensions/libextmod.so     [   641.716] (II) Module extmod: vendor="X.Org Foundation"     [   641.716]    compiled for 1.10.6, module version = 1.0.0     [   641.716]    Module class: X.Org Server Extension     [   641.716]    ABI class: X.Org Server Extension, version 5.0     [   641.716] (II) Loading extension SELinux     [   641.716] (II) Loading extension MIT-SCREEN-SAVER     [   641.716] (II) Loading extension XFree86-VidModeExtension     [   641.716] (II) Loading extension XFree86-DGA     [   641.716] (II) Loading extension DPMS     [   641.716] (II) Loading extension XVideo     [   641.716] (II) Loading extension XVideo-MotionCompensation     [   641.716] (II) Loading extension X-Resource     [   641.716] (II) LoadModule: "dri2"     [   641.716] (II) Loading /usr/lib64/xorg/modules/extensions/libdri2.so     [   641.717] (II) Module dri2: vendor="X.Org Foundation"     [   641.717]    compiled for 1.10.6, module version = 1.2.0     [   641.717]    ABI class: X.Org Server Extension, version 5.0     [   641.717] (II) Loading extension DRI2     [   641.717] (II) LoadModule: "record"     [   641.717] (II) Loading /usr/lib64/xorg/modules/extensions/librecord.so     [   641.718] (II) Module record: vendor="X.Org Foundation"     [   641.718]    compiled for 1.10.6, module version = 1.13.0     [   641.718]    Module class: X.Org Server Extension     [   641.718]    ABI class: X.Org Server Extension, version 5.0     [   641.718] (II) Loading extension RECORD     [   641.718] (II) LoadModule: "glx"     [   641.723] (II) Loading /usr/lib64/xorg/modules/extensions/libglx.so     [   641.819] (II) Module glx: vendor="NVIDIA Corporation"     [   641.819]    compiled for 4.0.2, module version = 1.0.0     [   641.819]    Module class: X.Org Server Extension     [   641.819] (II) NVIDIA GLX Module  331.79  Sat May 17 23:58:32 PDT 2014     [   641.820] (II) Loading extension GLX     [   641.820] (II) LoadModule: "dri"     [   641.820] (II) Loading /usr/lib64/xorg/modules/extensions/libdri.so     [   641.821] (II) Module dri: vendor="X.Org Foundation"     [   641.821]    compiled for 1.10.6, module version = 1.0.0     [   641.821]    ABI class: X.Org Server Extension, version 5.0     [   641.821] (II) Loading extension XFree86-DRI     [   641.821] (II) LoadModule: "nvidia"     [   641.821] (II) Loading /usr/lib64/xorg/modules/drivers/nvidia_drv.so     [   641.828] (II) Module nvidia: vendor="NVIDIA Corporation"     [   641.829]    compiled for 4.0.2, module version = 1.0.0     [   641.829]    Module class: X.Org Video Driver     [   641.830] (II) NVIDIA dlloader X Driver  331.79  Sat May 17 23:37:42 PDT 2014     [   641.830] (II) NVIDIA Unified Driver for all Supported NVIDIA GPUs     [   641.830] (--) using VT number 7          [   641.842] (II) Loading sub module "fb"     [   641.842] (II) LoadModule: "fb"     [   641.842] (II) Loading /usr/lib64/xorg/modules/libfb.so     [   641.843] (II) Module fb: vendor="X.Org Foundation"     [   641.843]    compiled for 1.10.6, module version = 1.0.0     [   641.843]    ABI class: X.Org ANSI C Emulation, version 0.4     [   641.843] (II) Loading sub module "wfb"     [   641.843] (II) LoadModule: "wfb"     [   641.843] (II) Loading /usr/lib64/xorg/modules/libwfb.so     [   641.845] (II) Module wfb: vendor="X.Org Foundation"     [   641.845]    compiled for 1.10.6, module version = 1.0.0     [   641.845]    ABI class: X.Org ANSI C Emulation, version 0.4     [   641.845] (II) Loading sub module "ramdac"     [   641.845] (II) LoadModule: "ramdac"     [   641.845] (II) Module "ramdac" already built-in     [   641.846] (II) Loading /usr/lib64/xorg/modules/drivers/nvidia_drv.so     [   641.846] (II) Loading /usr/lib64/xorg/modules/libwfb.so     [   641.846] (II) Loading /usr/lib64/xorg/modules/libfb.so     [   641.847] (==) NVIDIA(0): Depth 24, (==) framebuffer bpp 32     [   641.847] (==) NVIDIA(0): RGB weight 888     [   641.847] (==) NVIDIA(0): Default visual is TrueColor     [   641.847] (==) NVIDIA(0): Using gamma correction (1.0, 1.0, 1.0)     [   641.847] (**) NVIDIA(0): Enabling 2D acceleration     [   642.374] (II) NVIDIA(0): NVIDIA GPU Quadro 410 (GK107GL) at PCI:5:0:0 (GPU-0)     [   642.374] (--) NVIDIA(0): Memory: 524288 kBytes     [   642.374] (--) NVIDIA(0): VideoBIOS: 80.07.47.00.17     [   642.374] (II) NVIDIA(0): Detected PCI Express Link width: 16X     [   642.378] (--) NVIDIA(0): Valid display device(s) on Quadro 410 at PCI:5:0:0     [   642.378] (--) NVIDIA(0):     CRT-0     [   642.378] (--) NVIDIA(0):     DFP-0 (boot)     [   642.378] (--) NVIDIA(0):     DFP-1     [   642.378] (--) NVIDIA(0):     DFP-2     [   642.378] (--) NVIDIA(0): CRT-0: 400.0 MHz maximum pixel clock     [   642.378] (--) NVIDIA(0): DFP-0: Internal Single Link TMDS     [   642.378] (--) NVIDIA(0): DFP-0: 330.0 MHz maximum pixel clock     [   642.378] (--) NVIDIA(0): DFP-1: Internal Single Link TMDS     [   642.378] (--) NVIDIA(0): DFP-1: 165.0 MHz maximum pixel clock     [   642.378] (--) NVIDIA(0): DFP-2: Internal DisplayPort     [   642.378] (--) NVIDIA(0): DFP-2: 960.0 MHz maximum pixel clock     [   642.378] (EE) NVIDIA(0): Failed to assign any connected display devices to X screen 0.     [   642.378] (EE) NVIDIA(0):     Set AllowEmptyInitialConfiguration if you want the server     [   642.378] (EE) NVIDIA(0):     to start anyway     [   642.596] (EE) NVIDIA(0): Failing initialization of X screen 0     [   642.596] (II) UnloadModule: "nvidia"     [   642.596] (II) Unloading nvidia     [   642.596] (II) UnloadModule: "wfb"     [   642.596] (II) Unloading wfb     [   642.596] (II) UnloadModule: "fb"     [   642.596] (II) Unloading fb     [   642.596] (EE) Screen(s) found, but none have a usable configuration.     [   642.596]     Fatal server error:     [   642.596] no screens found     [   642.596]     Please consult the Red Hat, Inc. support              at https://www.redhat.com/apps/support/      for help.     [   642.596] Please also check the log file at "/var/log/Xorg.0.log" for additional information.     [   642.596]           Here is xorg.conf:               # nvidia-xconfig: X configuration file generated by nvidia-xconfig     # nvidia-xconfig:  version 331.79  (buildmeister@swio-display-x86-rhel47-09)  Sun May 18 00:42:05 PDT 2014               Section "ServerLayout"         Identifier     "X.org Configured"         Screen      0  "Screen0" 0 0         Screen      1  "Screen1" RightOf "Screen0"         Screen      2  "Screen2" RightOf "Screen1"         Screen      3  "Screen3" RightOf "Screen2"         InputDevice    "Mouse0" "CorePointer"         InputDevice    "Keyboard0" "CoreKeyboard"         Option         "AllowEmptyInput" "no"     EndSection          Section "Files"         ModulePath      "/usr/lib64/xorg/modules"         FontPath        "catalogue:/etc/X11/fontpath.d"         FontPath        "built-ins"     EndSection          Section "Module"         Load           "dbe"         Load           "extmod"         Load           "dri2"         Load           "record"         Load           "glx"     EndSection          Section "InputDevice"         Identifier     "Keyboard0"         Driver         "kbd"     EndSection          Section "InputDevice"         Identifier     "Mouse0"         Driver         "mouse"         Option         "Protocol" "auto"         Option         "Device" "/dev/input/mice"         Option         "ZAxisMapping" "4 5 6 7"     EndSection          Section "Monitor"         Identifier     "Monitor0"         VendorName     "Monitor Vendor"         ModelName      "Monitor Model"     EndSection          Section "Monitor"         Identifier     "Monitor1"         VendorName     "Monitor Vendor"         ModelName      "Monitor Model"     EndSection          Section "Monitor"         Identifier     "Monitor2"         VendorName     "Monitor Vendor"         ModelName      "Monitor Model"     EndSection          Section "Monitor"         Identifier     "Monitor3"         VendorName     "Monitor Vendor"         ModelName      "Monitor Model"     EndSection          Section "Device"                  ### Available Driver options are:-             ### Values: : integer, : float, : "True"/"False",             ### : "String", : " Hz/kHz/MHz",             ### : "%"             ### [arg]: arg optional             #Option     "SWcursor"                  # []             #Option     "HWcursor"                  # []             #Option     "NoAccel"                   # []             #Option     "ShadowFB"                  # []             #Option     "UseFBDev"                  # []             #Option     "Rotate"                    # []             #Option     "VideoKey"                  #              #Option     "FlatPanel"                 # []             #Option     "FPDither"                  # []             #Option     "CrtcNumber"                #              #Option     "FPScale"                   # []             #Option     "FPTweak"                   #              #Option     "DualHead"                  # []         Identifier     "Card0"         Driver         "nvidia"         BusID          "PCI:5:0:0"     EndSection          Section "Device"                  ### Available Driver options are:-             ### Values: : integer, : float, : "True"/"False",             ### : "String", : " Hz/kHz/MHz",             ### : "%"             ### [arg]: arg optional             #Option     "SWcursor"                  # []             #Option     "HWcursor"                  # []             #Option     "NoAccel"                   # []             #Option     "ShadowFB"                  # []             #Option     "UseFBDev"                  # []             #Option     "Rotate"                    # []             #Option     "VideoKey"                  #              #Option     "FlatPanel"                 # []             #Option     "FPDither"                  # []             #Option     "CrtcNumber"                #              #Option     "FPScale"                   # []             #Option     "FPTweak"                   #              #Option     "DualHead"                  # []         Identifier     "Card1"         Driver         "nvidia"         BusID          "PCI:5:0:0"     EndSection          Section "Device"                  ### Available Driver options are:-             ### Values: : integer, : float, : "True"/"False",             ### : "String", : " Hz/kHz/MHz",             ### : "%"             ### [arg]: arg optional             #Option     "ShadowFB"                  # []             #Option     "Rotate"                    #              #Option     "fbdev"                     #              #Option     "debug"                     # []         Identifier     "Card2"         Driver         "nvidia"         BusID          "PCI:5:0:0"     EndSection          Section "Device"                  ### Available Driver options are:-             ### Values: : integer, : float, : "True"/"False",             ### : "String", : " Hz/kHz/MHz",             ### : "%"             ### [arg]: arg optional             #Option     "ShadowFB"                  # []             #Option     "DefaultRefresh"            # []             #Option     "ModeSetClearScreen"        # []         Identifier     "Card3"         Driver         "nvidia"         BusID          "PCI:5:0:0"     EndSection          Section "Screen"         Identifier     "Screen0"         Device         "Card0"         Monitor        "Monitor0"         SubSection     "Display"             Viewport    0 0         EndSubSection         SubSection     "Display"             Viewport    0 0             Depth       4         EndSubSection         SubSection     "Display"             Viewport    0 0             Depth       8         EndSubSection         SubSection     "Display"             Viewport    0 0             Depth       15         EndSubSection         SubSection     "Display"             Viewport    0 0             Depth       16         EndSubSection         SubSection     "Display"             Viewport    0 0             Depth       24         EndSubSection     EndSection          Section "Screen"         Identifier     "Screen1"         Device         "Card1"         Monitor        "Monitor1"         SubSection     "Display"             Viewport    0 0         EndSubSection         SubSection     "Display"             Viewport    0 0             Depth       4         EndSubSection         SubSection     "Display"             Viewport    0 0             Depth       8         EndSubSection         SubSection     "Display"             Viewport    0 0             Depth       15         EndSubSection         SubSection     "Display"             Viewport    0 0             Depth       16         EndSubSection         SubSection     "Display"             Viewport    0 0             Depth       24         EndSubSection     EndSection          Section "Screen"         Identifier     "Screen2"         Device         "Card2"         Monitor        "Monitor2"         SubSection     "Display"             Viewport    0 0         EndSubSection         SubSection     "Display"             Viewport    0 0             Depth       4         EndSubSection         SubSection     "Display"             Viewport    0 0             Depth       8         EndSubSection         SubSection     "Display"             Viewport    0 0             Depth       15         EndSubSection         SubSection     "Display"             Viewport    0 0             Depth       16         EndSubSection         SubSection     "Display"             Viewport    0 0             Depth       24         EndSubSection     EndSection          Section "Screen"         Identifier     "Screen3"         Device         "Card3"         Monitor        "Monitor3"         SubSection     "Display"             Viewport    0 0         EndSubSection         SubSection     "Display"             Viewport    0 0             Depth       4         EndSubSection         SubSection     "Display"             Viewport    0 0             Depth       8         EndSubSection         SubSection     "Display"             Viewport    0 0             Depth       15         EndSubSection         SubSection     "Display"             Viewport    0 0             Depth       16         EndSubSection         SubSection     "Display"             Viewport    0 0             Depth       24         EndSubSection     EndSection      **UPD**. Could this be a symptom of the problem? It cannot see the model of the card.               $ lspci -nn | grep VGA     05:00.0 VGA compatible controller [0300]: NVIDIA Corporation Device [10de:0fff] (rev a1)


title: right way to mount sdcard in linux

text: i have a problem with mounting my camcoder with sdcard as volume. It seems it is sdcard problem, can it be repaired? I have reformated sdcard in windows system but this did'nt solve problem all remained the same.               #lsubs:Bus 001 Device 011: ID 0603:8611 Novatek Microelectronics Corp.        # lsblk     NAME                        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT          sdb                           8:16   1  29.8G  0 disk      └─sdb1                        8:17   1  29.8G  0 part      sr0                          11:0    1  1024M  0 rom       # mount /dev/sdb /mountpoint     mount: /dev/sdb: can't read superblock         #dmesg:     [  393.331415] sd 2:0:0:0: [sdb]  Sense Key : Medium Error [current]      [  393.331428] sd 2:0:0:0: [sdb]  Add. Sense: Unrecovered read error     [  393.331443] sd 2:0:0:0: [sdb] CDB: Read(10): 28 00 00 00 00 02 00 00 02 00     [  393.331470] end_request: critical target error, dev sdb, sector 2     [  393.331497] EXT4-fs (sdb): unable to read superblock     [  393.338515] sd 2:0:0:0: [sdb] Unhandled sense code     [  393.338525] sd 2:0:0:0: [sdb]  Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE     [  393.338538] sd 2:0:0:0: [sdb]  Sense Key : Medium Error [current]      [  393.338551] sd 2:0:0:0: [sdb]  Add. Sense: Unrecovered read error     [  393.338565] sd 2:0:0:0: [sdb] CDB: Read(10): 28 00 00 00 00 40 00 00 02 00     [  393.338593] end_request: critical target error, dev sdb, sector 64     [  393.338621] isofs_fill_super: bread failed, dev=sdb, iso_blknum=16, block=32     [  393.346514] sd 2:0:0:0: [sdb] Unhandled sense code     [  393.346524] sd 2:0:0:0: [sdb]  Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE     [  393.346537] sd 2:0:0:0: [sdb]  Sense Key : Medium Error [current]      [  393.346550] sd 2:0:0:0: [sdb]  Add. Sense: Unrecovered read error     [  393.346564] sd 2:0:0:0: [sdb] CDB: Read(10): 28 00 00 00 00 00 00 00 01 00     [  393.346592] end_request: critical target error, dev sdb, sector 0     [  393.346619] FAT-fs (sdb): unable to read boot sector


title: How to adjust time command to measure a program elapsed time

text: I'm trying to get the time that my program takes to finish (aka elapsed time) so I'm using the common `time`. What I get by doing this is 3 measurements: user, system and total. This is fine but I found that the user time that I'm interested in has only two decimal places and I would need more. Is there any way I can get more decimal places out of my time command? Example: `time ./myCProgram`   Output: 0.17s user 1.21s system 130% cpu 0.187 total Wished output wanted: 0.17000s user 1.21s system 130% cpu 0.187 total (or more decimal places)


title: How can I combine grep with file and extra regex

text: I have a file of strings in each line. For example:               AAAAA        BBBBB        CCCCC       etc        I want to check each string one by one whether it exists in a series of files in a specific directory. I know that I can do: `grep -f filename` to do the search. But what I need is to use one more regular expression per line to get more specific results. The file with the strings is big and changes often so it does not make sense to modify each line to add an expression. So what I need is to combine the `grep -f filename` to loop over each line of the file (and grep for it in the files) but add some more conditions. E.g. that `AAAAA` exists **and** `[0-9]{1,3}$` exists as well in the same line.


title: Ubuntu 12.04 liveusb/cd - Mount in Read Write Mode?

text: How do you mount a drive (internal or external) in READ/WRITE mode using the Ubuntu 12.04 Live CD / USB? I can boot the computer with the LiveUSB but Ubuntu is only mounting the drives as read only ...


title: mailing thru ssh

text: (I am a Linux only user & MELT software developer, and use Linux since kernel 0.99.15 e.g. the previous century) I have a VPS host `ovh.starynkevitch.net` (running Linux) which is also the _MX_ host for my email. It is getting emails only for less than a dozen users (my relatives, i.e. kids, grand-children, wife). So a quite small traffic. the MTA is `exim4` ... I specifically don't want to use _gmail_ I have secure `ssh` (public-key, so without passwords) access to that machine (from every -latop or desktop machine I am working on). I want to be able to read (and post, but SMTP forwarding is not an issue) my email thru it. Up to now, I forwarded my email (to some home server). In practice, I want to run some graphical MUA (e.g. `sylpheed` or `evolution` ...) because I am tired of `mutt`... I also want to be able to use some spam filter like spamoracle; it has to run on my VPS host (not locally on the MUA machines). And I need to conveniently be able (with a single keystroke!) to improve (by the usual machine learning techniques) its filtering. I was thinking of installing some IMAP server (like the `imapd` from GNU mailutils). But then, it is less easy to use _spamoracle_ with it. I thought of:   1. Using `imapd` above SSL or some other secure transport. But then I am not familiar with the configuration, and I have no idea if the SSL should be related to my `ssh` settings or not.   2. doing port redirection with `ssh` Any hints or some other solutions?


title: Log if no network

text: I have a router with OpenWRT. I noticed that sometimes (during night time) I have no internet connection. How can I log when this happens?


title: make a linux "from scratch" using package manager?

text: Is there an easy way yet to make a linux system "from scratch" using a package manager like pacman, dpkg, etc.? For example, something with which you can just say you want a working computer system with the `python` and `perl` packages, and then you get an installer (or filesystem image, or the like) with everything needed for those programs to run (the dependencies of the packages, and things needed to run programs at all)?


title: 'E:The package linux-headers-3.5.0-54 needs to be reinstalled, but I can't find an archive for it. ' when upgrading the system

text: I am using Ubuntu 12.04, and I try to upgrade to 14.04.1 using the terminal using:               do-release-upgrade      but I keep getting the following error:               SystemError: E:The package linux-headers-3.5.0-54 needs to be      reinstalled, but I can't find an archive for it.       How can I fix the error and go on with the upgrade? Output for `sudo apt-get check` is:               Reading package lists... Done     Building dependency tree            Reading state information... Done     E: The package linux-headers-3.5.0-54 needs to be reinstalled, but I can't find an archive for it.      Output for `sudo dpkg -C`               The following packages are in a mess due to serious problems during     installation.  They must be reinstalled for them (and any packages     that depend on them) to function properly:      linux-headers-3.5.0-54 (no description available)      Out put for `cat /etc/apt/sources.list`               # deb cdrom:[Ubuntu 12.04.2 LTS _Precise Pangolin_ - Release i386 (20130213)]/ precise main restricted          # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to     # newer versions of the distribution.     deb http://us.archive.ubuntu.com/ubuntu/ trusty main restricted     deb-src http://us.archive.ubuntu.com/ubuntu/ trusty main restricted          ## Major bug fix updates produced after the final release of the     ## distribution.     deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates main restricted     deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates main restricted          ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu     ## team. Also, please note that software in universe WILL NOT receive any     ## review or updates from the Ubuntu security team.     deb http://us.archive.ubuntu.com/ubuntu/ trusty universe     deb-src http://us.archive.ubuntu.com/ubuntu/ trusty universe     deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates universe     deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates universe          ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu      ## team, and may not be under a free licence. Please satisfy yourself as to      ## your rights to use the software. Also, please note that software in      ## multiverse WILL NOT receive any review or updates from the Ubuntu     ## security team.     deb http://us.archive.ubuntu.com/ubuntu/ trusty multiverse     deb-src http://us.archive.ubuntu.com/ubuntu/ trusty multiverse     deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse     deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse          ## N.B. software from this repository may not have been tested as     ## extensively as that contained in the main release, although it includes     ## newer versions of some applications which may provide useful features.     ## Also, please note that software in backports WILL NOT receive any review     ## or updates from the Ubuntu security team.     deb http://us.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse     deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse          deb http://security.ubuntu.com/ubuntu trusty-security main restricted     deb-src http://security.ubuntu.com/ubuntu trusty-security main restricted     deb http://security.ubuntu.com/ubuntu trusty-security universe     deb-src http://security.ubuntu.com/ubuntu trusty-security universe     deb http://security.ubuntu.com/ubuntu trusty-security multiverse     deb-src http://security.ubuntu.com/ubuntu trusty-security multiverse          ## Uncomment the following two lines to add software from Canonical's     ## 'partner' repository.     ## This software is not part of Ubuntu, but is offered by Canonical and the     ## respective vendors as a service to Ubuntu users.     # deb http://archive.canonical.com/ubuntu precise partner     # deb-src http://archive.canonical.com/ubuntu precise partner          ## This software is not part of Ubuntu, but is offered by third-party     ## developers who want to ship their latest software.     deb http://extras.ubuntu.com/ubuntu trusty main     deb-src http://extras.ubuntu.com/ubuntu trusty main


title: Bash pattern to match all files but directories

text: In bash, how do I specify a pattern that matches everything but subdirectories in current directory. Given that the pattern `*/` matches all the subdirectories, I tried (with extglob turned on):               $ echo !(*/)      But it didn't work.


title: How do I set different directories for different domains on CentOS 5.5 server?

text: I'm running a CentOs 5.5 server and wanted to know what commands I needed to run to be able to do the following; I have 3 domains on the server - example1.com, example2.com, example3.com I wanted to set up in conf so that the file contents of each domain are in different directories, so that I can upload 3 completely different sites using the one server. ie: /home/site1/ would be the upload dir for example1.com, /home/site2/ would be for example2.com, etc. If someone could help me with a line by line for terminal it would be very much appreciated!   Thank you!


title: Chromium when maximized has gaps at the sides in Awesome WM

text: There are 1-2 px gaps between a maximized Chromium window and screen's border. As a result when I put my mouse on the border the Chromium window loses focus, or if I'm using my mouse wheel it changes tags. This doesn't happen if I unmaximize Chromium and stretch it out, but it's annoying. If I am not mistaken this happens with the default `rc.lua`. Awesome 3.4.


title: Samba: system group mapping

text: I have w2008R2 PDC and Linux server with samba and winbind. Now I'd like to add some domain users to Unix `adm` group in AD. Let's say I have `adm` group defined in AD, and every user from this group will be a member of Unix `adm` group when logging to Linux over PuTTY. I expected that it will be possible with `net groupmap`, so I tried:               net groupmap add ntgroup="adm"  unixgroup=adm   type=l but it is not working. If I login I see that I'm a member of `adm` group, but I don't have `adm` group permissions (i.e I can't view syslog). I've tried also               net groupmap add ntgroup="adm"  unixgroup=adm   type=d but the behavior is the same.


title: Protecting Devices from dd and fdisk Commands

text: I'm wondering if there is some way to prevent certain certain devices from becoming the output file of the `dd` command and the target of the `fdisk` command. I'm currently using the two operations to set up a write a bootloader, kernel, and root filesystem on an SD card, which appears as `/dev/sdd`. I'm always a little anxious that I'll mix up `sdd` with `sdb`, or `sda` since the letters `A` and `D` are close on the keyboard, and I would like to find a way to prevent commands with this format:               dd if=/dev/sd[a-zA-Z0-9]* of=/dev/sd[ab]      or               fdisk /dev/sd[ab]


title: Mint Linux - Filesystem check or mount failed

text: I made a bootable USB stick in order to install Mint. When I start it, after the loading screen I get an error: > Filesystem check or mount failed. A maintenance shell will now be started. > CONTROL-D will terminate this shell and continue booting after re-trying > filesystems. Any further errors will be ignored I am using win32diskimager to write the iso file to usb stick, the usb stick is working properly, also the iso itself is fine, I have downloaded it 2 times just in case. ![enter image description here](http://i.stack.imgur.com/q7Uod.jpg)


title: Output from ls has newlines but displays on a single line. Why?

text: I think I may be overlooking a relatively fundamental point regarding shell. Output from the **ls** command by default separates output with newlines, but the shell displays the output on a single line. Can anyone explain this to me? I had always presumed that the output was simply separated by spaces, but now that I see the output separated by newlines, I would expect the output to be displaying on separate lines. Example:               cpoweradm@debian:~/lpi103-4$ ls text*     text1  text2  text3      **od** shows that the output is separated by newlines:               cpoweradm@debian:~/lpi103-4$ ls text* | od -c     0000000   t   e   x   t   1  \n   t   e   x   t   2  \n   t   e   x   t     0000020   3  \n     0000022      If newlines are present, then why doesn't the output display as:               text1      text2     text3


title: Shall I copy server's ca.crt to the client?

text: I'm setting up an OpenVPN server and I need a little info: do I need to copy the server's ca.crt to the client?   I have tried both ways and only when I do that I can get it working; I would like to know whether what I've done is correct because otherwise do I need to build the certificate on the client-side (`./build.ca`) just for the client.crt?


title: Disable GNOME on a Debian Install

text: I'm very new to Linux, and I'm setting up a Debian server. Since I don't have any need for a GUI most of the time, I'd like to disable it from running at startup and wasting system resources. However, I'd still like to have it available for running Firefox and performing tasks that might be painful to do with the command line. I've tried doing some research on the subject, and people seem to say this line will do it: `#update-rc.d -f gdm remove` (I assume the hash signifies I should enter it into the terminal; if I leave it in there nothing happens) If I SSH in as root and enter that line, I receive the result:               update-rc.d: using dependency based boot sequencing      which is wonderfully cryptic. When I reboot the computer afterwards, GNOME comes right back up. Does anyone know what I'm doing wrong here?


title: How to measure light?

text: I've got a Dell Latitude E6410 notebook which changes lcd light intensity in response to ambient light levels, so it has to have some photocell. How can I access the data from this photocell? I tried different google searches like lux meter, light intensity monitor and so on and did not find a single right thing.


title: Alternatives not working well for Java installation on Centos 6.4

text: I am trying to installing on Centos java from Oracle. Following are my steps.               yum install /usr/local/jdk-7u3-linux-x64.rpm               alternatives --install /usr/bin/java java /usr/java/latest/jre/bin/java 20000          alternatives --install /usr/bin/javaws javaws /usr/java/latest/jre/bin/javaws 20000          alternatives --install /usr/bin/javac javac /usr/java/latest/bin/javac 20000          alternatives --config java I pick the latest version here.      The problem now only my java is pointing to the new version wheras the javac is not pointing to it below is how I trace for java and javac. Java                ls -la /usr/bin/java lrwxrwxrwx. 1 root root 22 May 22 13:09 /usr/bin/java -> /etc/alternatives/java           ls -la /etc/alternatives/java lrwxrwxrwx. 1 root root 25 May 22 13:09 /etc/alternatives/java -> /usr/java/latest/bin/java      Javac               ls -la /usr/bin/javac lrwxrwxrwx. 1 root root 23 May 22 11:37 /usr/bin/javac -> /etc/alternatives/javac           ls -la /etc/alternatives/javac lrwxrwxrwx. 1 root root 48 May 22 11:37 /etc/alternatives/javac -> /usr/lib/jvm/java-1.7.0-openjdk.x86_64/bin/javac       Any solution to overcome this? I have tried previously on other machines on Centos 6.3 works fines.


title: How can I defragment my SSD on linux?

text: This page demonstrates that defragmentation is beneficial for SSDs. I suppose this type of defragmentation has to be trim-aware, so as to preserve the life time of the disk. How can I do that on linux? **EDIT** : Comments pointed out that this article's content is questionable.


title: Compare multiple files

text: I want a bash-script to compare OR find differences for multiple files which are stored in different locations: Files under `/tmp/test/`   * A.txt   * B.txt   * C.txt Compare with files under `/home/oldtest`/   * A.txt   * B.txt   * C.txt ### Condition:   1. File `/tmp/test/A.txt` compare only with `/home/oldtest/A.txt` (similarly for other files - `B.txt` compare with `B.txt`).   2. If any changes found: status should be "Modification require in file A.txt".


title: Graphical Keyboard-driven Email Client

text: I use a laptop without a mouse as my main work system, and I could really use a fully keyboard-driven email client with graphics support. Right now I have the option of using GUI clients, which, even if they support the keyboard, are optimized for the mouse (buttons and menus taking screen space, actions based on navigating menus with the arrow keys, etc) or terminal-based clients, which don't support embedded images in HTML messages. Is there something that tries to mix the best of both worlds?


title: reading exchange mail, address book and calendar in mint 14 nadia

text: I've heard the only mail client that can be used as ms outlook in mint is evolution. I couldn't find any good web resource regarding this. I have evolution installed, but I don't see Exchange as an option for server type. At least I want to be able to read exchange emails, address book and calendars on mint.


title: DLNA server on Linux

text: I just bought a TV with DLNA support. I already have a machine dedicated to file server (with 8 disks) and I would love to use this machine as DLNA server if possible. Are there any usable Linux implementations of DLNA?


title: WiFI access in BackTrack 5 R1

text: I recently started using a live USB version of BackTrack 5 R1 (A kubuntu-based distro), but I can't find any way to enable access to my home WiFi network. I can't find any comprehensive tutorials on Google, and BackTrack's wiki on the subject is vague at best. How can I connect it to my home wireless?


title: How to check progress of running cp?

text: Is it possible to check the progress of running cp process? Some processes respond to various KILL signals so that you can check what is their status. I know that I can run cp with parameter -v but what if forgot to do that, cp is running for a very long time and I want to know which file is being copied, or how many were already copied.


title: Restarting udev on centos6 (tethering a mobile phone using proxoid)

text: I am trying to use proxoid (a proxy server to allow tethering like facility for mobile phones). The https://code.google.com/p/proxoid/wiki/installationLinux says that I need to restart the process udev similar to (in ubuntu) sudo /etc/init.d/udev restart lsusb does list the mobile phone but I do not see a running process or a binary named as udev There is a process udevd on centos /sbin/udevd. Is it the same as udev. I could not find specific information to centos as the centos.org site seems to be down for several hours now. Any information helpful


title: zfs send volume fluctuates misteriously

text: Why would the amount of data in a zfs send stream "fluctuate"? I would expect send of a specific snapshot to always produce exactly the same data! The test data below was created through something like `dd if=/dev/zero of=filename bs=1024 count=1000` The snapshots were taken at intervals between creating the test files. I then repeatedly sent the data to /dev/null using command-history to re-run the command again and again rapidly. No cheating - the snapshots were taken prior to the test and no amount of "writing" to the file system should affect what goes on in an incremental send, or so I would imagine.               sol10-primary:/TST> # ls -l     total 1007     -rw-r--r--   1 root     root      102400 Mar  4 12:01 data1     -rw-r--r--   1 root     root      102400 Mar  4 11:49 data2     -rw-r--r--   1 root     root          30 Mar  4 11:48 data3     -rw-r--r--   1 root     root      102400 Mar  4 11:50 data4     -rw-r--r--   1 root     root      102400 Mar  4 11:52 data5     -rw-r--r--   1 root     root      102400 Mar  4 11:53 data6     sol10-primary:/TST> # rm data5     sol10-primary:/TST> # dd if=/dev/zero of=data5 bs=1024 count=100               100+0 records in     100+0 records out     sol10-primary:/TST> # zfs send -i s1 rpool/tst@s3 | dd bs=1024 > /dev/null     412+6 records in     412+6 records out     sol10-primary:/TST> # zfs send -i s1 rpool/tst@s3 | dd bs=1024 > /dev/null     412+5 records in     412+5 records out     sol10-primary:/TST> # zfs send -i s1 rpool/tst@s3 | dd bs=1024 > /dev/null     412+6 records in     412+6 records out     sol10-primary:/TST> # zfs send -i s1 rpool/tst@s3 | dd bs=1024 > /dev/null     402+32 records in     402+32 records out     sol10-primary:/TST> # zfs send -i s1 rpool/tst@s3 | dd bs=1024 > /dev/null     405+22 records in     405+22 records out     sol10-primary:/TST> # zfs send -i s1 rpool/tst@s3 | dd bs=1024 > /dev/null     412+6 records in     412+6 records out     sol10-primary:/TST> # zfs send -i s1 rpool/tst@s3 | dd bs=1024 > /dev/null     412+5 records in     412+5 records out     sol10-primary:/TST> # zfs list -o name,mountpoint,used,referenced,usedbychildren,usedbysnapshots -r rpool/tst     NAME          MOUNTPOINT   USED  REFER  USEDCHILD  USEDSNAP     rpool/tst     /TST         892K   532K          0      360K     rpool/tst@s1  -             20K   232K          -         -     rpool/tst@s2  -             20K   432K          -         -     rpool/tst@s3  -            120K   532K          -         -      Sometimes in the above I created a snapshot then dd-ed over an existing file, just to get something into the "USEDBYSNAPSHOTS" value. This is basically pretty much an academic question, I suspect that the variance is within a very small limit, only noticed here because my test data is itself pretty small.


title: Get the most recent backup files

text: I'm googling for this, but the terms are so generic I'm getting way too many false positives, so what the hey, I'll ask here. I'm sure there's a simple answer but I don't generally script in *nix. I'm trying to write a database refresh script to our test environment. The backups are mounted from an smbfs share, something like `/data/backups/prod`, but the subfolders get a little tricky. It looks like `myproddbserver/yyyymmdd`, with a bunch of files underneath. I want to execute a command `restore` that will collect the files with known names from the most recent `yyyymmdd` directory. For example, if I had:               myproddbserver/20130630/foo.bak     myproddbserver/20130630/bar.bak     myproddbserver/20130731/foo.bak     myproddbserver/20130731/bar.bak      I would want to restore `myproddbserver/20130731/foo.bak` and `myproddbserver/20130731/bar.bak`. How would I reliably get those paths?


title: Sparse files/file holes and unexpected block size

text: For my own learning, I've been playing around with creating files with file holes. I created a util that simply reads from stdin and writes to a file, but before writing to the file, it uses lseek to move beyond the end of file by a number of bytes.               fh -b 20000 testfile     hello     there      After starting this process, input can be entered ("hello"), and written to testfile, but before it does, it seeks past end of file by 20000 bytes. Then before writing, it seeks again past end of file another 20000 bytes before "there" is written. What I'm not clear on is the number of blocks allocated to the newly created file. If I do               ls -ls testfile      it shows 8 blocks are allocated, and the file size is 40013 (which is expected). A new file with 13 bytes (but no file holes) allocates 4 blocks according to `ls -ls`. I found out that this really means 1 block (2048 bytes for a block) but the blocks reported are divisible by 512 bytes. So presuming this is true, the math doesn't compute for the file with files holes. Why are 8 blocks allocated, shouldn't it still only be 4 since the physical file size is only 13 bytes (as opposed to logical size of 40013)? I'm not sure if I'm reading the block size correctly, and secondly, I don't understand why the block size is 8 considering that a similar size file with no file holes has only 4. I'm running Ubuntu 11.10 on an ext4 file system.


title: Bash -Extract characters from string

text: Suppose I have the following variable $string = 'cat somecommandhere' Now the output of the above `cat` command is               test="Thanks serverfault"      I want to extract the value between the quotes and store it in the same variable `$string`, including the quotes. I want string to contain value below:               $string = "Thanks serverfault"        How can this be done with `sed` or `grep` but not `awk`. I haven't learned `awk` yet.


title: vim - don't highlight search term after a search & replace?

text: After performing a search and replace, my installation of GVIM highlights any text remaining that still matches the search pattern. Example input text:               foo     foo     fighters      I run `:%s/foo/bar/gc` and confirm that I only wish to replace one `foo`. The other `foo` remains highlighted. Can this be disabled?


title: Screen content showing for a few seconds before screensaver starts (Fedora 14)

text: This happens every now and then, I have not pinned down the cause but let me describe the symptoms. On occasion when I come back to the computer after a few hours the screen is in energy saving mode, I touch the mouse, or the keyboard and I see the screen as it was when I left it. Then, a few seconds later the screen dims to black and the screen saver turns on, moving the mouse again brings me to the login page to unlock the screen. This seems to be a security flaw since unauthorised users can see my screen... Anyone seen this happen to them? I'm using Fedora 14 2.6.35.14-95.fc14.i686PAE Cheers.


title: Vim syntax highlight certain lines

text: I have php files well any file type in general that I would like vim to highlight here docs sections using a different syntax highlighting.               <?php     echo <<<HTMLDOC     <h1> I am highlighted as html </h1>     <<<HTMLDOC          echo 'High Lighted as PHP again '     ?>


title: Increasing the size limit for /var/cache/apt/archives

text: I have 2 systems running Debian at home and I am trying to minimize the bandwidth use while upgrading the packages. How can I increase the size limit of the cache, so that I could just copy the packages over LAN? (currently they get removed too quickly)


title: Vim remembering settings of edited files

text: I read some where about creating files in vim to save things like open windows and folds. I tried to Google it but had trouble finding reference to it. What should I be looking for?


title: How to limit ftp access to multiple places for one user

text: I don't even know how to write the correct question since it is a little confusing to ask it. Here is the problem. User X would like FTP access to /user/x folder and to /var/www/x folder. How can I manage to give the user access to both places without making 2 ftp accounts for each. Am using vsftpd on Ubuntu 11.04. He will use filezilla to login and wants to see the following structure or something similare to it:               / <-- The root of the ftp directory       usr/x <-- The user X       www/x <-- The www folder for X      Is this possible all in one ftp access account?


title: How to see the iTunes shared library from Linux Banshee?

text: I'm trying to see my friend's Mac iTunes library through Banshee and can't get it to work. The daap is already installed and i still can't list their musics. Is there a way to make this work on Ubuntu?


title: Conky on multiple display?

text: I have an external display that show the right part of my screen (`\--right- of` option in xrandr), And my conky panel was just gone. (occupies space, but not visible on both display) What I want is the same view of conky, for both my laptop display and the external one, any thoughts? Thanks **Part of my conkyrc, might be helpful**               own_window yes      if_up_strictness address     own_window_colour 262729     own_window_transparent no      own_window_type panel     own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager     double_buffer yes     use_spacer right      use_xft yes     font snap.se-7     xftalpha 1     text_buffer_size 2048      #alignment tl     alignment bl     gap_x 0     gap_y 3


title: How to Update only important Security Packages in redhat 5.6

text: One of our client has Redhat 5.6 and he is asking to update only the important packages. But question is how do we know which are the important packages. Note:: It will be a partial Update not complete update.


title: CentOS file owner changed on editing

text: I have the following problem. On Unix server (CentOS 5.5) a number of users belonging to the same group have access to the same files (via ssh). After one particular user (let's say usera A) has edited the file the file owner is changed to A, the group (G) and the permissions (0664) remain intact. Once a second user (B) tries to modify the same file he is not allowed to do so. If on other hand the user B modifies the file then A can change it without problems (except screwing up the permissions). I understand that there is something screwed up with the permissions/groups but I can't find out what. So any help would be appreciated. Providing more information:               $ ls -l /path/file     -rwxrwxr-x 1 B G 42269 jan 14 10:30 file          $ getfacl /path/file     # file: file     # owner: B     # group: G     user::rwx     group::rwx     other::r-x          $ ls -ld /path     drwxrwxr-x 12 B G 4096 jan 14 10:24 .          $ getfacl /path     # file: .     # owner: B     # group: G     user::rwx     group::rwx     other::r-x


title: Externaly limiting number of CPU cores used

text: I need to externally limit a process/session to a certain number of cores. Are there any other possibilities than CPU affinity (I don't like the need to specify the actual cores) and cgroups (hard to integrate into our project)?


title: What is the common name for directories . (dot) and .. (dot dot)?

text: The . (dot) and .. (dot dot) exist in every directory (and probably in every OS). As we all know (or at least should):   * . (dot) is the current directory    * .. (dot dot) is the parent directory **Is there a common name for these special cases?**


title: Enable remote desktop for Gnome from command line?

text: I am trying to set up some automation scripts to set up a Linux environment. I would like to enable remote desktop sharing without the user having to actually use the GUI to do so. My plan is to write a batch script that maybe edits some file to do this automatically, if possible. I am using Fedora 16 with the Gnome. I want to achieve the following: http://docs.fedoraproject.org/en- US/Fedora/13/html/User_Guide/chap-User_Guide-Sharing_your_desktop.html Any tips on what file to edit would be greatly appreciated.


title: How to set default tabs only for cat?

text: I prefer to set `tabs 4` however this may have some side effects, such as for example `ls` out put may look not properly aligned. **How might I configure the terminal / cat to use four spaces for tabs for cat only?** Should I just alias / wrap `cat` to something that sets `tabs 4`, runs `/bin/cat`, then sets it back? My thinking is that this route is less preferable since in fact I would like this behaviour for `less`, `diff`, and other utilities.


title: Having desktop icons with Thunar on Arch Linux with Openbox

text: I'm using Arch Linux with Openbox as my window manager. And Thunar as my preferred file manager. I'm using `zsh` in case that's relevant in any way. How would I go about having desktop icons? I find it very useful to have my desktop with symlinks to all my frequently used folders and apps. I tried searching Google but haven't been able to find anything about accomplishing this with _only_ Thunar. Or some script that accomplishes just that.


title: Why is uname -M returning an empty string?

text: On the exact same machine (AIX 6.1), in 2 different login shells (both ksh), with different user IDs, I can do `uname -M`; in one shell I get the system model. In the other shell I get BLANK! The only difference is the user ID and therefore the environment. I can't put the environment in here. Example User 1 Shell:               $ uname -M     IBM,1234-567     $      Example User 2 Shell:               $ uname -M          $      I have done a truss in both shells. There is a difference, but I don't understand it. Here is the bad truss:               truss uname -M     .. a bunch of execve's ripped out as it was searching the PATH for uname.     execve("/bin/uname", 0x2FF2155C, 0x20012EF8)     argc: 2     __loadx(0x03480000, 0x2FF21380, 0x00000108, 0xF0713968, 0x20000CD0) = 0x00000000     __loadx(0x0A040000, 0xD042D064, 0x0000008A, 0x20001254, 0x00000000) = 0x00000000     sbrk(0x00000000)                                = 0x200013D0     vmgetinfo(0x2FF20530, 7, 16)                    = 0     sbrk(0x00000000)                                = 0x200013D0     __libc_sbrk(0x00000000)                         = 0x200013D0     getuidx(4)                                      = 28633     getuidx(2)                                      = 28633     getuidx(1)                                      = 28633     getgidx(4)                                      = 100     getgidx(2)                                      = 100     getgidx(1)                                      = 100     getuidx(4)                                      = 28633     getuidx(2)                                      = 28633     getuidx(1)                                      = 28633     getgidx(4)                                      = 100     getgidx(2)                                      = 100     getgidx(1)                                      = 100     __loadx(0x01480080, 0x2FF1FEF0, 0x00000A50, 0x2FF20A60, 0x2FF22ED1) = 0xD0538128     __loadx(0x01480180, 0x2FF1FEF0, 0x00000A50, 0xF068921C, 0xF068914C) = 0xF0759FA0     __loadx(0x07080000, 0xF06891EC, 0xFFFFFFFF, 0xF0759FA0, 0x00000000) = 0xF075AF3C     __loadx(0x07080000, 0xF068912C, 0xFFFFFFFF, 0xF0759FA0, 0x00000000) = 0xF075AF48     __loadx(0x07080000, 0xF06891FC, 0xFFFFFFFF, 0xF0759FA0, 0x00000000) = 0xF075AF78     __loadx(0x07080000, 0xF068913C, 0xFFFFFFFF, 0xF0759FA0, 0x00000000) = 0xF075AF84     __loadx(0x07080000, 0xF06891BC, 0xFFFFFFFF, 0xF0759FA0, 0x00000000) = 0xF075AF54     __loadx(0x07080000, 0xF068915C, 0xFFFFFFFF, 0xF0759FA0, 0x00000000) = 0xF075AF6C     __loadx(0x07080000, 0xF06891CC, 0xFFFFFFFF, 0xF0759FA0, 0x00000000) = 0xF075AF90     __loadx(0x07080000, 0xF06891DC, 0xFFFFFFFF, 0xF0759FA0, 0x00000000) = 0xF075AFC0     __loadx(0x07080000, 0xF068916C, 0xFFFFFFFF, 0xF0759FA0, 0x00000000) = 0xF075AFA8     __loadx(0x07080000, 0xF068917C, 0xFFFFFFFF, 0xF0759FA0, 0x00000000) = 0xF075B020     getuidx(4)                                      = 28633     getuidx(2)                                      = 28633     getuidx(1)                                      = 28633     getgidx(4)                                      = 100     getgidx(2)                                      = 100     getgidx(1)                                      = 100     __loadx(0x01480080, 0x2FF1FEF0, 0x00000A50, 0x2FF20A60, 0x2FF22ED1) = 0xD0538128     getuidx(4)                                      = 28633     getuidx(2)                                      = 28633     getuidx(1)                                      = 28633     getgidx(4)                                      = 100     getgidx(2)                                      = 100     getgidx(1)                                      = 100     __loadx(0x01480080, 0x2FF1FEF0, 0x00000A50, 0x2FF20A60, 0x2FF22ED1) = 0xD0538128     getuidx(4)                                      = 28633     getuidx(2)                                      = 28633     getuidx(1)                                      = 28633     getgidx(4)                                      = 100     getgidx(2)                                      = 100     getgidx(1)                                      = 100     __loadx(0x01480080, 0x2FF1FEF0, 0x00000A50, 0x2FF20A60, 0x2FF22ED1) = 0xD0538128     getuidx(4)                                      = 28633     getuidx(2)                                      = 28633     getuidx(1)                                      = 28633     getgidx(4)                                      = 100     getgidx(2)                                      = 100     getgidx(1)                                      = 100     __loadx(0x01480080, 0x2FF1FEF0, 0x00000A50, 0x2FF20A60, 0x2FF22ED1) = 0xD0538128     access("/usr/lib/nls/msg/en_US/uname.cat", 0)   = 0     _getpid()                                       = 7405946     uname(0x2000132C)                               = 0     statx("CuAt", 0x2FF20870, 76, 0)                Err#2  ENOENT     kopen("CuAt", O_RDONLY)                         Err#2  ENOENT     kioctl(1, 22528, 0x00000000, 0x00000000)        = 0          kwrite(1, "\n", 1)                              = 1     __loadx(0x04000000, 0x2FF20970, 0x00000800, 0x0000D032, 0x00000000) = 0x00000000     kfcntl(1, F_GETFL, 0x00000001)                  = 67110914     kfcntl(2, F_GETFL, 0x2FF22FFC)                  = 67110914     _exit(0)      You can see the `kwrite` at the end is only printing out a newline character, `"\n"`. In the good truss output, it looks like uname is getting the attribute from:               /etc/objrepos/CuAt      This lead me to the `lsattr` command and others. **Why is uname -M blank? What environment variables would affect this?**


I have an unshadowed db.txt file:               [root@SERVER ~]# rpm -qa | grep -i john     john-1.7.9-1.el6.rf.x86_64     [root@SERVER ~]# head -1 /etc/issue     Scientific Linux release 6.3 (Carbon)     [root@SERVER ~]# cat db.txt      cecil:$6$iHc0bEXn$IxtX8x0TCx6h13qTH8yVjf5cGwT25AitFEQpJc3cP6qgN4LLMiJfDD2pQGUyZFX7JYeGneX34j38tNZHAgQsV/:503:504::/home/cecil:/bin/bash     [root@SERVER ~]# john db.txt      fopen: $JOHN/dynamic.conf: No such file or directory     [root@SERVER ~]# ls -la .john/     összesen 44     drwx------.  2 root root  4096 máj   31 11.27 .     dr-xr-x---. 15 root root  4096 máj   31 11.35 ..     -rw-------.  1 root root     0 máj   31 11.24 dynamic.conf     -rw-------.  1 root root 36305 máj   31 11.27 john.conf     -rw-------.  1 root root     0 máj   31 11.24 john.ini     [root@SERVER ~]#       But can't resolve the:               fopen: $JOHN/dynamic.conf: No such file or directory      error message. How can I? I already touched john.ini & dynamic.conf & copied john.conf from /etc.. UPDATE:               [root@SERVER ~]# john db.txt      fopen: $JOHN/dynamic.conf: No such file or directory     [root@SERVER ~]# echo $JOHN          [root@SERVER ~]#       The $JOHN variable is empty. UPDATE2: I updated to SL 6.4, but still the same, after a reboot too.


title: Install Desktop on Centos 6.3 remote server

text: Through our hosting provider, we can create servers running CentOS 6.3. However, these installs are meant to be used as servers that are accessed remotely. They do not come packaged with a GUI "Desktop" environment. What steps do you suggest to take in order to go from the packaged minimal install, to an install that includes:   * Desktop GUI    * Remote desktop functionality (so we can log and use the desktop from a remote environment)


title: How is 32bit Linux virtual memory structured in relation to PCIe Base Address Registers

text: I'm working on a Linux system (32 bit, 4GB RAM) and found some contradictory information about memory addressing in Linux. Am I right with this: Only virtual memory has the differentiation between kernel and user space. Virtual memory is in a 32bit system 4GB large. 3 GB for the User space, 1GB for the kernel space. But there are also addresses for the physical memory or which are not located - referencing to ZONE_NORMAL and it's association with Kernel/User-pages?.   * On this homepage it is illustrated that the physical memory has also the differentiation in kernel and user space, is that right?   * Since I'm working with PCIe, I would like to know how it is possible, that the BAR has a physical address?   * That would mean that there is a reserved space for the PCIe device - where is this space located?   * Is there a special structure in the physical memory? I found a reference here, which might show the structure in figure 16.   * I'm translating this BAR address into a virtual address, so how is this possible?   * Also some references say, that each process can uses all of the virtual addresses, is that right? If yes, how can I combine this fact with the above ones?


title: Why does hitting "Ctrl minus" in the command line shrink the font size?

text: I have hit a few `CTRL``-` in command line and I see the text in the terminal getting smaller with every invocation. What is going on here and is there a way to redo ie magnify the text to bring it back to the original size via a command? Edit: As per Christopher's suggestion in the comment I can get back to my original font size by hitting `CTRL``+` but I would still like to understand what is going on behind the scenes here.


title: Stop broken NFS mounts from locking a directory?

text: I have a somewhat interesting setup: A server with multiple remote NFS servers mounted in a folder, with that folder then being re-exported over Samba. Think of it as a share proxy, keeping all the shared folders in one place. My issue though is that whenever one of the mounts goes down (server restarted, service restarted, external hard drive that the server was exporting removed, etc) any attempt to read the mount blocks forever. This also means that running `ls` in that directory freezes and users connecting over Samba also freeze. This has also caused a few times one of my cron jobs to block which almost crashed the server because it had hundreds of blocked processes. This is getting very annoying as I usually have to bring up a terminal that isn't waiting for `ls` to finish (can't cancel it), run `for i in *; do sudo umount -l -f $i; done;`, hope that it works, fix the issue, then remount everything. Is there a way to mount an NFS share with the stipulation that if the connection fails for whatever reason (preferably with a retry period) then the mount un-mount's itself or at least doesn't block?


title: Make group permissions same as user permissions

text: I want to set the group permissions for all files and subdirectories within a certain parent directory to whatever the user permission setting for that specific file or directory is. For example, everything under `/path/to/parentdir`               # Permissions before     # Path                      Permissions     /path/to/parentdir/file1    755     /path/to/parentdir/file2    644     /path/to/parentdir/file3    600          # Permissions after     /path/to/parentdir/file1    775     /path/to/parentdir/file2    664     /path/to/parentdir/file3    660      I'm hoping there's a simple way to do this in hopefully one command. I can think of ways using a script with a bunch of commands, but it feels like there should be a pretty direct way of doing it. Thanks in advance!


title: why does htop meter show >90% while table is 0.0%?

text: Why do the progress meters across the top of the screen in `htop` show CPU usage consistently above >90% while the numbers in the table below show a nearly idle system with CPU usage and load average at 0.0%? ![partial htop screen grab](http://i.imgur.com/0yVCK.png)


title: wired ethernet interface not detected by lshw, lspci

text: I have a Toshiba Satellite PSAG8U-04001W. No eth* interface shows up on ifconfig.               $ ifconfig -a     lo        Link encap:Local Loopback                 inet addr:127.0.0.1  Mask:255.0.0.0               inet6 addr: ::1/128 Scope:Host               UP LOOPBACK RUNNING  MTU:16436  Metric:1               RX packets:32 errors:0 dropped:0 overruns:0 frame:0               TX packets:32 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0                RX bytes:2544 (2.4 KiB)  TX bytes:2544 (2.4 KiB)          wlan2     Link encap:Ethernet  HWaddr 00:21:6b:d3:1b:dc                 inet addr:192.168.1.83  Bcast:192.168.1.255  Mask:255.255.255.0               inet6 addr: fe80::221:6bff:fed3:1bdc/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:27901 errors:0 dropped:0 overruns:0 frame:0               TX packets:18098 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:20958957 (19.9 MiB)  TX bytes:3551000 (3.3 MiB)      Even more surprinsingly, neither lshw nor lspci shows anything related to wired ethernet controller/adapter: lshw:               $lshw -C network       *-network            description: Wireless interface            product: WiFi Link 5100            vendor: Intel Corporation            physical id: 0            bus info: pci@0000:03:00.0            logical name: wlan2            version: 00            serial: 00:21:6b:d3:1b:dc            width: 64 bits            clock: 33MHz            capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless            configuration: broadcast=yes driver=iwlwifi driverversion=3.2.0-4-amd64 firmware=8.83.5.1 build 33692 ip=192.168.1.83 latency=0 link=yes multicast=yes wireless=IEEE 802.11abgn            resources: irq:45 memory:d4600000-d4601fff      lspci:               $lspci -nnk     00:00.0 Host bridge [0600]: Intel Corporation Mobile 4 Series Chipset Memory Controller Hub [8086:2a40] (rev 07)        Subsystem: Toshiba America Info Systems Device [1179:ff1e]        Kernel driver in use: agpgart-intel     00:02.0 VGA compatible controller [0300]: Intel Corporation Mobile 4 Series Chipset Integrated Graphics Controller [8086:2a42] (rev 07)        Subsystem: Toshiba America Info Systems Device [1179:ff1e]        Kernel driver in use: i915     00:02.1 Display controller [0380]: Intel Corporation Mobile 4 Series Chipset Integrated Graphics Controller [8086:2a43] (rev 07)        Subsystem: Toshiba America Info Systems Device [1179:ff1e]     00:1a.0 USB controller [0c03]: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #4 [8086:2937] (rev 03)        Subsystem: Toshiba America Info Systems Device [1179:ff1e]        Kernel driver in use: uhci_hcd     00:1a.1 USB controller [0c03]: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #5 [8086:2938] (rev 03)        Subsystem: Toshiba America Info Systems Device [1179:ff1e]        Kernel driver in use: uhci_hcd     00:1a.7 USB controller [0c03]: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #2 [8086:293c] (rev 03)        Subsystem: Toshiba America Info Systems Device [1179:ff1e]        Kernel driver in use: ehci_hcd     00:1b.0 Audio device [0403]: Intel Corporation 82801I (ICH9 Family) HD Audio Controller [8086:293e] (rev 03)        Subsystem: Toshiba America Info Systems Device [1179:ff1e]        Kernel driver in use: snd_hda_intel     00:1c.0 PCI bridge [0604]: Intel Corporation 82801I (ICH9 Family) PCI Express Port 1 [8086:2940] (rev 03)        Kernel driver in use: pcieport     00:1c.1 PCI bridge [0604]: Intel Corporation 82801I (ICH9 Family) PCI Express Port 2 [8086:2942] (rev 03)        Kernel driver in use: pcieport     00:1c.4 PCI bridge [0604]: Intel Corporation 82801I (ICH9 Family) PCI Express Port 5 [8086:2948] (rev 03)        Kernel driver in use: pcieport     00:1d.0 USB controller [0c03]: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #1 [8086:2934] (rev 03)        Subsystem: Toshiba America Info Systems Device [1179:ff1e]        Kernel driver in use: uhci_hcd     00:1d.1 USB controller [0c03]: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #2 [8086:2935] (rev 03)        Subsystem: Toshiba America Info Systems Device [1179:ff1e]        Kernel driver in use: uhci_hcd     00:1d.2 USB controller [0c03]: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #3 [8086:2936] (rev 03)        Subsystem: Toshiba America Info Systems Device [1179:ff1e]        Kernel driver in use: uhci_hcd     00:1d.3 USB controller [0c03]: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #6 [8086:2939] (rev 03)        Subsystem: Toshiba America Info Systems Device [1179:ff1e]        Kernel driver in use: uhci_hcd     00:1d.7 USB controller [0c03]: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #1 [8086:293a] (rev 03)        Subsystem: Toshiba America Info Systems Device [1179:ff1e]        Kernel driver in use: ehci_hcd     00:1e.0 PCI bridge [0604]: Intel Corporation 82801 Mobile PCI Bridge [8086:2448] (rev 93)     00:1f.0 ISA bridge [0601]: Intel Corporation ICH9M LPC Interface Controller [8086:2919] (rev 03)        Subsystem: Toshiba America Info Systems Device [1179:ff1e]     00:1f.2 SATA controller [0106]: Intel Corporation 82801IBM/IEM (ICH9M/ICH9M-E) 4 port SATA Controller [AHCI mode] [8086:2929] (rev 03)        Subsystem: Toshiba America Info Systems Device [1179:ff1e]        Kernel driver in use: ahci     00:1f.3 SMBus [0c05]: Intel Corporation 82801I (ICH9 Family) SMBus Controller [8086:2930] (rev 03)        Subsystem: Toshiba America Info Systems Device [1179:ff1e]        Kernel driver in use: i801_smbus     03:00.0 Network controller [0280]: Intel Corporation WiFi Link 5100 [8086:4232]        Subsystem: Intel Corporation WiFi Link 5100 AGN [8086:1201]        Kernel driver in use: iwlwifi     04:06.0 FireWire (IEEE 1394) [0c00]: Ricoh Co Ltd R5C832 IEEE 1394 Controller [1180:0832] (rev 05)        Subsystem: Toshiba America Info Systems Device [1179:ff1e]        Kernel driver in use: firewire_ohci     04:06.1 SD Host controller [0805]: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter [1180:0822] (rev 22)        Subsystem: Toshiba America Info Systems Device [1179:ff1e]        Kernel driver in use: sdhci-pci     04:06.2 System peripheral [0880]: Ricoh Co Ltd R5C592 Memory Stick Bus Host Adapter [1180:0592] (rev 12)        Subsystem: Toshiba America Info Systems Device [1179:ff1e]        Kernel driver in use: r592     04:06.3 System peripheral [0880]: Ricoh Co Ltd xD-Picture Card Controller [1180:0852] (rev 12)        Subsystem: Toshiba America Info Systems Device [1179:ff1e]        Kernel driver in use: r852      Why is my laptop's wired ethernet not showing? How can I debug this? The installation of Debian wasn't originally on this system: it was on an older laptop whose motherboard fried, so I rescued the hard drive as well as the Debian installation. However, I doubt this should have anything to do with lspci not even detecting the wired eth controller.


title: Will tar -cvzf packed.tar.gz mydir take hidden files into account?

text: I need to create a tarball of a given directory. However, I need to make sure hidden files are included too (such as those beginning with `.`). Will the following command automatically take the hidden files into account?               tar -cvzf packed.tar.gz mydir      If not, how can I make sure I include hidden files?


title: How to write a shell script restart apache if `server reached MaxClients`

text: Recently, My blog always shutdown, it use `centos6.2+apache2.2+mysql5.5+php5.3`. I have raised `MaxClients` in `httpd.conf`, but less useful. So is it possible to write a shell script (Run with crontab every 10 minutes), to read the `httpd/error_log`, if the last message `preg_match` `sending a SIGTERM` do restart apache automatically?


title: Swap alt and windows key except when using an external keyboard

text: On my laptop the `Alt` and `Windows` keys are in the opposite positions that I'd prefer them in. Swapping them is fairly easy. However, my external (USB) keyboard has the `Alt` and `Windows` keys in the order I prefer, meaning when I switch over to the external keyboard I have the unpreferable keyboard arrangement. Is there some manner of Linux-y voodoo I can invoke to detect whether input is coming from an external keyboard or not, and have it swap the two keys accordingly? If that's pushing it, I'd settle for a way to detect when an external keyboard is plugged in. Or are there any other reasonable solutions that I haven't considered?


title: Apache2 permissions issue

text: I have changed my DocumentRoot to `/home/user/www`. To achieve that I have just changed the 2 occurrences of the path at /etc/apache2/sites- available/default. The permissions of /home/user/www are 0774. I have added the www-data user to my user's group and the owner of `/home/user/www` is my own user and group (user:user). I have done that by:               sudo chmod -R 0774 www     sudo chown -R user:user www     sudo adduser www-data user      The problem is that Apache can't write to this directory. It can write only if I set www-data as owner, but if I do that, I can't write at the directory. I have tested the permissions with:               sudo -u www-data ls /home/user/www     sudo -u www-data cat /home/user/www/some-file      and it works. But the Wordpress I have at `www` can't delete or create files. Any ideas?


title: How can I use awk to extract URL's from a HTML file?

text: I have an HTML file with javascript and CSS in the source. Listed in the JS is a series of URLs' embedded with other meta-data. I want to use awk to extract the URLs (all enclosed in double quotes with the http:// prefix) and dump the urls to stdout. But I do not know how to use awk, but it seems to be the tool to use.               {     title: "Dsssat",     artist: "cxpl djij awsoj e",     mp3: "http://somesite.com/seal/dsssat.mp3",     },


title: confusing behavior of emacs-style keybindings in bash

text: Bash offers many useful `emacs-style keybindings` for simple commandline editing. For example, `Ctrl+w` deletes ("kills") word left from the cursor. Another keybinding, `Alt+d` is supposed to be a "mirror" of the first one. It is supposed to delete a word right from the cursor. However, I have noticed, these two keybindings do not act completely symetricaly. Whereas `Ctrl+w` treats `foo.bar` as one word, `Alt+d` treats it as two words Even more annoyingly, `# echo` are two words for `Ctrl+w`, but one word for `Alt+d`. Is there some logic in this? Is there some reason why they don't treat words in the same way? **Is there any way for me to change this?** I am using bash on `Debian Wheezy`


title: GlassFish/Tomcat security issue between domain users in linux server (alternate docroot issue)

text: Let's suppose we give to different users(clients) different domains (one domain for one user) in our glassfish application server for their work. This glassfish works in centos 6 server. Every user has his user folder in /home (/home/user1, /home/user2). Glassfish is installed in /usr/glassfish..... and runs as "glassfish" linux user. And every user(client) wants to have an alternate docroot(s). Here's is the problem. Every user has access only to his home folder. So it's the place where he wants to have alternate docroot(s) to keep his data. In order for glassfish to get users' alternate docroots we open users' folders (/home/user1, /home/user2) for glassfish. But now, every user can deploy his application and get another user's alternate docroot. Because it's the user sets alternate docroot folder not the admin. Here is the big difference - in apache it's the administrator who sets webserver folders for reading. So either my vision is wrong or how can it be fixed? [EDITED] Here I am talking about one linux server with one IP and one glassfish application server in that linux server. To supply services to our clients we don't install different glassfish servers we give them different domains in the same glassfish server as I see it's the best strategy.


title: How to check if aptitude did something?

text: I've a CI build process during which I install a debian package from my local reprepro. I have a `Makefile` which does call aptitude to install the package from its own repository like this               sudo aptitude -y install foobar >> aptitude.log 2>&1      Now it could happen that aptitude has conflicts, which can't be resolved or the repository doesn't offer a new version for the package "foobar". In both cases aptitude wouldn't install anything. But               echo $?      after the aptitude call in the `Makefile` always returns `0`. What way do you propose to check if aptitude actually did install anything? Grepping for the last line of the aptitude output is the only thing I can think of if the exit codes are always `0`.


title: Why doesn't Bash accept `&>&3`, i.e. redirecting stdout and stderr to file descriptor 3?

text: Given the preamble, `foobar` function and invocations of it:               exec 3>/dev/null         function foobar { echo foo; echo bar >&2; }     foobar >/dev/null     foobar 2>/dev/null     foobar &>/dev/null     foobar &>&3      Why doesn't the last simple command get executed by Bash? Instead Bash quits with:               -bash: syntax error near unexpected token `&'


title: Bash port auto upgrading script in cron doesn't work properly?

text: I've been recently try to write a script to automate checks for new version of ports and software installed on my FreeBSD server. This script is added to root's crontab and fires daily. If I run it from sudo /path/to/script it goes forward decently sending mail with content on my email address. If it's run by cron I get an empty mail. I think that the reason might be that while update sometimes window appears (from `make config` i think) with compilation options, but I might be wrong. Here's the script:               #!/usr/local/bin/bash     # DIRECTORIES SETUP     script_path_dir="/tmp"     working_dir="$script_path_dir/portsupgradescript"          # FILES SETUP     mail_file="$working_dir/mail.txt"     mail_address="MY_MAIL_ADDRESS"     mail_subject="Daily update"     pm_out="portmaster_log.txt"     pu_out="portupgrade_log.txt"               # START          if [ ! -d "$script_path_dir" ];      then       echo "Script base directory set does not exist. Creating..."       mkdir $script_path_dir      else       echo "Script base directory set exists. OK"     fi          if [ ! -d "$working_dir" ];      then       echo "Script working directory set does not exist. Creating..."       mkdir $working_dir      else       echo "Script working directory set exists. OK"     fi          if [ "$(ls -A $working_dir)" ]; then      echo "Script working directory is empty. OK"     else      echo "Script working directory is not empty. Cleaning..."      rm -rf $working_dir/*     fi               rm -rf $pm_out     rm -rf $pu_out     rm -rf $mail_file          /usr/sbin/portsnap fetch update && \     /usr/local/sbin/portmaster -L --index-only | egrep '(ew|ort) version|total install' > $pm_out          linecount=`wc -l $pm_out | awk {'print $1'}`     if [ "$linecount" != "0" ]     then      echo "Master file log not empty. Concatenating..."      cat $pm_out >> $mail_file      else       echo "Master file log empty... ( x )  "     fi               portupgrade -aqyP -l $pu_out          upg_linecount=`wc -l $pu_out`     if [ "$upg_linecount" != "0" ]      then       echo "Upgrade file log not empty. Concatenating..."       cat $pu_out >> $mail_file      else       echo "Upgrade file log empty... ( x ) "      fi               echo "Seding mail report..."      cat $mail_file | mail -s "$mail_subject" "$mail_address"      Is there any way to select defaults on "`make config`" window so this would be not a showstopper? Or maybe I should run this script sudoed in user's cron, not root's?


title: Find a particular nesting of directory names, e.g. .../project/dir1/dir2

text: I'm having some issues dealing with the `find` command; I don't know the syntax for it very well and I need to use it in a script to find a specific directory structure that could be located anywhere. Basically, I have a structure like "project/dir1/dir2" that I know will always be exactly those three directories, with the same names, in that order. What may not be the same is how deep this structure is nested; for example you could have: `$HOME/project/dir1/dir2` or `$HOME/workspace/project/dir1/dir2` Basically I need a general way to locate the `project/dir1/dir2` structure no matter how far deeply buried it is. If it helps, this will always be on Ubuntu. I thought about using locate, but then I'd have to guarantee that the locate db is always up to date.


title: Shuffle file randomly with some additional constraints

text: I have a huge music playlist and, while some artists have many albums, others have just one song. I wanted to sort the playlist so the same artist won't play twice in a row, or his songs won't end up mostly in the beginning or end of the playlist. Example playlist:               $ cat /tmp/playlist.m3u     Anna A. - Song 1     Anna A. - Song 2     I--Rock - Song 1     John B. - Song 1     John B. - Song 2     John B. - Song 3     John B. - Song 4     John B. - Song 5     Kyle C. - Song 1     U--Rock - Song 1      Output from `sort -R` or `shuf`:               $ sort -R /tmp/playlist.m3u     Anna A. - Song 1 #     U--Rock - Song 1     Anna A. - Song 2 # Anna's songs are all in the beginning.     John B. - Song 2     I--Rock - Song 1     John B. - Song 1     Kyle C. - Song 1     John B. - Song 4 #     John B. - Song 3 #     John B. - Song 5 # Three of John's songs in a row.      What I am expecting:               $ some_command /tmp/playlist.m3u     John B. - Song 1     Anna A. - Song 1     John B. - Song 2     I--Rock - Song 1     John B. - Song 3     Kyle C. - Song 1     Anna A. - Song 2     John B. - Song 4     U--Rock - Song 1     John B. - Song 5      **EDIT:** I have uploaded a real example of such a playlist here.


title: corrupt debian package archives on self-made database packages

text: I set about packaging several large databases in some very basic debian packages so as to make life easier at my job. However, I'm now encountering some issues. Most of the databases will install happily, however, the largest three are failing.               find . -name "*.deb" -exec du -h '{}' \; | sort -h     # These install fine     4.0K    ./hh-suite-data_1.0_all.deb     422M    ./hh-suite-data-env70/package/hh-suite-data-env70_1.0.0_amd64.deb     660M    ./hh-suite-data-env90/package/hh-suite-data-env90_1.0.0_amd64.deb     795M    ./hh-suite-data-env/package/hh-suite-data-env_1.0.0_amd64.deb     1.6G    ./hh-suite-data-scop70/package/hh-suite-data-scop70_1.0.0_amd64.deb     2.6G    ./hh-suite-data-nr70/package/hh-suite-data-nr70_1.0.0_amd64.deb     2.8G    ./hh-suite-data-pfamA/package/hh-suite-data-pfama_1.0.0_amd64.deb     3.2G    ./hh-suite-data-nr90/package/hh-suite-data-nr90_1.0.0_amd64.deb     # These fail to install     4.3G    ./hh-suite-data-nr20/package/hh-suite-data-nr20_1.0.0_amd64.deb     6.2G    ./hh-suite-data-pdb70/package/hh-suite-data-pdb70_1.0.0_amd64.deb     7.4G    ./hh-suite-data-nr/package/hh-suite-data-nr_1.0.0_amd64.deb      The failures look like this:               sudo dpkg -i package/hh-suite-data-nr20_1.0.0_amd64.deb      [sudo] password for esr:      (Reading database ... 276172 files and directories currently installed.)     Unpacking hh-suite-data-nr20 (from .../hh-suite-data-nr20_1.0.0_amd64.deb) ...     dpkg: error processing package/hh-suite-data-nr20_1.0.0_amd64.deb (--install):      corrupted filesystem tarfile - corrupted package archive     dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)     Errors were encountered while processing:      package/hh-suite-data-nr20_1.0.0_amd64.deb      I'm somewhat convinced it's because of the size of the archives, that somewhere between 3.2 and 4.3G. Does anyone have any experience with _very_ large packages and their failure modes? Anyone have any idea why this is happening? I have no reason to believe the tar archive are corrupted, I've built the package many times and still see this error on installation I'm re-writing my packages to just `wget` the files from a mirror instead of actually containing the databases, as that'll get around the tar problem. ## Running with -D10               # This file unpacks fine     D000010: tarobject ti->name='./usr/share/hh-suite-data/pdb70/pdb70_19Oct13_a3m_db.index' mode=100644 owner=0.0 type=48(-) ti->linkname='' namenode='/usr/share/hh-suite-data/pdb70/pdb70_19Oct13_a3m_db.index' flags=2 instead='<none>'     D000010: ensure_pathname_nonexisting `/usr/share/hh-suite-data/pdb70/pdb70_19Oct13_a3m_db.index.dpkg-tmp'     D000010: ensure_pathname_nonexisting `/usr/share/hh-suite-data/pdb70/pdb70_19Oct13_a3m_db.index.dpkg-new'     # This is a 16G file and fails IMMEDIATELY.     D000010: tarobject ti->name='./usr/share/hh-suite-data/pdb70/pdb70_19Oct13_a3m_db' mode=100644 owner=0.0 type=48(-) ti->linkname='' namenode='/usr/share/hh-suite-data/pdb70/pdb70_19Oct13_a3m_db' flags=2 instead='<none>'     D000010: ensure_pathname_nonexisting `/usr/share/hh-suite-data/pdb70/pdb70_19Oct13_a3m_db.dpkg-tmp'     D000010: ensure_pathname_nonexisting `/usr/share/hh-suite-data/pdb70/pdb70_19Oct13_a3m_db.dpkg-new'     dpkg: error processing hh-suite-data-pdb70_1.0.0_amd64.deb (--install):      corrupted filesystem tarfile - corrupted package archive      ## Running with -D100 There are two entries in this portion, a good one and the bad one, and some after the failure. What worries me is the "tarobject file open size=0" bit.               D000100: setupvnamevbs main=`/usr/share/hh-suite-data/pdb70/pdb70_19Oct13_a3m_db.index' tmp=`/usr/share/hh-suite-data/pdb70/pdb70_19Oct13_a3m_db.index.dpkg-tmp' new=`/usr/share/hh-suite-data/pdb70/pdb70_19Oct13_a3m_db.index.dpkg-new'     D000100: tarobject already exists     D000100: tarobject file open size=900749     D000100: tarobject nondirectory, `link' backup     D000100: tarobject done and installation deferred     D000100: setupvnamevbs main=`/usr/share/hh-suite-data/pdb70/pdb70_19Oct13_a3m_db' tmp=`/usr/share/hh-suite-data/pdb70/pdb70_19Oct13_a3m_db.dpkg-tmp' new=`/usr/share/hh-suite-data/pdb70/pdb70_19Oct13_a3m_db.dpkg-new'     D000100: tarobject already exists     D000100: tarobject file open size=0     D000100: tarobject nondirectory, `link' backup     D000100: tarobject done and installation deferred     dpkg: error processing hh-suite-data-pdb70_1.0.0_amd64.deb (--install):      corrupted filesystem tarfile - corrupted package archive     D000100: setupvnamevbs main=`//usr/share/hh-suite-data/pdb70/pdb70_19Oct13_a3m_db' tmp=`//usr/share/hh-suite-data/pdb70/pdb70_19Oct13_a3m_db.dpkg-tmp' new=`//usr/share/hh-suite-data/pdb70/pdb70_19Oct13_a3m_db.dpkg-new'     D000100: cu_installnew restoring atomic     D000100: secure_remove '//usr/share/hh-suite-data/pdb70/pdb70_19Oct13_a3m_db.dpkg-new' unlink OK


title: Why can't my python script change umask?

text: This is my script               #!/usr/bin/python          import os          print "hello world from python"     os.system("echo 'hello world from bash'")     os.system("umask 055")     os.system("ls -alh > test")      If I run this code the permissions of file test are not set as 722 but as 600. What could be the reason? the Umask of my shell is 0077.


title: What files should I copy from Windows into Wine?

text: As far as I understand Wine runtime does better if some libraries are copied from MS Windows, but some Windows system libraries really are not to be used with Wine (some can even make it stop working, and many are simply useless). So what files make sense and are safe to copy from MS Windows into Wine system? I own a legal Windows XP copy (but prefer to use GNU/Linux) and run Wine 1.3.8 on Ubuntu 10.10.


title: What Linux distro would you recommend for a big all-purpose LiveUSB?

text: I am about to buy a 2TB hard drive to have all my scrap in one place. I will split it to some partitions one to store my data, and others to store OS distros and bootable OSes like WinPE and Linux. I'd like the Linux system to be a fully-equipped all-purpose graphical environment (preferably with XFCE, but this doesn't really matter) with all hardware (including 3D graphics) automatic support on virtually any machine and automatic RW mounting of all available partitions (incl. those on this HDD and on a host machine (incl. NTFS, LVM, and FreeBSD partitions)). I'd like as fresh software versions as possible. Should I use Mandriva Move, Knoppix, or something else?


title: How to get Nautilus to "Open with Archive Mounter"?

text: I see Ubuntu screenshots showing that one can right-click an ISO, and have an option to "Open with Archive Mount". How do I get that running elsewhere where it isn't default (Debian in my case)? This is so as to avoid having to use the command-line to loop-mount it. Note that I use GNOME **2.30**.


title: How to create .ko files in Linux

text: I have written one driver for one device in Linux. How can I create (using `gcc`) a `.ko` file so that I can insert it into the kernel?


title: Blank Screen after login. Although virtual console works. Please help

text: A very frustrating thing happened today. To give you a little background, I had been running Dropbox and a few other programs prior on my CrunchBang box (Debian based). It seems that some of the processes were taking more than the amount of memory I prefer. So, I performed a system reboot. Once the box came back to the login screen I entered my necessary credentials. After that, to my horror the screen went blank/dark grey!!! I did a hard reboot as the box didn't seem to respond to commands. Once it came back I noted that it would let me switch to command line terminal view (virtual console). It appeared all my files where intact. But, I really need my GUI back. Any ideas on what may have happened? Or what I might try to do to fix this? This CrunchBang install is only a few days old, it doesn't matter since it's not working. I've also tried launching the X server by running:               startx       Still nothing happens, just the blank screen. If I `Control`+`C` it terminates the X server and returns back to the command prompt. **Solution UPDATE (11/22/13):** Come to find out, my problem was simply that my default x-session-manager got switched to "lxsession" (which was configured to display a blank screen by default apparently). I'm not sure why but that's what happened. I'm thinking maybe one of the system updates changed the default x-session manager configuration. The following command allows you to change the defualt x-session manager(atleast in debian): > sudo update-alternatives --config x-session-manager Something like this will be the ouput:                    There are 2 choices for the alternative x-session-manager (providing /usr/bin/x-session-manager).            Selection    Path                      Priority   Status     ------------------------------------------------------------       0            /usr/bin/lxsession         49        auto mode       1            /usr/bin/lxsession         49        manual mode     * 2            /usr/bin/openbox-session   40        manual mode          Press enter to keep the current choice[*], or type selection number:            The output of that command will allow you to switch between all installed x-session managers. Thanks all!


title: How do I download PDFs from PubMed, given their IDs?

text: I have PubMed IDs for files I need to download from the PubMed site in `.pdf` format. I tried this script:               #!/usr/bin/env bash          Link="http://www.ncbi.nlm.nih.gov/pubmed/"          ID=(10021369              10051005     10051007     100562     10064668     10071185     )          for f in ${ID[]};     do        wget  --user-agent="Mozilla/5.0 (Windows NT 5.2; rv:2.0.1) Gecko/20100101 Firefox/4.0.1" \              -l1 --no-parent -A.pdf ${Link}${f}/pdf/ -O ${f}.pdf     done      This gives me PDF files, but I can't open any of them. What am I doing wrong?


title: How to exit vncconfig process properly

text: On CentOS 5.7, when open up a `vncconfig`, a tray icon shows on the taskbar. Hit `close` or the `x` button to close the vncconfig doesn't exit the vncconfig, the tray icon is still there. Next time, if I open up another vncconfig rather than clicking the one on taskbar. There will be another vncconfig tray icon added to the taskbar. Except using `kill $pid` to remove the tray icon, is there any other way to exit the vncconfig process properly? See screenshot below: ![enter image description here](http://i.stack.imgur.com/OQqhh.png)


title: Debian VLAN (8021q) Configuration doesn't work

text: I try to setup VLANs on a virtual Debian machine. It's connected to an Cisco 2960 Switch. The Switch has 3 VLANs (1,100,200) which're allowed the pass the trunk. The Switch Configurations was tested with an other layer2 switch, which was also configured as trunk. It worked perfectly so it has to be the VM. The 8021q Kernel Module is loaded but "Used by" is set to 0. The Network Configuration of the Debian Host looks like:               auto eth0.1     iface eth0.1 int static         address 192.168.0.1         netmask 255.255.255.0         vlan_raw_device eth0          auto eth0.100     iface eth0.100 int static         address 192.168.1.1         netmask 255.255.255.0         vlan_raw_device eth0          auto eth0.200     iface eth0.200 int static         address 192.168.2.1         netmask 255.255.255.0         vlan_raw_device eth0      When I try to ping the IP of the Switch I get back               From 192.168.1.1 icmp_swq=1 Destination Host Unreachable      I would realy appreciate Help!


title: File compression - how to implement in Linux

text: I would like to be able to compress certain files (that I need to keep, but use rarely) on disk. I noticed that `chattr +c` flags a file for compression, but it doesn't seem to actually compress files. What is the simplest way to implement file compression on a per-file or per- directory basis?


title: RHEL - GDM could not be initialized

text: **Actions before the GDM failure** I was trying to install _RT tool_ in my system. However, the RT tool required _Perl 5.10_. So, I did `yum remove perl` to remove the existing version. While the command was getting executed, I was not able to navigate to any other tab or window. The system was stuck. So, I long pressed the power button and turned it on. **After Turning ON** I got the below error messages (Not exactly in the same order, but after trying various options)   * Couldn't start X server on card 0. (I think when I did the `startx` command)   * Xserver not found.   * Install x server or correct GDM configuration and restart GDM.  I tried to do the below command.               cp xorg.conf failsafe xorg.conf      However, I did not find the file **xorg.conf** file itself. I tried to update the GDM by doing `yum install GDM` after removing GDM. However, I still do not get the display. I want to bring back the display without having to reinstall the entire OS again.


title: Archlinux not configured with iptables

text: I have been trying to set up iptables on my archlinux server, however when I run `iptables -nvL` I receive the error `iptables v1.4.20: can't initialize iptables table 'filter': Table does not exist (do you need to insmod?) Perhaps iptables or your kernel needs to be upgraded.` Having tried to load the modules and failing I checked to see if they were installed using modinfo and they could not be found. I was trying to run these modules `x_tables, ip_tables, ip_filter, iptable_filter, xt_tcpudp, nf_conntrack, xt_state, nf_conntrack_ipv4` Does anybody know how to solve this problem? EDIT: Having done some more research on the problem I think I may need to install the necessary modules manually. Is this something which is possible over ssh? I am not sure how to go about rebuilding the kernel.


I want to run `cmake` for a program,               [build]$ cmake ../     cmake: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by cmake)      I have this error, how i can fix it? I use from Archlinux


title: Is NFS very secure? Secure alternatives

text: I know that there is a very similar question to that Is NFS Secure Over Internet, but I am asking a little bit different. I guess that NFS is not so secure, as I can learn from the internet and from that question. Are there any very secure methods to use in order for your employees to have access to some files you want to be _very_ secure? Let's say it a little different. If NSA for example, has some documents, lets say top secret, and wants those documents to be available to its employees (NSA may want each employee to have access to different documents according with what they are working on) but no-one else, and under no circumstances someone from inside or outside of the agency could have access to files that should not see, what NSA may do? I am not just asking for NFS here, but everything that NSA could use to achieve it's purpose.