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.

Latest Articles

  • Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO


    I'm using ecryptfs and was suddenly unable to access or even ls my home directory (but every subfolder is accessible).  It just hangs and throws this message in messages/dmesg:

    Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO

    I read somewhere that perhaps some file or folder is owned by root somehow, sure enough there are some and sudoing to root allows me to access the home directory (my actual home directory, not root's) just fine.


  • WD 20EARX 2TB Bad within days


    This is just trying to read 5GB off the drive with dd and the drive initially tested ok but shortly after I wondered why I was seeing 2MB/s read speeds.  Notice the "current_pending_sector", anytime I've seen it at anything above 0 even with no other bad fields/attributes, it means the drive is bad.

    ata1.00: exception Emask 0x0 SAct 0x3 SErr 0x0 action 0x0
    ata1.00: irq_stat 0x40000008
    ata1.00: failed command: READ FPDMA QUEUED
    ata1.00: cmd 60/00:00:00:8b:34/01:00:00:00:00/40 tag 0 ncq 131072 in
             res 41/40:00:c8:8b:34/00:00:00:00:00/40 Emask 0x409 (media error) <F>
    ata1.00: status: { DRDY ERR }
    ata1.00: error: { UNC }
    ata1.00: configured for UDMA/133
    ata1: EH complete
    ata1.00: exception Emask 0x0 SAct 0x3 SErr 0x0 action 0x0
    ata1.00: irq_stat 0x40000008
    ata1.00: failed command: READ FPDMA QUEUED
    ata1.00: cmd 60/00:08:00:8b:34/01:00:00:00:00/40 tag 1 ncq 131072 in
             res 41/40:00:c8:8b:34/00:00:00:00:00/40 Emask 0x409 (media error) <F>
    ata1.00: status: { DRDY ERR }
    ata1.00: error: { UNC }
    ata1.00: configured for UDMA/133
    ata1: EH complete
    ata1.00: exception Emask 0x0 SAct 0x3 SErr 0x0 action 0x0
    ata1.00: irq_stat 0x40000008
    ata1.00: failed command: READ FPDMA QUEUED
    ata1.00: cmd 60/00:00:00:8b:34/01:00:00:00:00/40 tag 0 ncq 131072 in
             res 41/40:00:c8:8b:34/00:00:00:00:00/40 Emask 0x409 (media error) <F>
    ata1.00: status: { DRDY ERR }
    ata1.00: error: { UNC }
    ata1.00: configured for UDMA/133
    ata1: EH complete
    ata1.00: exception Emask 0x0 SAct 0x3 SErr 0x0 action 0x0
    ata1.00: irq_stat 0x40000008
    ata1.00: failed command: READ FPDMA QUEUED
    ata1.00: cmd 60/00:08:00:8b:34/01:00:00:00:00/40 tag 1 ncq 131072 in
             res 41/40:00:c8:8b:34/00:00:00:00:00/40 Emask 0x409 (media error) <F>
    ata1.00: status: { DRDY ERR }
    ata1.00: error: { UNC }
    ata1.00: configured for UDMA/133
    ata1: EH complete
    ata1.00: exception Emask 0x0 SAct 0x3 SErr 0x0 action 0x0
    ata1.00: irq_stat 0x40000008
    ata1.00: failed command: READ FPDMA QUEUED
    ata1.00: cmd 60/00:00:00:8b:34/01:00:00:00:00/40 tag 0 ncq 131072 in
             res 41/40:00:c8:8b:34/00:00:00:00:00/40 Emask 0x409 (media error) <F>
    ata1.00: status: { DRDY ERR }
    ata1.00: error: { UNC }
    ata1.00: configured for UDMA/133
    ata1: EH complete
    ata1.00: exception Emask 0x0 SAct 0x3 SErr 0x0 action 0x0
    ata1.00: irq_stat 0x40000008
    ata1.00: failed command: READ FPDMA QUEUED
    ata1.00: cmd 60/00:08:00:8b:34/01:00:00:00:00/40 tag 1 ncq 131072 in
             res 41/40:00:c8:8b:34/00:00:00:00:00/40 Emask 0x409 (media error) <F>
    ata1.00: status: { DRDY ERR }
    ata1.00: error: { UNC }
    ata1.00: configured for UDMA/133
    sd 0:0:0:0: [sda] Unhandled sense code
    sd 0:0:0:0: [sda] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
    sd 0:0:0:0: [sda] Sense Key : Medium Error [current] [descriptor]
    Descriptor sense data with sense descriptors (in hex):
            72 03 11 04 00 00 00 0c 00 0a 80 00 00 00 00 00
            00 34 8b c8
    sd 0:0:0:0: [sda] Add. Sense: Unrecovered read error - auto reallocate failed
    sd 0:0:0:0: [sda] CDB: Read(10): 28 00 00 34 8b 00 00 01 00 00
    Buffer I/O error on device sda, logical block 430457
    Buffer I/O error on device sda, logical block 430458
    Buffer I/O error on device sda, logical block 430459
    Buffer I/O error on device sda, logical block 430460
    Buffer I/O error on device sda, logical block 430461
    Buffer I/O error on device sda, logical block 430462
    Buffer I/O error on device sda, logical block 430463
    ata1: EH complete
    ata1.00: exception Emask 0x0 SAct 0x3 SErr 0x0 action 0x0
    ata1.00: irq_stat 0x40000008
    ata1.00: failed command: READ FPDMA QUEUED
    ata1.00: cmd 60/08:08:c8:8b:34/00:00:00:00:00/40 tag 1 ncq 4096 in
             res 41/40:00:c8:8b:34/00:00:00:00:00/40 Emask 0x409 (media error) <F>
    ata1.00: status: { DRDY ERR }
    ata1.00: error: { UNC }
    ata1.00: configured for UDMA/133
    ata1: EH complete
    ata1.00: exception Emask 0x0 SAct 0x3 SErr 0x0 action 0x0
    ata1.00: irq_stat 0x40000008
    ata1.00: failed command: READ FPDMA QUEUED
    ata1.00: cmd 60/08:00:c8:8b:34/00:00:00:00:00/40 tag 0 ncq 4096 in
             res 41/40:00:c8:8b:34/00:00:00:00:00/40 Emask 0x409 (media error) <F>
    ata1.00: status: { DRDY ERR }
    ata1.00: error: { UNC }
    ata1.00: configured for UDMA/133
    ata1: EH complete
    ata1.00: exception Emask 0x0 SAct 0x3 SErr 0x0 action 0x0
    ata1.00: irq_stat 0x40000008
    ata1.00: failed command: READ FPDMA QUEUED
    ata1.00: cmd 60/08:08:c8:8b:34/00:00:00:00:00/40 tag 1 ncq 4096 in
             res 41/40:00:c8:8b:34/00:00:00:00:00/40 Emask 0x409 (media error) <F>
    ata1.00: status: { DRDY ERR }
    ata1.00: error: { UNC }
    ata1.00: configured for UDMA/133
    ata1: EH complete
    ata1.00: exception Emask 0x0 SAct 0x3 SErr 0x0 action 0x0
    ata1.00: irq_stat 0x40000008
    ata1.00: failed command: READ FPDMA QUEUED
    ata1.00: cmd 60/08:00:c8:8b:34/00:00:00:00:00/40 tag 0 ncq 4096 in
             res 41/40:00:c8:8b:34/00:00:00:00:00/40 Emask 0x409 (media error) <F>
    ata1.00: status: { DRDY ERR }
    ata1.00: error: { UNC }
    ata1.00: configured for UDMA/133
    ata1: EH complete
    ata1.00: exception Emask 0x0 SAct 0x3 SErr 0x0 action 0x0
    ata1.00: irq_stat 0x40000008
    ata1.00: failed command: READ FPDMA QUEUED
    ata1.00: cmd 60/08:08:c8:8b:34/00:00:00:00:00/40 tag 1 ncq 4096 in
             res 41/40:00:c8:8b:34/00:00:00:00:00/40 Emask 0x409 (media error) <F>
    ata1.00: status: { DRDY ERR }
    ata1.00: error: { UNC }
    ata1.00: configured for UDMA/133
    ata1: EH complete
    ata1.00: exception Emask 0x0 SAct 0x3 SErr 0x0 action 0x0
    ata1.00: irq_stat 0x40000008
    ata1.00: failed command: READ FPDMA QUEUED
    ata1.00: cmd 60/08:00:c8:8b:34/00:00:00:00:00/40 tag 0 ncq 4096 in
             res 41/40:00:c8:8b:34/00:00:00:00:00/40 Emask 0x409 (media error) <F>
    ata1.00: status: { DRDY ERR }
    ata1.00: failed command: READ FPDMA QUEUED
    ata1.00: cmd 60/08:08:c8:8b:34/00:00:00:00:00/40 tag 1 ncq 4096 in
             res 41/40:00:c8:8b:34/00:00:00:00:00/40 Emask 0x409 (media error) <F>
    ata1.00: status: { DRDY ERR }
    ata1.00: error: { UNC }
    ata1.00: configured for UDMA/133
    ata1: EH complete
    ata1.00: exception Emask 0x0 SAct 0x3 SErr 0x0 action 0x0
    ata1.00: irq_stat 0x40000008
    ata1.00: failed command: READ FPDMA QUEUED
    ata1.00: cmd 60/08:00:c8:8b:34/00:00:00:00:00/40 tag 0 ncq 4096 in
             res 41/40:00:c8:8b:34/00:00:00:00:00/40 Emask 0x409 (media error) <F>
    ata1.00: status: { DRDY ERR }
    ata1.00: error: { UNC }
    ata1.00: configured for UDMA/133
    ata1: EH complete
    ata1.00: exception Emask 0x0 SAct 0x3 SErr 0x0 action 0x0
    ata1.00: irq_stat 0x40000008
    ata1.00: failed command: READ FPDMA QUEUED
    ata1.00: cmd 60/08:08:c8:8b:34/00:00:00:00:00/40 tag 1 ncq 4096 in
             res 41/40:00:c8:8b:34/00:00:00:00:00/40 Emask 0x409 (media error) <F>
    ata1.00: status: { DRDY ERR }
    ata1.00: error: { UNC }
    ata1.00: configured for UDMA/133
    ata1: EH complete
    ata1.00: exception Emask 0x0 SAct 0x3 SErr 0x0 action 0x0
    ata1.00: irq_stat 0x40000008
    ata1.00: failed command: READ FPDMA QUEUED
    ata1.00: cmd 60/08:00:c8:8b:34/00:00:00:00:00/40 tag 0 ncq 4096 in
             res 41/40:00:c8:8b:34/00:00:00:00:00/40 Emask 0x409 (media error) <F>
    ata1.00: status: { DRDY ERR }
    ata1.00: error: { UNC }
    ata1.00: configured for UDMA/133
    ata1: EH complete
    ata1.00: exception Emask 0x0 SAct 0x3 SErr 0x0 action 0x0
    ata1.00: irq_stat 0x40000008
    ata1.00: failed command: READ FPDMA QUEUED
    ata1.00: cmd 60/08:08:c8:8b:34/00:00:00:00:00/40 tag 1 ncq 4096 in
             res 41/40:00:c8:8b:34/00:00:00:00:00/40 Emask 0x409 (media error) <F>
    ata1.00: status: { DRDY ERR }
    ata1.00: error: { UNC }
    ata1.00: configured for UDMA/133
    ata1: EH complete
    ata1.00: exception Emask 0x0 SAct 0x3 SErr 0x0 action 0x0
    ata1.00: irq_stat 0x40000008
    ata1.00: failed command: READ FPDMA QUEUED
    ata1.00: cmd 60/08:00:c8:8b:34/00:00:00:00:00/40 tag 0 ncq 4096 in
             res 41/40:00:c8:8b:34/00:00:00:00:00/40 Emask 0x409 (media error) <F>
    ata1.00: status: { DRDY ERR }
    ata1.00: error: { UNC }
    ata1.00: configured for UDMA/133
    sd 0:0:0:0: [sda] Unhandled sense code
    sd 0:0:0:0: [sda] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
    sd 0:0:0:0: [sda] Sense Key : Medium Error [current] [descriptor]
    Descriptor sense data with sense descriptors (in hex):
            72 03 11 04 00 00 00 0c 00 0a 80 00 00 00 00 00
            00 34 8b c8
    sd 0:0:0:0: [sda] Add. Sense: Unrecovered read error - auto reallocate failed
    sd 0:0:0:0: [sda] CDB: Read(10): 28 00 00 34 8b c8 00 00 08 00
    Buffer I/O error on device sda, logical block 430457
    ata1: EH complete

    smartctl -a /dev/sda
    smartctl 5.43 2012-06-30 r3573 [x86_64-linux-2.6.32-279.el6.x86_64] (local build)
    Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net

    === START OF INFORMATION SECTION ===
    Model Family:     Western Digital Caviar Green (Adv. Format)
    Device Model:     WDC WD20EARX-008FB0
    Serial Number:    WD-WCAZAK523299
    LU WWN Device Id: 5 0014ee 25d303568
    Firmware Version: 51.0AB51
    User Capacity:    2,000,398,934,016 bytes [2.00 TB]
    Sector Sizes:     512 bytes logical, 4096 bytes physical
    Device is:        In smartctl database [for details use: -P show]
    ATA Version is:   8
    ATA Standard is:  Exact ATA specification draft version not indicated
    Local Time is:    Thu May 16 04:36:59 2013 EDT
    SMART support is: Available - device has SMART capability.
    SMART support is: Enabled
                        Auto Offline data collection on/off support.
                        Suspend Offline collection upon new
                        command.
                        Offline surface scan supported.
                        Self-test supported.
                        Conveyance Self-test supported.
                        Selective Self-test supported.
    SMART capabilities:            (0x0003)    Saves SMART data before entering
                        power-saving mode.
                        Supports SMART auto save timer.
    Error logging capability:        (0x01)    Error logging supported.
                        General Purpose Logging supported.
    Short self-test routine
    recommended polling time:      (   2) minutes.
    Extended self-test routine
    recommended polling time:      ( 331) minutes.
    Conveyance self-test routine
    recommended polling time:      (   5) minutes.
    SCT capabilities:            (0x30b5)    SCT Status supported.
                        SCT Feature Control supported.
                        SCT Data Table supported.

    SMART Attributes Data Structure revision number: 16
    Vendor Specific SMART Attributes with Thresholds:
    ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
      1 Raw_Read_Error_Rate     0x002f   200   200   051    Pre-fail  Always       -       18
      3 Spin_Up_Time            0x0027   100   253   021    Pre-fail  Always       -       0
      4 Start_Stop_Count        0x0032   100   100   000    Old_age   Always       -       2
      5 Reallocated_Sector_Ct   0x0033   200   200   140    Pre-fail  Always       -       0
      7 Seek_Error_Rate         0x002e   200   200   000    Old_age   Always       -       0
      9 Power_On_Hours          0x0032   100   100   000    Old_age   Always       -       685
     10 Spin_Retry_Count        0x0032   100   253   000    Old_age   Always       -       0
     11 Calibration_Retry_Count 0x0032   100   253   000    Old_age   Always       -       0
     12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       2
    192 Power-Off_Retract_Count 0x0032   200   200   000    Old_age   Always       -       1
    193 Load_Cycle_Count        0x0032   200   200   000    Old_age   Always       -       32
    194 Temperature_Celsius     0x0022   123   121   000    Old_age   Always       -       27
    196 Reallocated_Event_Count 0x0032   200   200   000    Old_age   Always       -       0
    197 Current_Pending_Sector  0x0032   200   200   000    Old_age   Always       -       3
    198 Offline_Uncorrectable   0x0030   100   253   000    Old_age   Offline      -       0
    199 UDMA_CRC_Error_Count    0x0032   200   200   000    Old_age   Always       -       0
    200 Multi_Zone_Error_Rate   0x0008   100   253   000    Old_age   Offline      -       0

    SMART Error Log Version: 1
    No Errors Logged

    SMART Self-test log structure revision number 1
    Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
    # 1  Extended offline    Interrupted (host reset)      90%       134         -

    SMART Selective self-test log data structure revision number 1
     SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
        1        0        0  Not_testing
        2        0        0  Not_testing
        3        0        0  Not_testing
        4        0        0  Not_testing
        5        0        0  Not_testing
    Selective self-test flags (0x0):
      After scanning selected spans, do NOT read-scan remainder of disk.
    If Selective self-test is pending on power-up, resume after 0 minute delay.


  • Powersupply Issue, Motherboard AHCI issue?


    This is the most I can get when plugging in a hard drive hot and only on some power connectors.

     

    [71656.314271] ata5: exception Emask 0x50 SAct 0x0 SErr 0x90a02 action 0xe frozen
    [71656.314277] ata5: irq_stat 0x00400000, PHY RDY changed
    [71656.314285] ata5: SError: { RecovComm Persist HostInt PHYRdyChg 10B8B }
    [71656.314294] ata5: hard resetting link
    [71660.360686] ata5: softreset failed (device not ready)
    [71660.360694] ata5: applying SB600 PMP SRST workaround and retrying
    [71660.532709] ata5: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
    [71660.535388] ata5.00: configured for UDMA/133
    [71660.535398] ata5: EH complete
    [71740.781179] ata5: exception Emask 0x10 SAct 0x0 SErr 0x90202 action 0xe frozen
    [71740.781186] ata5: irq_stat 0x00400000, PHY RDY changed
    [71740.781192] ata5: SError: { RecovComm Persist PHYRdyChg 10B8B }
    [71740.781202] ata5: hard resetting link
    [71744.833991] ata5: softreset failed (device not ready)
    [71744.833998] ata5: applying SB600 PMP SRST workaround and retrying
    [71745.012046] ata5: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
    [71745.014726] ata5.00: configured for UDMA/133
    [71745.014736] ata5: EH complete
     


  • VBoxSVC uses 100% CPU on Virtualbox Host running Ubuntu


    I haven't updated VBOX in ages but have never seen this issue and it has my CPU running at 100C.

    Manually/forcefully killing the process does not work with "kill -kill 3892".

    I've closed the VBOXManager and everything else related to it.

    This did seem to happen around the time I ran VBoxManage clonehd and it failed, the terminal issue locked up and also never wrote a byte of anything.  I forced killed the VBoxManage and tried to remove "rm" the empty image and that "rm" process is still locked and can't be force killed.


  • KVM Guest Network Not Working Can't Ping ETC Solution


    Once I set a new MAC address everything was fine and finally anything can be pinged etc.., I've had this happen with many clients in different datacenters on different hardware.


  • init: tty (/dev/tty2) main process (1031) terminated with status 1 init: tty (/dev/tty2) main process ended, respawning


    After some fsck issues I can't boot my Centos 6.4, this just keeps repeating over and over.

    init: tty (/dev/tty2) main process (1031) terminated with status 1
    init: tty (/dev/tty2) main process ended, respawning


    Disabling SELinux through Single User mode fixed this.


  • Apache SSL Change Default SSL Vhost and Listening Port for SSL


    vi /etc/httpd/conf.d/ssl.conf

    Change the following from "Listen 443" to something like below

    Listen 2243

     

    Then find the SSL Virtual Host Context and edit like below (to your new listening port)


    ##
    ## SSL Virtual Host Context
    ##

    <VirtualHost _default_:2243>


  • MySQL my.cnf Server How To Secure/Bind to Localhost and Prevent Outside Connections Solutions


    [mysqld]
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    user=mysql
    # Disabling symbolic-links is recommended to prevent assorted security risks
    symbolic-links=0
    bind-address=127.0.0.1

    The key is "bind-address", set that to 127.0.0.1 and no one from outside the server can connect.


  • mysqldump: Couldn't execute 'show create table `general_log`': SHOW command denied to user 'user'@'localhost' for table 'general_log' (1142) - Solution


    mysqldump: Couldn't execute 'show create table `general_log`': SHOW command denied to user 'user'@'localhost' for table 'general_log' (1142)

    One of my clients almost found out the hard way, here is an unlikely situation that happened.

    1.) Years ago the client had another VPS to which they backed up a BLOG nightly to an .sql file, what they forgot is that the file also contained all databases (they used the --all-databases option but forgot).  So imagine the surprise when they ran this .sql file on a production server, thinking they're just importing their old BLOG.  In fact the "mysql" table was part of that backup since it was --all-databases, and it flushed the mysql table with entries from their old VPS.  As you can imagine this would effect every database driven application including websites and even email etc...

    2.) They were lucky because I was able to see what had happened and they haven't run "flush privileges" so the original mysql database was in memory.  I thought I would just restore backups they had taken so no problem right ?  Their dumps weren't working right but fortunately I was able to take a raw /var/lib/mysql backup from their filesystem and get up on another VPS and dump the original mysql db from there and restore it. 

    3.) No, every database except "mysql' was backed up successfully, the user they had to dump all the databases needed one specific privilege to be able to dump mysql. 

    The solution for the above error:

    ADD the privileges "Show_db" to the user and then it will work.
     


  • Solution ERROR 1146 (42S02): Table ‘mysql.servers’ doesn’t exist - when running flush privileges


    flush privileges;

    ERROR 1146 (42S02): Table ‘mysql.servers’ doesn’t exist

    This happened to me on a system running Centos with the REMI repo and a new version of Mysql 5 (which the official Centos/RHEL does not support on version 5).

    The solution is just to run this program "mysql_upgrade", after that flush privileges will work.

    mysql_upgrade


  • mysql how to execute script from the bash prompt .sql


    mysql -u username --password='yourpassword' < thesqlscript.sql


  • PHP How To Create and Assign Variables from POST/Submit FORM


        foreach ($_POST as $key => $value) {
               if ( $key != submit )
                            {
                               $values.="$key=$value<br>";
                               eval("$$key = '$value';");
                            }
            }

    This few lines of code is quite handy and powerful, it automatically creates variables of all POST values except (submit).  Change the "$key != submit" part on line 2 to whatever the name of your submit button is.

    Also keep in mind the name of the variables will be the exact case and spelling as you have them on your form.  This is not the best idea ofr the long-term but a great way for testing and doing mockups of various systems.


  • Country List Names in HTML Select From


    This is useful for developing a lot of applications, I'm putting it here to keep it handy for myself and hopefully others:

     

    <select name='country'><option value=Choose>Choose Country</option><option value=CA>Canada</option><option value=JP>Japan</option><option value=US>United States</option><option value=GB>United Kingdom</option><option value=AF>Afghanistan</option><option value=AL>Albania</option><option value=DZ>Algeria</option><option value=AS>American Samoa</option><option value=AD>Andorra</option><option value=AO>Angola</option><option value=AI>Anguilla</option><option value=AQ>Antarctica</option><option value=AG>Antigua and Barbuda</option><option value=AR>Argentina</option><option value=AM>Armenia</option><option value=AW>Aruba</option><option value=AU>Australia</option><option value=AT>Austria</option><option value=AZ>Azerbaijan</option><option value=BS>Bahamas</option><option value=BH>Bahrain</option><option value=BD>Bangladesh</option><option value=BB>Barbados</option><option value=BY>Belarus</option><option value=BE>Belgium</option><option value=BZ>Belize</option><option value=BJ>Benin</option><option value=BM>Bermuda</option><option value=BT>Bhutan</option><option value=BO>Bolivia</option><option value=BA>Bosnia</option><option value=BW>Botswana</option><option value=BV>Bouvet Island</option><option value=BR>Brazil</option><option value=BN>Brunei</option><option value=BG>Bulgaria</option><option value=BF>Burkina Faso</option><option value=BI>Burundi</option><option value=KH>Cambodia</option><option value=CM>Cameroon</option><option value=CV>Cape Verde</option><option value=KY>Cayman Islands</option><option value=CF>Central African Republic</option><option value=TD>Chad</option><option value=CL>Chile</option><option value=CN>China</option><option value=CX>Christmas Island</option><option value=CC>Cocos (Keeling) Islands</option><option value=CO>Colombia</option><option value=KM>Comoros</option><option value=CG>Congo</option><option value=CK>Cook Islands</option><option value=CR>Costa Rica</option><option value=CI>C&ocirc;te d'Ivoire</option><option value=HR>Croatia (Hrvatska)</option><option value=CU>Cuba</option><option value=CY>Cyprus</option><option value=CZ>Czech Republic</option><option value=CD>Congo (DRC)</option><option value=DK>Denmark</option><option value=DJ>Djibouti</option><option value=DM>Dominica</option><option value=DO>Dominican Republic</option><option value=TP>East Timor</option><option value=EC>Ecuador</option><option value=EG>Egypt</option><option value=SV>El Salvador</option><option value=GQ>Equatorial Guinea</option><option value=ER>Eritrea</option><option value=EE>Estonia</option><option value=ET>Ethiopia</option><option value=FK>Falkland Islands</option><option value=FO>Faroe Islands</option><option value=FJ>Fiji Islands</option><option value=FI>Finland</option><option value=FR>France</option><option value=GF>French Guiana</option><option value=PF>French Polynesia</option><option value=GA>Gabon</option><option value=GM>Gambia</option><option value=GE>Georgia</option><option value=DE>Germany</option><option value=GH>Ghana</option><option value=GI>Gibraltar</option><option value=GR>Greece</option><option value=GL>Greenland</option><option value=GD>Grenada</option><option value=GP>Guadeloupe</option><option value=GU>Guam</option><option value=GT>Guatemala</option><option value=GN>Guinea</option><option value=GW>Guinea-Bissau</option><option value=GY>Guyana</option><option value=HT>Haiti</option><option value=HN>Honduras</option><option value=HK>Hong Kong SAR</option><option value=HU>Hungary</option><option value=IS>Iceland</option><option value=IN>India</option><option value=ID>Indonesia</option><option value=IR>Iran</option><option value=IQ>Iraq</option><option value=IE>Ireland</option><option value=IL>Israel</option><option value=IT>Italy</option><option value=JM>Jamaica</option><option value=JO>Jordan</option><option value=KZ>Kazakhstan</option><option value=KE>Kenya</option><option value=KI>Kiribati</option><option value=KR>Korea</option><option value=KW>Kuwait</option><option value=KG>Kyrgyzstan</option><option value=LA>Laos</option><option value=LV>Latvia</option><option value=LB>Lebanon</option><option value=LS>Lesotho</option><option value=LR>Liberia</option><option value=LY>Libya</option><option value=LI>Liechtenstein</option><option value=LT>Lithuania</option><option value=LU>Luxembourg</option><option value=MO>Macao SAR</option><option value=MK>Macedonia</option><option value=MG>Madagascar</option><option value=MW>Malawi</option><option value=MY>Malaysia</option><option value=MV>Maldives</option><option value=ML>Mali</option><option value=MT>Malta</option><option value=MH>Marshall Islands</option><option value=MQ>Martinique</option><option value=MR>Mauritania</option><option value=MU>Mauritius</option><option value=YT>Mayotte</option><option value=MX>Mexico</option><option value=FM>Micronesia</option><option value=MD>Moldova</option><option value=MC>Monaco</option><option value=MN>Mongolia</option><option value=MS>Montserrat</option><option value=MA>Morocco</option><option value=MZ>Mozambique</option><option value=MM>Myanmar</option><option value=NA>Namibia</option><option value=NR>Nauru</option><option value=NP>Nepal</option><option value=NL>Netherlands</option><option value=AN>Netherlands Antilles</option><option value=NC>New Caledonia</option><option value=NZ>New Zealand</option><option value=NI>Nicaragua</option><option value=NE>Niger</option><option value=NG>Nigeria</option><option value=NU>Niue</option><option value=NF>Norfolk Island</option><option value=KP>North Korea</option><option value=MP>Northern Mariana Islands</option><option value=NO>Norway</option><option value=OM>Oman</option><option value=PK>Pakistan</option><option value=PW>Palau</option><option value=PA>Panama</option><option value=PG>Papua New Guinea</option><option value=PY>Paraguay</option><option value=PE>Peru</option><option value=PH>Philippines</option><option value=PN>Pitcairn Islands</option><option value=PL>Poland</option><option value=PT>Portugal</option><option value=PR>Puerto Rico</option><option value=QA>Qatar</option><option value=RE>Reunion</option><option value=RO>Romania</option><option value=RU>Russia</option><option value=RW>Rwanda</option><option value=WS>Samoa</option><option value=SM>San Marino</option><option value=ST>S&atilde;o Tom&eacute; and Pr&iacute;ncipe</option><option value=SA>Saudi Arabia</option><option value=SN>Senegal</option><option value=YU>Serbia and Montenegro</option><option value=SC>Seychelles</option><option value=SL>Sierra Leone</option><option value=SG>Singapore</option><option value=SK>Slovakia</option><option value=SI>Slovenia</option><option value=SB>Solomon Islands</option><option value=SO>Somalia</option><option value=ZA>South Africa</option><option value=ES>Spain</option><option value=LK>Sri Lanka</option><option value=SH>St. Helena</option><option value=KN>St. Kitts and Nevis</option><option value=LC>St. Lucia</option><option value=PM>St. Pierre and Miquelon</option><option value=VC>St. Vincent / Grenadines</option><option value=SD>Sudan</option><option value=SR>Suriname</option><option value=SJ>Svalbard and Jan Mayen</option><option value=SZ>Swaziland</option><option value=SE>Sweden</option><option value=CH>Switzerland</option><option value=SY>Syria</option><option value=TW>Taiwan</option><option value=TJ>Tajikistan</option><option value=TZ>Tanzania</option><option value=TH>Thailand</option><option value=TG>Togo</option><option value=TK>Tokelau</option><option value=TO>Tonga</option><option value=TT>Trinidad and Tobago</option><option value=TN>Tunisia</option><option value=TR>Turkey</option><option value=TM>Turkmenistan</option><option value=TC>Turks and Caicos Islands</option><option value=TV>Tuvalu</option><option value=UG>Uganda</option><option value=UA>Ukraine</option><option value=AE>United Arab Emirates</option><option value=UY>Uruguay</option><option value=UZ>Uzbekistan</option><option value=VU>Vanuatu</option><option value=VA >Vatican City</option><option value=VE>Venezuela</option><option value=VN>Viet Nam</option><option value=VG>Virgin Islands (British)</option><option value=VI>Virgin Islands</option><option value=WF>Wallis and Futuna</option><option value=WI>West Indies</option><option value=YE>Yemen</option><option value=ZM>Zambia</option><option value=ZW>Zimbabwe</option></select>


  • How to wipe/erase hard drives clean so data cannot be recovered for privacy reasons


    This is something many people and especially businesses worry about, or at least they should.  Before throwing away a hard drive, returning a hard drive, or especially Warrantying/RMAing it, you should wipe the drive.

    Linux provides the "shred" and "dd" utlities which work quite well.  It seems even a single pass is good enough but by default shred will do 3 passes.

    Here's an example of using shred in Linux (I use a custom made distribution from a USB key):

    /shred -v /dev/sdd
    ./shred: /dev/sdd: pass 1/3 (random)...
    ./shred: /dev/sdd: pass 1/3 (random)...585MiB/932GiB 0%
    ./shred: /dev/sdd: pass 1/3 (random)...1.0GiB/932GiB 0%
    ./shred: /dev/sdd: pass 1/3 (random)...1.4GiB/932GiB 0%
    ./shred: /dev/sdd: pass 1/3 (random)...1.8GiB/932GiB 0%
    ./shred: /dev/sdd: pass 1/3 (random)...2.3GiB/932GiB 0%
    ./shred: /dev/sdd: pass 1/3 (random)...2.7GiB/932GiB 0%
    ./shred: /dev/sdd: pass 1/3 (random)...3.1GiB/932GiB 0%
    ./shred: /dev/sdd: pass 1/3 (random)...3.6GiB/932GiB 0%
    ./shred: /dev/sdd: pass 1/3 (random)...4.0GiB/932GiB 0%
    ./shred: /dev/sdd: pass 1/3 (random)...4.5GiB/932GiB 0%
    ./shred: /dev/sdd: pass 1/3 (random)...4.9GiB/932GiB 0%
    ./shred: /dev/sdd: pass 1/3 (random)...5.4GiB/932GiB 0%
    ./shred: /dev/sdd: pass 1/3 (random)...5.8GiB/932GiB 0%
    ./shred: /dev/sdd: pass 1/3 (random)...6.3GiB/932GiB 0%
    ./shred: /dev/sdd: pass 1/3 (random)...6.7GiB/932GiB 0%
    ./shred: /dev/sdd: pass 1/3 (random)...7.2GiB/932GiB 0%
    ./shred: /dev/sdd: pass 1/3 (random)...7.6GiB/932GiB 0%
    ./shred: /dev/sdd: pass 1/3 (random)...8.0GiB/932GiB 0%
    ./shred: /dev/sdd: pass 1/3 (random)...8.5GiB/932GiB 0%
    ./shred: /dev/sdd: pass 1/3 (random)...8.9GiB/932GiB 0%
    ./shred: /dev/sdd: pass 1/3 (random)...9.4GiB/932GiB 1%
    ./shred: /dev/sdd: pass 1/3 (random)...9.8GiB/932GiB 1%
    ./shred: /dev/sdd: pass 1/3 (random)...10GiB/932GiB 1%
    ./shred: /dev/sdd: pass 1/3 (random)...11GiB/932GiB 1%
    ./shred: /dev/sdd: pass 1/3 (random)...12GiB/932GiB 1%
    ./shred: /dev/sdd: pass 1/3 (random)...13GiB/932GiB 1%
    ./shred: /dev/sdd: pass 1/3 (random)...14GiB/932GiB 1%
    ./shred: /dev/sdd: pass 1/3 (random)...15GiB/932GiB 1%
    ./shred: /dev/sdd: pass 1/3 (random)...16GiB/932GiB 1%
    ./shred: /dev/sdd: pass 1/3 (random)...17GiB/932GiB 1%

     

    You can also use dd and some suggest it works just as well even once:

    dd if=/dev/zero of=/dev/sdyourdrivedevice bs=16M


  • Ubuntu/Linux disable extra Mouse Buttons Microsoft Comfort Mouse 4500


    I find it very annoying that this mouse has buttons on the side where you grip it and the left one goes back in the browser and the right one goes forward.  Imagine if you're filling out a form and hit it, most forms/websites have no protection against it.

    Source: http://ubuntuforums.org/showthread.php?t=2065400

    Here's how I fixed it with xinput, it's too bad there's no good standard GUI tool to set mouse buttons:

    xinput list

    This will show your input devices, in my case "10" was the case.

    xinput list 10
    Microsoft Microsoft® Comfort Mouse 4500    id=10    [slave  pointer  (2)]
        Reporting 5 classes:
            Class originated from: 10
            Buttons supported: 13
            Button labels: Button Left Button Middle Button Right Button Wheel Up Button Wheel Down Button Horiz Wheel Left Button Horiz Wheel Right Button Side Button Extra Button Unknown Button Unknown Button Unknown Button Unknown
            Button state:
            Class originated from: 10
            Keycodes supported: 248
            Class originated from: 10
            Detail for Valuator 0:
              Label: Abs X
              Range: -1.000000 - -1.000000
              Resolution: 1 units/m
              Mode: relative
            Class originated from: 10
            Detail for Valuator 1:
              Label: Abs Y
              Range: -1.000000 - -1.000000
              Resolution: 1 units/m
              Mode: relative
            Class originated from: 10
            Detail for Valuator 2:
              Label: Abs Gas
              Range: -1.000000 - -1.000000
              Resolution: 1 units/m
              Mode: relative

    Solution

    It is tedious but copy and paste the "Button labels" and put each one in a text file (that has numbered lines) and separate each "Button" at the beginning of each like this (this will make it easier to number each button you want and disable them).

    1. Button Left
    2. Button Middle
    3. Button Right
    4. Button Wheel Up
    5. Button Wheel Down
    6. Button Horiz Wheel Left
    7. Button Horiz Wheel Right
    8. Button Side
    9. Button Extra
    10. Button Unknown
    11. Button Unknown
    12. Button Unknown
    13. Button Unknown


    xinput set-button-map 10 1 2 3 4 5 6 7 0 0 10 11 12 13
     

    Note the "10" after "set-button-map" that corresponds to your device number/id.

    Note the "0 0" after "7" corresponds to the two side buttons, you set 0 in place of the button number to disable it.


  • postfix/dovecot Sent emails missing sometimes


    On occassion and from a variety of networks and clients, Sent messages don't get saved.

    I'm wondering if these log messages could be why:

    May  3 14:16:39 mail.box postfix/smtpd[5195]: connect from 192.168.1.58
    May  3 14:16:39 mail.box postfix/smtpd[5195]: SSL_accept error from 192.168.1.58: -1
    May  3 14:16:39 mail.box postfix/smtpd[5195]: lost connection after CONNECT from 192.168.1.58
    May  3 14:16:39 mail.box postfix/smtpd[5195]: disconnect from 192.168.1.58
    May  2 22:14:30 mail.box dovecot: imap-login: SSL_accept() syscall failed: Connection reset by peer [::ffff:192.168.1.58]
    May  3 14:16:39 mail.box postfix/smtpd[5195]: SSL_accept error from 192.168.1.58: -1


  • Starting MySQL. ERROR! Manager of pid-file quit without updating file. - Solution/How To Fix


    service mysql start
    Starting MySQL. ERROR! Manager of pid-file quit without updating file.

    Solution

    killall -9 mysqld_safe
    killall -9 mysqld
    service mysql start


    Starting MySQL SUCCESS!


  • mdadm create RAID 1 array example


    mdadm --create /dev/md2 --level=1 --raid-devices=2 /dev/sda3 /dev/sdb3

    cat /proc/mdstat
    Personalities : [raid1]
    md2 : active raid1 sdb3[1] sda3[0]
          1363020736 blocks super 1.2 [2/2] [UU]
          [=>...................]  resync =  8.3% (113597440/1363020736) finish=276.2min speed=75366K/sec
     


  • sysctl how to apply values from /etc/sysctl.conf after changes


    If you make changes to /etc/sysctl.conf (which are permanent and not lost during reboot) but want them to apply with rebooting just use the following command:

    sysctl -p

    After that your changes will be enabled.


  • SMARTCTL Enable SMART on Device Solution for Error "Device does not support SMART Error Counter logging not supported"


    smartctl -a /dev/sda
    smartctl version 5.36 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce Allen
    Home page is http://smartmontools.sourceforge.net/

    Device: ATA      WDC WD1600YS-01S Version: 20.0
    Serial number:      WD-WCAP03024940
    Device type: disk
    Local Time is: Mon Apr 29 21:40:07 2013 PDT
    Device does not support SMART

    Error Counter logging not supported

    [GLTSD (Global Logging Target Save Disable) set. Enable Save with '-S on']
    Device does not support Self Test logging

     

    smartctl -a -S on -d ata -T permissive /dev/sda


  • eth0 changed to eth1 or eth2 and the solution to fix it


    If you move your hard drive(s) around to other computers/servers, you'll find that your eth0 keeps getting higher, the first time it will become eth1 and then eth2 etc and even higher if your server has dual or quad NICs.  The reason is that udevd basically assigns eth0 tot he first NIC it finds and remembers it, if it encounters a NIC with a different MAC, it assigns it one higher (eg. eth1).

    See the example below, I have eth2 now so how do I fix it?

    ifconfig
    eth2      Link encap:Ethernet  HWaddr 90:e6:ba:30:fb:0c 
              inet addr:192.168.1.103  Bcast:192.168.1.255  Mask:255.255.255.0
              inet6 addr: fe80::92e6:baff:fe30:fb0c/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:62000457 errors:0 dropped:0 overruns:0 frame:0
              TX packets:25890816 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:3247729393 (3.2 GB)  TX bytes:1775390659 (1.7 GB)
              Interrupt:253 Base address:0xa000




    vi /etc/udev/rules.d/70-persistent-net.rules


    # This file maintains persistent names for network interfaces.
    # See udev(7) for syntax.
    #
    # Entries are automatically added by the 75-persistent-net-generator.rules
    # file; however you are also free to add your own entries.

    # PCI device 0x10de:0x03ef (forcedeth)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:19:66:51:42:83", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

    # PCI device 0x10ec:0x8168 (r8169)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="20:cf:30:79:a4:95", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

    # PCI device 0x10ec:0x8168 (r8169)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="90:e6:ba:30:fb:0c", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"

     

    Remove the two entries at the top and then change the last entry where it says "eth2" to "eth0" and reboot your computer. 

    I thought restarting udevd and network/networking would enable it on the fly but it doesn't, I believe this is because Linux assigns a static device name at boot time only.

     


  • SSH Can't Login/Hang


    Client Log

    OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: Applying options for *
    debug1: Connecting to 192.168.1.253 [192.168.1.253] port 22.
    debug1: Connection established.
    debug1: permanently_set_uid: 0/0
    debug1: identity file /root/.ssh/identity type -1
    debug1: identity file /root/.ssh/id_rsa type 1
    debug1: identity file /root/.ssh/id_dsa type -1
    debug1: loaded 3 keys
    debug1: Remote protocol version 2.0, remote software version OpenSSH_4.6
    debug1: match: OpenSSH_4.6 pat OpenSSH*
    debug1: Enabling compatibility mode for protocol 2.0
    debug1: Local version string SSH-2.0-OpenSSH_4.3
    debug1: SSH2_MSG_KEXINIT sent
    debug1: SSH2_MSG_KEXINIT received
    debug1: kex: server->client aes128-cbc hmac-md5 none
    debug1: kex: client->server aes128-cbc hmac-md5 none
    debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
    debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
    debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
    debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
    debug1: Host '192.168.1.253' is known and matches the DSA host key.
    debug1: Found key in /root/.ssh/known_hosts:12
    debug1: ssh_dss_verify: signature correct
    debug1: SSH2_MSG_NEWKEYS sent
    debug1: expecting SSH2_MSG_NEWKEYS
    debug1: SSH2_MSG_NEWKEYS received
    debug1: SSH2_MSG_SERVICE_REQUEST sent
    debug1: SSH2_MSG_SERVICE_ACCEPT received
    debug1: Authentications that can continue: publickey,password
    debug1: Next authentication method: publickey
    debug1: Trying private key: /root/.ssh/identity
    debug1: Offering public key: /root/.ssh/id_rsa
    debug1: Authentications that can continue: publickey,password
    debug1: Trying private key: /root/.ssh/id_dsa
    debug1: Next authentication method: password
    hostmeister@192.168.1.253's password:
    debug1: Authentication succeeded (password).
    debug1: channel 0: new [client-session]
    debug1: Entering interactive session.
    debug1: Sending environment.
    debug1: Sending env LANG = en_US.UTF-8

    Server Error Log:


    sshd: error: openpty: No such file or directory
    sshd: error: session_pty_req: session 0 alloc failed

    Solution (Enable Legacy PTY because it's a new option in Kernel 3)

    Edit .config

    Virtual terminal (VT) [Y/?] y
      Support for binding and unbinding console drivers (VT_HW_CONSOLE_BINDING) [Y/n/?] y
    Unix98 PTY support (UNIX98_PTYS) [Y/?] y
      Support multiple instances of devpts (DEVPTS_MULTIPLE_INSTANCES) [Y/n/?] y
    Legacy (BSD) PTY support (LEGACY_PTYS) [Y/n/?] y
      Maximum number of legacy PTY in use (LEGACY_PTY_COUNT) [256] (NEW) y


  • Kernel panic - not syncing: Attempted to kill init! Pid: 1,comm: init Tained: G I------------- 2.6.32-358.el6.x86_64 #1 Call Trace: [] ? panic+0xa0/0x16f [] ? do_exit+0x862/0x870 [] ? fput+0x25/0


    Kernel panic - not syncing: Attempted to kill init!
    Pid: 1,comm: init Tained: G        I-------------    2.6.32-358.el6.x86_64 #1
    Call Trace:
     [<fffffff8150cfc8>] ? panic+0xa0/0x16f
     [<fffffff81073ae2>] ? do_exit+0x862/0x870
     [<fffffff81182885>] ? fput+0x25/0x30
     [<fffffff81073b48>] ? do_group_exit+0x58/0xd0
     [<fffffff81073bd7>] ? sys_exit_group+0x17/0x20
     [<fffffff8100b072>] ? system_call_fastpath+0x16/0x1b
    panic occurred, switching back to text console

    The Solution

    This was caused by a typo in /etc/selinux/config

    Make sure it is set correctly, for example I had it as so (I put disabled in the wrong spot by accident):

    It's amazing how a bad SELinux config can crash your system and cause it not to boot.

    Notice below that "SELINUXTYPE=disabled", that's wrong and was the problem.

    Bad Config Example (don't use it!):

    # This file controls the state of SELinux on the system.
    # SELINUX= can take one of these three values:
    #     enforcing - SELinux security policy is enforced.
    #     permissive - SELinux prints warnings instead of enforcing.
    #     disabled - No SELinux policy is loaded.
    SELINUX=enforcing
    # SELINUXTYPE= can take one of these two values:
    #     targeted - Targeted processes are protected,
    #     mls - Multi Level Security protection.
    SELINUXTYPE=disabled

    Good Config Example (use it because selinux causes issues):

    # This file controls the state of SELinux on the system.
    # SELINUX= can take one of these three values:
    #     enforcing - SELinux security policy is enforced.
    #     permissive - SELinux prints warnings instead of enforcing.
    #     disabled - No SELinux policy is loaded.
    SELINUX=disabled
    # SELINUXTYPE= can take one of these two values:
    #     targeted - Targeted processes are protected,
    #     mls - Multi Level Security protection.
    SELINUXTYPE=targeted


  • Directadmin Log File Locations


    This is a handy link and list of all the relevant Directadmin log files and related servers.

     

    http://help.directadmin.com/item.php?id=11

     

    DirectAdmin:

    /var/log/directadmin/error.log
    /var/log/directadmin/errortaskq.log
    /var/log/directadmin/system.log
    /var/log/directadmin/security.log


    Apache:

    /var/log/httpd/error_log
    /var/log/httpd/access_log
    /var/log/httpd/suexec_log
    /var/log/httpd/fpexec_log
    /var/log/httpd/domains/domain.com.error.log
    /var/log/httpd/domains/domain.com.log
    /var/log/messages (generic errors)


    Proftpd:

    /var/log/proftpd/access.log
    /var/log/proftpd/auth.log
    /var/log/messages (generic errors)


    PureFTPd:

    /var/log/pureftpd.log

    Dovecot and vm-pop3d:

    /var/log/maillog
    /var/log/messages

    named (bind):

    /var/log/messages


    exim:

    /var/log/exim/mainlog
    /var/log/exim/paniclog
    /var/log/exim/processlog
    /var/log/exim/rejectlog
    (on FreeBSD, they have "exim_" in front of the filenames)


    mysqld:
    RedHat:

    /var/lib/mysql/server.hostname.com.err
    FreeBSD and Debian:

    /usr/local/mysql/data/server.hostname.com.err


  • LVM How-To Activate and Access Volumes/Data


    vgchange -ay
      3 logical volume(s) in volume group "vg_12" now active

    lvscan

      inactive          '/dev/vg_12/lv_root' [144.04 GB] inherit
      inactive          '/dev/vg_12/lv_home' [1.00 GB] inherit
      inactive          '/dev/vg_12/lv_swap' [7.85 GB] inherit

     pvscan
      PV /dev/sdc2   VG vg_12   lvm2 [152.89 GB / 0    free]
      Total: 1 [152.89 GB] / in use: 1 [152.89 GB] / in no VG: 0 [0   ]


    mount /dev/mapper/vg_12-lv_root /mnt/12/


  • Linux/Debian shutdown/reboot without going through init force


    -bash-3.1# shutdown -rn now

    Connection to localhost closed by remote host.
    Connection to localhost closed.

    Sometimes I work with embedded systems/custom kernels without any of the fancy init scripts and other common Linux basics that most would expect.  This means that often the "reboot" command (which uses an init script) will never work, not only that but it will hang the server and a manual power cycle or reboot will be necessary.

    The above command forces it to reboot and works even without an init script, but be warned that it won't unmount anything so make sure the system is truly ready and safe to be rebooted.


  • Centos Net Install Format


    After booting the net install, eg. over tftp here's the format you need to install the OS when it asks for the URL:

    http://mirror.centos.org/centos-6/6.4/os/x86_64/

    Obviously change the URL and path to match the architecture and version that you're looking for and you'll be good to go.


  • bash add numbers


    num=$(($onenum + $anothernum))
    It's a bit silly that bash can't add normally as you'd expect (eg. $num + $num).
    

  • bash random number


    $[ ( $RANDOM % 5000 )  + 20 ]

    echo "$[ ( $RANDOM % 5000 )  + 20 ]"
    392
     


  • bash linux extract specific lines from a file


    start=1
    increment=5
    lines=`cat linesfile.txt|sed -n "$start","$increment"p`
    The secret here is the power of sed.

    Basically the example above would take the first 5 lines from the file.  You could change it though to say take 20 lines starting from the 5th line by adjusting the start and increment values.


  • bash for loop script for a specified number of times example


    for entity in {1..20}; do

    echo "entity=entity"

    done

    The above will loop 20 times, you could also do {2..50} etc...

    for entity in {0..10..5}; do

    echo "entity=entity"

    done

    The above will loop 10 times but will start from 0 and increment by 5 each time.


  • vzquota : (warning) block_hard_limit [102] < block_current_usage [520824] - Openvz Solution


    vzquota : (warning) block_hard_limit [102] < block_current_usage [520824]

    This is because your disk usage of the container exceeds the quota.

    Eg. once on a test container I had accidentally set it to 32MB yet the OS took about 600MB.

    Just set the quota to something bigger than the currently used space to solve it.

    vzctl set 3891 --diskspace 5G:5G --save


  • Directadmin error/** Found 7 pre-existing rpmdb problem(s), 'yum check' output follows: e2fsprogs-devel-1.41.12-3.el6.i686 has missing requires of e2fsprogs-libs = ('0', '1.41.12', '3.el6') e2fsprogs-devel-1.41.12-3.el6.i686 has missing requires of l


    Solution To The Following:

    yum -y install zlib-devel
    yum -y install e2fsprogs*


    *** Cannot find /usr/include/et/com_err.h.  (yum install libcom_err-devel) ***
    Installation didn't pass, halting install.
    Once requirements are met, run the following to continue the install:
      cd /usr/local/directadmin/scripts
      ./install.sh

    Common pre-install commands:
     http://help.directadmin.com/item.php?id=354


    ==================
    yum install libcom_err-devel
    ==================
    Total                                                                                        972 kB/s | 116 MB     02:02    
    Running rpm_check_debug
    ERROR with rpm_check_debug vs depsolve:
    keyutils-libs-devel is needed by krb5-devel-1.10.3-10.el6_4.1.i686
    libselinux-devel is needed by krb5-devel-1.10.3-10.el6_4.1.i686
    zlib-devel is needed by openssl-devel-1.0.0-27.el6_4.2.i686
    ** Found 7 pre-existing rpmdb problem(s), 'yum check' output follows:
    e2fsprogs-devel-1.41.12-3.el6.i686 has missing requires of e2fsprogs-libs = ('0', '1.41.12', '3.el6')
    e2fsprogs-devel-1.41.12-3.el6.i686 has missing requires of libcom_err-devel
    e2fsprogs-devel-1.41.12-3.el6.i686 has missing requires of pkgconfig(com_err)
    krb5-devel-1.8.2-3.el6.i686 has missing requires of keyutils-libs-devel
    krb5-devel-1.8.2-3.el6.i686 has missing requires of libcom_err-devel
    krb5-devel-1.8.2-3.el6.i686 has missing requires of libselinux-devel
    openssl-devel-1.0.0-4.el6.i686 has missing requires of zlib-devel
    Your transaction was saved, rerun it with: yum load-transaction /tmp/yum_save_tx-2013-04-10-19-56ubtoEE.yumtx
    [root@zrm /]# yum install libcom_err-devel -y
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: centos.01link.hk
     * extras: centos.01link.hk
     * updates: centos.01link.hk
    base                                                                                                  | 3.7 kB     00:00    
    extras                                                                                                | 3.5 kB     00:00    
    updates                                                                                               | 3.5 kB     00:00    
    vz-base                                                                                               |  951 B     00:00    
    vz-updates                                                                                            |  951 B     00:00    
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package libcom_err-devel.i686 0:1.41.12-14.el6 will be installed
    --> Processing Dependency: libcom_err = 1.41.12-14.el6 for package: libcom_err-devel-1.41.12-14.el6.i686
    --> Running transaction check
    ---> Package libcom_err.i686 0:1.41.12-11.el6 will be updated
    --> Processing Dependency: libcom_err = 1.41.12-11.el6 for package: libss-1.41.12-11.el6.i686
    --> Processing Dependency: libcom_err = 1.41.12-11.el6 for package: e2fsprogs-libs-1.41.12-11.el6.i686
    --> Processing Dependency: libcom_err = 1.41.12-11.el6 for package: e2fsprogs-1.41.12-11.el6.i686
    ---> Package libcom_err.i686 0:1.41.12-14.el6 will be an update
    --> Running transaction check
    ---> Package e2fsprogs.i686 0:1.41.12-11.el6 will be updated
    ---> Package e2fsprogs.i686 0:1.41.12-14.el6 will be an update
    ---> Package e2fsprogs-libs.i686 0:1.41.12-11.el6 will be updated
    ---> Package e2fsprogs-libs.i686 0:1.41.12-14.el6 will be an update
    ---> Package libss.i686 0:1.41.12-11.el6 will be updated
    ---> Package libss.i686 0:1.41.12-14.el6 will be an update
    --> Finished Dependency Resolution

    Dependencies Resolved

    =============================================================================================================================
     Package                             Arch                    Version                           Repository               Size
    =============================================================================================================================
    Installing:
     libcom_err-devel                    i686                    1.41.12-14.el6                    base                     31 k
    Updating for dependencies:
     e2fsprogs                           i686                    1.41.12-14.el6                    base                    552 k
     e2fsprogs-libs                      i686                    1.41.12-14.el6                    base                    126 k
     libcom_err                          i686                    1.41.12-14.el6                    base                     36 k
     libss                               i686                    1.41.12-14.el6                    base                     40 k

    Transaction Summary
    =============================================================================================================================
    Install       1 Package(s)
    Upgrade       4 Package(s)

    Total size: 786 k
    Downloading Packages:
    Running rpm_check_debug
    ERROR with rpm_check_debug vs depsolve:
    e2fsprogs-libs = 1.41.12-3.el6 is needed by (installed) e2fsprogs-devel-1.41.12-3.el6.i686
    ** Found 7 pre-existing rpmdb problem(s), 'yum check' output follows:
    e2fsprogs-devel-1.41.12-3.el6.i686 has missing requires of e2fsprogs-libs = ('0', '1.41.12', '3.el6')
    e2fsprogs-devel-1.41.12-3.el6.i686 has missing requires of libcom_err-devel
    e2fsprogs-devel-1.41.12-3.el6.i686 has missing requires of pkgconfig(com_err)
    krb5-devel-1.8.2-3.el6.i686 has missing requires of keyutils-libs-devel
    krb5-devel-1.8.2-3.el6.i686 has missing requires of libcom_err-devel
    krb5-devel-1.8.2-3.el6.i686 has missing requires of libselinux-devel
    openssl-devel-1.0.0-4.el6.i686 has missing requires of zlib-devel
    Your transaction was saved, rerun it with: yum load-transaction /tmp/yum_save_tx-2013-04-11-04-38irCjT5.yumtx

    ===================
    yum -y install zlib-devel
    yum -y install e2fsprogs*
     


  • mdadm recover from dead drive


    mdadm --manage /dev/md3 --add /dev/sda1

    cat /proc/mdstat
    Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10]
    md0 : inactive sdd2[1] sdd1[2](S)
          31270272 blocks
          
    md3 : active raid1 sda1[2] sdb1[1] sdc1[3](F)
          943730240 blocks [2/1] [_U]
          [>....................]  recovery =  4.9% (46270656/943730240) finish=217.0min speed=68900K/sec
         
    unused devices:

    Important Install GRUB on the new drive or you won't be able to boot from it:

    grub-install /dev/sda

    This is critical because you won't be able to boot off the new drive if the other fails (you'll likely just see a flashing cursor after your system posts and will wonder what the issue is).

    Change /dev/sda to whatever the new drive that you added is (and I do mean sda and not sda1). 


  • Toshiba Hard Drive Warranty RMA Serial Number Info


    Here's the link to the warranty checker and from there you can also create an RMA:

    https://myapps.taec.toshiba.com/myapps/admin/jsp/webrma/addRequest1NoLogin.jsp

    Note that the serial# shown in SMART is not complete as is the case for many other brand sof HDDs.

    For example a 2TB Toshiba shows the following Serial Number in SMART:

    Device Model:     TOSHIBA DT01ACA200
    Serial Number:    Z2U9JKUAS
    Firmware Version: MX4OABB0

     

    But if you enter Z2U9JKUAS into the Warranty Checker, it will say "Not Under Warranty" and to "Call Toshiba".  On the physical drive, there is a space after Z2U9JKUAS with a "TZ5".  You need to enter it as " Z2U9JKUASTZ5" to check the warranty and to do an RMA.

    I still have no idea why there is no formal documentation about this from manufacturers or that their system can't work with the main Serial# from SMART.


  • Samsung Galaxy Note I717M Canadian Version, Root and Unlock


    I chose this because I heard a lot of stories about scams and that many providers I contacted said they can't unlock the Canadian I717s (one said "my Bell server" is down). 

    This method worked perfectly on my Bell I717M and should work for all I717 in Canada, I was able to insert a foreign SIM card.  This will work abroad too but remember entering CWM mode is different for I717's in other countries (at least the US).

    Step 1 - Root + CWM

    First you need to root your phone, this is done via CWM (Clockwork Mod) flashing via Odin.

    Note that on Canadian I717 Notes, to enter CWM you hold Volume Up + Down (the other methods on the net don't work because the US I717 is programmed differently, at least for entering CWM mode/BIOS).

    After booting into CWM, install the "Superuser-i717-ICS-signed.zip" and then you'll be rooted.

    Step 2 - Flash T989 Modem

    This is the key, you need to boot into CWM mode (on my phone it's only possible when plugged into a USB cable).

    Copy the T989 file to /sdcard on your phone.

    Reboot your phone and hold Volume Up + Volume Down, you should be inside CWM mode.  Find the T989 file and install it, then reboot your phone.

    Step 3 - Follow These Steps (repeat if it doesn't work)

    I found the timing wasn't that important but it took two tries for this to work for me (I probably did a step wrong but timing does not seem to be a factor).

    *copied from http://forum.xda-developers.com/showthread.php?t=2024514

    Turn off phone. Insert a SIM from another provider into your phone.

    Click "DISMISS" on the Enter Unlock Code screen after the phone starts up.

    Wait a minute for the phone to power on and settle down.

    Go to dailer screen. press *#197328640#

    The screen will change to the hidden menu as soon as you hit the last # key in the dailer

    press [1]DEBUG SCREEN
    Press [8]PHONE CONTROL
    Press [5] SIMULATION
    Press [6] NETWORK LOCK
    Press [3] PERSO SHA256 OFF
    Wait exactly 30 seconds
    press the menu key on the phone and select back option. This will take you back to NETWORK LOCK screen.
    Press [4] NW LOCK NV DATA INITIALLIZ
    Wait exactly one minute and reboot the phone.
    Your phone should be unlocked.
    I tried this on T-989 UVLE1 original ROM with root ON.
    I haven't tested it on any other version or ROMs or any other phones.

    Disclaimer: I am not responsible for anything you do with your phone.

    Step 4 - It Should Be Working/Flash Back Old Modem

    The T989 modem worked fine for me but just to be safe, I flashed back my original modem after in CWM mode.

    If you can insert a foreign SIM card/not from your provider, it should work if the SIM has service or it may say "Unregistered SIM" which is also fine (this is what it said for my old SIMs).


  • Directadmin php.ini location


    /usr/local/lib/php.ini


  • Bad Hard Drive Slows Down Computer


    Here's a proven example of what a bad hard drive can do, it was technically functioning OK in a RAID array but the system became extremely low and the load become high and IOWAIT was even higher and I always thought it was a bad application.  The truth is that this failing 1TB Hitachi has slowly gotten worse and caused huge slowdowns, (eg. 100% load on Thunderbird waiting for e-mails to load etc..).  After swapping it out, tabs change instantly, emails are not lagged, and Firefox does slow down or lag.  Basically generally slowness in your system that can't be explained or corrected is often due to a bad hard drive causing high IOWAIT which results in extreme lag.  

     

     

    Look below at all of the UDMA_CRC_ERRORS

    199 UDMA_CRC_Error_Count    0x000a   200   200   000    Old_age   Always       -       122

    And the other error messages from the SMART log:

     

    Error 122 occurred at disk power-on lifetime: 20037 hours (834 days + 21 hours)
      When the command that caused the error occurred, the device was active or idle.

      After command completion occurred, registers were:
      ER ST SC SN CL CH DH
      -- -- -- -- -- -- --
      84 51 00 00 00 00 00

      Commands leading to the command that caused the error were:
      CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
      -- -- -- -- -- -- -- --  ----------------  --------------------
      ec 00 00 00 00 00 a0 08  25d+05:58:47.630  IDENTIFY DEVICE
      60 18 00 27 54 fe a0 04  25d+05:58:46.675  READ FPDMA QUEUED
      60 18 00 27 54 fe a0 04  25d+05:58:45.623  READ FPDMA QUEUED
      60 18 00 27 54 fe a0 ff  25d+05:58:43.621  READ FPDMA QUEUED
      60 18 00 27 54 fe a0 ff  25d+05:58:43.611  READ FPDMA QUEUED


     

     sudo smartctl -a /dev/sdc
    smartctl 5.40 2010-03-16 r3077 [i686-pc-linux-gnu] (local build)
    Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

    === START OF INFORMATION SECTION ===
    Device Model:     Hitachi HDS721010CLA332
    Serial Number:    JP2940HQ3ZY7KH
    Firmware Version: JP4OA3EA
    User Capacity:    1,000,204,886,016 bytes
    Device is:        Not in smartctl database [for details use: -P showall]
    ATA Version is:   8
    ATA Standard is:  ATA-8-ACS revision 4
    Local Time is:    Mon Apr  8 17:59:38 2013 PDT
    SMART support is: Available - device has SMART capability.
    SMART support is: Enabled

    === START OF READ SMART DATA SECTION ===
    SMART overall-health self-assessment test result: PASSED

    General SMART Values:
    Offline data collection status:  (0x84)    Offline data collection activity
                        was suspended by an interrupting command from host.
                        Auto Offline Data Collection: Enabled.
    Self-test execution status:      (   0)    The previous self-test routine completed
                        without error or no self-test has ever
                        been run.
    Total time to complete Offline
    data collection:          (10399) seconds.
    Offline data collection
    capabilities:              (0x5b) SMART execute Offline immediate.
                        Auto Offline data collection on/off support.
                        Suspend Offline collection upon new
                        command.
                        Offline surface scan supported.
                        Self-test supported.
                        No Conveyance Self-test supported.
                        Selective Self-test supported.
    SMART capabilities:            (0x0003)    Saves SMART data before entering
                        power-saving mode.
                        Supports SMART auto save timer.
    Error logging capability:        (0x01)    Error logging supported.
                        General Purpose Logging supported.
    Short self-test routine
    recommended polling time:      (   1) minutes.
    Extended self-test routine
    recommended polling time:      ( 173) minutes.
    SCT capabilities:            (0x003d)    SCT Status supported.
                        SCT Error Recovery Control supported.
                        SCT Feature Control supported.
                        SCT Data Table supported.

    SMART Attributes Data Structure revision number: 16
    Vendor Specific SMART Attributes with Thresholds:
    ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
      1 Raw_Read_Error_Rate     0x000b   099   099   016    Pre-fail  Always       -       2
      2 Throughput_Performance  0x0005   135   135   054    Pre-fail  Offline      -       97
      3 Spin_Up_Time            0x0007   135   135   024    Pre-fail  Always       -       238 (Average 321)
      4 Start_Stop_Count        0x0012   100   100   000    Old_age   Always       -       31
      5 Reallocated_Sector_Ct   0x0033   100   100   005    Pre-fail  Always       -       0
      7 Seek_Error_Rate         0x000b   100   100   067    Pre-fail  Always       -       0
      8 Seek_Time_Performance   0x0005   138   138   020    Pre-fail  Offline      -       31
      9 Power_On_Hours          0x0012   098   098   000    Old_age   Always       -       20049
     10 Spin_Retry_Count        0x0013   100   100   060    Pre-fail  Always       -       0
     12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       31
    192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       43
    193 Load_Cycle_Count        0x0012   100   100   000    Old_age   Always       -       43
    194 Temperature_Celsius     0x0002   142   142   000    Old_age   Always       -       42 (Lifetime Min/Max 21/60)
    196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -       0
    197 Current_Pending_Sector  0x0022   100   100   000    Old_age   Always       -       0
    198 Offline_Uncorrectable   0x0008   100   100   000    Old_age   Offline      -       0
    199 UDMA_CRC_Error_Count    0x000a   200   200   000    Old_age   Always       -       122

    SMART Error Log Version: 1
    ATA Error Count: 122 (device log contains only the most recent five errors)
        CR = Command Register [HEX]
        FR = Features Register [HEX]
        SC = Sector Count Register [HEX]
        SN = Sector Number Register [HEX]
        CL = Cylinder Low Register [HEX]
        CH = Cylinder High Register [HEX]
        DH = Device/Head Register [HEX]
        DC = Device Command Register [HEX]
        ER = Error register [HEX]
        ST = Status register [HEX]
    Powered_Up_Time is measured from power on, and printed as
    DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes,
    SS=sec, and sss=millisec. It "wraps" after 49.710 days.

    Error 122 occurred at disk power-on lifetime: 20037 hours (834 days + 21 hours)
      When the command that caused the error occurred, the device was active or idle.

      After command completion occurred, registers were:
      ER ST SC SN CL CH DH
      -- -- -- -- -- -- --
      84 51 00 00 00 00 00

      Commands leading to the command that caused the error were:
      CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
      -- -- -- -- -- -- -- --  ----------------  --------------------
      ec 00 00 00 00 00 a0 08  25d+05:58:47.630  IDENTIFY DEVICE
      60 18 00 27 54 fe a0 04  25d+05:58:46.675  READ FPDMA QUEUED
      60 18 00 27 54 fe a0 04  25d+05:58:45.623  READ FPDMA QUEUED
      60 18 00 27 54 fe a0 ff  25d+05:58:43.621  READ FPDMA QUEUED
      60 18 00 27 54 fe a0 ff  25d+05:58:43.611  READ FPDMA QUEUED

    Error 121 occurred at disk power-on lifetime: 20037 hours (834 days + 21 hours)
      When the command that caused the error occurred, the device was active or idle.

      After command completion occurred, registers were:
      ER ST SC SN CL CH DH
      -- -- -- -- -- -- --
      84 51 09 36 54 fe 05

      Commands leading to the command that caused the error were:
      CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
      -- -- -- -- -- -- -- --  ----------------  --------------------
      60 18 00 27 54 fe 40 08  25d+05:58:43.528  READ FPDMA QUEUED
      60 10 00 bf 6c fe 40 08  25d+05:58:43.479  READ FPDMA QUEUED
      60 20 00 87 3e fd 40 08  25d+05:58:43.427  READ FPDMA QUEUED
      60 18 00 ff 1b fe 40 08  25d+05:58:43.372  READ FPDMA QUEUED
      60 20 00 67 fd fd 40 08  25d+05:58:43.345  READ FPDMA QUEUED

    Error 120 occurred at disk power-on lifetime: 20037 hours (834 days + 21 hours)
      When the command that caused the error occurred, the device was active or idle.

      After command completion occurred, registers were:
      ER ST SC SN CL CH DH
      -- -- -- -- -- -- --
      84 51 01 de e7 fc 05

      Commands leading to the command that caused the error were:
      CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
      -- -- -- -- -- -- -- --  ----------------  --------------------
      60 10 00 cf e7 fc 40 08  25d+05:58:13.286  READ FPDMA QUEUED
      60 10 00 af 83 fc 40 08  25d+05:58:13.267  READ FPDMA QUEUED
      ef 10 02 00 00 00 a0 08  25d+05:58:13.266  SET FEATURES [Reserved for Serial ATA]
      27 00 00 00 00 00 e0 08  25d+05:58:13.265  READ NATIVE MAX ADDRESS EXT
      ec 00 00 00 00 00 a0 08  25d+05:58:13.261  IDENTIFY DEVICE

    Error 119 occurred at disk power-on lifetime: 20037 hours (834 days + 21 hours)
      When the command that caused the error occurred, the device was active or idle.

      After command completion occurred, registers were:
      ER ST SC SN CL CH DH
      -- -- -- -- -- -- --
      84 51 01 be 83 fc 05

      Commands leading to the command that caused the error were:
      CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
      -- -- -- -- -- -- -- --  ----------------  --------------------
      60 10 00 af 83 fc 40 08  25d+05:58:09.177  READ FPDMA QUEUED
      ef 10 02 00 00 00 a0 08  25d+05:58:09.176  SET FEATURES [Reserved for Serial ATA]
      27 00 00 00 00 00 e0 08  25d+05:58:09.175  READ NATIVE MAX ADDRESS EXT
      ec 00 00 00 00 00 a0 08  25d+05:58:09.171  IDENTIFY DEVICE
      ef 03 42 00 00 00 a0 08  25d+05:58:09.170  SET FEATURES [Set transfer mode]

    Error 118 occurred at disk power-on lifetime: 20037 hours (834 days + 21 hours)
      When the command that caused the error occurred, the device was active or idle.

      After command completion occurred, registers were:
      ER ST SC SN CL CH DH
      -- -- -- -- -- -- --
      84 51 00 00 00 00 00

      Commands leading to the command that caused the error were:
      CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
      -- -- -- -- -- -- -- --  ----------------  --------------------
      ec 00 00 00 00 00 a0 08  25d+05:57:34.494  IDENTIFY DEVICE
      60 10 00 af 83 fc a0 04  25d+05:57:33.538  READ FPDMA QUEUED
      60 10 00 af 83 fc a0 04  25d+05:57:32.486  READ FPDMA QUEUED
      60 10 00 af 83 fc a0 ff  25d+05:57:30.486  READ FPDMA QUEUED
      60 10 00 af 83 fc a0 ff  25d+05:57:30.477  READ FPDMA QUEUED

    SMART Self-test log structure revision number 1
    Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
    # 1  Short offline       Completed without error       00%       207         -

    SMART Selective self-test log data structure revision number 1
     SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
        1        0        0  Not_testing
        2        0        0  Not_testing
        3        0        0  Not_testing
        4        0        0  Not_testing
        5        0        0  Not_testing
    Selective self-test flags (0x0):
      After scanning selected spans, do NOT read-scan remainder of disk.
    If Selective self-test is pending on power-up, resume after 0 minute delay.
     


  • Hitachi Serial Numbers for Hard Drives without seeing the physical drive


    Here's what SMART tells me the serial number is:

    === START OF INFORMATION SECTION ===
    Device Model:     Hitachi HDS721010CLA332
    Serial Number:    JP2940HQ3ZY7KH
    Firmware Version: JP4OA3EA
    User Capacity:    1,000,204,886,016 bytes
    Device is:        Not in smartctl database [for details use: -P showall]
    ATA Version is:   8
    ATA Standard is:  ATA-8-ACS revision 4
    Local Time is:    Mon Apr  8 17:47:02 2013 PDT
    SMART support is: Available - device has SMART capability.
    SMART support is: Enabled

    As we can see it says "JP2940HQ3ZY7KH" it the serial number but this number is not valid to Hitachi when entered here to check the Warranty:

    http://www.hgst.com/portal/site/en/support/warranty/

    When looking at the actual drive you will see "HQ3ZY7KH" which omits the beginning "JP2940" that SMART reports.

    This is the case with other manufacturers too, sometimes you have to add or remove things from what SMART gives you.  It should be mandatory that what appears as the SERIAL# in the firmware is the same as the sticker.

    When you have a lot of drives to deal with it's easier and quicker to use a program to pull the serial rather than opening the case(s) of multiple computers.


  • Strange SATA error code when turning on HDD/Hard drive - [1433128.139339] sd 5:0:1:0: [sde] Unhandled error code [1433128.139343] sd 5:0:1:0: [sde] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [1433128.139348] sd 5:0:1:0: [sde] CDB: Read(10):


    [1433128.139339] sd 5:0:1:0: [sde] Unhandled error code
    [1433128.139343] sd 5:0:1:0: [sde] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
    [1433128.139348] sd 5:0:1:0: [sde] CDB: Read(10): 28 00 00 00 00 00 00 00 08 00
    [1433128.139360] end_request: I/O error, dev sde, sector 0
    [1433128.139410] sd 5:0:1:0: [sde] Unhandled error code
    [1433128.139414] sd 5:0:1:0: [sde] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
    [1433128.139420] sd 5:0:1:0: [sde] CDB: Read(10): 28 00 74 70 6d a8 00 00 08 00
    [1433128.139433] end_request: I/O error, dev sde, sector 1953525160
    [1433128.139462] sd 5:0:1:0: [sde] Unhandled error code
    [1433128.139466] sd 5:0:1:0: [sde] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
    [1433128.139472] sd 5:0:1:0: [sde] CDB: Read(10): 28 00 74 70 6d a8 00 00 08 00
    [1433128.139484] end_request: I/O error, dev sde, sector 1953525160
    [1433128.139581] sd 5:0:1:0: [sde] Unhandled error code
    [1433128.139585] sd 5:0:1:0: [sde] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
    [1433128.139591] sd 5:0:1:0: [sde] CDB: Read(10): 28 00 00 00 00 00 00 00 20 00
    [1433128.139604] end_request: I/O error, dev sde, sector 0
    [1433128.139634] sd 5:0:1:0: [sde] Unhandled error code
    [1433128.139638] sd 5:0:1:0: [sde] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
    [1433128.139644] sd 5:0:1:0: [sde] CDB: Read(10): 28 00 00 00 00 00 00 00 08 00
    [1433128.139657] end_request: I/O error, dev sde, sector 0

     


  • Samsung Galaxy Note ICS Corrupting microSDHC partition table?


    This was partitioned as a single 32GB VFAT but when I inserted it into the phone it said that it can't read it and now here is how the partition table looks.  Interestingly enough the data works and reads fine from the computer still.

    Disk /dev/sdb1: 32.1 GB, 32085360640 bytes
    64 heads, 32 sectors/track, 30598 cylinders, total 62666720 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x2052474d

    This doesn't look like a partition table
    Probably you selected the wrong device.

         Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1p1   ?     6579571  1924427647   958924038+  70  DiskSecure Multi-Boot
    /dev/sdb1p2   ?  1953251627  3771827541   909287957+  43  Unknown
    /dev/sdb1p3   ?   225735265   225735274           5   72  Unknown
    /dev/sdb1p4      2642411520  2642463409       25945    0  Empty

     

     


  • Virtualbox Failed to open a session for the virtual machine XP. Failed to launch Remote Desktop Extension server (Unknown Status 0x80004005). Failed to load VMMR0.r0 (VERR_SUPLIB_OWNER_NOT_ROOT).


    Failed to open a session for the virtual machine XP.
    Failed to launch Remote Desktop Extension server (Unknown Status 0x80004005).


    Disabled remote display:

    Failed to load VMMR0.r0 (VERR_SUPLIB_OWNER_NOT_ROOT).

    solution

    chown root.root /usr/lib/


  • How to log all PHP based E-mails for abuse


    Step #1 - Create Wrapper Script

    vi /usr/local/bin/phpsendmail

    #!/usr/bin/php
    <?php

    //changed by realtechtalk.com to make the log readable
    /**
      This script is a sendmail wrapper for php to log calls of the php mail() function.
      Author: Till Brehm, www.ispconfig.org
      (Hopefully) secured by David Goodwin <david @ _palepurple_.co.uk>
    */

    $sendmail_bin = '/usr/sbin/sendmail';
    $logfile = '/tmp/mail_php.log';

    //* Get the email content
    $logline = '';
    $pointer = fopen('php://stdin', 'r');

    while ($line = fgets($pointer)) {
            if(preg_match('/^to:/i', $line) || preg_match('/^from:/i', $line)) {
                    $logline .= trim($line).' ';
            }
            $mail .= $line;
    }

    //* compose the sendmail command
    $command = 'echo ' . escapeshellarg($mail) . ' | '.$sendmail_bin.' -t -i';
    for ($i = 1; $i < $_SERVER['argc']; $i++) {
            $command .= escapeshellarg($_SERVER['argv'][$i]).' ';
    }



    //* Write the log
    //file_put_contents($logfile, date('Y-m-d H:i:s') . ' ' . $_ENV['PWD'] . ' ' . $logline, FILE_APPEND);

    //changed by realtechtalk.com to make the log readable
    file_put_contents($logfile, date('Y-m-d H:i:s') . ' ' . $_ENV['PWD'] . ' ' . $logline . PHP_EOL, FILE_APPEND);
    //* Execute the command
    return shell_exec($command);
    ?>

    Make it executable:

    chmod +x /usr/local/bin/phpsendmail

    Create Log File (on Centos the log does not get created or written to unless you do it manually)

    touch /tmp/mail_php.log; chmod 777 /tmp/mail_php.log;chown apache.apache /tmp/mail_php.log

    Step 2 - Backup & Modify php.ini

    cp /etc/php.ini /etc/php.ini-bk

    (Your php.ini may be in a different location depending on your OS/control panel).

    Edit  /etc/php.ini

    Find the part that starts with "sendmail" and make it like my example below:

    sendmail_path = /usr/local/bin/phpsendmail

    ; For Win32 only.
    ;sendmail_from = me@example.com

    ; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
    ;sendmail_path = /usr/sbin/sendmail -t -i
    sendmail_path = /usr/local/bin/phpsendmail

    Restart httpd:

    service httpd restart

    After this you should find entries in /tmp/mail_php.log
     


  • iptables v1.4.10: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)


    I have iptable_filter loaded on the hostnode so I don't understand this issue.


  • Samba Solution To Error "[2013/02/22 19:06:37.373564, 0] param/loadparm.c:8004(lp_do_parameter) Global parameter guest account found in service section!"


    [2013/02/22 19:06:37.373564,  0] param/loadparm.c:8004(lp_do_parameter)
      Global parameter guest account found in service section!

    This is annoying but the solution is simple:

    The line "guest account = " is in the section for a share (in /etc/samba/smb.conf), but it should be under globals. Move it under [global] and then everything should be fine.


  • Linux OpenOffice Convert .doc/documents to PDF format with unoconv


    Install unoconv

    unoconv -d document -f pdf file.doc

    Change "file.doc" to the name of your document.  Note you could specify *.doc and it will convert all .doc's in the current directory to pdf which is very handy.

    unoconv uses the cli from OpenOffice to do this, OpenOffice actually doesn't have an easy way I've found of doing this despite it having the functionality.
     


  • Centos 6 RTL8111/8168B r8169 link up and down error solution/fix


    02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 03)

    For whatever reason it seems the r8169 driver that ships and has shipped with most Linux distros for years is still flawed and does not work properly on these cards, causing 100mbit connectivity when it should be 1gbit and even worse, causing random network dropouts.  The r8169 driver in Linux kernels is simply not meant to be used on this cards.

    You need to download and compile the driver from here:

    http://realtechtalk.com/downloads/r8168-8.035.00.tar.bz2

     

    For Centos Enable the elrepo

    Centos 6: rpm -Uvh http://elrepo.org/elrepo-release-6-5.el6.elrepo.noarch.rpm

    yum -y install kmod-r8168


  • OpenVZ - how to manually restore a VPS from another host or backup


    There are 3 pieces that are required to restore and make it work (of course consider if any kernel modules need to re-enabled and if you need to change the IPs):

    1. Copy the vz/private/VEID directory to /vz/private
    2. Copy the vz/conf/VEID.conf to /etc/vz/conf
    3. mkdir /vz/root/VEID

    After that you should be able to see the VE in vzlist -a

    You should then be able to start it normally.


  • Linux/Ubuntu Samsung Linux Driver Praise with CLP-365W


    Usually a lot of things don't work right on Linux, but Samsung printers aren't one of them.  I used to have a CLP310N that never worked right in Linux, it would print strange lines over pictures or with some programs, no picture at all.  I was using whatever the default driver that Ubuntu found.

    Now I upgraded to a CLP-365W which is basically the same thing with wireless but no driver from Ubuntu (eg CLP-350) works.  I was forced to go to Samsung's site and was surprised they have a "Unified Linux Driver", this basically includes all of their supported printers and you simply just run the .sh file and it does the rest.

    I'm very happy with Samsung and their Linux support.  I will definitely stick with their printers as their Linux support is top notch.


  • Samsung Galaxy Note Ubuntu Linux USB Connection Error


    This pops up when connecting the phone and it doesn't seem to charge.  The phone keeps showing a status message every few seconds "Connected as a media device". 

    It's ridiculous why this phone doesn't just default as a simple USB Mass storage device.

    Here's what I see in /var/log/messages:

    Jan 30 18:51:27 QuadCoreAM2 kernel: [18038228.144046] usb 1-3: new high speed USB device using ehci_hcd and address 24
    Jan 30 18:51:28 QuadCoreAM2 kernel: [18038228.736112] usb 1-3: new high speed USB device using ehci_hcd and address 25
    Jan 30 18:51:28 QuadCoreAM2 kernel: [18038229.328485] usb 1-3: new high speed USB device using ehci_hcd and address 26
    Jan 30 18:51:29 QuadCoreAM2 kernel: [18038229.864557] usb 1-3: new high speed USB device using ehci_hcd and address 27
    Jan 30 18:51:30 QuadCoreAM2 kernel: [18038230.692394] usb 3-3: new full speed USB device using ohci_hcd and address 107
    Jan 30 18:51:30 QuadCoreAM2 kernel: [18038230.851694] usb 3-3: not running at top speed; connect to a high speed hub
    Jan 30 18:51:30 QuadCoreAM2 kernel: [18038230.871687] cdc_acm 3-3:1.1: ttyACM0: USB ACM device
    Jan 30 18:51:30 QuadCoreAM2 kernel: [18038230.952290] usb 3-3: USB disconnect, address 107

     

    Apparently this will fix it: http://www.omgubuntu.co.uk/2011/12/how-to-connect-your-android-ice-cream-sandwich-phone-to-ubuntu-for-file-access/

    My only issue is that my Ubuntu can't find mtp-tools even with --fix-missing:

    Install these packages without verification [y/N]? y
    Err http://archive.ubuntu.com/ubuntu/ maverick/main mtp-tools i386 1.0.3-4
      404  Not Found [IP: 91.189.92.200 80]
    Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/libm/libmtp/mtp-tools_1.0.3-4_i386.deb 404  Not Found [IP: 91.189.92.200 80]
    E: Unable to fetch some archives, try running apt-get update or apt-get --fix-missing.


  • badblocks in Linux to check/verify if a hard drive/HDD is good or bad


    I like badblocks and don't know a better more reliable way of checking the drive. If there are no errors from badblocks and dmesg doesn't produce any SATA related errors, the drive should be good (for now at least).

    I also prefer to do read and write mode, yes it takes ages but it is really the best way of doing it.  This gives me the most confidence in knowing that a drive, especially a new one is at least OK at the moment.

    To test in read only mode

    badblocks -v /dev/sdc

    To test in non-destructive read-write mode (to preserve data):

    badblocks -nv /dev/sdc
    Checking for bad blocks in non-destructive read-write mode

    To test in -destructive read-write mode (you will lose all data!)

    *Warning again the method below will erase all data!

    I used the option "-w" for write mode (only use this on a new drive or one where the data doesn't matter is it will wipe it out).

    I alos used "v" for verbose to get a little more info. 

    *Warning again the method below will erase all data!

     badblocks -wv /dev/sdc
    Checking for bad blocks in read-write mode
    From block 0 to 1953514584
    Testing with pattern 0xaa:



  • KVM support Ubuntu 12.04 or 12.10


    This seems to be a verified bug on KVM with no solution.  I wasn't able to get through the installer with Ubuntu 12.04, it would crash while "configuring apt".  I was able to install it with Ubuntu 12.10 but it crashes randomly at times.

    This happens with the latest Centos 6.3 kernel and KVM package, I even compiled the latest version from the KVM website and used that, but the results are still the same.

    Here's some links to discussion about the bugs:

    https://github.com/sahlberg/libiscsi/issues/32

    https://bugs.launchpad.net/ubuntu/+source/qemu-kvm/+bug/975834

    https://answers.launchpad.net/ubuntu/+source/ubiquity/+question/197304


  • OpenOffice Writer Replacing/Reformatting Dates in Tables - Howto Disable


    Tools -> Options -> OpenOffice Writer -> Table

    Uncheck "Number Recognition"

    This will permanently disable it but won't undo the damage it has already done.  I spent a long-time fighting with this horrible feature which should be disabled by default.


  • FBDIMM /PC5300F RAM chips can work properly be with mixed timing/speeds


    I've read some people/sources say "the timing must match or it won't work".  This is not true at least for the Supermicro boards I've tested this on.

    Some examples:

    PC2-5300F-555-12

    PC2-5300F-555-11

    etc.. Notice the "12" and "11"

    Also the ones that have a "PC2-5300F-555-11-B0" or "PC2-5300-555-11-D0" are also fine.

    What happens is what one would expect, the RAM will run at the speed of the slowest chip.


  • Samsung 4GB 1Rx4 DDR2 PC5300F FBDIMM Running Hot


    sensors|head
    i5k_amb-isa-0000
    Adapter: ISA adapter
    Ch. 0 DIMM 0:+115.0°C  (low  = +127.5°C, high = +127.5°C) 
    Ch. 0 DIMM 1: +63.5°C  (low  = +127.5°C, high = +127.5°C) 
    Ch. 0 DIMM 2: +61.0°C  (low  = +127.5°C, high = +127.5°C) 
    Ch. 1 DIMM 0: +65.0°C  (low  = +127.5°C, high = +127.5°C) 
    Ch. 1 DIMM 1: +75.0°C  (low  = +127.5°C, high = +127.5°C) 
    Ch. 1 DIMM 2: +70.0°C  (low  = +127.5°C, high = +127.5°C)

    The 115 degree chip is the 1Rx4 4GB chip, while the Ch .1 DIMM 0 is a 2Rx4 GB chip and is running cool.

    I'm not sure why but these Samsung chips with the 1Rx4 run extremely hot and this is not the only example, I have seen many other servers like this and always thought the chip was in a bad/hot spot of the server but swapping the positions didnt' change anything.

     

    Specs again of the cool/good chip:

    Samsung (Made in Korea): 4GB 2Rx4 PC2-5300F-555-11-D0

    M395T5166AZ4-CE60

    Specs of the bad/hot chip (it works perfectly fine but the heat concerns me that it won't last):

    Samsung (Mede in Korea) - no the "Mede" is not a typo, could this be fake RAM?: 4GB 1Rx4 PC2-5300F-555-11-B0

    M395T5166AZ4-CE66

    The two chips also have a different style heatsink.


  • How-to Change Thunderbird Profile


    thunderbird -ProfileManager

    Type that from the command prompt and you can choose, that's the only way you can do it which I find a bit silly.


  • How to install GRUB to the MBR of a disk image.


     cat | grub --device-map=/dev/null

    Now pay close to the attention of the beginning.

    Type: "device (hd0) VPS.img" this is telling what hd0 will be to GRUB and we're telling it the disk image file "VPS.img" in the current directory is hd0, you can specify alternate paths and image names of course.

        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.]
    device (hd0) VPS.img
    grub> device (hd0) VPS.img
    root (hd0,0)
    grub> root (hd0,0)
     Filesystem type is ext2fs, partition type 0x83
    setup (hd0)
    grub> 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)"...  15 sectors are embedded.
    succeeded
     Running "install /grub/stage1 (hd0) (hd0)1+15 p (hd0,0)/grub/stage2 /grub/grub.conf"... succeeded
    Done.


  • kvm cannot boot xen guest using lvm


    This booting error is because the Xen PV guest image uses the Xen kernel, this is not compatible with anything but a host running a Xen kernel.

    I did a kpartx -av virtual.img and then it created some partitions that showed up in fdisk.

    I mounted it and did a chroot into it and removed the xen kernel and installed a normal kernel but Xen still shows the same kernel in Grub (only the Xen one).

    This is strange but it seems like this Xen PV guest has some sort of hidden or file based virtual /boot because I can't even see the newly installed kernel.

    It's obvious that Xen must have a virtual-boot partition in the form of an image for grub somewhere on the main root filesystem but I cannot find it and as usual the Xen documentation does not refer to this or makes it too hard to find.

    fdisk -l VPS.img

    Disk VPS.img: 0 MB, 0 bytes
    255 heads, 63 sectors/track, 0 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: 0x0008c4a7

         Device Boot      Start         End      Blocks   Id  System
    VPS.img1   *           1          13      104391   83  Linux
    VPS.img2              14        1305    10377990   8e  Linux LVM
    Partition 2 has different physical/logical endings:
         phys=(1023, 254, 63) logical=(1304, 254, 63)

    I didn't notice the VPS.img1 which was created as loop0p1 with kartpx which is actually a separate boot partition.  Copy your non-xen kernel to the mounted Partition #1.  Edit the boot line to reflect the non-Xen kernel and initrd

    *Important note

    Remove the console=/dev/xvc0 from the kernel line or the kernel will not even start to boot (this should be removed permanently).  Also make sure you do a kpartx -dv VPS.img before booting and deactivate any LVM partitions from it or groups.

    kpartx -dv VPS.img
    device-mapper: remove ioctl on loop0p2 failed: Device or resource busy
    ioctl: LOOP_CLR_FD: Device or resource busy
    can't del loop : /dev/loop0
     

    vgchange -a n /dev/VolGroup00

    kpartx -dv VPS.img

    del devmap : loop0p2
    del devmap : loop0p1
    loop deleted : /dev/loop0

    For some reason I'm getting a kernel panic:

    switchroot: mount failed: No such file or directory

    Kernel panic - not syncing: Attempted to kill init

    I believe this is because the Centos initrd for the non-Xen kernel was installed using chroot and doesn't understand it needs /dev/mapper

    I used the non-Xen kernel with the Xen initrd and the process gets farther but can't access the volume groups still due to it looking for non-existent modules.

    I need to create a proper initrd in Centos

    cd /boot/
    [root@2 boot]# ls
    config-2.6.18-238.el5xen        lost+found                      System.map-2.6.18-308.24.1.el5
    config-2.6.18-308.24.1.el5      message                         vmlinuz-2.6.18-238.el5xen
    grub                            symvers-2.6.18-238.el5xen.gz    vmlinuz-2.6.18-308.24.1.el5
    initrd-2.6.18-238.el5xen.img    symvers-2.6.18-308.24.1.el5.gz  xen.gz-2.6.18-238.el5
    initrd-2.6.18-308.24.1.el5.img  System.map-2.6.18-238.el5xen    xen-syms-2.6.18-238.el5
    [root@2 boot]# mv initrd-2.6.18-308.24.1.el5.img initrd-2.6.18-308.24.1.el5.img.old
    [root@2 boot]# mkinitrd initrd-2.6.18-308.24.1.el5.img 2.6.18-308.24.1.el5
    error opening /sys/block: No such file or directory
    error opening /sys/block: No such file or directory
    No module xenblk found for kernel 2.6.18-308.24.1.el5, aborting.

    mkinitrd --with lvm --force-lvm-probe -v -f initrd-2.6.18-308.24.1.el5.img 2.6.18-308.24.1.el5
    Creating initramfs
    Looking for deps of module ehci-hcd
    Looking for deps of module ohci-hcd
    Looking for deps of module uhci-hcd
    Looking for deps of module ext3: jbd
    Looking for deps of module jbd
    Looking for driver for device VolGroup00/LogVol00
    error opening /sys/block: No such file or directory
    Looking for driver for device VolGroup00/LogVol01
    error opening /sys/block: No such file or directory
    Looking for deps of module ide-disk
    Looking for deps of module dm-mem-cache
    Looking for deps of module dm-region_hash: dm-mod dm-log
    Looking for deps of module dm-mod
    Looking for deps of module dm-log: dm-mod
    Looking for deps of module dm-message
    Looking for deps of module dm-raid45: dm-message dm-mod dm-mem-cache dm-log dm-region_hash
    Looking for deps of module lvm
    No module lvm found for kernel 2.6.18-308.24.1.el5, aborting.

    before chrooting, do a mount -o bind /sys /root/mnt/sys

    mkinitrd --with lvm --force-lvm-probe -v -f initrd-2.6.18-308.24.1.el5.img 2.6.18-308.24.1.el5
    Creating initramfs
    Looking for deps of module ehci-hcd
    Looking for deps of module ohci-hcd
    Looking for deps of module uhci-hcd
    Looking for deps of module ext3: jbd
    Looking for deps of module jbd
    Looking for driver for device VolGroup00/LogVol00
    Looking for driver for device VolGroup00/LogVol01
    Looking for deps of module ide-disk
    Looking for deps of module dm-mem-cache
    Looking for deps of module dm-region_hash: dm-mod dm-log
    Looking for deps of module dm-mod
    Looking for deps of module dm-log: dm-mod
    Looking for deps of module dm-message
    Looking for deps of module dm-raid45: dm-message dm-mod dm-mem-cache dm-log dm-region_hash
    Looking for deps of module lvm
    No module lvm found for kernel 2.6.18-308.24.1.el5, aborting.

     mkinitrd -v -f initrd-2.6.18-308.24.1.el5.img 2.6.18-308.24.1.el5Creating initramfs
    Looking for deps of module ehci-hcd
    Looking for deps of module ohci-hcd
    Looking for deps of module uhci-hcd
    Looking for deps of module ext3: jbd
    Looking for deps of module jbd
    Looking for driver for device VolGroup00/LogVol00
    Looking for driver for device VolGroup00/LogVol01
    Looking for deps of module ide-disk
    Looking for deps of module dm-mem-cache
    Looking for deps of module dm-region_hash: dm-mod dm-log
    Looking for deps of module dm-mod
    Looking for deps of module dm-log: dm-mod
    Looking for deps of module dm-message
    Looking for deps of module dm-raid45: dm-message dm-mod dm-mem-cache dm-log dm-region_hash
    Using modules:  /lib/modules/2.6.18-308.24.1.el5/kernel/drivers/usb/host/ehci-hcd.ko /lib/modules/2.6.18-308.24.1.el5/kernel/drivers/usb/host/ohci-hcd.ko /lib/modules/2.6.18-308.24.1.el5/kernel/drivers/usb/host/uhci-hcd.ko /lib/modules/2.6.18-308.24.1.el5/kernel/fs/jbd/jbd.ko /lib/modules/2.6.18-308.24.1.el5/kernel/fs/ext3/ext3.ko /lib/modules/2.6.18-308.24.1.el5/kernel/drivers/md/dm-mem-cache.ko /lib/modules/2.6.18-308.24.1.el5/kernel/drivers/md/dm-mod.ko /lib/modules/2.6.18-308.24.1.el5/kernel/drivers/md/dm-log.ko /lib/modules/2.6.18-308.24.1.el5/kernel/drivers/md/dm-region_hash.ko /lib/modules/2.6.18-308.24.1.el5/kernel/drivers/md/dm-message.ko /lib/modules/2.6.18-308.24.1.el5/kernel/drivers/md/dm-raid45.ko
    /sbin/nash -> /tmp/initrd.124034/bin/nash
    /sbin/insmod.static -> /tmp/initrd.124034/bin/insmod
    copy from `/lib/modules/2.6.18-308.24.1.el5/kernel/drivers/usb/host/ehci-hcd.ko' [elf32-i386] to `/tmp/initrd.124034/lib/ehci-hcd.ko' [elf32-i386]
    copy from `/lib/modules/2.6.18-308.24.1.el5/kernel/drivers/usb/host/ohci-hcd.ko' [elf32-i386] to `/tmp/initrd.124034/lib/ohci-hcd.ko' [elf32-i386]
    copy from `/lib/modules/2.6.18-308.24.1.el5/kernel/drivers/usb/host/uhci-hcd.ko' [elf32-i386] to `/tmp/initrd.124034/lib/uhci-hcd.ko' [elf32-i386]
    copy from `/lib/modules/2.6.18-308.24.1.el5/kernel/fs/jbd/jbd.ko' [elf32-i386] to `/tmp/initrd.124034/lib/jbd.ko' [elf32-i386]
    copy from `/lib/modules/2.6.18-308.24.1.el5/kernel/fs/ext3/ext3.ko' [elf32-i386] to `/tmp/initrd.124034/lib/ext3.ko' [elf32-i386]
    copy from `/lib/modules/2.6.18-308.24.1.el5/kernel/drivers/md/dm-mem-cache.ko' [elf32-i386] to `/tmp/initrd.124034/lib/dm-mem-cache.ko' [elf32-i386]
    copy from `/lib/modules/2.6.18-308.24.1.el5/kernel/drivers/md/dm-mod.ko' [elf32-i386] to `/tmp/initrd.124034/lib/dm-mod.ko' [elf32-i386]
    copy from `/lib/modules/2.6.18-308.24.1.el5/kernel/drivers/md/dm-log.ko' [elf32-i386] to `/tmp/initrd.124034/lib/dm-log.ko' [elf32-i386]
    copy from `/lib/modules/2.6.18-308.24.1.el5/kernel/drivers/md/dm-region_hash.ko' [elf32-i386] to `/tmp/initrd.124034/lib/dm-region_hash.ko' [elf32-i386]
    copy from `/lib/modules/2.6.18-308.24.1.el5/kernel/drivers/md/dm-message.ko' [elf32-i386] to `/tmp/initrd.124034/lib/dm-message.ko' [elf32-i386]
    copy from `/lib/modules/2.6.18-308.24.1.el5/kernel/drivers/md/dm-raid45.ko' [elf32-i386] to `/tmp/initrd.124034/lib/dm-raid45.ko' [elf32-i386]
    /sbin/dmraid.static -> /tmp/initrd.124034/bin/dmraid
    /sbin/kpartx.static -> /tmp/initrd.124034/bin/kpartx
    Adding module ehci-hcd
    Adding module ohci-hcd
    Adding module uhci-hcd
    Adding module jbd
    Adding module ext3
    Adding module dm-mem-cache
    Adding module dm-mod
    Adding module dm-log
    Adding module dm-region_hash
    Adding module dm-message
    Adding module dm-raid45
     

    this did it, the mnt proc and dev

    mount -o bind /proc mnt/proc/
    [root@12 ~]# mount -o bind /dev mnt/dev/
    [root@12 ~]# chroot mnt
    [root@12 /]# cd /boot/
    [root@12 boot]# mkinitrd -v -f initrd-2.6.18-308.24.1.el5.img 2.6.18-308.24.1.el5
    Creating initramfs
    Looking for deps of module ehci-hcd
    Looking for deps of module ohci-hcd
    Looking for deps of module uhci-hcd
    Looking for deps of module ext3: jbd
    Looking for deps of module jbd
    Looking for driver for device mapper/loop0p2
    Found DM device mapper/loop0p2
    Looking for deps of module ide-disk
    Looking for deps of module dm-mod
    Looking for deps of module dm-mirror: dm-mod dm-log
    Looking for deps of module dm-log: dm-mod
    Looking for deps of module dm-zero: dm-mod
    Looking for deps of module dm-snapshot: dm-mod
    Looking for deps of module dm-mem-cache
    Looking for deps of module dm-region_hash: dm-mod dm-log
    Looking for deps of module dm-message
    Looking for deps of module dm-raid45: dm-message dm-mod dm-mem-cache dm-log dm-region_hash
    Using modules:  /lib/modules/2.6.18-308.24.1.el5/kernel/drivers/usb/host/ehci-hcd.ko /lib/modules/2.6.18-308.24.1.el5/kernel/drivers/usb/host/ohci-hcd.ko /lib/modules/2.6.18-308.24.1.el5/kernel/drivers/usb/host/uhci-hcd.ko /lib/modules/2.6.18-308.24.1.el5/kernel/fs/jbd/jbd.ko /lib/modules/2.6.18-308.24.1.el5/kernel/fs/ext3/ext3.ko /lib/modules/2.6.18-308.24.1.el5/kernel/drivers/md/dm-mod.ko /lib/modules/2.6.18-308.24.1.el5/kernel/drivers/md/dm-log.ko /lib/modules/2.6.18-308.24.1.el5/kernel/drivers/md/dm-mirror.ko /lib/modules/2.6.18-308.24.1.el5/kernel/drivers/md/dm-zero.ko /lib/modules/2.6.18-308.24.1.el5/kernel/drivers/md/dm-snapshot.ko /lib/modules/2.6.18-308.24.1.el5/kernel/drivers/md/dm-mem-cache.ko /lib/modules/2.6.18-308.24.1.el5/kernel/drivers/md/dm-region_hash.ko /lib/modules/2.6.18-308.24.1.el5/kernel/drivers/md/dm-message.ko /lib/modules/2.6.18-308.24.1.el5/kernel/drivers/md/dm-raid45.ko
    /sbin/nash -> /tmp/initrd.125242/bin/nash
    /sbin/insmod.static -> /tmp/initrd.125242/bin/insmod
    copy from `/lib/modules/2.6.18-308.24.1.el5/kernel/drivers/usb/host/ehci-hcd.ko' [elf32-i386] to `/tmp/initrd.125242/lib/ehci-hcd.ko' [elf32-i386]
    copy from `/lib/modules/2.6.18-308.24.1.el5/kernel/drivers/usb/host/ohci-hcd.ko' [elf32-i386] to `/tmp/initrd.125242/lib/ohci-hcd.ko' [elf32-i386]
    copy from `/lib/modules/2.6.18-308.24.1.el5/kernel/drivers/usb/host/uhci-hcd.ko' [elf32-i386] to `/tmp/initrd.125242/lib/uhci-hcd.ko' [elf32-i386]
    copy from `/lib/modules/2.6.18-308.24.1.el5/kernel/fs/jbd/jbd.ko' [elf32-i386] to `/tmp/initrd.125242/lib/jbd.ko' [elf32-i386]
    copy from `/lib/modules/2.6.18-308.24.1.el5/kernel/fs/ext3/ext3.ko' [elf32-i386] to `/tmp/initrd.125242/lib/ext3.ko' [elf32-i386]
    copy from `/lib/modules/2.6.18-308.24.1.el5/kernel/drivers/md/dm-mod.ko' [elf32-i386] to `/tmp/initrd.125242/lib/dm-mod.ko' [elf32-i386]
    copy from `/lib/modules/2.6.18-308.24.1.el5/kernel/drivers/md/dm-log.ko' [elf32-i386] to `/tmp/initrd.125242/lib/dm-log.ko' [elf32-i386]
    copy from `/lib/modules/2.6.18-308.24.1.el5/kernel/drivers/md/dm-mirror.ko' [elf32-i386] to `/tmp/initrd.125242/lib/dm-mirror.ko' [elf32-i386]
    copy from `/lib/modules/2.6.18-308.24.1.el5/kernel/drivers/md/dm-zero.ko' [elf32-i386] to `/tmp/initrd.125242/lib/dm-zero.ko' [elf32-i386]
    copy from `/lib/modules/2.6.18-308.24.1.el5/kernel/drivers/md/dm-snapshot.ko' [elf32-i386] to `/tmp/initrd.125242/lib/dm-snapshot.ko' [elf32-i386]
    copy from `/lib/modules/2.6.18-308.24.1.el5/kernel/drivers/md/dm-mem-cache.ko' [elf32-i386] to `/tmp/initrd.125242/lib/dm-mem-cache.ko' [elf32-i386]
    copy from `/lib/modules/2.6.18-308.24.1.el5/kernel/drivers/md/dm-region_hash.ko' [elf32-i386] to `/tmp/initrd.125242/lib/dm-region_hash.ko' [elf32-i386]
    copy from `/lib/modules/2.6.18-308.24.1.el5/kernel/drivers/md/dm-message.ko' [elf32-i386] to `/tmp/initrd.125242/lib/dm-message.ko' [elf32-i386]
    copy from `/lib/modules/2.6.18-308.24.1.el5/kernel/drivers/md/dm-raid45.ko' [elf32-i386] to `/tmp/initrd.125242/lib/dm-raid45.ko' [elf32-i386]
    /sbin/lvm.static -> /tmp/initrd.125242/bin/lvm
    /sbin/dmraid.static -> /tmp/initrd.125242/bin/dmraid
    /sbin/kpartx.static -> /tmp/initrd.125242/bin/kpartx
    Adding module ehci-hcd
    Adding module ohci-hcd
    Adding module uhci-hcd
    Adding module jbd
    Adding module ext3
    Adding module dm-mod
    Adding module dm-log
    Adding module dm-mirror
    Adding module dm-zero
    Adding module dm-snapshot
    Adding module dm-mem-cache
    Adding module dm-region_hash
    Adding module dm-message
    Adding module dm-raid45
     

    The above got it booting but during init or after it says

    INIT: Id "co" respawning too fast: disabled for 5 minutes

    This is an easy fix, just edit:

    vi /etc/inittab

    Type: "/^co" or navigate to the line that has:

    co:2345:respawn:/sbin/agetty xvc0 9600 vt100-nav

    Comment the above line out, then uncomment the following which will be commented out below the co line:

    1:2345:respawn:/sbin/mingetty tty1
    2:2345:respawn:/sbin/mingetty tty2
    3:2345:respawn:/sbin/mingetty tty3
    4:2345:respawn:/sbin/mingetty tty4
    5:2345:respawn:/sbin/mingetty tty5
    6:2345:respawn:/sbin/mingetty tty6

    After that, reboot and your conversion from Xen PV is over and your system should be working perfectly now.

    As we can see, having a separate boot partition and LVM really complicate the migration process.


  • Thunderbird Caused Nearly 100% CPU usage with Xorg


    I closed program by program until I found the culprit, it's baffling how the cause was Thunderbird but then again it does use a lot of memory and I have thousands of messages between dozens of mailboxes.

    But still I don't think this should happen and Xorg shouldn't allow this either.

    So for those who have mysteriously high CPU usage from Xorg start closing program by program until you find the culprit.

    The interesting thing is that after reloading it, the Xorg CPU usage is fine (reloading Thunderbird that is).  It doesn't take long for my Thunderbird to slow down so I'm guessing that as it encounters these delays and gets slower and slower, this eventually causes the high Xorg CPU usage.


  • Nearly 100% CPU Usage from processes called dma0chan0 dma0chan1 dma0chan2 dma0chan3


    I never started these processes but they are from a custom based bootable Linux I've made and I've never seen this behavior on other machines or even with the same machine using different kernels.  These processes seemed to spawn on their own and I have no idea why and even worse why the CPU usage is so high?

    Here's the output from top:

      907 extaudit  30  10     0    0    0 R 90.7  0.0  16:26.16 dma0chan0-copy0                                    
      908 extaudit  30  10     0    0    0 R 90.7  0.0  16:25.78 dma0chan1-copy0                                    
      909 extaudit  30  10     0    0    0 R 90.7  0.0  16:24.45 dma0chan2-copy0                                    
      910 extaudit  30  10     0    0    0 R 90.4  0.0  16:22.41 dma0chan3-copy0 

     

    find |grep dma0
    ./sys/devices/pci0000:00/0000:00:08.0/dma:dma0chan0
    ./sys/devices/pci0000:00/0000:00:08.0/dma:dma0chan1
    ./sys/devices/pci0000:00/0000:00:08.0/dma:dma0chan2
    ./sys/devices/pci0000:00/0000:00:08.0/dma:dma0chan3
    ./sys/class/dma/dma0chan0
    ./sys/class/dma/dma0chan0/uevent
    ./sys/class/dma/dma0chan0/subsystem
    ./sys/class/dma/dma0chan0/device
    ./sys/class/dma/dma0chan0/memcpy_count
    ./sys/class/dma/dma0chan0/bytes_transferred
    ./sys/class/dma/dma0chan0/in_use
    ./sys/class/dma/dma0chan0/quickdata
    ./sys/class/dma/dma0chan0/quickdata/ring_size
    ./sys/class/dma/dma0chan0/quickdata/ring_active
    ./sys/class/dma/dma0chan0/quickdata/cap
    ./sys/class/dma/dma0chan0/quickdata/version
    ./sys/class/dma/dma0chan1
    ./sys/class/dma/dma0chan1/uevent
    ./sys/class/dma/dma0chan1/subsystem
    ./sys/class/dma/dma0chan1/device
    ./sys/class/dma/dma0chan1/memcpy_count
    ./sys/class/dma/dma0chan1/bytes_transferred
    ./sys/class/dma/dma0chan1/in_use
    ./sys/class/dma/dma0chan1/quickdata
    ./sys/class/dma/dma0chan1/quickdata/ring_size
    ./sys/class/dma/dma0chan1/quickdata/ring_active
    ./sys/class/dma/dma0chan1/quickdata/cap
    ./sys/class/dma/dma0chan1/quickdata/version
    ./sys/class/dma/dma0chan2
    ./sys/class/dma/dma0chan2/uevent
    ./sys/class/dma/dma0chan2/subsystem
    ./sys/class/dma/dma0chan2/device
    ./sys/class/dma/dma0chan2/memcpy_count
    ./sys/class/dma/dma0chan2/bytes_transferred
    ./sys/class/dma/dma0chan2/in_use
    ./sys/class/dma/dma0chan2/quickdata
    ./sys/class/dma/dma0chan2/quickdata/ring_size
    ./sys/class/dma/dma0chan2/quickdata/ring_active
    ./sys/class/dma/dma0chan2/quickdata/cap
    ./sys/class/dma/dma0chan2/quickdata/version
    ./sys/class/dma/dma0chan3
    ./sys/class/dma/dma0chan3/uevent
    ./sys/class/dma/dma0chan3/subsystem
    ./sys/class/dma/dma0chan3/device
    ./sys/class/dma/dma0chan3/memcpy_count
    ./sys/class/dma/dma0chan3/bytes_transferred
    ./sys/class/dma/dma0chan3/in_use
    ./sys/class/dma/dma0chan3/quickdata
    ./sys/class/dma/dma0chan3/quickdata/ring_size
    ./sys/class/dma/dma0chan3/quickdata/ring_active
    ./sys/class/dma/dma0chan3/quickdata/cap
    ./sys/class/dma/dma0chan3/quickdata/version
     


  • "** You must add a global ddns-update-style statement to /etc/dhcpd.conf." DHCPD Solution


    No one needs this feature for the most part, so here's what I added to /etc/dhcpd.conf to fix it:

    ddns-update-style none;


  • "Cannot load certificate file keys/server.crt: error:0906D06C:PEM" OpenVPN Solution


    Cannot load certificate file keys/server.crt: error:0906D06C:PEM

    The .crt is blank empty because when generating it I kept hitting enter for the defaults and this caused the crt not to be signed.


    Certificate is to be certified until Dec 18 00:35:49 2022 GMT (3650 days)
    Sign the certificate? [y/n]:y


    1 out of 1 certificate requests certified, commit? [y/n]y

    So if you get messages like these, actually check to see if the referenced file exists and isn't blank.  If it is then recreate the public/private keys.


  • How to convert raw,img,vdi,vmdk and other virtual image formats using qemu-img convert between VBOX/KVM/VMWare/Xen


    The example below converts youvm.img into a vdi.

    The -O vdi specifies the new format will be vdi but you can use any other valid formats/vice versa.

    qemu-img convert yourvm.img -O vdi yourvm.vdi

    This is very handy for those who need to switch between virtualization technologies.


  • Startech SV1107IPEXT KVM/IP Review


    Let's keep this simple, it's horrible, not only is the picture quality horrible (it's not a big deal) but the keyboard input is an issue.  You have to type slowly, lightly and carefully otherwise 1-keystroke could end up being dozens of keystrokes.

    It's also a confusing unit for many datacenter techs, I've seen these units hooked up wrong and the instructions themselves aren't clear.  I had to resort to shipping one to my office and take my phone pictures of the setup for the techs to understand it.

    This unit also requires power, it just takes too much space too.  I would only recommend a unit like the Lantronix because it works well, without power and doesn't have any keystroke issues.

    Startech is aware of this issue but hasn't released any new firmware since the original and its only recommendation is to upgrade/buy a different unit of theirs.


  • Lantronix KVM/IP Keyboard/Mouse not working in BIOS before booting the OS


    I've run into two issues with Lantronix based KVMs on various servers and here's how I solved them (with that said I like these units as they are Java based and OS independent and work very well, unike some other models like Startech).

    1.) If you are connected by USB only and you're sure USB support from the BIOS is enabled, you just need to click the following in Lantronix

    Interfaces -> Keyboard/Mouse

    Check "Force USB Full Speed Mode", this fixed the issue for me and I was able to access the BIOS and select OS boot options etc..

    *Save Settings

    2.) If you are connected by USB but dont' have BIOS support for USB and if you have PS2 connected go to:

    Interfaces -> Keyboard/Mouse

    Change -> "Host Interface" to "PS/2"

    *Save Settings

    I hope this helps someone as it can be a waste of time for both the customer and datacenter when this happens by preventing unnecessary work and troubleshooting.


  • Delete arp entry from Linux Howto


    arp -a
    syst (192.168.1.122) at 21:96:43:3a:62:a2 [ether] on eth0

    arp -d 192.168.1.122

    If you get an error do:

    arp -d 192.168.1.122 -i eth0

    Sometimes the arp cache just won't clear either, some say it should automatically but there are cases where the above doesn't work.  I believe it may be that some network applications are keeping the entry alive but this is just a guess.


  • lvm resize and use the remaining extra space


    df -h
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/mapper/vg_12-lv_root
                           50G  1.2G   46G   3% /
    tmpfs                 7.8G     0  7.8G   0% /dev/shm
    /dev/sda1             485M   52M  408M  12% /boot
    /dev/mapper/vg_12-lv_home
                           94G  188M   89G   1% /home


    I want to resize /dev/mapper/vg_12-lv_home

    lvresize -r -L 100M /dev/mapper/vg_12-lv_home

    The above resizes it to 100 megabytes, you could specify G for gigabytes too, of course you can't make it too small if you have used more space than the size you specify, it will throw an error.
    resize2fs 1.41.12 (17-May-2010)
    resize2fs: New size smaller than minimum (92233)

    fsadm: Resize ext4 failed
      fsadm failed: 1
      Filesystem resize failed.

    *Changing it to 1G made it work.


    Now I want to resize my root to use the maximum possible space:

    lvresize -r -l +100%FREE /dev/mapper/vg_12-lv_root
    Notice instead of using -L which specifies a specific size, I've used "-l +100%FREE", it makes vg_12-lv_root use 100% of the available free space on the physical volume I freed by resizing the lv_home above


  • Login and download all files script


    This is very handy if you're too busy and don't have time to download whatever files you need.

    The -D specifies the domains allowed, this is because I specified -H which means foreign hosts are allowed, if you don't restrict them you'll end up going to the whole internet via ads and other links just like a search Engine would follow.

    -l 0 specifies to go deep, to as many levels as possible/as exist.

    -e robots=off is important because robots.txt often says you can't view certain files which we don't want (this is intended for search engines).

    -A .zip specifies that we only want to download .zip files, you can add more, change it from zip to jpg or remove it all together if you like.

    --user and --password are hopefully obvious

    wget -l 0 -e robots=off --keep-session-cookies -A .zip -H -D allowedomain.com,otherdomain.com -U "Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20100101 Firefox/12.0" -m --user=user --password=pass http://url.com

     


  • Setup PXE Boot using Centos and dhcpd, tftp and syslinux


    This is something I often setup for clients because it's very helpful for people in datacenters, this allows custom OS installs on demand, you can customize it more by using kickstart etc.. but here's a base I use before customizing more:

    This little script below will install everything you need to get booting by PXE Linux.

    It also assumes you set a local IP (be sure not to overwrite your existing IP) on eth0:0 (note the :0) as 192.168.1.10 and it takes a simple iptables command to NAT/Masquerade everything so the NAT clients can get to the public internet (you could also use public IPs if they are available but I prefer not to do this).

     

    yum -y install tftp-server syslinux dhcp

    #note the /tftpboot directory this will be the base directory we work from
    #this will contain syslinux files and our boot images

    #copy syslinux to /tftpboot
    cp /usr/share/syslinux/pxelinux.0 /tftpboot
    cp /usr/share/syslinux/menu.c32 /tftpboot
    cp /usr/share/syslinux/memdisk /tftpboot
    cp /usr/share/syslinux/mboot.c32 /tftpboot
    cp /usr/share/syslinux/chain.c32 /tftpboot

    #create Centos 6 basedir and others like this
    #copy the /pxeboot from the mirror of Centos:
    mkdir -p /tftpboot/images/centos/6.3/x64
    cd /tftpboot/images/centos/6.3/x64
    wget http://mirror.centos.org/centos-6/6.3/os/x86_64/images/pxeboot/initrd.img
    wget http://mirror.centos.org/centos-6/6.3/os/x86_64/images/pxeboot/vmlinuz

    #set /etc/dhcpd.conf for booting:
    cat <<'EOF' > /etc/dhcpd.conf
    allow booting;
    allow bootp;
    option option-128 code 128 = string;
    option option-129 code 129 = text;
    filename "/pxelinux.0";
    #to make dhcpd happy or it won't start

    #next-server 192.168.1.10;
    authoritative;
    ddns-update-style none;

    #next, my one and only subnet

    subnet 192.168.1.0 netmask 255.255.255.0 {
        range 192.168.1.50 192.168.1.254;
        option routers 192.168.1.10;
        option domain-name-servers 208.67.222.222;
    }
    EOF


    #
    mkdir -p /tftpboot/pxelinux.cfg/

    cat << 'EOF' > /tftpboot/pxelinux.cfg/default
    default menu.c32
    prompt 5
    timeout 300

    MENU TITLE Menu
    LABEL Centos6.3x64
         MENU Label 6364
         kernel ../images/centos/6.3/x64/vmlinuz
         append initrd=../images/centos/6.3/x64/initrd.img
    EOF

    #restart dhcp server
    service dhcpd restart
    #start xinetd
    service xinetd start

    #set eth0:0 IP to 192.168.1.10
    #set iptables masquerade
    iptables -t nat -A POSTROUTING -m iprange --src-range 192.168.1.11-192.168.1.254 -j MASQUERADE


  • How to Encode all VOBs from a DVD/Bluray VIDEO_TS folder into an XVID


    In my case I already copied the VIDEO_TS folder to my hard drive.

    Here is the command for mencoder:

    mencoder -dvd-device "myvideobackup/VIDEO_TS" dvd:// -ovc xvid -oac mp3lame -lameopts cbr:br=128 -xvidencopts pass=2:bitrate=-700000 -o myvideobackup.avi


    Replace "-dvd-device myvideobackup/VIDEO_TS" with the location of your backup files or the /dev device of your DVD drive.

    The -o myvideobackup.avi is of course the name of the resulting file.

    Also note the "dvd://" option, that means take everything/all VOBs, I'm not sure why so many guides specify dvd://1 which means just the first chapter/VOB which is usually not what anyone would want.  Imagine if you backup your weddding/other important video and find you only have the first part/chapter?


  • Howto Copy/Backup/Restore All Firefox Settings/Preferences/Addons/Bookmarks to another computer/desktop


    I've used rsync again for this because I found it very simple, I've only excluded the Cache directory since it's not necessary and could be several GB in size.

    rsync -Phaz --exclude=Cache/* user@remotehost.com:/home/user/.mozilla/firefox/profile.default/* /home/user/.mozilla/firefox/ec1n9opl.default/

    This is a great way once again to get going how you were on the old/remote computer fairly quickly.  It even restores all of your history including the very tabs that were open and also includes your bookmarks, settings and addons too!


  • Thunderbird How-To Copy/Backup/Restore Accounts and Settings to Another Computer


    The best way is to use rsync, I've set it up so it doesn't copy unnecessary files, or at least ones I'm sure aren't needed.

    Here is the rsync command I used (adapt to your specific Thunderbird profile location):

    rsync -hazv user@remotehost.com:/home/user/.thunderbird/sbrer.default/* /home/user/.thunderbird/4nyb0.default/ --exclude=global* --exclude=Cache --exclude=ImapMail --exclude=Mail

    This is a great way to get your e-mail accounts going on a new computer no matter where you are, or on a new install of Thunderbird.

    Keep the exclude statements, I excluded "global*" because those are the message databases and can be gigabytes in size.  I also excluded the Cache ImapMail and Mail folders for the same reason.

    The above command made it so when I opened Thunderbird that all my account settings/folders were there so I didn't have to manually create anything.  This saves the hassle of setting up again especially if you have several mail accounts and custom settings (eg. SSL specific ports etc..)

    Update the best way*

    I finally figured out what files you need as a minimum to restore your e-mail accounts and settings. 

    They are as follows:

    prefs.js
    key3.db
    signons3.txt
    signons.sqlite
    abook*

    *Note that I had to disable all add-ons to make it work on one of my machines (it would take100% CPU and loop for more than 24 hours).  This may be because I have dozens of e-mail accounts with several hundred thousands of messages.

    How to Copy msgFilters

    They are stored inside a folder inside your profile which will either be "Mail" or "ImapMail" depending on if you use POP3 or IMAP.

    Here is a script I've made for bash/Linux to automatically do it.  For it to work you need to enter the original/old profile folder.

    eg. /home/youruser/.thunderbird/abcprofile-default

    cd /home/youruser/.thunderbird/abcprofile-default

    Put this code into a file in your folder profile and make it executable chmod +x

    #!/bin/bash

    dest=$1
    if [ -d "$dest" ]; then
    for filter in `find .|grep -i msgFilterRules`; do
     echo "copy $filter to $dest"
     cp -a $filter $dest/$filter
    done
    fi

    Execute it below by passing it the path/dir of your new profile

    ./thescriptabove.sh /home/user/.thunderbird/newprofile-default

    This script works great for me because I have dozens of mail boxes so it saves me from manually copying.


  • Disable SELinux How To Tutorial Solution


    Here is a quick script that works on most Centos versions to disable the virus/SELinux from blocking basic functionality.

    The first echo 0 statement disables SELinux instantly but it will still be enabled on reboot.

    The second line disables it permanently.

    #!/bin/bash

    #disable SELinux Immediately
    echo 0 > /selinux/enforce

    #disable SELinux Permanently
    sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

    Disabling SELinux is necessary at least on Centos 6 to even login via SSH using public key authentication!  SELinux also prevents many other legitimate and common uses/servers from functioning properly so it's important to disable on almost any server, it causes bizarre failures/behavior that are difficult to troubleshoot if you don't consider SELinux as being the culprit.


  • KVM compilation issue/solution - Disabling PIE due to missing toolchain support glib-2.12 required to compile QEMU


    qemu-kvm-1.2.0]# ./configure
    Disabling PIE due to missing toolchain support
    glib-2.12 required to compile QEMU

    Solution install glib2

    *Don't confuse glib2 with glibc, they are different and it may catch some off guard.


     yum -y install glib2*

    After that KVM should compile and install just fine.


  • KVM Windows 7 won't boot Virtual Machine/VM after install solution


    This seems to be common for some reason when trying to run Windows 7 under KVM and 7 has always had strange issues with KVM.  What happens for me is after the install it simply won't boot, it stays on the POST screen and does nothing.

    For some reason it appears the boot sector either doesn't get installed or gets corrupted with KVM.

    The solution is to boot the install disc for Windows 7 and reinstall the windows MBR into the boot sector:

    1. Boot the 7 install disc and choose the "Use recovery tools" option instead of installing. 

    2. Then click "Command Prompt" at the bottom and run the following:

    bootsect /nt60 SYS /mbr

    The end message should be something like "Bootcode was succesfully updated on all target volumes".

    After that reboot and Windows 7 should load.


  • KVM/QEMU Base/Template Images and the power they provide


     qemu-img create -b centos.5-8.x86.20120308.qcow2 -f qcow2 ../kvmguests/25000-centos5.8x86.qcow2
    Formatting '../kvmguests/25000-centos5.8x86.qcow2', fmt=qcow2, backing_file=centos.5-8.x86.20120308.qcow2, size=10485760 kB

    -b the source/base image

    -f format is qcow2 and the location of the destination image

    What is so special about this?  It's even quicker than creating a template with OpenVZ but this is an actual OS.

    It saves time and disk space because it only writes the changes to the file of your image since the base OS/image is being used as a backing.  This means you could quickly and in an automated fashion create several servers for testing purposes for your applications or stress testing etc..

    But there is one caveat and it's that you can't afford to lose the base image, it can't move or be modified/harmed otherwise the resulting images creating from it will stop working or have issues.  So it does introduce an unwanted and single point of failure, this is fine for testing but probably not wise to do for mission critical situations.


  • mdadm: /dev/sdb1 not large enough to join array solution


    mdadm --manage /dev/md1 --add /dev/sdb1
    mdadm: metadata format 00.90 unknown, ignored.
    mdadm: metadata format 00.90 unknown, ignored.
    mdadm: metadata format 00.90 unknown, ignored.
    mdadm: /dev/sdb1 not large enough to join array

    md1's first primary member /dev/sda3 has 57394 cylinders while the /dev/sdb1 has 57393 (1 less cylinder) which is why it won't work.


     fdisk -l /dev/sda3

    Disk /dev/sda3: 472.0 GB, 472081720320 bytes
    255 heads, 63 sectors/track, 57394 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0x00000000



    fdisk -l /dev/sdb1

    Disk /dev/sdb1: 472.0 GB, 472081688064 bytes
    255 heads, 63 sectors/track, 57393 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0x00000000

    Disk /dev/sdb1 doesn't contain a valid partition table

     

    The solution is to delete /dev/sdb1 and make the partition the same 57394 cylinders.

    fdisk /dev/sdb

    The number of cylinders for this disk is set to 121601.
    There is nothing wrong with that, but this is larger than 1024,
    and could in certain setups cause problems with:
    1) software that runs at boot time (e.g., old versions of LILO)
    2) booting and partitioning software from other OSs
       (e.g., DOS FDISK, OS/2 FDISK)

    Command (m for help): d
    Selected partition 1

    Command (m for help): p

    Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
    255 heads, 63 sectors/track, 121601 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0x000976e6

       Device Boot      Start         End      Blocks   Id  System

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

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

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


    #even though I'm matching the cylinders the size still ends up being off!

    fdisk -l /dev/sdb1

    Disk /dev/sdb1: 472.0 GB, 472089913344 bytes
    255 heads, 63 sectors/track, 57394 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0x00000000

    Disk /dev/sdb1 doesn't contain a valid partition table


    #but it ends up being a little bigger so it makes mdadm happy
    mdadm --manage /dev/md1 --add /dev/sdb1
    mdadm: metadata format 00.90 unknown, ignored.
    mdadm: metadata format 00.90 unknown, ignored.
    mdadm: metadata format 00.90 unknown, ignored.
    mdadm: added /dev/sdb1


  • CPanel error: "Your SSL certificate failed to install on your site."


    This error in my experience is user error although CPanel doesn't help, this message doesn't give you much to go on.

    Let's talk more about the process of setting up SSL with CPanel.

    1. Your site must have a dedicated/non-shared IP to even have the option of creating an SSL Certificate.
    2. You must create a Private Key (do not delete this private key!)
    3. You must create a CSR ( Certificate Signing Request)
    4. Use CSR to create certificate with your SSL Provider

    It sounds simple if you know how to do it but what happens if say you delete your private key after generating the CSR?

    With some clients this does happen and they end up using their CSR as their Private Key .key file which doesn't work of course.  It also doesn't help that once you delete a CSR the corresponding private key is deleted with it and CPanel doesn't warn the user.

    In either case if things aren't working the chances are that you/the client has mixed up the different certificates.  The best thing to do is to start over with a new Private Key (make sure you save it) and new CSR.


  • postfix how to send to multiple recipients default limit of 1000


    The size of the message you are trying to send exceeds a temporary size limit of the server. The message was not sent; try to reduce the message size or wait some time and try again. The server responded:  4.5.3 Error: too many recipients.

    We set this in main.cf:
    smtpd_client_recipient_rate_limit=0


    We didn't specify it before and the default is said to be 0/unlimited and it still didn't change anything.

    The real solution is actually in the smtpd_recipient_limit  (set it to however many people you were e-mailing at once, this could be important for large organizations or companies as some still do BCC thousands of people even though mailing lists/aliases/groups are preferable):
    smtpd_recipient_limit=5000

    Just reload postfix to make it take effect (service postfix reload) you don't need to restart the entire server.


  • Centos 5 and OpenVZ won't boot after kernel install


    For whatever reason the current OpenVZ yum repo file enables the RHEL6 version of OpenVZ, why is this bad?  Because if you're running Centos 5 it still defaults to using the kernel from RHEL6 which won't work on RHEL5/Centos 5.

    I only realized this after wondering why I couldn't boot into OpenVZ that it was using one meant for RHEL6.

    To fix the problem you have to edit /etc/yum.repos.d/openvz.repo and disable the "[openvz-kernel-rhel6]" section by changing "enabled=1" to "enabled=0", see the example of the two sections below.   Make sure that you don't install "vzkernel" of any sort if you're on Centos 5, it should be called "ovzkernel" and that's another way to know if things are working as you like.

    ovzkernel=Centos 5

    vzkernel=Centos 6

    vi /etc/yum.repos.d/openvz.repo

    # Stable branches

    [openvz-kernel-rhel6]
    name=OpenVZ RHEL6-based kernel
    #baseurl=http://download.openvz.org/kernel/branches/rhel6-2.6.32/current/
    mirrorlist=http://download.openvz.org/kernel/mirrors-rhel6-2.6.32
    enabled=0
    gpgcheck=1
    gpgkey=http://download.openvz.org/RPM-GPG-Key-OpenVZ
    exclude=vzkernel-firmware

    [openvz-kernel-rhel5]
    name=OpenVZ RHEL5-based kernel
    #baseurl=http://download.openvz.org/kernel/branches/rhel5-2.6.18/current/
    mirrorlist=http://download.openvz.org/kernel/mirrors-rhel5-2.6.18
    enabled=1
    gpgcheck=1
    gpgkey=http://download.openvz.org/RPM-GPG-Key-OpenVZ

     


  • Creating tunnel gives the error ioctl: no such device


    ip tunnel add tun3 mode gre remote 192.58.1.5 ttl 64

    ioctl: no such device

    I solved this on Centos by loading the ip_gre module:

    modprobe ip_gre

    On Debian I believe it is the "sit" module.


  • How to mount/access a single partition from dd image with Linux



     parted sdc.img
    GNU Parted 1.8.8
    Using /home/one/sdc.img
    Welcome to GNU Parted! Type 'help' to view a list of commands.
    (parted) unit                                                            
    Unit?  [compact]? B                                                      
    (parted) print                                                           
    Model:  (file)
    Disk /home/one/sdc.img: 32085377024B
    Sector size (logical/physical): 512B/512B
    Partition Table: msdos

    Number  Start     End           Size          Type     File system  Flags   
     1      4194304B  32085377023B  32081182720B  primary  fat32        boot, lba

     

    1. The key things above are to change the unit to bytes
    2. Divide the bytes of the starting point of your partition by 512 (because that's how many bytes per sector you get normally when dding a device)

    With dd set the blocksize: bs=512 (since our blocksize with this image is 512).  The count will be the size 32081182720 bytes/4= 32081182720

    So 4194304 bytes/512=8192 (is our start or skip=8192 with dd)

    dd if=sdc.img skip=8192 bs=512 count=8020295680 of=sdc1.img

    After that it's a matter of mounting it:

    mount -o loop sdc1.img mountlocation


  • ioctl: Operation not permitted can't delete tunnel


    When trying to delete a tunnel

    ip tunnel del tunl0

    I get this message:

    ioctl: Operation not permitted


  • ip_conntrack: table full, dropping packet. solution for Linux RHEL/Centos/Debian


    ip_conntrack: table full, dropping packet.

    A lot of clients I've seen have this issue, it really seems the default level is way too small.  Once this connection tracking table becomes full then packets get dropped which is obviously a bad thing.

    One thing to be mindful of though is that 350 bytes of memory are used per entry so there is some justification for not keeping it too high.  However, if you have multiple servers running or high traffic daemons then you'll want to increase the level which is the only solution to avoid the dropped packets.

    check to see how many connections there are:
    cat /proc/sys/net/ipv4/netfilter/ip_conntrack_count

    check to see your limit:
    cat /proc/sys/net/ipv4/netfilter/ip_conntrack_max
    65536


    double your limit:
    echo 131072 > /proc/sys/net/ipv4/ip_conntrack_max

    Make the change permanent:

    echo "net.ipv4.netfilter.ip_conntrack_max=131072" >> /etc/sysctl.conf


  • Linux/Centos how to block SSH bruteforce/dictionary attacks automatically with denyhosts


    A lot of people become nervous (and understandably so) when checking their auth or security logs, in Centos /var/log/secure and see dozens, hundreds of even thousands of attempted logins to various services, especially SSH.

    Of course you could manually block these people/IPs but no one has time to read the logs like that, what if some program or script could do it for you?

    This is what denyhosts does for you, it checks the logs and based on a certain number of failed SSH attempts, automatically adds an entry with the offending IPs to /etc/hosts.deny

    How to install denyhosts

    yum -y install denyhosts

    chkconfig denyhosts on

    service denyhosts on

    That's all there is to it and your system becomes more secure in just 3 commands and a few seconds of your time, in my opinion most Linux distros should have this enabled by default.  Just make sure you don't get you own IP blocked by numerous SSH auth failures.


  • Samsung Galaxy Note Upgrade to ICS 4.0 microSDHC card not detected/dataloss after upgrading - possible solutions


    I backed up everything in the /mnt/sd_card directory thinking that some dataloss could occur for some reason but purposely left my microSDHC unbacked up thinking that "it won't touch that since it's external" and Samsung's and other manufacturers website even say this (that it won't be affected and not to worry etc).

    Apparently I was wrong, my microSD was "undetected" and asked to be formatted after the upgrade (there goes 3-months worth of family photos).  No, of course I didn't format though since I already knew what happened, somehow during the upgrade the card was corrupted.  I'm sure that the card was mounted and the OS was rebooted without unmounting it and this easily causes fat32 dataloss.

    So what are the options?

    The most obvious thought and hope to me is that the partition table was just corrupt and my data would be easily accessible as some have said in forums, or maybe the card just wasn't being mounted by the phone.    My card was corrupt and it had nothing to do with mounting as some lucky people have encountered.

    The filesystem as I said was clearly corrupt, fdisk returned no partitions.

    #1 Backup the current state to an image

    This assumes your sdcard is plugged in as /dev/sdc, change it to whatever is correct for you.

    dd if=/dev/sdc of=sdc.img; cp sdc.img sdc.img-orig

    The cp command also makes a backup of the image so you can play around the with the backup and still have something to restore if you mess it up.

    Run testdisk on your image:

    testdisk sdc.img

    Basically it was able to restore the partition table and either through the partition or testdisk I could restore about 2.3 gigs of data.  But here's the weird part.

    df -h reports about 7 gigs used on the card (which I know is correct) but the actual accessible files are about 2.3 gigs and are from when I first installed the card.  It's as if the data from the weeks after is ignored/missing/inaccessible.  An fsck.vfat wasn't able to help with this either.

    Also all of the 2.3 gigs of pics/videos have corrupt headers and no program can view or open them.

    I've tried everything and unfortunately haven't been abl to recover anything working, let alone find the other 5 gigs of missing data.

    I wasn't able to recover any working data.

    As mentioned above I wasn't able to recover anything unfortunately and I've tried other tools that examined the filesystem and tried to recreate missing files without any different result.  My conclusion is that somehow besides corruption, some glitch caused the files to be permanently erased.  I'm still keeping the original image file(s) in hope I may be able to find a solution in the future but I'm not optimistic.

    In hindsight I learned a few valuable lessons here that I'll share after this.

    1. NEVER use fat32 as your filesystem if possible for anything (not your phone, not your external hard drive etc..), I believe Android generally supports other journal'd filesystems like ext3 and maybe NTFS.  Take the time and don't use the default fat32 or let Android format your card, do it on your computer with ext3.  The reason is that in the event the card is not unmounted or the power is suddenly cut, you shouldn't lose data like fat32 will, this is the nature of fat32 being unjournaled.

    2. You just never know, I should have removed the microSDHC card like my gut told me before upgrading or at least backed it up (I normally do periodic backups anyway but this is the one time I didn't and look what happened!).


  • Centos how to upgrade from PHP 5.2 to 5.3 without downtime


    This may sound silly but there will be conflicts/issues with the default Centos repository so you have to use a third party like remi (I prefer not to do this but it's the only option unless you migrate your sites/data to another server or can stand some downtime-not an option IMHO on a production server).

    You may need to upgrade to PHP 5.3 to run Joomla or many other reasons.

    Your host needs to use PHP 5.2.4 or higher to run this version of Joomla!

    yum install php53-* -y
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirror.ubiquityservers.com
     * extras: yum.singlehop.com
     * rpmforge: mirror.us.leaseweb.net
     * updates: mirrors.gigenet.com
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package php53.i386 0:5.3.3-13.el5_8 set to be updated
    ---> Package php53-bcmath.i386 0:5.3.3-13.el5_8 set to be updated
    ---> Package php53-cli.i386 0:5.3.3-13.el5_8 set to be updated
    ---> Package php53-common.i386 0:5.3.3-13.el5_8 set to be updated
    ---> Package php53-dba.i386 0:5.3.3-13.el5_8 set to be updated
    ---> Package php53-devel.i386 0:5.3.3-13.el5_8 set to be updated
    ---> Package php53-gd.i386 0:5.3.3-13.el5_8 set to be updated
    ---> Package php53-imap.i386 0:5.3.3-13.el5_8 set to be updated
    ---> Package php53-intl.i386 0:5.3.3-13.el5_8 set to be updated
    --> Processing Dependency: libicuuc.so.36 for package: php53-intl
    --> Processing Dependency: libicudata.so.36 for package: php53-intl
    --> Processing Dependency: libicui18n.so.36 for package: php53-intl
    --> Processing Dependency: libicuio.so.36 for package: php53-intl
    ---> Package php53-ldap.i386 0:5.3.3-13.el5_8 set to be updated
    ---> Package php53-mbstring.i386 0:5.3.3-13.el5_8 set to be updated
    ---> Package php53-mysql.i386 0:5.3.3-13.el5_8 set to be updated
    ---> Package php53-odbc.i386 0:5.3.3-13.el5_8 set to be updated
    ---> Package php53-pdo.i386 0:5.3.3-13.el5_8 set to be updated
    ---> Package php53-pgsql.i386 0:5.3.3-13.el5_8 set to be updated
    ---> Package php53-process.i386 0:5.3.3-13.el5_8 set to be updated
    ---> Package php53-pspell.i386 0:5.3.3-13.el5_8 set to be updated
    ---> Package php53-snmp.i386 0:5.3.3-13.el5_8 set to be updated
    ---> Package php53-soap.i386 0:5.3.3-13.el5_8 set to be updated
    ---> Package php53-xml.i386 0:5.3.3-13.el5_8 set to be updated
    ---> Package php53-xmlrpc.i386 0:5.3.3-13.el5_8 set to be updated
    --> Running transaction check
    ---> Package libicu.i386 0:3.6-5.16.1 set to be updated
    --> Processing Conflict: php53-common conflicts php-common
    --> Finished Dependency Resolution
    php53-common-5.3.3-13.el5_8.i386 from updates has depsolving problems
      --> php53-common conflicts with php-common
    Error: php53-common conflicts with php-common
     You could try using --skip-broken to work around the problem
     You could try running: package-cleanup --problems
                            package-cleanup --dupes
                            rpm -Va --nofiles --nodigest
    The program package-cleanup is found in the yum-utils package.

    As you can see it's not possible to upgrade to 5.3 because it conflicts with the default 5.2 install, there's no common-sense way to upgrade it without fully removing the existing PHP.

    So we have to enable remi, a third party repo that will make this work


    wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
    wget http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
    rpm -ivh epel-release-5-4.noarch.rpm
    rpm -ivh remi-release-5.rpm


    yum --enablerepo=remi update php php-*



    php-readline-5.1.6-15.el5.centos.1.i386 from installed has depsolving problems
      --> Missing Dependency: php-api = 20041225 is needed by package php-readline-5.1.6-15.el5.centos.1.i386 (installed)
    php-syck-0.55-4.el5.rf.i386 from installed has depsolving problems
      --> Missing Dependency: php = 5.1.6 is needed by package php-syck-0.55-4.el5.rf.i386 (installed)
    Error: Missing Dependency: php = 5.1.6 is needed by package php-syck-0.55-4.el5.rf.i386 (installed)
    Error: Missing Dependency: php-api = 20041225 is needed by package php-readline-5.1.6-15.el5.centos.1.i386 (installed)
     You could try using --skip-broken to work around the problem
     You could try running: package-cleanup --problems
                            package-cleanup --dupes
                            rpm -Va --nofiles --nodigest

    We run into an issue with php-readline and php-syck and have to remove them to make remi happy.


    yum remove php-readline php-syck

    Run the install again and it will work.

    You may get some weird messages from PHP/MySQL but everything seems to work.


    WARNING : This MySQL RPM is not an official Fedora / Red Hat build and it
    overrides the official one. Don't file bugs on Fedora Project nor Red Hat.
    Use dedicated forums http://forums.famillecollet.com/


    PHP Warning:  PHP Startup: mysql: Unable to initialize module
    Module compiled with module API=20050922
    PHP    compiled with module API=20090626
    These options need to match
     in Unknown on line 0
    PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/mysqli.so' - /usr/lib/php/modules/mysqli.so: undefined symbol: php_set_error_handling in Unknown on line 0
    PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/ncurses.so' - /usr/lib/php/modules/ncurses.so: undefined symbol: first_arg_force_ref in Unknown on line 0
    PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/pdo_mysql.so' - /usr/lib/php/modules/pdo_mysql.so: undefined symbol: php_pdo_declare_long_constant in Unknown on line 0

     

    I really do not like this method because it even updates MySQLD in the process for some reason.  Beware that when doing this the newer 5.0 version of MySQL will not let you login with a 16-character+ username this means sites/databases won't work unless you create a user with less characters (this is a weird feature of the new version and is ridiculous in my opinion).  I thought I'd mention it because I spent a lot of time troubleshooting why some databases no longer connected.


  • xen how to resize an image properly


    The best way I could figure out is to use another guest of some sort to do this, while assigning the disk that needs to be resized to the same guest.

    So say we have /dev/xvda as the guests drive and we've booted it up.

    We also have /dev/xvdb (this is going to be the image/disk to be resized).

    In this case it's based on an ext3/4 image.

    Run e2fsck on it to ensure there are no filesystem errors.

    e2fsck /dev/xvdb
    e2fsck 1.41.12 (17-May-2010)
    root: recovering journal
    root: clean, 20868/656640 files, 250543/2621440 blocks

    Remove the journal so it really becomes an ext2 filesystem (this is because it cannot be resized directly as an ext3/4)
     

    tune2fs -O ^has_journal /dev/xvdb
    tune2fs 1.41.12 (17-May-2010)
     

    Run e2fsck again just to make sure there are no errors after removing the journal

    e2fsck /dev/xvdb
    e2fsck 1.41.12 (17-May-2010)
    root: clean, 20868/656640 files, 217775/2621440 blocks
     

    Run e2fsck on the resized image (this seems silly but you'll get an error otherwise)

    resize2fs /dev/xvdb 5120M
    resize2fs 1.41.12 (17-May-2010)
    Please run 'e2fsck -f /dev/xvdb' first.


    e2fsck -f /dev/xvdb
    e2fsck 1.41.12 (17-May-2010)
    Pass 1: Checking inodes, blocks, and sizes
    Pass 2: Checking directory structure
    Pass 3: Checking directory connectivity
    Pass 4: Checking reference counts
    Pass 5: Checking group summary information
    root: 20868/656640 files (0.1% non-contiguous), 217775/2621440 blocks


    Resize the image to whatever you would like (if this is a template make sure you don't resize it to something smaller than the currently used space or obviously you'll have a corrupt template/image)


    resize2fs /dev/xvdb 5120M
    resize2fs 1.41.12 (17-May-2010)
    Resizing the filesystem on /dev/xvdb to 1310720 (4k) blocks.
    The filesystem on /dev/xvdb is now 1310720 blocks long.

    *Re-enable the journal

    tune2fs -O has_journal /dev/xvdb


  • ntpd[7047]: can't open /var/lib/ntp/drift.TEMP: Permission denied solution


    ntpd[7047]: can't open /var/lib/ntp/drift.TEMP: Permission denied

    chown ntp.ntp /var/lib/ntp/

    The solution is shown above and changes the ownership to ntp.ntp which is what the ntpd daemon/server is running as.  This is based on Centos but the same idea will apply on any other OS.  You can do a "ps aux|grep ntpd" to see what it is running as in the case it's running as a different user.

    After that this annoying message will be gone.


  • Linux Ubuntu/Debian ATI 9902 No Sound Solution on HP G6 Pavilion Laptop


    00:14.2 Audio device: Advanced Micro Devices [AMD] Hudson Azalia Controller (rev 01)

    00:01.1 Audio device: Advanced Micro Devices [AMD] nee ATI Device 9902

    Backup your also.conf file

    cp /usr/share/alsa/alsa.conf /usr/share/alsa/alsa.conf.bk

    Change all instances of "card 0" to "card 1" (no need to manually do it, this command below does it all instantly and without fail or error:

    sed -i 's/card 0/card 1/g' /usr/share/alsa/alsa.conf

    After that you may need to restart but your sound/audio should be working.


  • Joomla Error - JFolder::create: Could not create directory


    JFolder::create: Could not create directory
    Plugin Install: Failed to create directory:

     

    This can occur when trying to upload content or when installing themes/templates.

    It's usually not a permissions issue per say but doing a 777 (which is very insecure) will fix it.  But the real problem solution is that the owner of the files is different than the owner of the Apache process/server.

    Eg. if your Apache is running as user "apache" but your Joomla files/folders are owned by "abcuser", this is why you're having issues.  One solution is to give ownership to "abcuser" over the Joomla files and it will be fixed.


  • How to view an EFI GPT partition in Linux



    Disk /dev/sda: 320.0 GB, 320072933376 bytes
    256 heads, 63 sectors/track, 38761 cylinders
    Units = cylinders of 16128 * 512 = 8257536 bytes

       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1               1       38762   312571223+  ee  EFI GPT

    I was wondering why I couldn't access the above, it was a Windows 7 system.

    Solution - To view it you need to use parted and you can then mount the devices as normal.


    parted /dev/sda print

    Disk /dev/sda: 320GB
    Sector size (logical/physical): 512B/512B
    Partition Table: gpt

    Number  Start   End    Size    File system  Name                          Flags 
     1      1049kB  211MB  210MB   fat32        EFI system partition          boot  
     2      211MB   345MB  134MB                Microsoft reserved partition  msftres
     3      345MB   128GB  128GB   ntfs         Basic data partition                
     4      128GB   293GB  165GB   ntfs         Basic data partition                
     5      293GB   320GB  26.8GB  ntfs         Basic data partition          hidden

    Information: Don't forget to update /etc/fstab, if necessary.

    ntsf-3g /dev/sda3 /mnt/sda3


  • MySQL Authentication fails after Upgrade to Version 5.5


    ERROR 1045 (28000): Access denied for user 'contentmanager'@'localhost' (using password: YES)

    For fun I thought I'd reset the password:

    GRANT ALL ON thecontent.* TO contentmanager IDENTIFIED by 'dfdfsdfdsfsdfsd';
    ERROR 1470 (HY000): String 'contentmanager' is too long for user name (should be no longer than 16)

    This is ridiculous that this new version has some bizarre 16 character username limit and not only that but it causes authentication to fail.

    Apparently this is some new "feature" of MySQL and from what I understand it can't be turned off except by editing the source code and recompiling.  This is simply not an option for production servers and a disaster when sites/databases/apps stop working after upgrading.

    So the only quick solution is to create a new username that is less than 16 characters long and update your apps/config files.


  • mdadm how to add a device to an array after a failure


    This array is a RAID 1 and in this case 1 of the 2 drives failed (a WD drive and I've found them to be the weakest and most unreliable of any brand and are easily damaged/DOA when shipping them).

    mdadm --manage /dev/md0 --add /dev/sdb1

    The above assumes the array you want to add to is /dev/md0 and the device we are adding is /dev/sdb1

    *One thing to remember is to make sure the partition you are adding is the correct size for the array.  You can also get away with creating the partition and running "partprobe" instead of restarting if the HDD is not in use already.

    After that you can check /proc/mdstat and see the rebuild progress.  It will be faster or slow depending on the current IO on the existing array.


  • setquota: Mountpoint (or device) / not found. setquota: Not all specified mountpoints are using quota. with openvz solution


    Directadmin Error when changing user settings/saving
    Details


    Error with system Quotas
    setquota: Mountpoint (or device) / not found. setquota: Not all specified mountpoints are using quota.
    Debug Guide
     

    You have to disable and enable the quota's using vzquota on and off.

    After that it will work.


  • Debian UUID not working


    Neither the blkid or the UUID internal to mdadm work to automount for some reason in Debian
    partprobe doesn't work but was a good suggestion from: http://pato.dudits.net/2008/11/03/special-device-uuidxxxxxxxxxxxxxxxx-does-not-exist-especially-with-lvm

    mount: special device /dev/disk/by-uuid/431b9b96-29e8f298-e89bd504-7065bddd does not exist

    mdadm -D /dev/md_d12
    mdadm: metadata format 00.90 unknown, ignored.
    /dev/md_d12:
            Version : 00.90
      Creation Time : Thu Apr 26 03:44:13 2012
         Raid Level : raid1
         Array Size : 1953511936 (1863.01 GiB 2000.40 GB)
      Used Dev Size : 1953511936 (1863.01 GiB 2000.40 GB)
       Raid Devices : 2
      Total Devices : 1
    Preferred Minor : 12
        Persistence : Superblock is persistent

        Update Time : Wed Jun  6 03:08:39 2012
              State : clean, degraded
     Active Devices : 1
    Working Devices : 1
     Failed Devices : 0
      Spare Devices : 0

               UUID : 431b9b96:29e8f298:e89bd504:7065bddd (local to host one-desktop)
             Events : 0.111702


    blkid /dev/md_d12
    /dev/md_d12: UUID="0cca0399-58e7-44e8-a329-016ccd820ce7" TYPE="ext3"
    mount: special device /dev/disk/by-uuid/0cca0399-58e7-44e8-a329-016ccd820ce7 does not exist


  • Linux Quick and Simple Animated Banner Creation using gifsicle


    This is just how I like things, quick and simple through CLI (command line) using gifsicle for free.

    gifsicle --colors 256 --delay=200 --loop banner.gif banner-page2.gif > banner.gif

    banner.gif = the first page of the banner

    banner-page2.gif = the second page

    --delay=200 ms to switch between the two

    --loop=it goes back and forth between the two pages forever

    banner.gif=the resulting animated gif.

    There are many other options and features but this is a quick and easy way to get an Animated banner going.


  • Slow KVM Virtual Machine Performance Solved - Choose the right architecture with the CPU flag


    I am running a 64-bit host and was running a 32-bit XP guest which was crawling no matter what I was doing with it,in fact it frequently used 100% CPU power while having no real work load.  I experienced with this other guests and wondered why KVM was slow compared to say Xen or Virtualbox.

    This is because you need to use the "-cpu" flag.

    For a full list of options run:

    /usr/libexec/qemu-kvm -cpu ?

    x86           qemu64
    x86           qemu32
    x86         pentium3

    The option you need to pass is either "-cpu qemu64" or "-cpu qemu32".  Obviously qemu64 is for 64bit guests and qemu32 is for 32bit guests.

    Make sure you specify this or your guest will be extremely slow since it will be emulating the architecture and won't give you native performance if you choose the wrong architecture. 

    Also note that if you don't specify the -cpu flag it defaults to your host's architecture (eg. 64bit Centos or 32bit Centos).

    So again, the solution is to use the -cpu flag and make sure you specify the correct architecture for the guest.


  • Windows Secret Hidden Temp Directory to free out of disk space issues


    Replace "Administrator" with your username.

    C:Documents and SettingsAdministratorLocal SettingsTemp

    I have often found several gigabytes of temporary files in there!  Just be warned that they may not all be deletable if the files are being used by open programs (so close everything you can).

    This helped me in a pinch many times when for apparently no reason gigs of disk space are being used for an unknown reason.


  • MySQL how to copy/duplicate a table


    CREATE TABLE articles_backup LIKE articles

    The code above creates a new table called "articles_backup" which has the exact same structure and attributes as the original articles table.

    CREATE TABLE articles_backup SELECT * FROM articles; 

    The above code does the same thing as the first example, BUT it also copies all of the data.