RealTechTalk (RTT) - Linux/Server Administration/Related

We have years of knowledge with technology, especially in the IT (Information Technology) industry. 

realtechtalk.com will always have fresh and useful information on a variety of subjects from Graphic Design, Server Administration, Web  Hosting Industry and much more.

This site will specialize in unique topics and problems faced by web hosts, Unix/Linux administrators, web developers, computer technicians, hardware, networking, scripting, web design and much more. The aim of this site is to explain common problems and solutions in a simple way. Forums are ineffective because they have a lot of talk, but it's hard to find the answer you're looking for, and as we know, the answer is usually not there. No one has time to scour the net for forums and read pages of irrelevant information on different forums/threads. RTT just gives you what you're looking for.

  • Uploading Error HTTP error. Wordpress Upload Error Solution


    When you start uploading larger images in Wordpress you have to make sure your maximum attachment size is large enough and that the execution time is not too short:

    Uploading
    Error
    HTTP error.


    [Thu May 12 16:32:25 2016] [error] [client 10.10.5.2] PHP Fatal error:  Maximum execution time of 30 seconds exceeded in /httpdocs/blog/wp-includes/class-wp-image-editor-gd.php on line 182


    Solution Edit php.ini to increase the maximum_execution_time variable to 80 seconds
    vi /etc/php.ini

    max_execution_time = 80
     


  • mysql_real_escape_string returns an empty string solution


    This is a common mistake but many people do not realize this function comes from mysql itself, so therefore you need an active mysql connection open.

    Usually the string will be empty and null when you call it from outside of the database connection portion of your code.

    eg. an example of the wrong way and creating a null/empty string

    $var = mysql_real_escape_string($myself)

    mysql_connect();

    // returns null/empty

    As you can see above the escape was called before we connected to the db so that's why it returns empty.

    How to fix it (put the escape call after you connect to mysql):

    mysql_connect();

    $var = mysql_real_escape_string($myself)

     

    There realy should be more of a warning from PHP itself because an empty string could cause havoc with database transactions.

    Another way the problem can be created:

    Sometimes as coders we get too smart and thank "we'll update all of our unescaped data to be escaped and mass replace all functions with sed"

    sed -i s/'addslashes('/'mysql_real_escape_string('/g admin.php

    A good example is the above, why does it break?  Because as we showed earlier typically most coders will do the string manipulation outside of the database call section.


  • Script runs fine from shell but not from cron job in Linux/Unix Debian/Ubuntu/Mint/Centos


    Usually the cause is inexplicable because some things just don't work correctly even when calling all commands by their full path.

    Usually adding the following to your crontab file at the top will fix/solve the issue:

    SHELL=/bin/sh
    PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

     


  • Cannot Read License File cPanel Solution


    This can happen because port 80 is not open, or your license has expired and/or your IP is out of date and also if the license server itself from cPanel is having issues.

    In most cases as long as you have a valid license the following command will solve it:

     /usr/local/cpanel/cpkeyclt
    Updating cPanel license...Done. Update succeeded.
    Building global cache for cpanel...Done

     



    Cannot Read License File
    To access the interface, you must install the license and ensure that the license is active.

        To ensure that the server is licensed, navigate to http://verify.cpanel.net/, and enter the server’s public IP address.
        If the server is licensed, run the /usr/local/cpanel/cpkeyclt command as the root user.
        Make certain that port 80 is open to contact our license server and that your server’s hostname is a FQDN.

    If you do not currently own a license, register at the cPanel Store and request a trial license in the Free Services section.

    You can purchase or lease a license directly from cPanel, or from one of our Partners.

    After you successfully activate the license, reload the page and the message will no longer display.


  • Centos and obfsproxy install errors


    pip install obfsproxy
    /usr/lib/python2.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
      InsecurePlatformWarning
    You are using pip version 7.1.0, however version 8.1.1 is available.
    You should consider upgrading via the 'pip install --upgrade pip' command.
    Collecting obfsproxy
    /usr/lib/python2.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
      InsecurePlatformWarning
      Downloading obfsproxy-0.2.13.tar.gz (93kB)
        100% |████████████████████████████████| 94kB 39kB/s
    Requirement already satisfied (use --upgrade to upgrade): setuptools in /usr/lib/python2.6/site-packages (from obfsproxy)
    Collecting PyCrypto (from obfsproxy)
      Downloading pycrypto-2.6.1.tar.gz (446kB)
        100% |████████████████████████████████| 446kB 259kB/s
    Collecting Twisted (from obfsproxy)
      Downloading Twisted-16.1.1.tar.bz2 (2.9MB)
        100% |████████████████████████████████| 2.9MB 95kB/s
        Complete output from command python setup.py egg_info:
        Traceback (most recent call last):
          File "<string>", line 20, in <module>
          File "/tmp/pip-build-7aeuJC/Twisted/setup.py", line 57, in <module>
            main(sys.argv[1:])
          File "/tmp/pip-build-7aeuJC/Twisted/setup.py", line 36, in main
            from twisted.python.dist import (
          File "./twisted/__init__.py", line 55, in <module>
            _checkRequirements()
          File "./twisted/__init__.py", line 17, in _checkRequirements
            raise ImportError("Twisted requires Python 2.7 or later.")
        ImportError: Twisted requires Python 2.7 or later.

    #try again after installing these packages
    yum -y install python-crypto gcc make

    pip install obfsproxy
    #same result as before
     ImportError: Twisted requires Python 2.7 or later.

    #there is no python 2.7 package for Centos 6

    #build it ourselves


  • There was a problem importing one of the Python modules required to run yum. The error leading to this problem was:



    There was a problem importing one of the Python modules
    required to run yum. The error leading to this problem was:

       No module named yum

    Please install a package which provides this module, or
    verify that the module is installed correctly.

    It's possible that the above module doesn't match the
    current version of Python, which is:
    2.7.9 (default, Apr 21 2016, 16:51:58)
    [GCC 4.4.7 20120313 (Red Hat 4.4.7-16)]

    If you cannot solve this problem yourself, please go to
    the yum faq at:
      http://yum.baseurl.org/wiki/Faq

     
    Solution

    Revert back to the stock Centos Python and do not ever overwrite the default Python.  You can install a newer python along side but NEVER overwrite the default or it will break things like Python or you will have to manually symlink a lof of things to manually use the old/original python.


  • curl: (35) SSL connect error solution


    curl -k https://somesite.org
    curl: (35) SSL connect error


    The site used to work until I got a new SSL cert
    Updating curl with (yum -y install curl) made it work again.

     


  • Mint/Ubuntu/Debian error twisted/test/raiser.c:4:20: fatal error: Python.h: No such file or directory #include Python.h


    Simple solution install python-dev

    sudo apt-get install python-dev libyaml-dev libpam-dev


  • find: missing argument to '-mtime'


    This is using find and -mtime in Centos Linux, it simply takes "n" (which is a day) as a number and you can specifiy a + or - to say older or less than a certain age.

    # (show everything older than 1 day)

    find . -mtime +1

     


  • openvpn 2.3.10-1.el6 issues auth-env does not work correctly for auth-user-pass-verify


    openvpn 2.3.10-1.el6 issues
     

    in the .conf

    auth-user-pass-verify "passwordcheck $username $password $untrusted_ip"  via-env


    auth-env does not work correctly in OpenVPN 2.3:


    Sat Apr 23 02:30:22 2016 - $username - $untrusted_ip - login failure

    But OpenVPN 2.2 does work as expected.

    It could be that the specified script automatically receives those variables and manually passing them breaks things in OpenVPN 2.3?


  • How to modify HTML/Themeforest Themes to work in any path statically using unix/linux's sed command


    For themes and custom CMS setups, the typical HTML theme is not ready to go at all but here are some common sed commands (search and replace that will get most of them working without breaking as you'd expect).

    The problem is that often the theme directory will be separate from the content and this will break the relative paths that these themes use.

    sed -i s/'href="'/'href="/themes/yourtheme/'/g index.html
    sed -i s/'src="'/'src="/themes/yourtheme/'/g index.html
    sed -i s/"url(.."/"url(/themes/yourtheme/"/g *.css

    In the order of the above

    replace all instances of href=" with href="/themes/yourtheme/

    replace all instances of src=" with src="/themes/yourtheme/

    replace all instances of "url(.. with url(/themes/yourtheme/


  • vps windows 2008 datacenter error code 0xc004c020


    Does anyone have any suggestions on how to handle this error code?  It is for a client who has a Windows 2008 R2 Datacenter License and wants to install virtual instances on the same host.


  • cp copy all contents of directory to another one including hidden files and folders howto


    cp -a /your/source/. /your/dest/

    -a preserves all file atributes and symlinks

    the "." at the end of /source/ includes all hidden files such as .htacess, .bash_history, .ssh etc..

    The / in /dest/ makes sure the contents go into it instead of replacing /dest itself (eg. if you did not have the / at the end).


  • Cannot load /etc/httpd/modules/mod_file_cache.so into server: /etc/httpd/modules/mod_file_cache.so:


    Stopping httpd:                                            [FAILED]
    Starting httpd: httpd: Syntax error on line 73 of /etc/httpd/conf/httpd.conf: Cannot load /etc/httpd/modules/mod_file_cache.so into server: /etc/httpd/modules/mod_file_cache.so: cannot open shared object file: No such file or directory
                                                               [FAILED]
    This is usually because the file is not found in the expected location.   This often happens when moving an httpd.conf between different servers and versions of Apache.  I

    In this case for some reason in a newer version of Apache the module mod_file_cache.so is missing.

    In the case of Centos/RHEL 5 it was, but in RHEL/Centos 6 mod_file_cache is missing according to this from the RHEL website:

    4.4. Apache HTTP Server

    Below is a list of changes for the Apache HTTP Server that are noteworthy when migrating to Red Hat Enterprise Linux 6:
    • The mod_file_cache, mod_mem_cache, and mod_imagemap modules are no longer supported.

    The Solution/Replacement

    mod_disk_cache or mod_cache

    It is as simple as the following in httpd.conf

    CacheEnable disk /
     

    This significantly improves the load times especially when Apache is using ProxyPass as a proxy server in front of the real host.


  • Apache SSL Reverse Proxy Very Slow Solution


    This is a simple fix but not a simple problem and it still doesn't make sense to me.

    But in a nutshell if your target proxy server works fast when accessing directly over SSL then this may be your issue.

    It seems SSL does not play nicely when the target proxy destination/host has a riduculously long key (such as 8192 bits long).  Now this is normally not a problem, in fact the target server could be accessed with hardly any delay directly despite such a long key.

    However when throwing a Proxy and Reverse Proxy with SSL in front of it, made requests take 20-30 seconds (not milliseconds but actual seconds).

    I found many proposed solutions or people saying it should be that slow, but that's just not the case, yes SSL is slower but it shouldn't be this slow.  Disabling or enabling all SSL protocols also made no difference.

    Solution

     

    The problem was instantly solved by replacing the target server's SSL key with a 2048 bit one ( a smaller one). I think this is a big where the SSLProxyPass just can't handle the request properly when the target SSL server has a large public key.

    Additional Performance Improvements


    Use the "CacheEnable disk /" directive in httpd.conf


  • PDF Cannot Open Interactive Solution Ubuntu/Debian/Mint Please wait... If this message is not eventually replaced by the proper contents of the document, your PDF viewer may not be able to display this type of document. You can upgrade to the latest


    Please wait...
    If this message is not eventually replaced by the proper contents of the document, your PDF
    viewer may not be able to display this type of document.
    You can upgrade to the latest version of Adobe Reader for Windows®, Mac, or Linux® by
    visiting http://www.adobe.com/products/acrobat/readstep2.html.
    For more assistance with Adobe Reader visit http://www.adobe.com/support/products/
    acrreader.html.
    Windows is either a registered trademark or a trademark of Microsoft Corporation in the United States and/or other countries. Mac is a trademark
    of Apple Inc., registered in the United States and other countries. Linux is the registered trademark of Linus Torvalds in the U.S. and other
    countries.

    There is a new style of PDFs floating around called "interactive PDFs", and not just fillable forms but more advanced onces that behave more like an HTML and Javascript dynamic form where dropdowns change etc.. This is a horrible idea and mistake because it is very difficult to save and reopen the contents between different Adobe versions and even different Operating Systems (some things just don't save or reopen properly).  Aside from that no standard Linux PDF reader can read these either.

    The only native Linux solution is an old Adobe Acrobat reader from 2013 (they seem to have abandoned Linux for everything) but you can still download and install it here quite easily:

    ftp://ftp.adobe.com/pub/adobe/reader/unix/9.x/9.5.5/enu/

    I used this .deb package for myself


  • Error: database disk image is malformed - yum error solution and fix


    I got this when running yum on a Centos 6 machine:

    Error: database disk image is malformed

    It was easily fixed with the following command:

    yum clean all


  • esniper error on Linux Mint 17.2 Debian/Ubuntu: Cannot connect to URL : SSL connect error: gnutls_handshake() failed: Illegal parameter Retrying... esniper encountered a bug. It looks like your esniper version is not current. You have version 2.28


    Auction 262382440107: Cannot connect to URL : SSL connect error: gnutls_handshake() failed: Illegal parameter
    Retrying...
    esniper encountered a bug.  It looks like your esniper version is not
    current.  You have version 2.28.0, the newest version is 2.31.0.
    Please go to http://esniper.sf.net/ and update your copy of esniper.


  • Nvidia Linux Card not working due to LSI 9200/SAS2008 IRQ conflict


    At first my BIOS said the card may not work right because there is no more option ROM space.

    I disabled the Option ROM for both LSI 1068 and 2008 chipsets, Network Boot ROM and most other PCI slots, Serial Port, etc... and the message went away but the card still does not work properly.

    But it still cannot initialize the card properly (does not work):

    [   33.943272] NVRM: This PCI I/O region assigned to your NVIDIA device is invalid:
    [   33.943272] NVRM: BAR0 is 0M @ 0x0 (PCI:0000:18:00.0)
    [   33.943279] NVRM: The system BIOS may have misconfigured your GPU.
    [   33.943286] nvidia: probe of 0000:18:00.0 failed with error -1
    [   33.943943] NVRM: The NVIDIA probe routine failed for 1 device(s).
    [   33.943953] NVRM: None of the NVIDIA graphics adapters were initialized!
    [   33.943958] [drm] Module unloaded
    [   33.944975] systemd-udevd[2015]: Failed to apply ACL on /dev/dri/card0: No such file or directory
    [   34.281514] NVRM: This PCI I/O region assigned to your NVIDIA device is invalid:
    [   34.281514] NVRM: BAR0 is 0M @ 0x0 (PCI:0000:18:00.0)
    [   34.281521] NVRM: The system BIOS may have misconfigured your GPU.
    [   34.281528] nvidia: probe of 0000:18:00.0 failed with error -1
    [   34.281844] NVRM: The NVIDIA probe routine failed for 1 device(s).
    [   34.281847] NVRM: None of the NVIDIA graphics adapters were initialized!
    [   34.281849] [drm] Module unloaded

    One thing is that lspci lists the SAS2008 card before the graphics card and I have not tried the other PCI x8 port yet:

    0000:00:00.0 RAM memory: NVIDIA Corporation MCP55 Memory Controller (rev a2)
    0000:00:01.0 ISA bridge: NVIDIA Corporation MCP55 LPC Bridge (rev a3)
    0000:00:01.1 SMBus: NVIDIA Corporation MCP55 SMBus Controller (rev a3)
    0000:00:02.0 USB controller: NVIDIA Corporation MCP55 USB Controller (rev a1)
    0000:00:02.1 USB controller: NVIDIA Corporation MCP55 USB Controller (rev a2)
    0000:00:04.0 IDE interface: NVIDIA Corporation MCP55 IDE (rev a1)
    0000:00:05.0 IDE interface: NVIDIA Corporation MCP55 SATA Controller (rev a3)
    0000:00:05.1 IDE interface: NVIDIA Corporation MCP55 SATA Controller (rev a3)
    0000:00:05.2 IDE interface: NVIDIA Corporation MCP55 SATA Controller (rev a3)
    0000:00:06.0 PCI bridge: NVIDIA Corporation MCP55 PCI bridge (rev a2)
    0000:00:06.1 Audio device: NVIDIA Corporation MCP55 High Definition Audio (rev a2)
    0000:00:08.0 Bridge: NVIDIA Corporation MCP55 Ethernet (rev a3)
    0000:00:09.0 Bridge: NVIDIA Corporation MCP55 Ethernet (rev a3)
    0000:00:0a.0 PCI bridge: NVIDIA Corporation MCP55 PCI Express bridge (rev a3)
    0000:00:0d.0 PCI bridge: NVIDIA Corporation MCP55 PCI Express bridge (rev a3)
    0000:00:0f.0 PCI bridge: NVIDIA Corporation MCP55 PCI Express bridge (rev a3)
    0000:00:18.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 10h Processor HyperTransport Configuration
    0000:00:18.1 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 10h Processor Address Map
    0000:00:18.2 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 10h Processor DRAM Controller
    0000:00:18.3 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 10h Processor Miscellaneous Control
    0000:00:18.4 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 10h Processor Link Control
    0000:00:19.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 10h Processor HyperTransport Configuration
    0000:00:19.1 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 10h Processor Address Map
    0000:00:19.2 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 10h Processor DRAM Controller
    0000:00:19.3 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 10h Processor Miscellaneous Control
    0000:00:19.4 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 10h Processor Link Control
    0000:01:05.0 FireWire (IEEE 1394): Texas Instruments TSB43AB22A IEEE-1394a-2000 Controller (PHY/Link) [iOHCI-Lynx]
    0000:05:00.0 Serial Attached SCSI controller: LSI Logic / Symbios Logic SAS2008 PCI-Express Fusion-MPT SAS-2 [Falcon] (rev 03)
    0000:18:00.0 VGA compatible controller: NVIDIA Corporation GT218 [GeForce 210] (rev a2)

    0000:18:00.1 Audio device: NVIDIA Corporation High Definition Audio Controller (rev a1)
    0000:2b:00.0 PCI bridge: NEC Corporation uPD720400 PCI Express - PCI/PCI-X Bridge (rev 06)
    0000:2b:00.1 PCI bridge: NEC Corporation uPD720400 PCI Express - PCI/PCI-X Bridge (rev 06)
    0001:40:00.0 RAM memory: NVIDIA Corporation MCP55 Memory Controller (rev a2)
    0001:40:01.0 RAM memory: NVIDIA Corporation MCP55 LPC Bridge (rev a3)
    0001:40:01.1 SMBus: NVIDIA Corporation MCP55 SMBus Controller (rev a3)
    0001:40:0d.0 PCI bridge: NVIDIA Corporation MCP55 PCI Express bridge (rev a3)
    0001:6b:00.0 SCSI storage controller: LSI Logic / Symbios Logic SAS1068E PCI-Express Fusion-MPT SAS (rev 08)

     

    The Solution

     

    I moved the LSI card to another PCI slot and it fixed it, basically if the SAS2008 is shown before the Nvidia card it is game over.  Notice the order after I switched the physical slot (of course if you have no other slots this is a big problem).  Even disabling the Option ROM on the SAS2008 did not fix it until I switched PCI slots:

     

    0000:18:00.0 VGA compatible controller: NVIDIA Corporation GT218 [GeForce 210] (rev a2)
    0000:18:00.1 Audio device: NVIDIA Corporation High Definition Audio Controller (rev a1)
    0000:2b:00.0 PCI bridge: NEC Corporation uPD720400 PCI Express - PCI/PCI-X Bridge (rev 06)
    0000:2b:00.1 PCI bridge: NEC Corporation uPD720400 PCI Express - PCI/PCI-X Bridge (rev 06)
    0001:40:00.0 RAM memory: NVIDIA Corporation MCP55 Memory Controller (rev a2)
    0001:40:01.0 RAM memory: NVIDIA Corporation MCP55 LPC Bridge (rev a3)
    0001:40:01.1 SMBus: NVIDIA Corporation MCP55 SMBus Controller (rev a3)
    0001:40:0a.0 PCI bridge: NVIDIA Corporation MCP55 PCI Express bridge (rev a3)
    0001:40:0d.0 PCI bridge: NVIDIA Corporation MCP55 PCI Express bridge (rev a3)
    0001:45:00.0 Serial Attached SCSI controller: LSI Logic / Symbios Logic SAS2008 PCI-Express Fusion-MPT SAS-2 [Falcon] (rev 03)
    0001:6b:00.0 SCSI storage controller: LSI Logic / Symbios Logic SAS1068E PCI-Express Fusion-MPT SAS (rev 08)


  • SAS2008 LSI 9200-E Linux Upgrade Flash Firmware with sas2flash


    Download from here http://www.avagotech.com/products/server-storage/host-bus-adapters/sas-9200-8e#downloads

     

    sudo Installer_P20_for_Linux/sas2flash_linux_i686_x86-64_rel/sas2flash -listall
    LSI Corporation SAS2 Flash Utility
    Version 20.00.00.00 (2014.09.18)
    Copyright (c) 2008-2014 LSI Corporation. All rights reserved

        Adapter Selected is a LSI SAS: SAS2008(B2)  

    Num   Ctlr            FW Ver        NVDATA        x86-BIOS         PCI Addr
    ----------------------------------------------------------------------------

    0  SAS2008(B2)     17.00.01.00    11.00.00.06    07.33.00.00     00:05:00:00

        Finished Processing Commands Successfully.
        Exiting SAS2Flash.



    sudo Installer_P20_for_Linux/sas2flash_linux_i686_x86-64_rel/sas2flash -f UEFI_BSD_P20/uefi_bsd_rel/x64sas2.rom
    LSI Corporation SAS2 Flash Utility
    Version 20.00.00.00 (2014.09.18)
    Copyright (c) 2008-2014 LSI Corporation. All rights reserved

        Adapter Selected is a LSI SAS: SAS2008(B2)  

        Executing Operation: Flash Firmware Image

            ERROR: Firmware Image does not have a Valid Signature.

            Firmware Image Validation Failed!

        Due to error remaining commands will not be executed.
        Unable to Process Commands.
        Exiting SAS2Flash.
     


  • Apache Vhost HowTo Serve Same Content using a different domain and IP


    There are a few ways of doing this and all basically involve using the reverse proxy or "ProxyPass" feature of Apache to accomplish it.

    1.) Create a normal vhost and simply symlink the root directory of the site you want to mirror.

    Eg. originalsite.com and newsite.com

    /vhosts/originalsite.com/httpdocs

    You would symlink like this:

    ln -s /vhosts/originalsite.com/httpdocs vhosts/originalsite.com/

    2.) A flexible way and the best way if you want the mirror/different site to have a different IP address but still serve the same content.


    This would be in your vhost.conf

    ServerName differentdomain.com
    ServerAlias www.differentdomain.com
    ProxyPass / http://yourmainsite.com/
    ProxyPassReverse / http://yourmainsite.com/

    Alternative Way If You Want To Proxy The Same Domain through a different IP (eg. for SEO geolocation purposes you could host all content on a single server and then put proxies in front of it)


    ServerName maindomani.com
    ServerAlias www.maindomain.com
    ProxyPass / http://ip.ip.ip.ip/
    ProxyPassReverse / http://ip.ip.ip.ip/
    ProxyPreserveHost On


    *Make sure you keep the "/" at the end of yourmainsite.com or it will not work properly.
    The above is a preferable for me because it will keep working even if the backend server config or IP changes.

    Caveats Issues To Take Into Account

    When doing this with live, public sites that are indexed in search engines you could get penalized or just plain confuse people so there are issues to handle.

    First of all if you force all requests to go to a certain domain or on SSL, you will have to consider how to handle it by updating your .htaccess

    Also if you don't want to get penalized for duplicate content, you will need to add some code to your site to determine if it is being accessed by the main host name, if not then you should dynamically insert a nofollow and noindex into your <head> section.

    <meta name="robots" content="noindex, nofollow" />

     


  • Check Linux Ubuntu/Debian/Mint Version from Command Line


    To check the version of Ubuntu just use the lsb_release command as shown below and you will be able to see the exact Ubuntu version you have installed.

    lsb_release -a
    No LSB modules are available.
    Distributor ID:    Ubuntu
    Description:    Ubuntu 14.04 LTS
    Release:    14.04
    Codename:    trusty


  • Linksys PAP2T No delay in dialing recommended fast dial plan


    I modified the default to the following for faster local dialing for North American area codes:

    (*xx|[3469]11|0|00 [2-9]xxxxxxS0|[2-9]xxxxxxxxxS0|1xxx[2-9]xxxxxxS0|xxxxxxxxxxxx.)

    This is what I added to the above: "[2-9]xxxxxxxxxS0" so any 9 digit number is dialed instantly xxx-xxx-xxxx (the S0 at the end makes it dial right away).  This makes dialing much quicker and is recommended.

    *Note the [2-9] is necessary otherwise the x matches a 1 so if you dial long distance or a toll-free number it dials the first 10 digits of it and cuts off the last one.

    I finally fixed this after years of slow dialing.  It is also important to note that almost all dialing delay problems are caused by your phone adapter (ATA/VOIP) dial plan and not the server side.  It is also shocking that many companies do not supply their ATAs with proper, fast dial plans at least for local dialing.


  • Linksys PAP2T No Dialtone and Cannot Hear Caller


    I have two lines on my PAP2T and the only thing that solved this problem rather instantly was to change the line with the problem to using port 5060 instead of 5061 (so both lines are using port 5600). Note that I am not forwarding either port in my router either.

    Some of the symptoms of this problem for me were the following:

    • No dialtone or it would take several tries.
    • You answer a call but the phone keeps ringing (takes a few times to answer).
    • You answer a call and cannot hear the caller but they can hear you.

  • iptables: Applying firewall rules: iptables-restore: line 40 failed


     service iptables start 
    iptables: Applying firewall rules: iptables-restore: line 40 failed
                                                               [FAILED]

    vi /etc/sysconfig/iptables
    Line 40 is just:
    COMMIT
     

    It turned out that the correct iptables modules were not enabled for the OpenVZ container, enabling and rebooting the container fixed it.


  • MySQL PHP adding a backslash/escaping apostrophes Solution


    The first thing to diagnose is what is actually in the database (use PHPMyAdmin or CLI).

    You will of course either find that the backslash is either in the database or not.

    If the backslash is in the database you probably have magic quotes gpc/runtime on and/or are calling the "addslashes()" function which does this.

    If you are escaping your data with mysql_real_escape_string() then think again, you probably have magic quotes gpc enabled either in php.ini or in an .htaccess

    Most people will remember to check php.ini, but what if there is an old htaccess or one you did not remember.

    In my case here is what I found:

    php_flag magic_quotes_gpc off
    php_flag magic_quotes_runtime on

    Solution, turn off magic quotes runtime:

    php_flag magic_quotes_gpc off
    php_flag magic_quotes_runtime off

    After that the problem should be solved.

    Here is a thread where I think the answer may very well be mine in many cases.


  • Linksys E2500 DD-WRT Upgrade Instructions and Enabling 5ghz with Tomato Firmware


    1.) Flash directly to this file:

    http://tomato.groov.pl/download/K26RT-N/build5x-132-EN/Linksys%20E-series/tomato-E2500-NVRAM60K-1.28.RT-N5x-MIPSR2-132-Max.zip

    *I was never able to get the larger "Mega" file to work, at least not initially so I recommend the file above.

    To enable 5ghz I had to do the "Clear NVRAM" Option before it was shown.

    2.) Or if you don't need 5ghz (most devices do not support it and cannot see it) I prefer DD-WRT:

    Latest versions here:

     

    ftp://ftp.dd-wrt.com/betas/2016/03-07-2016-r29218/broadcom_K3X/dd-wrt.v24-29218_NEWD-2_K3.x_mega-e2500.bin

    ===============

    dd-wrt upgrade problems when you have more than one unit that you have accessed before from the same browser.
    Clear cache and cookies

    #when upgrading make sure you choose reset to firmware defaults or you may have problems getting web interface after like me!

    I could not even reboot the connection would reset on me until I cleared cache and cookies it seems it was inteferring from another dd-wrt that was on the same

    After upgrading only telnet was up (no port 80 web interface):

    telnet 192.168.1.1
    Trying 192.168.1.1...
    Connected to 192.168.1.1.
    Escape character is '^]'.

    DD-WRT v3.0-r29218 mega (c) 2016 NewMedia-NET GmbH
    Release: 03/07/16

    Linksys E2500 login: root
    Password:
    ==========================================================
     
         ___  ___     _      _____  ______       ____  ___
        / _ / _ ___| | /| / / _ /_  __/ _  __|_  / / _
       / // / // /___/ |/ |/ / , _/ / /   | |/ //_ <_/ // /
      /____/____/    |__/|__/_/|_| /_/    |___/____(_)___/
                                                        
                           DD-WRT v3.0
                       http://www.dd-wrt.com
     
    ==========================================================


    BusyBox v1.24.1 (2016-03-07 09:39:54 CET) built-in shell (ash)

    root@Linksys E2500:~# reboot
    root@Linksys E2500:~# Connection closed by foreign host.

    #this did not fix it so I held the reinitialize button on the bottom of the unit for 10seconds
    #this did fix it with the reset/reinitialize (I should have chose reset to defaults when upgrading)
    I still have this problem even when choosing reset to firmware defaults


  • PAP2T Linksys VOIP strange ring problem


    The problem is that the default of most of these units is set for non-North American phones so the ring sounds like it cuts off and is not  sequential.

    How To Fix the Issue

    Click on "Provisioning" and make sure you are in Advanced mode.

         

    Set the following options:

    Ring Waveform: Sinusoid

    Ring Frequency: 25

    Now your phone will ring normally and properly.


  • A start job is running for /etc/rc.local Compatibility


    According to this and my own experience it is the case that you have started something running in the foreground or a server that does not terminate with a normal rc.d script.  The server will reboot once you kill whatever command or process that is.


  • Linux Mint/Ubuntu/Debian Window Controls Missing Solution


    If Linux Mint 17 or other has no window buttons/controls you can do the following from terminal:

    marco --replace&
    Sometimes it can be fixed if you go to your themes/appearance and choose a new one but in the case like mine where Compiz is installed but not running/working then that fix will not work and will require the marco command above.

    What if you can't type in a terminal Window?

    If you close that terminal window the problem reappears only worse, you will not be able to type anything in any window so you cannot do the fix again.


    Do a Ctrl+Alt+F1 and login by terminal and do the following:

    marco --replace -d :0&  (:0 specifies the X session number).

    To find the Xsession #:
    cat /tmp/.X0-lock
         28520



    ps aux|grep 28520

    user       9725  0.0  0.0  11748  2200 pts/23   S+   00:24   0:00 grep --color=auto 28520
    root     28520  2.3  0.5 476780 181152 tty7    Rs+  Mar13  34:43 /usr/bin/X :0 -audit 0 -auth /var/lib/mdm/:0.Xauth -nolisten tcp vt7

    "/usr/bin/X :0" shows that it is ":0" and that is why we will pass to marco's -d option


  • Linux Mint/Ubuntu/Debian Dual NICs networks problem when enabling and disabling one device


    The Scenario

    You have dual NICs and you disable NIC1 which uses 192.168.1.1 as its gateway.  With NIC2 you enable it/connect it to another network which also has the gateway 192.168.1.1

    Everything will work fine at this point.

    When switching back to NIC1 even with NIC2 disabled and even unplugged, the OS basically can't pick up the new/updated ARP entry of the old device for 192.168.1.1 and perhaps thinks it is a security risk or spoof of some sorts and blocks it all.  You may think there is an issue somewhere else but the syslog shows the issue below.

    Mar 13 23:16:58 mybox dbus[1698]: [system] Rejected send message, 7 matched rules; type="method_return", sender=":1.9" (uid=0 pid=2031 comm="/usr/sbin/dnsmasq --no-resolv --keep-in-foreground") interface="(unset)" member="(unset)" error name="(unset)" requested_reply="0" destination=":1.6" (uid=0 pid=1983 comm="NetworkManager ")
    Mar 13 23:16:59 mybox dbus[1698]: [system] Rejected send message, 7 matched rules; type="method_return", sender=":1.9" (uid=0 pid=2031 comm="/usr/sbin/dnsmasq --no-resolv --keep-in-foreground") interface="(unset)" member="(unset)" error name="(unset)" requested_reply="0" destination=":1.6" (uid=0 pid=1983 comm="NetworkManager ")
    Mar 13 23:17:01 mybox CRON[27807]: pam_unix(cron:session): session opened for user root by (uid=0)
    Mar 13 23:17:01 mybox CRON[27807]: pam_unix(cron:session): session closed for user root
    Mar 13 23:17:16 mybox sudo: pam_unix(sudo:auth): conversation failed
    Mar 13 23:17:16 mybox sudo: pam_unix(sudo:auth): auth could not identify password for [one]
    Mar 13 23:17:24 mybox smbd[21006]: pam_unix(samba:session): session closed for user nobody
    Mar 13 23:17:41 mybox dbus[1698]: [system] Rejected send message, 7 matched rules; type="method_return", sender=":1.9" (uid=0 pid=2031 comm="/usr/sbin/dnsmasq --no-resolv --keep-in-foreground") interface="(unset)" member="(unset)" error name="(unset)" requested_reply="0" destination=":1.6" (uid=0 pid=1983 comm="NetworkManager ")
    Mar 13 23:17:42 mybox dbus[1698]: [system] Rejected send message, 7 matched rules; type="method_return", sender=":1.9" (uid=0 pid=2031 comm="/usr/sbin/dnsmasq --no-resolv --keep-in-foreground") interface="(unset)" member="(unset)" error name="(unset)" requested_reply="0" destination=":1.6" (uid=0 pid=1983 comm="NetworkManager ")

    Solution

     sudo service network-manager restart
    network-manager stop/waiting
    network-manager start/running, process 31647
     


  • Linux Mint Network Manager Connection Disconnect Option Grayed Out


    This is a real pain because I had to manually unplug ethernet cables for network testing or to use an alternate network or guarantee physical access to one network segment is cut off. 

    For some reason this happened after I killed dbus because it was confused and blocking packets thinking they were coming from the wrong interface since eth0 and eth1 both had the same subnet and gateway.

    I eventually did a "service network-manager restart" but the option was still grayed out until hours later the option returned and I could click disconnect.

     


  • Errors were found while checking the disk drive for /.


    I will start by saying I think I know what caused this boot-time error on Linux Mint but should also apply to Debian and Ubuntu.

    I changed my BIOS time to several hours in the past to match the current time, but this caused Linux to think there were incorrect filesystem times. 

    The problem is that it seems when you hit this I am not sure what is happening, it doesn't seem to be doing fsck and hangs without prompting the user. 

    What I have found is that you can usually hit "S" to skip fsck or "Y" to try and fix it and it may boot.  It did in my case but X did not start probably because fsck did not complete.

    So I rebooted and then got the error "Starting Enable Remaining Boot-Time Encrypted Block Devices" but it hangs there too for ages not seeming to do anything.  I think I hit "S" and was given the option to fsck so I said yes and this fixed it all and allowed boot to complete.  I did have to ignore mounting /tmp to get there though.

    Another solution is that for some there are bad fstab entries causing the issue but that was not my case.

    I am fairly comfortable with Linux/Debian but this threw me for a loop, the problem is that it is not obvious what is happening and it is hard to get prompted to fsck, there should be a definitive action or prompt to ask you to fsck or not etc....


  • Contact Us


    Thanks for your e-mail.

    We'll reply as soon as possible to $email
    "; } $form = <<< HTML
    $thanksmessage

    To Contact Us Send Us A Message Below

    E-mail Address

    Your Message

    HTML; ?>

    Contact RealTechTalk


  • Redirect www host to non-www Linux Apache modrewrite


    The below forces all request to your domain to go to the main non-www root domain.

    Updated code:

    RewriteCond %{HTTP_HOST} !=domain.com
    RewriteRule ^(.*)$ https://newurl.com/subdir/$1 [R=301,L]

    If you don't want it to go to a subdirectory:

    RewriteCond %{HTTP_HOST} !=domain.com
    RewriteRule ^(.*)$ https://newurl.com/$1 [R=301,L]

    Bad code:

    This code is bad because the REQUEST_URI is not valid or correct if you want to rewrite to a subdirectory and may cause a // home page etc...

    RewriteCond %{HTTP_HOST} !=domain.com
    RewriteCond %{HTTP_HOST} !=""
    RewriteRule ^ http://domain.com/%{REQUEST_URI} [R=301,L]


  • Force SSL for all URLs Apache htaccess modrewrite


    The best way is as below in .htaccess using modrewrite, any request that is not SSL will be redirected to https://domain.com and the exact same URL

    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$ https://domain.com/$1 [R=301,L]


  • WHMCS CC Encryption Hash Location


    The location of the hash is stored in the configuration.php file and is really a bit of pain to have to pull out everytime but this is how WHMCS stores its encryption key hash to see the full credit card number.


  • Debian Ubuntu Mint Samba Share config file location


    /var/lib/samba/usershares

    But note that it is just simple file sharing if you need directory mask, create mask etc... you still need to edit the smb.conf file to create your share.

    Here is an example file:

    comment=
    usershare_acl=S-1-1-0:R,S-1-22-1-1000:F
    guest_ok=y
    sharename=BabyPhotos


  • Debian Linux Ubuntu Mint connect to pptp from terminal bash shell




    apt-get install pptp-linux
    echo "yourvpnusername * yourpasspass *" >> /etc/ppp/chap-secrets


    vi /etc/ppp/peers/provpnaccounts.com

    enter (ignore the lines):

    ============
    pty "pptp server.provpnaccounts.com --nolaunchpppd"
    name testuser
    #remotename PPTP
    require-mppe-128
    file /etc/ppp/options.pptp

    ============

    #add this to /etc/ppp/ip-up

    Where eth0 is your NIC and ppp0 is the name of your VPN connection

    route del default eth0
    route add default dev ppp0

    Connect:
    pppd call provpnaccounts.com

    Disconnect:
    killall pppd

    Customize it

    What I do is add the following to /etc/rc.local

    pppd call provpnaccounts.com

    Make it so the VPN reconnects by itself:

    vi /etc/ppp/options

    persist

    To make it even more fun let's make it so the system can only connect to the outside world if it is connected to the VPN

     


  • Linux Debian/Ubuntu/Centos How To Force Internet Traffic Through PPTP L2TP OpenVPN Account Only


    The following assumes the computer is local/physical to you and/or it always has a LAN IP so it can be accessed on site without having a default gateway.

    The key to this is not to set a default gateway for your computer or you can set a script on boot or other time to delete the gateway (where eth0 is the NIC you are using):

    route del default eth0

    50.80.20.2 is the VPN server you connect to

    192.168.1.1 is your LAN default gateway/router

    ip route add 50.80.20.2 via 192.168.1.1

    The routing command above makes it so the only external traffic not passing through the VPN is the connection to the IP of your VPN (necessary of course to be able to establish the connection).

    With the above even if you lose the connection to your VPN no traffic can reach the outside without being connected to the VPN.


  • vi Debian Linux Ubuntu Mint arrow key problem linux ssh bash shell terminal


    Debian/Ubuntu vi keyboard problem, up and down arrows do not work and instead make an A (Up), B (Down), C (Right) or D(Left).

    The working solution

    (you could also add the set nocompatible to /etc/vim/vimrc to make it system wide-will not be applied until reboot I believe):

    echo "set nocompatible" > ~/.vimrc

    some suggest entering this in vi but it did not work for me:

    :set term=cons25
    The arrow keys work but then Home and End produce garbage characters
     

     


  • Is this partition table correct starting and ending partition on same cylinder?


       Device Boot      Start         End      Blocks   Id  System
    /dev/sdc1               1         132     1060256+  fd  Linux raid autodetect
    Partition 1 does not end on cylinder boundary.
    Partition 1 does not start on physical sector boundary.
    /dev/sdc2             132        2744    20972860   fd  Linux raid autodetect
    /dev/sdc3            2744       60801   466350884+  fd  Linux raid autodetect

    Notice we have partitions ending and starting on the same cylinder.  I cannot duplicate this in fdisk as it will say the value is out of range and not allowed.


  • Vbox Cannot register the hard disk


    Cannot register the hard disk '/media/Debian8.vdi' {d01efabc-aacf-4614-b29c} because a hard disk '/home/VirtualBox VMs/Debian/Debian8.vdi' with UUID {d01efabc-aacf-4614-b29} already exists.

    This is what happens if you move the VDI to another location.
    The easiest way is to delete/remove the machine from VBOX and then reimport it from the new location.


  • Mount a SMB Samba share in fstab Linux Debian/Ubuntu/Centos


    Add the following to fstab where 192.168.1.125/Media is the samba share and where /home/homeuser/Downloads is where you want to mount.

    Change user and pass to what is needed (if no pass is required it still works fine with the below).

    //192.168.1.125/Media /home/homeuser/Downloads cifs        user=guest,pass=bla 0 0


    mount: wrong fs type, bad option, bad superblock on //192.168.1.125/Media,
           missing codepage or helper program, or other error
           (for several filesystems (e.g. nfs, cifs) you might
           need a /sbin/mount.<type> helper program)

           In some cases useful info is found in syslog - try
           dmesg | tail or so.


    *Make sure you install cifs-utils or equivalent so you have the mount.cifs binary


  • Avocent 8020 KVM Java Icedtea Viewer "Network Connect Error" Solution


    It seems every other updated version of Java or Icedtea breaks things and I will save the frustration of Java for another post.

    To fix this error you need to edit the java.security file manually (I recommend updating all in case there is any confusion about what version is being executed):

    Solution

    sudo vi /usr/lib/jvm/*/jre/lib/security/java.security

    Notice the * (wildcard) this will have vi open up every version's java security for you to change or you could also try the most recent version.

    Make the following line look like this:

    jdk.tls.disabledAlgorithms=SSLv3, RC4

    After that the error was fixed and finally the KVM viewer worked again (I wish you could just use VNC or other more reliable ways).


  • tsclient (Terminal Server RDP Client) missing in Debian, Ubuntu, Linux Mint


    This was a horrible shock after upgrading from Ubuntu 9 to Linux Mint 17 and I found that the last distro to support tsclient was Debian Squeeze.

    For some reason it has disappeared for a long time and the new options such as rdesktop and gnome-rdp do not have any start menu entry and just aren't done as well as tsclient.

    Fortunately there is a solution:

    tsclient surprisingly can be downloaded as a direct .deb package and it fails with some various dependency errors when installing but works just fine.

    You can download it here: https://packages.debian.org/squeeze/amd64/tsclient/download


  • Centos Add Multiple IP Addresses in a range without manually setting each static IP


    This is actually very simple and this example assumes your network device is "eth0"

    In Centos your network config would be the following: /etc/sysconfig/network-scripts/ifcfg-eth0

    Take the same path and just add a "-range0"

    So to add a range create the following file: /etc/sysconfig/network-scripts/ifcfg-eth0-range0

    IPADDR_START=192.168.1.50

    IPADDR_END=192.168.1.99

    CLONENUM_START=0

    Obviously change the IPADDR_START and IPADDR_END to suit your subnet and actual range you are looking for.

    This is much easier than having eth0:0 to eth:50 etc... set manually or


  • grub> setup (hd1) Checking if "/boot/grub/stage1" exists...


    It freezes on "grub> setup (hd1)
    Checking if "/boot/grub/stage1" exists..."

    Basically it looks like the partiion table is corrupt or the data/files are not there.


  • Centos installing grub problems suspect gpt problem


    grub> root (hd0,0)
    root (hd0,0)
     Filesystem type is ext2fs, partition type 0xfd
    grub> setup (hd0)
    setup (hd0)


    But if you do:
    root (hd1,0)
    setup (hd1)

    it does work, I think hd0/sda had a GPT partition that was not removed properly (what I did was just dd bs=512 count=1 the partition table from another drive since the partition table should be identical).

     Checking if "/boot/grub/stage1" exists... no
     Checking if "/grub/stage1" exists... yes
     Checking if "/grub/stage2" exists... yes
     Checking if "/grub/e2fs_stage1_5" exists... yes
     Running "embed /grub/e2fs_stage1_5 (hd1)"...  27 sectors are embedded.
    succeeded
     Running "install /grub/stage1 (hd1) (hd1)1+27 p (hd1,0)/grub/stage2 /grub/grub.conf"... succeeded
    Done.

    ==============
    Checking for gpt with gdisk:

    GPT fdisk (gdisk) version 0.8.10

    Partition table scan:
      MBR: MBR only
      BSD: not present
      APM: not present
      GPT: not present


    ***************************************************************
    Found invalid GPT and valid MBR; converting MBR to GPT format
    in memory. THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by
    typing 'q' if you don't want to convert your MBR partitions
    to GPT format!
    ***************************************************************


    ===========

    gdisk /dev/sda
    GPT fdisk (gdisk) version 0.8.10

    Partition table scan:
      MBR: MBR only
      BSD: not present
      APM: not present
      GPT: not present


    ***************************************************************
    Found invalid GPT and valid MBR; converting MBR to GPT format
    in memory. THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by
    typing 'q' if you don't want to convert your MBR partitions
    to GPT format!
    ***************************************************************


    Command (? for help): p
    Disk /dev/sda: 976773168 sectors, 465.8 GiB
    Logical sector size: 512 bytes
    Disk identifier (GUID): 4DE51E1D-DC93-43EC-B670-44A0A9FEE114
    Partition table holds up to 128 entries
    First usable sector is 34, last usable sector is 976773134
    Partitions will be aligned on 8-sector boundaries
    Total free space is 5099 sectors (2.5 MiB)

    Number  Start (sector)    End (sector)  Size       Code  Name
       1              63         2120575   1.0 GiB     FD00  Linux RAID
       2         2120576        44066295   20.0 GiB    FD00  Linux RAID
       3        44066296       976768064   444.7 GiB   FD00  Linux RAID

    Command (? for help): g
    b    back up GPT data to a file
    c    change a partition's name
    d    delete a partition
    i    show detailed information on a partition
    l    list known partition types
    n    add a new partition
    o    create a new empty GUID partition table (GPT)
    p    print the partition table
    q    quit without saving changes
    r    recovery and transformation options (experts only)
    s    sort partitions
    t    change a partition's type code
    v    verify disk
    w    write table to disk and exit
    x    extra functionality (experts only)
    ?    print this menu

    Command (? for help): r

    Recovery/transformation command (? for help): p
    Disk /dev/sda: 976773168 sectors, 465.8 GiB
    Logical sector size: 512 bytes
    Disk identifier (GUID): 4DE51E1D-DC93-43EC-B670-44A0A9FEE114
    Partition table holds up to 128 entries
    First usable sector is 34, last usable sector is 976773134
    Partitions will be aligned on 8-sector boundaries
    Total free space is 5099 sectors (2.5 MiB)

    Number  Start (sector)    End (sector)  Size       Code  Name
       1              63         2120575   1.0 GiB     FD00  Linux RAID
       2         2120576        44066295   20.0 GiB    FD00  Linux RAID
       3        44066296       976768064   444.7 GiB   FD00  Linux RAID

    Recovery/transformation command (? for help): ?
    b    use backup GPT header (rebuilding main)
    c    load backup partition table from disk (rebuilding main)
    d    use main GPT header (rebuilding backup)
    e    load main partition table from disk (rebuilding backup)
    f    load MBR and build fresh GPT from it
    g    convert GPT into MBR and exit
    h    make hybrid MBR
    i    show detailed information on a partition
    l    load partition data from a backup file
    m    return to main menu
    o    print protective MBR data
    p    print the partition table
    q    quit without saving changes
    t    transform BSD disklabel partition
    v    verify disk
    w    write table to disk and exit
    x    extra functionality (experts only)
    ?    print this menu

    Recovery/transformation command (? for help): g

    MBR command (? for help): g
    a    toggle the active/boot flag
    c    recompute all CHS values
    l    set partition as logical
    o    omit partition
    p    print the MBR partition table
    q    quit without saving changes
    r    set partition as primary
    s    sort MBR partitions
    t    change partition type code
    w    write the MBR partition table to disk and exit

    MBR command (? for help): g
    a    toggle the active/boot flag
    c    recompute all CHS values
    l    set partition as logical
    o    omit partition
    p    print the MBR partition table
    q    quit without saving changes
    r    set partition as primary
    s    sort MBR partitions
    t    change partition type code
    w    write the MBR partition table to disk and exit

    MBR command (? for help): w

    Converted 3 partitions. Finalize and exit? (Y/N): y
    Warning: The kernel is still using the old partition table.
    The new table will be used at the next reboot.
    GPT data structures destroyed! You may now partition the disk using fdisk or
    other utilities.

    ===========
    I can even do
    root (hd1,0)
    setup (hd0) and it will work.........but not hd0,0 even though both are in the same RAID array on the same partition


  • bash scripting for loop set number of iterations


    A handy trick in bash that can be adapted to many useful tasks:

    for i in {1..99}; do

    echo $i

    done

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99


  • linux bash mass rename tool Centos/Debian/Ubuntu


    Say you have a bunch of files like this:

    file-01.jpg

    file-02.jpg

    ...............

    What if you want to mass rename them?

    the rename tool can work just like sed

    For Debian based distros:

    Note "file" is what we search for and "newname" is what we replace it with, so substitute according to your requirements.

    rename s/file/newname/ name-file-*.jpg

    For RHEL Centos:

    rename file newname file-*
     


  • Cannot get mono to work properly on Linux Mint


     

    mono/wine not working in Ubuntu/Linux Mint/Debian:



    The assembly mscorlib.dll was not found or could not be loaded.
    It should have been installed in the `/usr/lib/mono/2.0/mscorlib.dll' directory.

     

    solution:

    sudo apt-get install mono-complete
     

     

     Problems:

    mono does not work well for even simple things like a Winrar self extracting .exe file:

    File does not contain a valid CIL image.

    Try wine (you can never get it to work or install)



    sudo apt-get install wine1.6-amd64
    Reading package lists... Done
    Building dependency tree      
    Reading state information... Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help resolve the situation:

    The following packages have unmet dependencies:
     wine1.6-amd64 : Depends: libopencl-1.1-1
                     Depends: wine1.6:any (= 1:1.6.2-0ubuntu4)
    E: Unable to correct problems, you have held broken packages.
    user@box:~$

    sudo apt-add-repository ppa:ubuntu-wine/ppa
    sudo apt-get update

    sudo apt-get install wine1.8-amd64
    Reading package lists... Done
    Building dependency tree      
    Reading state information... Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help resolve the situation:

    The following packages have unmet dependencies:
     wine1.8-amd64 : Depends: libopencl-1.1-1
                     Depends: wine1.8:any (= 1:1.8.0-0ubuntu1)
    E: Unable to correct problems, you have held broken packages.


    nvidia-libopencl1-346-updates


  • CPanel SNI error


    Your server does not support SNI, so all of your SSL websites must use the same SSL certificate. An update to the certificate on an existing SSL website will affect all of your SSL websites, and new SSL websites must use the currently installed certificate.


  • Bing/Microsoft Ads flex.atdmt.com causing problems for ad tracking and site loading


    I was asked to troubleshoot why a site wasn't loaded or responding properly, it turned out they were using some old javascript tracker from Bing/Microsoft that is no longer valid or working.  You have to wait forever for it to time out but it really did disrupt the functionality of a very important site:

    flex.atdmt.com

    If you have the above code in javascript on your site remove or comment it out.


  • imagemagick converting jpg images to pdf file size too large


    If the file size is too large you need to resize them on the fly:

    convert -resize 25% *.jpg output.pdf

    The resize flag takes a % I have tried without and it seems to take it as pixels and becomes way too small.

    You can also play with the "-quality 25" flag to decrease file size even more.


  • convert imagemagick pdf to jpg is too small when converting solution


    It is a common issue and here is the solution (increase the density/dpi):

    convert -density 120 some.pdf output.jpg

    You will need to play with the density setting to get the perfect file size and resolution.

    If you want a smaller file you can always use the "-quality" switch and eg. -quality 25 would be 25%/100 quality


  • How To Record Your Screen with Linux




    Istanbul:


    At least in Linux Mint the latest 17.2 version Istanbul freezes when "In process of saving to Disk" even with the workaround of not having Sound recording enabled.  It looks like a great app but bugs like this seem to have plague it for over 8 years!

    Kazam:

    This little app works great, its only bug is that when you try to tell it to record a window or area it puts a gray cover over the whole screen so you have to guess where the window is and hope you clicked right.  It seems again like another bug but is a minor issue since it actually records and works quite well otherwise.

     


  • Virtualbox Error


    In plain English this happens after you upgrade VBOX and it rebuilds kernel modules based on a newer kernel than you are running (eg. you upgraded your kernel but haven't booted into it).

    It is too bad there is not a standard work around that would allow it to realize this and keep old kernel modules and use them if it detects your current kernel is older than the most recently build modules.

    ===============

    RTR3InitEx failed with rc=-1912 (rc=-1912)

    The VirtualBox kernel modules do not match this version of VirtualBox. The installation of VirtualBox was apparently not successful. Executing

    '/etc/init.d/vboxdrv setup'

    may correct this. Make sure that you do not mix the OSE version and the PUEL version of VirtualBox.


    Result Code:
    NS_ERROR_FAILURE (0x80004005)
    Component:
    Machine
    Interface:
    IMachine {480cf695-2d8d-4256-9c7c-cce4184fa048}
     


  • How to get/display full path to file in Linux/Unix


    It is just the readlink command with the -f switch and it will display the full path, very handy to save time when you want to copy and paste the location of a file or script etc..

     readlink -f updatehtaccess.sh
    /var/lib/updatehtaccess.sh

     


  • kernel:[14277.697049] EDAC MC0: UE row 4, channel-a= 0 channel-b= 1 labels "-": (Branch=0 DRAM-Bank=0 RDWR=Read RAS=7048 CAS=0 FATAL Err=0x4 (>Tmid Thermal event with intelligent throttling disabled))


    I am getting this error:

     kernel:[14277.697049] EDAC MC0: UE row 4, channel-a= 0 channel-b= 1 labels "-": (Branch=0 DRAM-Bank=0 RDWR=Read RAS=7048 CAS=0 FATAL Err=0x4 (>Tmid Thermal event with intelligent throttling disabled))
     

    But many people believe this is a bug/false message and the server is running stably.


  • CPanel Cannot Login HTTP error 401 You do not have permission to access this page.


    HTTP error 401

    You do not have permission to access this page.

    It was actually a bad hosts entry or where your IP was somehow added to /etc/hosts.deny this is what you will see from CPanel


  • Failed to open a session for the virtual machine XPCB. Implementation of the USB 2.0 controller not found! Because the USB 2.0 controller state is part of the saved VM state, the VM cannot be started. To fix this problem, either install the 'Oracle V


    I have guest extensions installed but still getting the error:


    Failed to open a session for the virtual machine XPCB.
    Implementation of the USB 2.0 controller not found!
    Because the USB 2.0 controller state is part of the saved VM state, the VM cannot be started. To fix this problem, either install the 'Oracle VM VirtualBox Extension Pack' or disable USB 2.0 support in the VM settings (VERR_NOT_FOUND).

    This seems to stem more from moving an old VM from an older VBOX to a newer version (because freshly installed VMs could use USB just fine).  The only way I got it working was to remove guest additions, reboot, reinstall guest additions and then re-enable USB and it worked just fine after.  If you have migrated your VM to a newer version of VBOX host machine, then don't believe anyone who says "just install guest additions" especially if they are already installed.


  • OpenVZ how to enable FUSE in the container


    vzctl set 2 --devnodes fuse:rw --save

    Where "2" is the ctid


  • How to manually mount Linux disk image partition without using losetup


    In this case we want to mount partition #2

    fdisk -lu Centos-6.6-x86_64.img
    You must set cylinders.
    You can do this from the extra functions menu.

    Disk Centos-6.6-x86_64.img: 0 MB, 0 bytes
    255 heads, 63 sectors/track, 0 cylinders, total 0 sectors
    Units = sectors of 1 * 512 = 512 bytes

                    Device Boot      Start         End      Blocks   Id  System
    Centos-6.6-x86_64.img1            2048     1026047      512000   82  Linux swap / Solaris
    Partition 1 does not end on cylinder boundary.
    Centos-6.6-x86_64.img2   *     1026048    10485759     4729856   83  Linux
    Partition 2 does not end on cylinder boundary.


    I want to mount partition 2 which starts at 1026048.

    Specify offset as: 1026048 * 512 = 525336576

    How to mount partition number 2

    mount -t ext4 -o loop,offset=525336576 Centos-6.6-x86_64.img /mnt


  • Debian 8 Jessie in Linux OpenVZ Container does not work on Centos host


    It sounds like this is corrected in later versions of the OpenVZ kernel but I am not sure, it may also be that a much newer kernel is needed and Centos may not have a recent enough kernel.

    *Debain 7.0 however does work fine as a temporary fix or work around.

    Debian 8 OpenVZ no IP and networking not working:

    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:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

    venet0    Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 
              BROADCAST POINTOPOINT NOARP  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)



    service networking restart
    Failed to get D-Bus connection: No such file or directory


  • bash script Get Model and Serial Number of All Hard Disks in Server on Linux


    for disk in `fdisk -l|grep "Disk /dev"|awk '{print $2}'|sed s/://g`; do
    echo "$disk" && smartctl -d ata -a "$disk" -T permissive|grep -iE 'Device Model:|Serial Number:'
    echo "---------------"
    done

    *Make sure you have smartctl from smartmon tools installed


      Sample output:

    /dev/sdc
    Device Model:     ST3750640NS
    Serial Number:    5QD3MZBP
    ---------------
    /dev/sdb
    Device Model:     ST3750640NS
    Serial Number:    5QD3RCTL
    ---------------
    /dev/md0
    Device Model:     [No Information Found]
    Serial Number:    [No Information Found]
    ---------------
    /dev/md2
    Device Model:     [No Information Found]
    Serial Number:    [No Information Found]
    ---------------
    /dev/md1
    Device Model:     [No Information Found]
    Serial Number:    [No Information Found]


  • How to scp transfer a file in Linux with spaces


    Say you have a path like this "/some/path/here with spaces/".  If you try to transfer it you will get a message along the lines of:

    scp -rp 192.168.0.12:"/some/path/here space/" .

    scp: /some/path/here: No such file or directory
    scp: space: No such file or directory

    You can escape each space but what a pain that is especially if you have multiple spaces in the path.

    The simplest way is to use the following instead:


    scp -rp 192.168.0.12:'"/some/path/here space/"' .

    or


    scp -rp 192.168.0.12:'"/some/path/here space/"' .

    As you can see we are basically padding it with a '" or "' on either side to make the shell interpret it as a literal instead of thinking the space is where the path name ends.


  • unfortunately lg keyboard has stopped - LG Phone Keyboard Issue


    This seems to effect many other LG phones , specifically their keyboard app and basically makes your phone unusable where you cannot use the keyboard because that message keeps popping up and the keyboard will not load.

    unfortunately lg keyboard has stopped solution:

    1. Go to your settings and manage apps and find the LG Keyboard app:

    2. Stop it from running, delete all data and clear all cache.

    After the above you will probably find that your keyboard responds better and more quickly too.


  • Location of cPanel apache access logs


    It is very handy to remember this and nice that the logs for all domains are in a central location:

    /usr/local/apache/domlogs


  • Windows showing wrong drive size after resizing the VPS/image or cloning howto fix


    1, Enter the command prompt

    Start -> cmd

    2. Start diskpart

    diskpart

    3. Find the drive that has the wrong size

    list volume

    4. Select the volume (in this example we use volume 2)

    select volume 2

    5. Extend the volume

    extend filesystem

    *Note the "extend filesystem" and not just extend, this is because our space is allocated and just not correctly reported to the NTFS system so it is necessary or you will ge the failure below"

    result:

    Diskpart successfully extended the volume

    failure:

    Virtual Disk Service error:

    The size of the extent is less than the minimum

    *I don't know why the above error happens,normally it is if the partition cannot extend that far because the next partition or volume is next but this is not the case on this system.

     


  • How to manually save bash history


    This is useful in the case you are not properly logged in via an OpenVZ session or even a normal SSH session that you fear may go down (if the connection is broken the history is not saved).

    Save your bash_history like this:

    history -w ~/.bash_history

    You can always change the above to another file eg /tmp/somefile.txt or ~/someotherfile.txt


  • Linux how to combine images into a single one using convert from ImageMagick


    convert -append file1.jpg file2.jpg output.jpg

    The above is all there is to it.

    file1.jpg and file2.jpg are the ones to combine (the order is used) and output.jpg is the combined image.


  • Mysql how to backup/copy row from one table to another


    INSERT INTO articles_backup
    SELECT * FROM articles WHERE articleID="118"

    It is so simple we always recommend people do this when updating their database so you always have a backup.

    The above inserts the copy into the table "articles_backup" which has an identical structure.

    It selects the entry from "articles" where the articleID is "118" but of course you can adapter yours to whatever the situation is.


  • mdadm real example of recovery and rebuilding of the array on Centos 6


    In this example we have 2 drives in a RAID array and /dev/sdb is the one that failed.  /dev/sda1 is also the /boot partition which we tell grub to install on /dev/sdb eg install root (hd0,0) /dev/sda1 on the new drive /dev/sdb (hd1)
     

    First copy the partition table from /dev/sda to /dev/sdb

    dd if=/dev/sda of=/dev/sdb bs=512 count=1

    Run partprobe to detect the new partition table
    partprobe

    Add the partitions of the replacement drive /dev/sdb back to the array


    mdadm --manage /dev/md0 -a /dev/sdb1
    mdadm --manage /dev/md1 -a /dev/sdb2
    mdadm --manage /dev/md2 -a /dev/sdb3

     

    Install grub on the new drive
    grub
    root (hd0,0)
    setup (hd1)


  • Microsoft Access .mdb files how to view them on Linux Ubuntu/Debian


    The package "mdbtools-gmdb" works very well but I was not able to get the forms working that were part of the .mdb but you can at least view all of the rows and Export to CSV


  • Centos 6 how to guide convert LVM non-RAID into mdadm 1/10 RAID array live without reinstalling


    Here is the scenario you or a client have a remote machine that was installed as a standard/default minimal Centos 6.x machine on a single disk with LVM for whatever reason.  Often many people do not know how to install it to a RAID array so it is common to have this problem and why reinstall if you don't need to?  In some cases on a remote system you can't easily reinstall without physical or KVM access.

    So in this case you add a second physical or disk or already have one and want to make it a RAID array but don't want much downtime, dataloss etc...

    In this tutorial we will show you how to turn this default install into a mdadm ARRAY with RAID10 on the / and a RAID 1 /boot and RAID 1 SWAP all without any downtime or other intervention (assuming all goes well and all steps are followed) :)

    Install rsync:

    yum -y install rsync

    #disable selinux! otherwise you won't be able to login (it will logout #instantly and show this in the logs

    sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

    centos cannot login session closed immediately


    login: pam_unix(login:session): session opened for user root by LOGIN(uid=0)
    login: ROOT LOGIN ON tty1
    pam_unix(login:session): session closed for user root

    Step 1.)
    Create your partitions on the second disc (I assume your second disc is /dev/sdb).
    md0=/dev/sdb1 is a 500M /boot partition
    md1=/dev/sdb2 is a 1024M swap partition
    md2=/dev/sdb3 is the / partition

    fdisk /dev/sdb

    WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
             switch off the mode (command 'c') and change display units to
             sectors (command 'u').

    Command (m for help): n
    Command action
       e   extended
       p   primary partition (1-4)
    p
    Partition number (1-4): 1
    First cylinder (1-652, default 1):
    Using default value 1
    Last cylinder, +cylinders or +size{K,M,G} (1-652, default 652): +500M

    Command (m for help): n
    Command action
       e   extended
       p   primary partition (1-4)
    p
    Partition number (1-4): 2
    First cylinder (66-652, default 66):
    Using default value 66
    Last cylinder, +cylinders or +size{K,M,G} (66-652, default 652): +1024M

    Command (m for help): n
    Command action
       e   extended
       p   primary partition (1-4)
    p
    Partition number (1-4):
    Value out of range.
    Partition number (1-4): 3
    First cylinder (198-652, default 198):
    Using default value 198
    Last cylinder, +cylinders or +size{K,M,G} (198-652, default 652):
    Using default value 652

    Command (m for help): t
    Partition number (1-4):
    Value out of range.
    Partition number (1-4): 1
    Hex code (type L to list codes): fd
    Changed system type of partition 1 to fd (Linux raid autodetect)

    Command (m for help): t
    Partition number (1-4): 2
    Hex code (type L to list codes): fd
    Changed system type of partition 2 to fd (Linux raid autodetect)

    Command (m for help): t
    Partition number (1-4): 3
    Hex code (type L to list codes): fd
    Changed system type of partition 3 to fd (Linux raid autodetect)

    Command (m for help): p

    Disk /dev/sdb: 5368 MB, 5368709120 bytes
    255 heads, 63 sectors/track, 652 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x0008b7d9

       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1               1          65      522081   fd  Linux raid autodetect
    /dev/sdb2              66         197     1060290   fd  Linux raid autodetect
    /dev/sdb3             198         652     3654787+  fd  Linux raid autodetect

    Command (m for help): w
    The partition table has been altered!

    Calling ioctl() to re-read partition table.
    Syncing disks.

    ====================

    Step 2.) Create RAID arrays
    md0=/dev/sdb1 is a 500M /boot partition
    md1=/dev/sdb2 is a 1024M swap partition
    md2=/dev/sdb3 is the / partition

    mdadm --create /dev/md0 --metadata=0.90 --level=1 --raid-devices=2 /dev/sdb1 missing
    mdadm --create /dev/md1 --level=10 --raid-devices=2 --layout=f2 /dev/sdb2 missing
    mdadm --create /dev/md2 --level=10 --raid-devices=2 --layout=f2 /dev/sdb3 missing


    [root@localhost ~]# mdadm --create /dev/md0 --metadata=0.90 --level=1 --raid-devices=2 /dev/sdb1 missing
    mdadm: array /dev/md0 started.
    [root@localhost ~]# mdadm --create /dev/md1 --level=10 --raid-devices=2 --layout=f2 /dev/sdb2 missing
    mdadm: Defaulting to version 1.2 metadata
    mdadm: array /dev/md1 started.
    [root@localhost ~]# mdadm --create /dev/md2 --level=10 --raid-devices=2 --layout=f2 /dev/sdb3 missing
    mdadm: Defaulting to version 1.2 metadata
    mdadm: array /dev/md2 started.

    [root@localhost ~]# cat /proc/mdstat
    Personalities : [raid1] [raid10]
    md2 : active raid10 sdb3[0]
          3652608 blocks super 1.2 512K chunks 2 far-copies [2/1] [U_]
         
    md1 : active raid10 sdb2[0]
          1058816 blocks super 1.2 512K chunks 2 far-copies [2/1] [U_]
         
    md0 : active raid1 sdb1[0]
          521984 blocks [2/1] [U_]

    Step 3.) Make filesystems on RAID arrays
    md0=/dev/sdb1 is a 500M /boot partition
    md1=/dev/sdb2 is a 1024M swap partition
    md2=/dev/sdb3 is the / partition
         

    mkfs.ext4 /dev/md0
    mke2fs 1.41.12 (17-May-2010)
    Filesystem label=
    OS type: Linux
    Block size=1024 (log=0)
    Fragment size=1024 (log=0)
    Stride=0 blocks, Stripe width=0 blocks
    130560 inodes, 521984 blocks
    26099 blocks (5.00%) reserved for the super user
    First data block=1
    Maximum filesystem blocks=67633152
    64 block groups
    8192 blocks per group, 8192 fragments per group
    2040 inodes per group
    Superblock backups stored on blocks:
        8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409

    Writing inode tables: done                           
    Creating journal (8192 blocks): done
    Writing superblocks and filesystem accounting information: done

    This filesystem will be automatically checked every 31 mounts or
    180 days, whichever comes first.  Use tune2fs -c or -i to override.
    [root@localhost ~]# mkswap /dev/md1
    mkswap: /dev/md1: warning: don't erase bootbits sectors
            on whole disk. Use -f to force.
    Setting up swapspace version 1, size = 1058812 KiB
    no label, UUID=821efb1f-95cd-4aab-803b-e26d9fa6a920
    [root@localhost ~]# mkfs.ext4
    mkfs.ext4     mkfs.ext4dev 
    [root@localhost ~]# mkfs.ext4 /dev/md2
    mke2fs 1.41.12 (17-May-2010)
    Filesystem label=
    OS type: Linux
    Block size=4096 (log=2)
    Fragment size=4096 (log=2)
    Stride=128 blocks, Stripe width=256 blocks
    228480 inodes, 913152 blocks
    45657 blocks (5.00%) reserved for the super user
    First data block=0
    Maximum filesystem blocks=935329792
    28 block groups
    32768 blocks per group, 32768 fragments per group
    8160 inodes per group
    Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736

    Writing inode tables: done                           
    Creating journal (16384 blocks): done
    Writing superblocks and filesystem accounting information: done

    This filesystem will be automatically checked every 37 mounts or
    180 days, whichever comes first.  Use tune2fs -c or -i to override.



    Step 4.) Create chroot environment/mount RAID arrays

    md0=/dev/sdb1 is a 500M /boot partition
    md1=/dev/sdb2 is a 1024M swap partition
    md2=/dev/sdb3 is the / partition


    mount /dev/md2 /mnt
    mkdir /mnt/boot
    mount /dev/md0 /mnt/boot/

    #time to rsync all your files
    rsync -Phaz / --exclude=/mnt --exclude=/sys/* --exclude=/proc/* /mnt

    sent 243.20M bytes  received 377.68K bytes  1.87M bytes/sec
    total size is 635.16M  speedup is 2.61


    #setup chroot environment

    for mount in dev sys proc; do
    mount -o bind /$mount /mnt/$mount
    done

    #chroot
    chroot /mnt

    #setup mdadm.conf
    for md in 0 1 2; do
    mdadm --detail --brief /dev/md$md >> /etc/mdadm.conf
    done

    #create new initrd with correct mdadm info
    dracut -f

    #get UUID of / for the next steps
    blkid /dev/md2
    /dev/md2: UUID="0e68a84d-cb61-4856-b23b-c2e2aa8294fb" TYPE="ext4"

    #backup grub menu.lst
    cp /boot/grub/menu.lst /boot/grub/menu.lst-before-raid

    #disable selinux just in case
    sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

    #change this:
    default=0
    timeout=5
    splashimage=(hd0,0)/grub/splash.xpm.gz
    hiddenmenu
    title CentOS (2.6.32-431.el6.x86_64)
            root (hd0,0)
            kernel /vmlinuz-2.6.32-431.el6.x86_64 ro root=/dev/mapper/VolGroup-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=VolGroup/lv_swap SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=VolGroup/lv_root  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
            initrd /initramfs-2.6.32-431.el6.x86_64.img

    #

    #to:
    default=0
    timeout=5
    #splashimage=(hd0,0)/grub/splash.xpm.gz
    hiddenmenu
    title CentOS (2.6.32-431.el6.x86_64)
            root (hd1,0)
            kernel /vmlinuz-2.6.32-431.el6.x86_64 ro root=UUID=0e68a84d-cb61-4856-b23b-c2e2aa8294fb KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
            initrd /initramfs-2.6.32-431.el6.x86_64.img

    #

    #install grub on second drive


    [root@localhost /]# grub
    Probing devices to guess BIOS drives. This may take a long time.


        GNU GRUB  version 0.97  (640K lower / 3072K upper memory)

     [ Minimal BASH-like line editing is supported.  For the first word, TAB
       lists possible command completions.  Anywhere else TAB lists the possible
       completions of a device/filename.]
    grub> root (hd1,0)
    root (hd1,0)
     Filesystem type is ext2fs, partition type 0xfd
    grub> setup (hd1)
    setup (hd1)
     Checking if "/boot/grub/stage1" exists... no
     Checking if "/grub/stage1" exists... yes
     Checking if "/grub/stage2" exists... yes
     Checking if "/grub/e2fs_stage1_5" exists... yes
     Running "embed /grub/e2fs_stage1_5 (hd1)"...  27 sectors are embedded.
    succeeded
     Running "install /grub/stage1 (hd1) (hd1)1+27 p (hd1,0)/grub/stage2 /grub/grub.conf"... succeeded
    Done.
    grub>


    #edit fstab
    #change
    /dev/mapper/VolGroup-lv_root /                       ext4    defaults        1 1
    UUID=ed0608b8-271a-47e9-b0ee-88060a006b0d /boot                   ext4    defaults        1 2
    /dev/mapper/VolGroup-lv_swap swap                    swap    defaults        0 0
    tmpfs                   /dev/shm                tmpfs   defaults        0 0
    devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
    sysfs                   /sys                    sysfs   defaults        0 0
    proc                    /proc                   proc    defaults        0 0
                                                                                              
    #

    #get /boot ID
    blkid /dev/md0
    /dev/md0: UUID="4bcf5b66-9d0c-4f5b-a9d8-2d524fbf1ccf" TYPE="ext4"

    # swap ID
    blkid /dev/md1
    /dev/md1: UUID="821efb1f-95cd-4aab-803b-e26d9fa6a920" TYPE="swap"

    #backup /etc/fstab
    cp /etc/fstab /etc/fstab-beforeraid

    #to
    UUID=0e68a84d-cb61-4856-b23b-c2e2aa8294fb /                       ext4    defaults        1 1
    UUID=4bcf5b66-9d0c-4f5b-a9d8-2d524fbf1ccf /boot                   ext4    defaults        1 2
    UUID=821efb1f-95cd-4aab-803b-e26d9fa6a920 swap                    swap    defaults        0 0
    tmpfs                   /dev/shm                tmpfs   defaults        0 0
    devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
    sysfs                   /sys                    sysfs   defaults        0 0
    proc                    /proc                   proc    defaults        0 0
                                                                                             
    #




    #final and crucial grub setup, we need to tell grub that the root is on hd1,0 (or sdb1) and to install it to the first hard drive (which is what will boot and will enter the old environment if we don't do this):
        GNU GRUB  version 0.97  (640K lower / 3072K upper memory)

     [ Minimal BASH-like line editing is supported.  For the first word, TAB
       lists possible command completions.  Anywhere else TAB lists the possible
       completions of a device/filename.]
    grub> root (hd1,0)
    root (hd1,0)
     Filesystem type is ext2fs, partition type 0xfd
    grub> setup (hd0)
    setup (hd0)
     Checking if "/boot/grub/stage1" exists... no
     Checking if "/grub/stage1" exists... yes
     Checking if "/grub/stage2" exists... yes
     Checking if "/grub/e2fs_stage1_5" exists... yes
     Running "embed /grub/e2fs_stage1_5 (hd0)"...  27 sectors are embedded.
    succeeded
     Running "install /grub/stage1 d (hd0) (hd0)1+27 p (hd1,0)/grub/stage2 /grub/grub.conf"... succeeded
    Done.
     


  • Centos cannot login by console or ssh session closed immediately


    In my case I could login with the initial install but I rsync'd everything over while preserving ownership and permissions to another RAID partition and booted from that.was fine before. The problem is that you are kicked out the second you login and the problem was SELINUX for some reason (perhaps it noticed something strange when it was moved to the new partition)


    login: pam_unix(login:session): session opened for user root by LOGIN(uid=0)
    login: ROOT LOGIN ON tty1
    pam_unix(login:session): session closed for user root

    #in my case the issue was selinux so disable it

    How to disable SELinux

     

    Here were the error/denied messages in /var/log/audit/audit.log

     

    type=AVC msg=audit(1445614919.831:12): avc:  denied  { entrypoint } for  pid=1072 comm="login" path="/bin/bash" dev=md2 ino=632 scontext=unconfined_u:system_r:abrt_helper_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:file_t:s0 tclass=file
    type=AVC msg=audit(1445614924.074:22): avc:  denied  { entrypoint } for  pid=1077 comm="login" path="/bin/bash" dev=md2 ino=632 scontext=unconfined_u:system_r:abrt_helper_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:file_t:s0 tclass=file
    type=AVC msg=audit(1445614943.809:38): avc:  denied  { entrypoint } for  pid=1088 comm="login" path="/bin/bash" dev=md2 ino=632 scontext=unconfined_u:system_r:abrt_helper_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:file_t:s0 tclass=file
    type=AVC msg=audit(1445614969.449:48): avc:  denied  { entrypoint } for  pid=1093 comm="login" path="/bin/bash" dev=md2 ino=632 scontext=unconfined_u:system_r:abrt_helper_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:file_t:s0 tclass=file
     


  • openvz yum problem Centos 6.5 cannot find file on mirror:



    #solution

    Edit /etc/yum.repos.d/openvz.repo
    For the first two entries comment out #mirrorlist and uncomment #baseurl and then it worked

    openvz yum problem Centos 6.5 cannot find file on mirror:

    yum update
    Loaded plugins: fastestmirror
    Determining fastest mirrors
     * openvz-kernel-rhel6: mirrors.ustc.edu.cn
     * openvz-utils: mirrors.ustc.edu.cn
    base                                                     | 3.7 kB     00:00    
    base/primary_db                                          | 4.6 MB     00:13    
    centosplus                                               | 3.4 kB     00:00    
    centosplus/primary_db                                    | 1.1 MB     00:03    
    contrib                                                  | 2.9 kB     00:00    
    contrib/primary_db                                       | 1.2 kB     00:00    
    extras                                                   | 3.4 kB     00:00    
    extras/primary_db                                        |  32 kB     00:00    
    openvz-kernel-rhel6                                      | 2.8 kB     00:00    
    http://mirrors.ustc.edu.cn/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://ftp.cuhk.edu.hk/pub/Linux/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://ftp.riken.jp/Linux/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://ftp.iij.ad.jp/pub/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://www.ftp.ne.jp/Linux/MISC/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.secureax.com/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] Downloaded more than max size for http://www.secureax.com/: 10950 > 9305
    Trying other mirror.
    http://ftp.yz.yamagata-u.ac.jp/pub/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.wanxp.id/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirrors.digipower.vn/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.supremebytes.com/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror2.scalabledns.com/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://kartolo.sby.datautama.net.id/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://download.openvz.org/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.lon.cenexo.com/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://openvz.mirrors.ovh.net/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.ubiquityservers.com/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.hdcore.eu/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirrors.vinahost.vn/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.fdcservers.net/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirrors.sphere.ly/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 12] Timeout on http://mirrors.sphere.ly/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: (28, 'connect() timed out!')
    Trying other mirror.
    http://mirror.h1host.ru/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.tocici.com/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://openvz.mirrors.skynet.be/pub/openvz.org/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.serverbeheren.nl/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 7 - "Failed to connect to 2001:67c:16b4:b010::1: Network is unreachable"
    Trying other mirror.
    http://mirror.trouble-free.net/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://openvz.webdesk.ru/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://ftp.yzu.edu.tw/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://ftp.heanet.ie/mirrors/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://ftp.linux.cz/pub/linux/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.jmu.edu/pub/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.vpsfree.cz/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.cogentco.com/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.bytemark.co.uk/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://ftp.fi.muni.cz/pub/linux/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirrors.nic.cz/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirrors.bangmodhosting.com/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.duomenucentras.lt/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://openvz.slaskdatacenter.com/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://openvz.mirror.serveriai.lt/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirrors.bestthaihost.com/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirrors.thzhost.com/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 403 Forbidden"
    Trying other mirror.
    http://ftp.ticklers.org/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.as24220.net/pub/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://ftp.fsn.hu/pub/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.zetup.net/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.nexcess.net/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.logol.ru/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.lagoon.nc/pub/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://ftp.nluug.nl/pub/os/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirrors.gigenet.com/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://openvz.hitme.net.pl/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://ftp.wicks.co.nz/pub/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://ftp-stud.hs-esslingen.de/pub/Mirrors/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.23media.de/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.ukhost4u.com/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://openvz.copahost.com/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://openvz.rinet.ru/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.checkdomain.de/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirrors.sonic.net/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirrors.neterra.net/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://openvz.just-hosting.ru/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.maeh.org/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.softaculous.com/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.optusnet.com.au/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://artfiles.org/openvz.org/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://linux.nsu.ru/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.vutbr.cz/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.mirohost.net/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://openvz.tsukuba.wide.ad.jp/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.yandex.ru/mirrors/download.openvz.org/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.netinch.com/pub/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://ftp.lip6.fr/pub/linux/distributions/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.ihc.ru/download.openvz.org/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirrors.syringanetworks.net/OpenVZ/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirrors.netix.net/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.steadfast.net/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://openvz.spd.co.il/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://ftp.colocall.net/pub/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirrors.xservers.ro/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://ftp.hawo.net/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://ftp.hawo.stw.uni-erlangen.de/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://ftp.acc.umu.se/mirror/openvz.org/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://openvz.mirror.garr.it/mirrors/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://openvz.proserve.nl/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://ftp.fau.de/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.satellite-service.ru/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.datacenter.by/pub/download.openvz.org/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirror.as43289.net/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://openvz.uberglobalmirror.com/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://ftp.cc.uoc.gr/mirrors/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://mirrors.ircam.fr/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://openvz.mindstudios.com/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 12] Timeout on http://openvz.mindstudios.com/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: (28, 'connect() timed out!')
    Trying other mirror.
    http://linorg.usp.br/openvz/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    http://openvz.mirror.triple-it.nl/kernel/branches/rhel6-2.6.32/current/repodata/8670e12519a6cccfe7ede0226dd94ce1956005df-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
     


  • mount -o bind permanent in /etc/fstab howto


    mount -o bind /somedir /anotherdir

    In /etc/fstab

    /somedir /anotherdir none bind 0 0


  • Virtualbox errors on Ubuntu/Debian/Mint


     

    The solution was to reinstall the vbox dkms package and do a manual modprobe of the modules it makes.

    I never sorted out the unable to start due to the USB issue, I did have the guest additions installed but the only way to boot was to change the pointing device from USB to PS2 and then to disable the USB controller (if your pointing device is set as USB, disabling USB will not work because it will re-enable by default when it sees your pointing device is USB, this is why you must set it to PS2 before disabling USB).

    ===========

    Failed to open a session for the virtual machine XPCB.
    The virtual machine 'XPCB' has terminated unexpectedly during startup with exit code 1.


    Kernel driver not installed (rc=-1908)

    The VirtualBox Linux kernel driver (vboxdrv) is either not loaded or there is a permission problem with /dev/vboxdrv. Please reinstall the kernel module by executing

    '/etc/init.d/vboxdrv setup'

    as root. If it is available in your distribution, you should install the DKMS package first. This package keeps track of Linux kernel changes and recompiles the vboxdrv kernel module if necessary.

    =========

    sudo apt-get install virtualbox-dkms
    [sudo] password for one:
    Reading package lists... Done
    Building dependency tree      
    Reading state information... Done
    The following NEW packages will be installed:
      virtualbox-dkms
    0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
    Need to get 538 kB of archives.
    After this operation, 4,321 kB of additional disk space will be used.
    Get:1 http://archive.ubuntu.com/ubuntu/ trusty-updates/multiverse virtualbox-dkms all 4.3.10-dfsg-1ubuntu5 [538 kB]
    Fetched 538 kB in 1s (447 kB/s)         
    Selecting previously unselected package virtualbox-dkms.
    (Reading database ... 188970 files and directories currently installed.)
    Preparing to unpack .../virtualbox-dkms_4.3.10-dfsg-1ubuntu5_all.deb ...
    Unpacking virtualbox-dkms (4.3.10-dfsg-1ubuntu5) ...
    Setting up virtualbox-dkms (4.3.10-dfsg-1ubuntu5) ...
    Loading new virtualbox-4.3.10 DKMS files...
    First Installation: checking all kernels...
    Building only for 3.16.0-38-generic
    Building initial module for 3.16.0-38-generic
    Done.

    vboxdrv:
    Running module version sanity check.
     - Original module
       - No original module exists within this kernel
     - Installation
       - Installing to /lib/modules/3.16.0-38-generic/updates/

    vboxnetadp.ko:
    Running module version sanity check.
     - Original module
       - No original module exists within this kernel
     - Installation
       - Installing to /lib/modules/3.16.0-38-generic/updates/

    vboxnetflt.ko:
    Running module version sanity check.
     - Original module
       - No original module exists within this kernel
     - Installation
       - Installing to /lib/modules/3.16.0-38-generic/updates/

    vboxpci.ko:
    Running module version sanity check.
     - Original module
       - No original module exists within this kernel
     - Installation
       - Installing to /lib/modules/3.16.0-38-generic/updates/

    depmod.......

    DKMS: install completed.

    =========

    sudo modprobe vboxdrv
    one@Opteron2419:~$ sudo modprobe vboxnetadp
    one@Opteron2419:~$ sudo modprobe vboxpci
    one@Opteron2419:~$ sudo modprobe vboxnetflt
    one@Opteron2419:~$ sudo modprobe vboxnetsf
    modprobe: FATAL: Module vboxnetsf not found.
    one@Opteron2419:~$ sudo modprobe vboxsf
    modprobe: ERROR: could not insert 'vboxsf': No such device
    one@Opteron2419:~$ sudo modprobe vboxsf
    modprobe: ERROR: could not insert 'vboxsf': No such device
    one@Opteron2419:~$ sudo modprobe vboxguest
    modprobe: ERROR: could not insert 'vboxguest': No such device
    one@Opteron2419:~$ sudo modprobe vboxvideo


    ===============

    Failed to open a session for the virtual machine XPCB.
    Implementation of the USB 2.0 controller not found!
    Because the USB 2.0 controller state is part of the saved VM state, the VM cannot be started. To fix this problem, either install the 'Oracle VM VirtualBox Extension Pack' or disable USB 2.0 support in the VM settings (VERR_NOT_FOUND).


  • How To Install Linux Mint 17.2 on mdadm RAID with a separate boot partition


    I was surprised to see that Linux Mint at the latest 17.2 version still has NO mdadm installer option, and worse the installer will not be able to create a proper booting environment even when you do install it.

    How to setup mdadm in Linux mint LiveCD

    sudo su

    apt-get install mdadm

    # partition as you need and then create your mdadm devices

    # create your SWAP md0

    mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1

    # create your boot md1 (remember to use the --metadata=0.90 or it will not be bootable and it must be RAID 1 as RAID 10 cannot be booted

    mdadm --create /dev/md1 --level=1 --metadata=0.90 --raid-devices=2 /dev/sda2 /dev/sdb2

    # create root mdadm md2

    mdadm -create /dev/md2 --level=10 --layout=f2 --raid-devices=2 /dev/sdb3 /dev/sdb3

    Run the installer

    Double click each mdadm array to create the appropriate partition (eg. md0 is swap, md1 is /boot and md2 is /)

    Choose to install the boot loader on sda (it doesn't really matter because it will not succeed or work even if Linux Mint says it did).

     

    The Most Crucial Part, to chroot and install the necessary utilities

    I admit I spent a few days sorting this out because I have never had a problem in the past normally installing grub 0.97 by using the old manual way.  Linux mint uses the newer grub2 and is more complex/picky but also does it all for you as long as you do it as below.

    mount /dev/md2p1 /mnt

    # do not forget to mount your /boot or grub-install will NEVER work

    mount /dev/md1p1 /mnt/boot

    mount=/mnt

    for bind in dev sys proc; do

    mount -o bind /$bind /$mount/$bind

    chroot /mnt

    apt-get -y install mdadm grub2

    grub-install /dev/sda

    grub-install /dev/sdb

    #change the grub-install portion to match the physical devices that make up your boot partition and make sure you just point to the raw disk and not a specific partition

    #the above last command should do it and get you booting

     

     


  • Linux sudo config sudoers to run command without a password howto


    Before reading on remember to put the line at the bottom of /etc/sudoers as from experience what happen is that other rules cancel out what you have added.

    If your sudoers setup is correct it will work immediately upon saving without requiring a reboot.

    Edit /etc/sudoers

    yourusername    ALL = NOPASSWD: /path/to/command

    *Once again remember the above should be on the bottom of the sudoers file or it may not work.


  • ONVIF Linux Security Camera Setup


    First of all this seems to apply to many ONVIF devices
    Hard coded IP: 192.168.1.10 (yes not kidding no DHCP!)
    00:12:12:9C:C2:00

    To view RTSP stream use VLC, or openRTSP or other RTSP capable software:


    rtsp://192.168.1.10/user=admin_password=tlJwpbo6_channel=1_stream=0.sdp

    user: admin
    password: blank
    http://ip/Login.htm
    Uses Quicktime and is a poor quality picture and slow
    Cannot change password

    There is also port 8899 open that an Android app found
    Video In: 1
    Alarm In: 2
    Alarm Output: 1
    Audio In: 1
    Build Date:2014/10/23 16:54:2
    System: V4.02.R12.00006510.10010.1303
    Serial ID: e2ae8546ba493897


    Starting Nmap 5.21 ( http://nmap.org ) at 2015-10-13 17:05 PDT
    Nmap scan report for 192.168.1.10
    Host is up (0.0050s latency).
    Not shown: 996 closed ports
    PORT     STATE SERVICE
    23/tcp   open  telnet
    80/tcp   open  http
    554/tcp  open  rtsp
    8899/tcp open  unknown



     


  • clamav freshclam out of date won't update solution


     freshclam
    ERROR: Can't open /var/log/clamav/freshclam.log in append mode (check permissions!).
    ERROR: Problem with internal logger (UpdateLogFile = /var/log/clamav/freshclam.log).


    Tue Oct 13 13:49:35 2015 -> WARNING: Incremental update failed, trying to download daily.cvd
    Tue Oct 13 13:49:35 2015 -> WARNING: Can't download daily.cvd from db.local.clamav.net
    Tue Oct 13 13:49:35 2015 -> Trying again in 5 secs...


    cd /var/lib/clamav/

    sudo rm daily.cld

    After deleting the above it will actually succeed and update


  • Installing zoneminder on Ubuntu/Debian Linux Howto




    sudo apt-get install zoneminder
    [sudo] password for one:
    Reading package lists... Done
    Building dependency tree      
    Reading state information... Done
    The following packages were automatically installed and are no longer required:
      libuser-perl python-evince kdebase-apps kwrite unixodbc
      libgnomeprint2.2-data python-soappy vgabios python-metacity hddtemp
      python-mediaprofiles libwww-search-perl libfile-slurp-perl python-bugbuddy
      python-totem-plparser python-fpconst libgnomeprint2.2-0 libgnomeprintui2.2-0
      libgnomeprintui2.2-common acroread-common python-gtop libgnomecups1.0-1
    Use 'apt-get autoremove' to remove them.
    The following extra packages will be installed:
      javascript-common libarchive-zip-perl libconvert-binhex-perl
      libdevice-serialport-perl libemail-date-format-perl libio-stringy-perl
      libjs-mootools libmime-lite-perl libmime-tools-perl libmime-types-perl
      libphp-serialization-perl php5-mysql wwwconfig-common
    Suggested packages:
      postgresql-client apache apache-ssl
    The following NEW packages will be installed:
      javascript-common libarchive-zip-perl libconvert-binhex-perl
      libdevice-serialport-perl libemail-date-format-perl libio-stringy-perl
      libjs-mootools libmime-lite-perl libmime-tools-perl libmime-types-perl
      libphp-serialization-perl php5-mysql wwwconfig-common zoneminder
    0 upgraded, 14 newly installed, 0 to remove and 3 not upgraded.
    Need to get 2,474kB of archives.
    After this operation, 10.1MB of additional disk space will be used.
    Do you want to continue [Y/n]? y
    Get:1 http://old-releases.ubuntu.com/ubuntu/ maverick/universe wwwconfig-common all 0.2.1 [22.8kB]
    Get:2 http://old-releases.ubuntu.com/ubuntu/ maverick/universe javascript-common all 7 [3,854B]
    Get:3 http://old-releases.ubuntu.com/ubuntu/ maverick/main libarchive-zip-perl all 1.30-2 [95.9kB]
    Get:4 http://old-releases.ubuntu.com/ubuntu/ maverick/main libconvert-binhex-perl all 1.119+pristine-3 [30.9kB]
    Get:5 http://old-releases.ubuntu.com/ubuntu/ maverick/universe libemail-date-format-perl all 1.002-1 [6,354B]
    Get:6 http://old-releases.ubuntu.com/ubuntu/ maverick/main libio-stringy-perl all 2.110-4 [94.7kB]
    Get:7 http://old-releases.ubuntu.com/ubuntu/ maverick/universe libjs-mootools all 1.2.4.0~debian1-1 [248kB]
    Get:8 http://old-releases.ubuntu.com/ubuntu/ maverick/universe libmime-lite-perl all 3.027-1 [76.6kB]
    Get:9 http://old-releases.ubuntu.com/ubuntu/ maverick/main libmime-tools-perl all 5.427-2 [238kB]
    Get:10 http://old-releases.ubuntu.com/ubuntu/ maverick/main libmime-types-perl all 1.30-1 [33.9kB]
    Get:11 http://old-releases.ubuntu.com/ubuntu/ maverick/universe libphp-serialization-perl all 0.34-1 [11.1kB]
    Get:12 http://old-releases.ubuntu.com/ubuntu/ maverick-updates/main php5-mysql i386 5.3.3-1ubuntu9.10 [65.7kB]
    Get:13 http://old-releases.ubuntu.com/ubuntu/ maverick/universe libdevice-serialport-perl i386 1.04-2 [79.4kB]
    Get:14 http://old-releases.ubuntu.com/ubuntu/ maverick/universe zoneminder i386 1.24.2-7ubuntu1 [1,466kB]
    Fetched 2,474kB in 3s (664kB/s)     
    Selecting previously deselected package wwwconfig-common.
    (Reading database ... 339187 files and directories currently installed.)
    Unpacking wwwconfig-common (from .../wwwconfig-common_0.2.1_all.deb) ...
    Selecting previously deselected package javascript-common.
    Unpacking javascript-common (from .../javascript-common_7_all.deb) ...
    Selecting previously deselected package libarchive-zip-perl.
    Unpacking libarchive-zip-perl (from .../libarchive-zip-perl_1.30-2_all.deb) ...
    Selecting previously deselected package libconvert-binhex-perl.
    Unpacking libconvert-binhex-perl (from .../libconvert-binhex-perl_1.119+pristine-3_all.deb) ...
    Selecting previously deselected package libemail-date-format-perl.
    Unpacking libemail-date-format-perl (from .../libemail-date-format-perl_1.002-1_all.deb) ...
    Selecting previously deselected package libio-stringy-perl.
    Unpacking libio-stringy-perl (from .../libio-stringy-perl_2.110-4_all.deb) ...
    Selecting previously deselected package libjs-mootools.
    Unpacking libjs-mootools (from .../libjs-mootools_1.2.4.0~debian1-1_all.deb) ...
    Selecting previously deselected package libmime-lite-perl.
    Unpacking libmime-lite-perl (from .../libmime-lite-perl_3.027-1_all.deb) ...
    Selecting previously deselected package libmime-tools-perl.
    Unpacking libmime-tools-perl (from .../libmime-tools-perl_5.427-2_all.deb) ...
    Selecting previously deselected package libmime-types-perl.
    Unpacking libmime-types-perl (from .../libmime-types-perl_1.30-1_all.deb) ...
    Selecting previously deselected package libphp-serialization-perl.
    Unpacking libphp-serialization-perl (from .../libphp-serialization-perl_0.34-1_all.deb) ...
    Selecting previously deselected package php5-mysql.
    Unpacking php5-mysql (from .../php5-mysql_5.3.3-1ubuntu9.10_i386.deb) ...
    Selecting previously deselected package libdevice-serialport-perl.
    Unpacking libdevice-serialport-perl (from .../libdevice-serialport-perl_1.04-2_i386.deb) ...
    Selecting previously deselected package zoneminder.
    Unpacking zoneminder (from .../zoneminder_1.24.2-7ubuntu1_i386.deb) ...
    Processing triggers for man-db ...
    Processing triggers for doc-base ...
    Processing 1 added doc-base file(s)...
    Registering documents with scrollkeeper...
    Processing triggers for libapache2-mod-php5 ...
     * Reloading web server config apache2                                   [ OK ]
    Processing triggers for ureadahead ...
    ureadahead will be reprofiled on next reboot
    Setting up wwwconfig-common (0.2.1) ...
    Setting up javascript-common (7) ...
    Setting up libarchive-zip-perl (1.30-2) ...
    Setting up libconvert-binhex-perl (1.119+pristine-3) ...
    Setting up libemail-date-format-perl (1.002-1) ...
    Setting up libio-stringy-perl (2.110-4) ...
    Setting up libjs-mootools (1.2.4.0~debian1-1) ...
    Setting up libmime-lite-perl (3.027-1) ...
    Setting up libmime-tools-perl (5.427-2) ...
    Setting up libmime-types-perl (1.30-1) ...
    Setting up libphp-serialization-perl (0.34-1) ...
    Setting up php5-mysql (5.3.3-1ubuntu9.10) ...
    Setting up libdevice-serialport-perl (1.04-2) ...
    Setting up zoneminder (1.24.2-7ubuntu1) ...
    Starting ZoneMinder: success

    userme@AM2:~$ ln -s /etc/zm/
    apache.conf  zm.conf     
    userme@AM2:~$ ln -s /etc/zm/apache.conf /etc/apache2/
    apache2.conf     httpd.conf       mods-enabled/    sites-enabled/
    conf.d/          magic            ports.conf      
    envvars          mods-available/  sites-available/
    userme@AM2:~$ ln -s /etc/zm/apache.conf /etc/apache2/conf.d/
    charset                  localized-error-pages    security
    javascript-common.conf   other-vhosts-access-log 
    userme@AM2:~$ ln -s /etc/zm/apache.conf /etc/apache2/conf.d/^C
    userme@AM2:~$ sudo su
    root@AM2:/home/one# cd /etc/apache2/
    root@AM2:/etc/apache2# ls
    apache2.conf  envvars     magic           mods-enabled  sites-available
    conf.d        httpd.conf  mods-available  ports.conf    sites-enabled
    root@AM2:/etc/apache2# cd conf.d/
    root@AM2:/etc/apache2/conf.d# ls
    charset                 localized-error-pages    security
    javascript-common.conf  other-vhosts-access-log
    root@AM2:/etc/apache2/conf.d# cd ..
    root@AM2:/etc/apache2# mkdir conf-enabled
    root@AM2:/etc/apache2# cp /etc/zm/apache.conf /etc/apache2/conf-enabled/zoneminder.conf
    root@AM2:/etc/apache2# sudo adduser www-data video
    Adding user `www-data' to group `video' ...
    Adding user www-data to group video
    Done.
    root@AM2:/etc/apache2# sudo a2enmod cgi
    Module cgi already enabled
    root@AM2:/etc/apache2# /etc/init.d/zoneminder
    Usage: /etc/init.d/zoneminder { start | stop | restart | status }
    root@AM2:/etc/apache2# /etc/init.d/zoneminder restart
    Stopping ZoneMinder: sudo service apache2 restart
    success

    Starting ZoneMinder: success

    root@AM2:/etc/apache2# sudo service apache2 restart
     * Restarting web server apache2                                                 ... waiting                                                             [ OK ]
    root@AM2:/etc/apache2# vi
    apache2.conf     envvars          mods-available/  sites-available/
    conf.d/          httpd.conf       mods-enabled/    sites-enabled/
    conf-enabled/    magic            ports.conf      
    root@AM2:/etc/apache2# vi httpd.conf
    root@AM2:/etc/apache2# ls -al
    total 96
    drwxr-xr-x   8 root root  4096 2015-10-02 22:00 .
    drwxr-xr-x 192 root root 12288 2015-10-02 21:59 ..
    -rw-r--r--   1 root root  7994 2011-11-02 19:36 apache2.conf
    drwxr-xr-x   2 root root  4096 2015-10-02 21:53 conf.d
    drwxr-xr-x   2 root root  4096 2015-10-02 21:59 conf-enabled
    -rw-r--r--   1 root root  1169 2011-11-02 19:36 envvars
    -rw-r--r--   1 root root     0 2010-09-08 21:44 httpd.conf
    -rw-r--r--   1 root root 31063 2010-04-13 12:27 magic
    drwxr-xr-x   2 root root 12288 2012-02-20 09:30 mods-available
    drwxr-xr-x   2 root root  4096 2010-12-05 14:36 mods-enabled
    -rw-r--r--   1 root root   750 2010-04-13 12:27 ports.conf
    drwxr-xr-x   2 root root  4096 2012-08-29 12:08 sites-available
    drwxr-xr-x   2 root root  4096 2010-09-08 21:44 sites-enabled
    root@AM2:/etc/apache2# vi /var/www/
    dbinfo.txt      html            speedtest.zip  
    Desktop/        index.html-     .ssh/          
    .gnome-desktop/ index.php       test.php       
    root@AM2:/etc/apache2# vi /var/www/html
    apache2.conf     envvars          mods-available/  sites-available/
    conf.d/          httpd.conf       mods-enabled/    sites-enabled/
    conf-enabled/    magic            ports.conf      
    root@AM2:/etc/apache2# vi /var/www/
    dbinfo.txt      html            speedtest.zip  
    Desktop/        index.html-     .ssh/          
    .gnome-desktop/ index.php       test.php       
    root@AM2:/etc/apache2# vi /var/www/index.php
    root@AM2:/etc/apache2# ls
    apache2.conf  envvars     mods-available  sites-available
    conf.d        httpd.conf  mods-enabled    sites-enabled
    conf-enabled  magic       ports.conf


    root@AM2:/etc/apache2# cat conf-enabled/zoneminder.conf >> ^C
    root@AM2:/etc/apache2# vi apache2.conf
    root@AM2:/etc/apache2# cat conf-enabled/zoneminder.conf >> apache2.conf root@AM2:/etc/apache2# sudo service apache2 restar
     * Usage: /etc/init.d/apache2 {start|stop|graceful-stop|restart|reload|force-reload|start-htcacheclean|stop-htcacheclean|status}
    root@AM2:/etc/apache2# sudo service apache2 restart
     * Restarting web server apache2                                                 ... waiting                                                             [ OK ]
    root@AM2:/etc/apache2#
     


  • status: { DRDY ERR } error: { ICRC ABRT } failed command: WRITE FPDMA QUEUED MCP55 Linux Errors


    [ 2868.041375] ata1: EH in SWNCQ mode,QC:qc_active 0x40 sactive 0x40
    [ 2868.041554] ata1: SWNCQ:qc_active 0x40 defer_bits 0x0 last_issue_tag 0x6
    [ 2868.041556]   dhfis 0x40 dmafis 0x40 sdbfis 0x20
    [ 2868.041874] ata1: ATA_REG 0x41 ERR_REG 0x84
    [ 2868.042013] ata1: tag : dhfis dmafis sdbfis sactive
    [ 2868.042163] ata1: tag 0x6: 1 1 0 1 
    [ 2868.042301] ata1.00: exception Emask 0x1 SAct 0x40 SErr 0x400000 action 0x6 frozen
    [ 2868.042490] ata1.00: Ata error. fis:0x21
    [ 2868.042624] ata1: SError: { Handshk }
    [ 2868.042756] ata1.00: failed command: WRITE FPDMA QUEUED
    [ 2868.042917] ata1.00: cmd 61/b8:30:4f:0c:7c/03:00:53:00:00/40 tag 6 ncq 487424 out
    [ 2868.042918]          res 41/84:30:4f:0c:7c/84:00:53:00:00/40 Emask 0x10 (ATA bus error)
    [ 2868.043299] ata1.00: status: { DRDY ERR }
    [ 2868.043437] ata1.00: error: { ICRC ABRT }
    [ 2868.043576] ata1: hard resetting link
    [ 2868.043705] ata1: nv: skipping hardreset on occupied port
    [ 2868.508050] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
    [ 2868.620254] ata1.00: configured for UDMA/133
    [ 2868.620414] ata1: EH complete


    0000:00:05.0 IDE interface: NVIDIA Corporation MCP55 SATA Controller (rev a3)
    0000:00:05.1 IDE interface: NVIDIA Corporation MCP55 SATA Controller (rev a3)
    0000:00:05.2 IDE interface: NVIDIA Corporation MCP55 SATA Controller (rev a3)
     

    Some people have reported disabling NCQ has fixed the errors .  This happens even in very recent kernels.

    To disable NCQ pass the following to your kernel boot line:

    libata.force=noncq

    It is reported on many motherboards or virtually any using the MCP55 SATA chipset.


  • bash script get directory location and path of script howto tutorial


    So the situaton is this, you depend on things being relevant to where your bash script is and to be safe you want it to be dynamic (eg. do not hard code that we switch to /abc/dir but rather detect where script.sh is located).

    scriptlocation="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

    The path is then contained the the variable "scriptlocation" so you can cd to it in your script etc....


  • initial Main Mode message received on 192.168.5.94:500 but no connection has been authorized with policy=PSK


    If you are getting this error from Pluto/IPSEC it is almost always due to a routing or NAT issue.


  • Firefox errors Unable to generate public/private key pair. (Error code: sec_error_keygen_fail)


    Your firefox is out of date if you get errors like below:

     

    Secure Connection Failed

         

         
         
         

         
           
           

             

    An error occurred during a connection to www.torproject.org.

    Unable to generate public/private key pair.

    (Error code: sec_error_keygen_fail)

           


           
           


        *   The page you are trying to view can not be shown because the authenticity of the received data could not be verified.

        *   Please contact the web site owners to inform them of this problem. Alternatively, use the command found in the help menu to report this broken site.

     


  • Centos/obfsproxy errors


    I never did get it working, it is too bad as obfsproxy should really be an option and integrated into the OpenVPN client and server or something similar:

     

    yum -y install python-pip python-devel

    No package python-pip available.
    #install the EPEL repo

    python-pip install obfsproxy

    python-pip install obfsproxy
    -bash: python-pip: command not found

    pip install obfsproxy

          File "/tmp/pip-build-6GFFBz/PyCrypto/setup.py", line 278, in run
            raise RuntimeError("autoconf error")
        RuntimeError: autoconf error

        ----------------------------------------
    Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-6GFFBz/PyCrypto/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('rn', 'n'), __file__, 'exec'))" install --record /tmp/pip-mdOoVA-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-6GFFBz/PyCrypto

    yum -y install python-crypto

        gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.6 -c twisted/test/raiser.c -o build/temp.linux-x86_64-2.6/twisted/test/raiser.o
        unable to execute gcc: No such file or directory
        error: command 'gcc' failed with exit status 1


    yum -y install gcc make

    pip install obfsproxy

    Installing collected packages: Twisted, argparse, pyptlib, pyyaml, obfsproxy
      Running setup.py install for Twisted
      Running setup.py install for pyptlib
      Running setup.py install for pyyaml
      Running setup.py install for obfsproxy
    Successfully installed Twisted-15.4.0 argparse-1.4.0 obfsproxy-0.2.13 pyptlib-0.0.6 pyyaml-3.11


     obfsproxy
    Traceback (most recent call last):
      File "/usr/bin/obfsproxy", line 5, in <module>
        from pkg_resources import load_entry_point
      File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 2655, in <module>
        working_set.require(__requires__)
      File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 648, in require
        needed = self.resolve(parse_requirements(requirements))
      File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 546, in resolve
        raise DistributionNotFound(req)
    pkg_resources.DistributionNotFound: argparse


    pip install -U setuptools

     obfsproxy      
    Traceback (most recent call last):
      File "/usr/bin/obfsproxy", line 9, in <module>
        load_entry_point('obfsproxy==0.2.13', 'console_scripts', 'obfsproxy')()
      File "/usr/lib/python2.6/site-packages/pkg_resources/__init__.py", line 558, in load_entry_point
        return get_distribution(dist).load_entry_point(group, name)
      File "/usr/lib/python2.6/site-packages/pkg_resources/__init__.py", line 2682, in load_entry_point
        return ep.load()
      File "/usr/lib/python2.6/site-packages/pkg_resources/__init__.py", line 2355, in load
        return self.resolve()
      File "/usr/lib/python2.6/site-packages/pkg_resources/__init__.py", line 2361, in resolve
        module = __import__(self.module_name, fromlist=['__name__'], level=0)
      File "/usr/lib/python2.6/site-packages/obfsproxy/pyobfsproxy.py", line 12, in <module>
        import obfsproxy.network.launch_transport as launch_transport
      File "/usr/lib/python2.6/site-packages/obfsproxy/network/launch_transport.py", line 2, in <module>
        import obfsproxy.transports.transports as transports
      File "/usr/lib/python2.6/site-packages/obfsproxy/transports/transports.py", line 4, in <module>
        import obfsproxy.transports.obfs2 as obfs2
      File "/usr/lib/python2.6/site-packages/obfsproxy/transports/obfs2.py", line 13, in <module>
        import obfsproxy.common.aes as aes
      File "/usr/lib/python2.6/site-packages/obfsproxy/common/aes.py", line 7, in <module>
        from Crypto.Util import Counter
    ImportError: cannot import name Counter
     


  • rsync backup entire system properly


    rsync -Phaz --exclude=/dev/* --exclude=/sys/* --exclude=/proc/* --exclude=/mnt/md126 / /mnt/md126


  • OpenVZ Install Guide Again / Quick Setup


    yum -y install wget

    wget -P /etc/yum.repos.d/ http://ftp.openvz.org/openvz.repo
    rpm --import http://ftp.openvz.org/RPM-GPG-Key-OpenVZ
    yum -y install vzkernel vzctl

    #enable ip_forward
    sed -i s/'net.ipv4.ip_forward = 0'/'net.ipv4.ip_forward = 1'/g /etc/sysctl.conf

    #all interfaces should not send redirects
    echo "net.ipv4.conf.default.send_redirects = 1" >> /etc/sysctl.conf
    echo "net.ipv4.conf.all.send_redirects = 0" >> /etc/sysctl.conf

    #disable SELinux
    sed -i s/'SELINUX=enabled'/'SELINUX=disabled'/g /etc/selinux/config
    echo 0 > /selinux/enforce


  • flypro EEPROM PLCC32 programmer software error "The device ID does not match, whether to continue operating"


    If you get that message it means you have inserted the adapter or device incorrectly.  In my case the adapter needed to be at the rear end of the pins and it caused this message.

    Do not ignore this message as it may appear to work but you will get errors and in reality your chip will not be erased or programmed even if it appears like it is working.


  • grub cannot install or boot from mdadm RAID 10 array


    root (hd2,1)
     Filesystem type unknown, partition type 0x83
    grub> root (hd2,2)
    root (hd2,2)
     Filesystem type is ext2fs, partition type 0x83
    grub> setup (hd2)
    setup (hd2)
     Checking if "/boot/grub/stage1" exists... no
     Checking if "/grub/stage1" exists... no


    #weird thing about grub is that the drive you enter is considered hd0
    For example when booted fully my drive was sdc and I would install grub referencing hd2,2
    But when booting from this same drive third/sdc it says it cannot find the disk or partition.
    Changing the root to:
    root (hd0,2) makes it boot interestingly enough

    The Solution

    Use a /boot partition and make it RAID 1


  • mdadm create raid10 array with only 2 drives


    mdadm --create /dev/md1 --level 10 --raid-devices=2 /dev/sdb2 /dev/sdc2 --layout=f2 --metadata=0.90

    Note that layout=f2 or layout=n2 is very important as without it you'll get a complaint like this:

    mdadm --create /dev/md0 --level 10 --raid-devices /dev/sdb1 /dev/sdc1 missing missing
    mdadm: invalid number of raid devices: /dev/sdb1

    It is basically more like a proper/hardware based RAID 1 where you see read speeds of both drives as one.

    Eg. 90MB/s drives will yield about 180-190MB/s read speeds.

     


  • Openvz Enable netadmin


    vzctl set $CTID --devnodes net/tun:rw --capability net_admin:on --save


  • Centos yum mirror problem error "[Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found""


    [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"

    The above happened when for some reason all the mirrors in my cache didn't have the files (some mirrors only keep the latest version of Centos).

    I tried to block them all but that didn't help because it seemed the mirrors were all hardcoded no matter what I tried.

    Here is how to fix it and reset your mirror list in Centos

    cd /var/cache/yum/x86_64/6/

    for mirror in `find .|grep mirror`; do
     echo y|rm $mirror
     done


  • ssh session and port forward or reverse port matching or assocation howto


    Use netstat with the -anpe option.  The e option shows the inodes and I do not know if it will always work or if it was by fluke but I was dealing with dozens of SSH sessions and needed to know which session was related to which forward (the PIDs of the SSH and SSHD did not match etc...)

    Notice the "59560675" and "59560762" those are almost identical, if you find two sets that are nearly identical except for the last 3 digits they may match (in my case they need and all the other sessions seemed to be like this too, close by inode number)

    netstat  -anpe

    tcp        0      0 ::ffff:92.15.15.5:443    ::ffff:50.14.16.19:33356 ESTABLISHED 0          59560675   10198/sshd: audi
    tcp        0      0 127.0.0.1:50003             0.0.0.0:*                   LISTEN      500        59560762   11767/sshd: audi

     

    Obvously the above way is cumbersome and maybe was a fluke or won't work but it worked in my case.  I would still like to know if there is a better or proper way of tracking/mapping SSH sessions to port forwards.


  • yum how to blacklist and exclude mirrors


    vi /etc/yum/pluginconf.d/fastestmirror.conf

    exclude=.hk,.cn

    You could also use specific domains but as you can see above we are blacklisting all Hong Kong and Chinese mirrors in this example.


  • ECC Errors in action


    Message from syslogd@server at Sep 14 11:35:59 ...
     kernel:[Hardware Error]: MC4 Error (node 1): DRAM ECC error detected on the NB.

    Message from syslogd@server at Sep 14 11:35:59 ...
     kernel:[Hardware Error]: Error Status: Corrected error, no action required.

    Message from syslogd@server at Sep 14 11:35:59 ...
     kernel:[Hardware Error]: CPU:6 (10:8:0) MC4_STATUS[Over|CE|MiscV|-|AddrV|CECC]: 0xdc00400021080813

    Message from syslogd@server at Sep 14 11:35:59 ...
     kernel:[Hardware Error]: MC4_ADDR: 0x000000082b185760

    Message from syslogd@server at Sep 14 11:35:59 ...
     kernel:[Hardware Error]: cache level: L3/GEN, mem/io: MEM, mem-tx: RD, part-proc: SRC (no timeout)

    We just wish we could know what module caused it.  This may not even be an issue as sometimes incorrect timings are what cause issues like this.