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.

  • Setting Up System for First Use... Please Wait... - WHMCS Installer


    This happens sometimes that it takes a fair amount of time for some WHMCS installations but it usually ends up completing eventually.


  • ERROR 2013 (HY000): Lost connection to MySQL server during query


    The solution is simple but strange, if you copy your /var/lib/mysql directory to another server and think it will work, be sure to check if you have /var/log/mysql and binary log files.  If you do, the server will not work and will give you errors like below and crash without the proper log files.

    UPDATE user SET password=password("newpass") WHERE user='root';
    flush privileges;

    ERROR 2013 (HY000): Lost connection to MySQL server during query

    No connection. Trying to reconnect...
    Connection id:    1
    Current database: *** NONE ***

    Database changed



    /var/log/mysqld.log output:

    As we can see it is crashing and also looking for non-existent logfiles.




    170116  2:31:44  InnoDB: Started; log sequence number 4 1641421037
    170116  2:31:44 [Note] /usr/libexec/mysqld: ready for connections.
    Version: '5.1.73'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  Source distribution
    170116  2:31:45  InnoDB: Assertion failure in thread 140102772668160 in file handler/ha_innodb.cc line 875
    InnoDB: Failing assertion: cset == 0
    InnoDB: We intentionally generate a memory trap.
    InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
    InnoDB: If you get repeated assertion failures or crashes, even
    InnoDB: immediately after the mysqld startup, there may be
    InnoDB: corruption in the InnoDB tablespace. Please refer to
    InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-innodb-recovery.html
    InnoDB: about forcing recovery.
    07:31:45 UTC - mysqld got signal 6 ;
    This could be because you hit a bug. It is also possible that this binary
    or one of the libraries it was linked against is corrupt, improperly built,
    or misconfigured. This error can also be caused by malfunctioning hardware.
    We will try our best to scrape up some info that will hopefully help
    diagnose the problem, but since we have already crashed,
    something is definitely wrong and this may fail.

    key_buffer_size=16384
    read_buffer_size=262144
    max_used_connections=0
    max_threads=151
    thread_count=0
    connection_count=0
    It is possible that mysqld could use up to
    key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 49909 K  bytes of memory
    Hope that's ok; if not, decrease some variables in the equation.

    Thread pointer: 0x0
    Attempting backtrace. You can use the following information to find out
    where mysqld died. If you see no messages after this, something went
    terribly wrong...
    stack_bottom = 0 thread_stack 0x20000
    /usr/libexec/mysqld(my_print_stacktrace+0x29) [0x8509f9]
    /usr/libexec/mysqld(handle_fatal_signal+0x483) [0x6a3f13]
    /lib64/libpthread.so.0(+0xf7e0) [0x7f6c44f1c7e0]
    /lib64/libc.so.6(gsignal+0x35) [0x7f6c435505e5]
    /lib64/libc.so.6(abort+0x175) [0x7f6c43551dc5]
    /usr/libexec/mysqld() [0x72d7ab]
    /usr/libexec/mysqld(dict_mem_table_add_col+0x20e) [0x7605de]
    /usr/libexec/mysqld(dict_load_table+0x99e) [0x75bf8e]
    /usr/libexec/mysqld(dict_load_table_on_id+0x403) [0x75cd13]
    /usr/libexec/mysqld(row_purge_step+0x39c) [0x7b360c]
    /usr/libexec/mysqld(que_run_threads+0x55b) [0x7a255b]
    /usr/libexec/mysqld(trx_purge+0x332) [0x7cc902]
    /usr/libexec/mysqld(srv_master_thread+0x708) [0x7c5298]
    /lib64/libpthread.so.0(+0x7aa1) [0x7f6c44f14aa1]
    /lib64/libc.so.6(clone+0x6d) [0x7f6c43606aad]
    The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
    information that should help you find out what is causing the crash.
    170116 02:31:45 mysqld_safe Number of processes running now: 0
    170116 02:31:45 mysqld_safe mysqld restarted
    170116  2:31:45 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
    170116  2:31:45  InnoDB: Initializing buffer pool, size = 8.0M
    170116  2:31:45  InnoDB: Completed initialization of buffer pool
    InnoDB: The log sequence number in ibdata files does not match
    InnoDB: the log sequence number in the ib_logfiles!
    170116  2:31:45  InnoDB: Database was not shut down normally!
    InnoDB: Starting crash recovery.
    InnoDB: Reading tablespace information from the .ibd files...
    InnoDB: Restoring possible half-written data pages from the doublewrite
    InnoDB: buffer...
    InnoDB: In a MySQL replication slave the last master binlog file
    InnoDB: position 0 6823363, file name bin.000001
    InnoDB: Last MySQL binlog file position 0 611287495, file name /var/log/mysql/bin.000118
    170116  2:31:45  InnoDB: Started; log sequence number 4 1641421037
    170116  2:31:45 [Note] /usr/libexec/mysqld: ready for connections.
    Version: '5.1.73'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  Source distribution

    The solution

    Make sure you copy /var/log/mysql as well.


  • if script bash check if socket file (mysql.sock) exists


    The "-S" switch is important as it works with sockets if you use "-f" it will not detect the socket file is there.

     

    if [ ! -S "/var/lib/mysql/mysql.sock" ]; then

     echo "Socket does not exist, restarting"

     service mysqld restart

    fi


  • ioncube loader install howto on PHP/Centos


    Disclaimer, before starting this I do not like ioncube, it is great to protect your source code, but a big pain to setup this extension since it has to be done manually.  Further, fi you do a PHP update ioncube may no longer work, causing important sites or services to not work (I wish authors would take another approach).

    1.) Download from here: https://www.ioncube.com/loaders.php

    2.) Extract the contents and copy the appropriate .so file somewhere.

    If you want to be sure of what file to use, you can use the load wizard php file and it will tell you exactly which one to use and copy.

    3.) Edit /etc/php.ini and add the following line (of course edit the path to suit your situation):

    zend_extension = /usr/lib64/php/modules/ioncube_loader_lin_7.0.so
     

    Errors from the loader wizard:

    ionCube installation : missing zend_extension

    This means you didn't add the zend_extension line above in step#3 to your php.ini file


  • apc_shm_attach: shmat failed: in Unknown on line 0 & apc_shm_create: shmget(0, 67108864, 914) failed PHP Solution


    PHP Fatal error:  PHP Startup: apc_shm_create: shmget(0, 67108864, 914) failed: Invalid argument. It is possible that the chosen SHM segment size is higher than the operation system allows. Linux has usually a default limit of 32MB per segment. in Unknown on line 0
    PHP Fatal error:  PHP Startup: apc_shm_attach: shmat failed: in Unknown on line 0

    This error is not at all fun because it actually prevents Apache/httpd from starting or working at all. It will die during restart

    [root@phpbox stats]# service httpd status
    httpd dead but subsys locked


    Solution - Increase shmmax value in sysctl.conf to 256MB:

    Edit /etc/sysctl.conf

    kernel.shmmax  = 268435456



    sysctl -p


  • MySQLD Server shutdown remotely unexpectedly


    170110  5:35:23 [Note] /usr/libexec/mysqld: Normal shutdown

    170110  5:35:23 [Note] Event Scheduler: Purging the queue. 0 events
    170110  5:35:23  InnoDB: Starting shutdown...
    170110  5:35:24  InnoDB: Shutdown completed; log sequence number 0 12765401
    170110  5:35:24 [Note] /usr/libexec/mysqld: Shutdown complete

    170110 05:35:24 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

    This could be an accidental shutdown or the work of hackers which is something that I have before.  Finding the cause is another issue as there is no MySQL logging of when and what user initiated the shutdown.


  • cPanel Install Error kernel ipv6 module support solution


    2017-01-12 14:25:36  529 (ERROR): The installer was unable to verify that your kernel supports IPv6.
    2017-01-12 14:25:36  530 (ERROR): The message received when trying to create an IPv6 socket was Address already in use

    2017-01-12 14:25:36  531 (ERROR): Please ensure that the ipv6 module is enabled and loaded in your kernel.
    2017-01-12 14:25:36  532 (FATAL): Exiting...

    Solution

    This happened in the middle of an install that I restarted.  The only way to fix it was to restart the VPS/Server as certainly even older kernels support IPV6.


  • bash count length of string and characters


    variable="abc hello"

    How do you count it (note blank/white space counts as a character too)?

    echo "${#variable}"

    9


  • PayPal Subscription Howto Creation Automatic Payments Manual


    An easy way to pay companies and friends/family since PayPal does not have an option when sending money to make it a subscription:

    • "business" = The e-mail or PayPal ID of the person/organization to pay to.
    • a3 The recurring amount "eg. 115" will be 115 USD
    • p3 The time period (eg. 2)
    • t3 Unit of time period m=monthly,w=weekly,y=yearly
    • item_name = "the note/product service reason you are paying handy for both you and the receiver to remember what it is payment for"


    Just use this code and insert into an html file.

    <form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <input type="hidden" name="cmd" value="_xclick-subscriptions">
    <input type="hidden" name="business" value="emailofperson@hotmail.com">
    <input type="hidden" name="a3" value="115">
    <input type="hidden" name="p3" value="2">
    <input type="hidden" name="t3" value="w">
    <input type="hidden" name="currency_code" value="USD">
    <input type="hidden" name="item_name" value="Notes/nameofproduct">
    <input type="hidden" name="amount" value="115">
    <input type="hidden" name="src" value="1">
    <input type="image" src="" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
    </form>


  • bind/named rndc: connect failed: 127.0.0.1#953: connection refused (solution)


    service named status
    rndc: connect failed: 127.0.0.1#953: connection refused
    named (pid  10557) is running...


    Check /var/log/messages:
    Jan  4 17:06:22 storagebox named[10753]: none:0: open: /etc/rndc.key: permission denied
    Jan  4 17:06:22 storagebox named[10753]: couldn't add command channel 127.0.0.1#953: permission denied
    Jan  4 17:06:22 storagebox named[10753]: none:0: open: /etc/rndc.key: permission denied
    Jan  4 17:06:22 storagebox named[10753]: couldn't add command channel ::1#953: permission denied


    Solution:

    chown named.named /etc/rndc.key
    service named restart
    service named status

    It is all good now!

    version: 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6_8.3
    CPUs found: 8
    worker threads: 8
    number of zones: 20
    debug level: 0
    xfers running: 0
    xfers deferred: 0
    soa queries in progress: 0
    query logging is OFF
    recursive clients: 0/0/1000
    tcp clients: 0/100
    server is up and running
    named (pid  11067) is running...


  • PYCURL ERROR 22 - The requested URL returned error: 404 Not Found Solution


    # yum -y install qemu-kvm
    Loaded plugins: fastestmirror
    Setting up Install Process
    Loading mirror speeds from cached hostfile
     * base: mirror.lzu.edu.cn
     * elrepo: ftp.utexas.edu
     * epel: ftp.jaist.ac.jp
     * extras: mirrors.aliyun.com
     * openvz-kernel-rhel6: mirror.fdcservers.net
     * openvz-utils: mirror.fdcservers.net
     * updates: mirrors.nwsuaf.edu.cn
    Resolving Dependencies
    --> Running transaction check
    ---> Package qemu-kvm.x86_64 2:0.12.1.2-2.491.el6_8.3 will be installed
    http://mirror.fdcservers.net/openvz/kernel/branches/rhel6-2.6.32/current/repodata/91e2997c1b30cadc1c17b524b44d4e3f65af4215-filelists.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    To address this issue please refer to the below knowledge base article

    https://access.redhat.com/articles/1320623

    If above article doesn't help to resolve this issue please open a ticket with Red Hat Support.

    http://openvz.mirror.ausnetservers.net.au/kernel/branches/rhel6-2.6.32/current/repodata/91e2997c1b30cadc1c17b524b44d4e3f65af4215-filelists.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.

    Solution

    yum clean all


  • grep only certain file types howto


    This can save a lot of time, otherwise grep will go through an entire directory recursively searching every type of file but what if you are sure you only need to search txt or php files?

    grep -r -i --include=*.php "what you are searching for" /the/path/to/search


  • MySQL Allow Access from Remote Host IP and Update All Users


    Change Host="192.168.5.99" with the remote IP allowed (this is of course more secure but also cumbersome if your IP changes).  You could also have a single layer of protection that specifies the IP via firewall or both (of course both are far mor secure).

    UPDATE user SET Host="192.168.5.99" where Host="localhost"
    or for any/wildcard
    UPDATE user SET Host="%" where Host="localhost"


  • fdisk wq causes hung process


    I created a new partition table on a newly plugged in device and it caused fdisk to hang (even force kill does not work).  It also may be a bad drive or some other issue because fdisk -l hangs after the first 2 HDDs (totaly of 8 HDDs on this system):


    [1232879.903596] INFO: task fdisk:27176 blocked for more than 120 seconds.
    [1232879.903607]       Tainted: P           OE 3.16.0-38-generic #52~14.04.1-Ubuntu
    [1232879.903609] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
    [1232879.903612] fdisk           D ffff88102fd130c0     0 27176  27054 0x00000000
    [1232879.903619]  ffff880aaf987d50 0000000000000082 ffff880fff807010 ffff880aaf987fd8
    [1232879.903622]  00000000000130c0 00000000000130c0 ffff880f7ec4dbb0 ffff880aaf987e78
    [1232879.903626]  ffff880aaf987e80 7fffffffffffffff ffff880fff807010 ffffffff81203970
    [1232879.903629] Call Trace:
    [1232879.903643]  [<ffffffff81203970>] ? do_fsync+0x80/0x80
    [1232879.903649]  [<ffffffff817699f9>] schedule+0x29/0x70
    [1232879.903653]  [<ffffffff81768dd9>] schedule_timeout+0x229/0x2a0
    [1232879.903657]  [<ffffffff81203970>] ? do_fsync+0x80/0x80
    [1232879.903663]  [<ffffffff815d14e5>] ? md_make_request+0xd5/0x220
    [1232879.903666]  [<ffffffff81203970>] ? do_fsync+0x80/0x80
    [1232879.903671]  [<ffffffff815e6027>] ? dm_request+0x107/0x1a0
    [1232879.903674]  [<ffffffff81203970>] ? do_fsync+0x80/0x80
    [1232879.903678]  [<ffffffff8176a4f6>] wait_for_completion+0xa6/0x160
    [1232879.903683]  [<ffffffff810a1550>] ? wake_up_state+0x20/0x20
    [1232879.903688]  [<ffffffff8134f35e>] submit_bio_wait+0x5e/0x70
    [1232879.903693]  [<ffffffff8135b4ca>] blkdev_issue_flush+0x5a/0x90
    [1232879.903699]  [<ffffffff81267f99>] ext4_sync_fs+0xe9/0x140
    [1232879.903702]  [<ffffffff81203990>] sync_fs_one_sb+0x20/0x30
    [1232879.903707]  [<ffffffff811d7cb2>] iterate_supers+0xb2/0x110
    [1232879.903710]  [<ffffffff81203a95>] sys_sync+0x55/0x90
    [1232879.903715]  [<ffffffff8176da4d>] system_call_fastpath+0x1a/0x1f
    [1232999.926891] INFO: task fdisk:27176 blocked for more than 120 seconds.
    [1232999.926902]       Tainted: P           OE 3.16.0-38-generic #52~14.04.1-Ubuntu
    [1232999.926904] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
    [1232999.926907] fdisk           D ffff88102fd130c0     0 27176  27054 0x00000000
    [1232999.926914]  ffff880aaf987d50 0000000000000082 ffff880fff807010 ffff880aaf987fd8
    [1232999.926918]  00000000000130c0 00000000000130c0 ffff880f7ec4dbb0 ffff880aaf987e78
    [1232999.926921]  ffff880aaf987e80 7fffffffffffffff ffff880fff807010 ffffffff81203970
    [1232999.926924] Call Trace:
    [1232999.926938]  [<ffffffff81203970>] ? do_fsync+0x80/0x80
    [1232999.926945]  [<ffffffff817699f9>] schedule+0x29/0x70
    [1232999.926949]  [<ffffffff81768dd9>] schedule_timeout+0x229/0x2a0
    [1232999.926952]  [<ffffffff81203970>] ? do_fsync+0x80/0x80
    [1232999.926959]  [<ffffffff815d14e5>] ? md_make_request+0xd5/0x220
    [1232999.926962]  [<ffffffff81203970>] ? do_fsync+0x80/0x80
    [1232999.926967]  [<ffffffff815e6027>] ? dm_request+0x107/0x1a0
    [1232999.926971]  [<ffffffff81203970>] ? do_fsync+0x80/0x80
    [1232999.926974]  [<ffffffff8176a4f6>] wait_for_completion+0xa6/0x160
    [1232999.926980]  [<ffffffff810a1550>] ? wake_up_state+0x20/0x20
    [1232999.926985]  [<ffffffff8134f35e>] submit_bio_wait+0x5e/0x70
    [1232999.926989]  [<ffffffff8135b4ca>] blkdev_issue_flush+0x5a/0x90
    [1232999.926995]  [<ffffffff81267f99>] ext4_sync_fs+0xe9/0x140
    [1232999.926999]  [<ffffffff81203990>] sync_fs_one_sb+0x20/0x30
    [1232999.927003]  [<ffffffff811d7cb2>] iterate_supers+0xb2/0x110
    [1232999.927007]  [<ffffffff81203a95>] sys_sync+0x55/0x90
    [1232999.927011]  [<ffffffff8176da4d>] system_call_fastpath+0x1a/0x1f
    [1233119.950269] INFO: task fdisk:27176 blocked for more than 120 seconds.
    [1233119.950285]       Tainted: P           OE 3.16.0-38-generic #52~14.04.1-Ubuntu
    [1233119.950290] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
    [1233119.950296] fdisk           D ffff88102fd130c0     0 27176  27054 0x00000000
    [1233119.950308]  ffff880aaf987d50 0000000000000082 ffff880fff807010 ffff880aaf987fd8
    [1233119.950316]  00000000000130c0 00000000000130c0 ffff880f7ec4dbb0 ffff880aaf987e78
    [1233119.950323]  ffff880aaf987e80 7fffffffffffffff ffff880fff807010 ffffffff81203970
    [1233119.950330] Call Trace:
    [1233119.950350]  [<ffffffff81203970>] ? do_fsync+0x80/0x80
    [1233119.950362]  [<ffffffff817699f9>] schedule+0x29/0x70
    [1233119.950370]  [<ffffffff81768dd9>] schedule_timeout+0x229/0x2a0
    [1233119.950378]  [<ffffffff81203970>] ? do_fsync+0x80/0x80
    [1233119.950389]  [<ffffffff815d14e5>] ? md_make_request+0xd5/0x220
    [1233119.950396]  [<ffffffff81203970>] ? do_fsync+0x80/0x80
    [1233119.950405]  [<ffffffff815e6027>] ? dm_request+0x107/0x1a0
    [1233119.950413]  [<ffffffff81203970>] ? do_fsync+0x80/0x80
    [1233119.950420]  [<ffffffff8176a4f6>] wait_for_completion+0xa6/0x160
    [1233119.950430]  [<ffffffff810a1550>] ? wake_up_state+0x20/0x20
    [1233119.950439]  [<ffffffff8134f35e>] submit_bio_wait+0x5e/0x70
    [1233119.950447]  [<ffffffff8135b4ca>] blkdev_issue_flush+0x5a/0x90
    [1233119.950457]  [<ffffffff81267f99>] ext4_sync_fs+0xe9/0x140
    [1233119.950465]  [<ffffffff81203990>] sync_fs_one_sb+0x20/0x30
    [1233119.950473]  [<ffffffff811d7cb2>] iterate_supers+0xb2/0x110
    [1233119.950481]  [<ffffffff81203a95>] sys_sync+0x55/0x90
    [1233119.950490]  [<ffffffff8176da4d>] system_call_fastpath+0x1a/0x1f


  • ADATA SU800 256GB 3D NAND Flash SSD Test & Review


    I keep reading these drives are slower, but they are cheap and still SSD and work very fast for my needs.

    As you can see the sequential read is 481-491MB/s, if I put them in MDADM RAID10 mode (normal RAID1) they should give me well over 900MB/s and with redundancy and being very cheap for what they offer.


    [1232206.315622] scsi 8:0:1:0: Direct-Access     ATA      ADATA SU800      1A   PQ: 0 ANSI: 6
    [1232206.315649] scsi 8:0:1:0: SATA: handle(0x000a), sas_addr(0x4433221105000000), phy(5), device_name(0x0000000000000000)
    [1232206.315657] scsi 8:0:1:0: SATA: enclosure_logical_id(0x500605b0079b94b0), slot(5)
    [1232206.315764] scsi 8:0:1:0: atapi(n), ncq(y), asyn_notify(n), smart(y), fua(y), sw_preserve(y)
    [1232206.315773] scsi 8:0:1:0: qdepth(32), tagged(1), simple(0), ordered(0), scsi_level(7), cmd_que(1)
    [1232206.316834] sd 8:0:1:0: [sdj] 500118192 512-byte logical blocks: (256 GB/238 GiB)
    [1232206.316849] sd 8:0:1:0: [sdj] 4096-byte physical blocks
    [1232206.316948] sd 8:0:1:0: Attached scsi generic sg8 type 0
    [1232206.319196] sd 8:0:1:0: [sdj] Write Protect is off
    [1232206.319209] sd 8:0:1:0: [sdj] Mode Sense: 7f 00 10 08
    [1232206.319452] sd 8:0:1:0: [sdj] Write cache: enabled, read cache: enabled, supports DPO and FUA
    [1232206.323356]  sdj: unknown partition table
    [1232206.326505] sd 8:0:1:0: [sdj] Attached SCSI disk

    homebox user # dd if=/dev/sdj of=/dev/null bs=1M count=10000
    10000+0 records in
    10000+0 records out
    10485760000 bytes (10 GB) copied, 21.3731 s, 491 MB/s


    homebox user # dd if=/dev/sdk of=/dev/null bs=1M count=10000
    10000+0 records in
    10000+0 records out
    10485760000 bytes (10 GB) copied, 21.7838 s, 481 MB/s


  • mdadm kernel panic if trying to change --layout on a RAID10


    It is already known this is not possible

     

    mdadm --create /dev/md3 --level 10 --layout=f2 --raid-devices=2 /dev/sdc1 /dev/sdd1
    mdadm: /dev/sdc1 appears to be part of a raid array:
           level=raid10 devices=2 ctime=Sat Dec 24 18:44:29 2016
    mdadm: /dev/sdd1 appears to be part of a raid array:
           level=raid10 devices=2 ctime=Sat Dec 24 18:44:29 2016
    Continue creating array? y
    mdadm: Defaulting to version 1.2 metadata
    mdadm: array /dev/md3 started.
    [root@node ~]# mount/
    [root@node ~]# mkdir /mnt/md3
    [root@node ~]# mount /dev/md3 /mnt


  • remove gpt partition linux



    sudo fdisk /dev/sdh

    WARNING: GPT (GUID Partition Table) detected on '/dev/sdh'! The util fdisk doesn't support GPT. Use GNU Parted.


    WARNING: The size of this disk is 8.0 TB (8001563221504 bytes).
    DOS partition table format can not be used on drives for volumes
    larger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID
    partition table format (GPT).


    The device presents a logical sector size that is smaller than
    the physical sector size. Aligning to a physical sector (or optimal
    I/O) size boundary is recommended, or performance may be impacted.


    sudo fdisk /dev/sdh

    WARNING: GPT (GUID Partition Table) detected on '/dev/sdh'! The util fdisk doesn't support GPT. Use GNU Parted.


    WARNING: The size of this disk is 8.0 TB (8001563221504 bytes).
    DOS partition table format can not be used on drives for volumes
    larger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID
    partition table format (GPT).


    The device presents a logical sector size that is smaller than
    the physical sector size. Aligning to a physical sector (or optimal
    I/O) size boundary is recommended, or performance may be impacted.

    Command (m for help): q

    user@storbox2419:~$ sudo gdisk /dev/sdh
    GPT fdisk (gdisk) version 0.8.8

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

    Found valid MBR and GPT. Which do you want to use?
     1 - MBR
     2 - GPT
     3 - Create blank GPT

    Your answer: 1

    Command (? for help): p
    Disk /dev/sdh: 15628053167 sectors, 7.3 TiB
    Logical sector size: 512 bytes
    Disk identifier (GUID): D09B1DC2-7324-4D04-9EFA-7F2C0581B8FA
    Partition table holds up to 128 entries
    First usable sector is 34, last usable sector is 15628053133
    Partitions will be aligned on 8-sector boundaries
    Total free space is 11333216875 sectors (5.3 TiB)

    Number  Start (sector)    End (sector)  Size       Code  Name
       1          131070      4294967294   2.0 TiB     8300  Linux filesystem

    Command (? for help): wq

    Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
    PARTITIONS!!

    Do you want to proceed? (Y/N): y
    OK; writing new GUID partition table (GPT) to /dev/sdh.
    Warning: The kernel is still using the old partition table.
    The new table will be used at the next reboot.
    The operation has completed successfully.


  • mdadm mirrored RAID1 performance using RAID10 -f2 (Far Layout) is the solution


    The only way I've found in mdadm to make 2 drives perform like a proper RAID 1 (eg. the read speed should be 2x that of a single drive) is to use the --layout=f2 (far 2).

     

    mdadm raid10 performance issues.
    Be very aware that mdadm seems to default to layout=n2 (which means near). In this scenario it means it is like mdadm RAID 1 performance (you get maximum read speeds of a single drive).

    dd if=/dev/md126 of=/dev/null bs=1M count=2000
    2000+0 records in
    2000+0 records out
    2097152000 bytes (2.1 GB) copied, 6.46397 s,
    180 MB/s

    Now look at the difference in the same drives in layout=f2 (which means far).

    dd if=/dev/md126 of=/dev/null bs=1M count=2000
    2000+0 records in
    2000+0 records out
    2097152000 bytes (2.1 GB) copied, 6.46397 s,
    324 MB/s

    As we can see the speed is nearly double (a small amount of bandwidth appears to be lost as overhead due to mdadm)

     


  • MySQL [ERROR] /usr/libexec/mysqld: Table './eximstats/sends' is marked as crashed and last (automatic?) repair failed solution


    You are checking your MySQL logs in /var/log/mysqld.log and come across an error like this:

    161222 18:03:40 [ERROR] /usr/libexec/mysqld: Table './eximstats/sends' is marked as crashed and last (automatic?) repair failed
     

    The Solution:


    cd /var/lib/mysql/eximstats
    myisamchk -r sends.MYI


    - recovering (with sort) MyISAM-table 'sends.MYI'
    Data records: 71129
    - Fixing index 1
    - Fixing index 2
    - Fixing index 3
    - Fixing index 4
    - Fixing index 5
    - Fixing index 6
    - Fixing index 7
    Data records: 133388


  • How to clear all iptables rules for all tables and chains


    iptables -F
    iptables -t nat -F
    iptables -t mangle -F

    This is as simple as it gets.


  • iptables how to forward localhost port to remote public IP


    iptables -t nat -A OUTPUT -m addrtype --src-type LOCAL --dst-type LOCAL -p tcp --dport 3306 -j DNAT --to-destination ip.ip.ip.ip
    iptables -t nat -A POSTROUTING -m addrtype --src-type LOCAL --dst-type UNICAST -j MASQUERADE

    sysctl -w net.ipv4.conf.all.route_localnet=1

    Make sure you substitute "ip.ip.ip.ip" for your real public IP and also the "--dport 3306" for the port you want to forward.

    Finally run the sysctl command and also update your /etc/sysctl.conf

    You can update sysctl.ctl to allow the routing of localhost with the following command:

    echo "net.ipv4.conf.all.route_localnet=1" >> /etc/sysctl.conf

    Now this all seems simple and good but it did take some research and hunting down.  Be warned and understand that forwarding localhost/127.0.0.1 requires this method and the typical other examples do not work.  Some examples of solutions that do not work with localhost:

     

    iptables -t nat -A PREROUTING -p tcp --dport 3306 -j DNAT --to ip.ip.ip.ip:3306
    iptables -t nat -A POSTROUTING -d ip.ip.ip.ip -j MASQUERADE


     

    iptables -t nat -A PREROUTING -p tcp --dport 3306 -j DNAT --to ip.ip.ip.ip
    iptables -A FORWARD -p tcp -d ip.ip.ip.ip --dport 3306 -j ACCEPT
    iptables -t nat -A POSTROUTING -j MASQUERADE


  • mcp55 NIC not working at boot on Centos 6.6-6.8




    forcedeth 0000:00:08.0: irq 25 for MSI/MSI-X
    forcedeth 0000:00:08.0: eth0: MSI enabled
    forcedeth 0000:00:08.0: eth0: no link during initialization
    ADDRCONF(NETDEV_UP): eth0: link is not ready
    forcedeth 0000:00:08.0: eth0: link up
    ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready


    Dec  1 18:21:32 box15 kernel: forcedeth: Reverse Engineered nForce ethernet driver. Version 0.64.
    Dec  1 18:21:32 box15 kernel: ACPI: PCI Interrupt Link [LMAC] enabled at IRQ 18
    Dec  1 18:21:32 box15 kernel: forcedeth 0000:00:08.0: PCI INT A -> Link[LMAC] -> GSI 18 (level, high) -> IRQ 18
    Dec  1 18:21:32 box15 kernel: forcedeth 0000:00:08.0: ifname eth0, PHY OUI 0x5043 @ 1, addr 6c:f0:49:a0:58:00
    Dec  1 18:21:32 box15 kernel: forcedeth 0000:00:08.0: highdma csum vlan pwrctl mgmt gbit lnktim msi desc-v3
    Dec  1 18:21:32 box15 kernel: ACPI: PCI Interrupt Link [LMA2] enabled at IRQ 17
    Dec  1 18:21:32 box15 kernel: forcedeth 0000:00:09.0: PCI INT A -> Link[LMA2] -> GSI 17 (level, high) -> IRQ 17
    Dec  1 18:21:32 box15 kernel: forcedeth 0000:00:09.0: ifname eth1, PHY OUI 0x5043 @ 2, addr 6c:f0:49:a0:58:01
    Dec  1 18:21:32 box15 kernel: forcedeth 0000:00:09.0: highdma csum vlan pwrctl mgmt gbit lnktim msi desc-v3


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


    sd 0:0:0:0: Attached scsi generic sg0 type 0
    forcedeth: Reverse Engineered nForce ethernet driver. Version 0.64.
    ACPI: PCI Interrupt Link [LMAC] enabled at IRQ 18
      alloc irq_desc for 18 on node 0
      alloc kstat_irqs on node 0
    forcedeth 0000:00:08.0: PCI INT A -> Link[LMAC] -> GSI 18 (level, high) -> IRQ 18
    forcedeth 0000:00:08.0: setting latency timer to 64
    forcedeth 0000:00:08.0: ifname eth0, PHY OUI 0x5043 @ 1, addr 6c:f0:49:a0:58:00
    forcedeth 0000:00:08.0: highdma csum vlan pwrctl mgmt gbit lnktim msi desc-v3
    ACPI: PCI Interrupt Link [LMA2] enabled at IRQ 17
      alloc irq_desc for 17 on node 0
      alloc kstat_irqs on node 0
    forcedeth 0000:00:09.0: PCI INT A -> Link[LMA2] -> GSI 17 (level, high) -> IRQ 17
    forcedeth 0000:00:09.0: setting latency timer to 64
    forcedeth 0000:00:09.0: ifname eth1, PHY OUI 0x5043 @ 2, addr 6c:f0:49:a0:58:01
    forcedeth 0000:00:09.0: highdma csum vlan pwrctl mgmt gbit lnktim msi desc-v3



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



    [    6.932843] forcedeth 0000:00:08.0: ifname eth0, PHY OUI 0x5043 @ 1, addr 6c:f0:49:6a:28:24
    [    6.932852] forcedeth 0000:00:08.0: highdma csum vlan pwrctl mgmt gbit lnktim msi desc-v3
    [    6.933161] ACPI: PCI Interrupt Link [LMA2] enabled at IRQ 17
    [    6.933167]   alloc irq_desc for 17 on node 0
    [    6.933170]   alloc kstat_irqs on node 0
    [    6.933182] forcedeth 0000:00:09.0: PCI INT A -> Link[LMA2] -> GSI 17 (level, high) -> IRQ 17
    [    6.933188] forcedeth 0000:00:09.0: setting latency timer to 64
    [    7.454541] forcedeth 0000:00:09.0: ifname eth1, PHY OUI 0x5043 @ 2, addr 6c:f0:49:6a:28:25
    [    7.454546] forcedeth 0000:00:09.0: highdma csum vlan pwrctl mgmt gbit lnktim msi desc-v3


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

    echo "options forcedeth msi=0 msix=0" > /etc/modprobe.d/forcedeth.conf

    forcedeth: Reverse Engineered nForce ethernet driver. Version 0.64.
    forcedeth 0000:00:08.0: PCI INT A -> Link[LMAC] -> GSI 18 (level, high) -> IRQ 18
    forcedeth 0000:00:08.0: setting latency timer to 64
    forcedeth 0000:00:08.0: ifname eth0, PHY OUI 0x5043 @ 1, addr 6c:f0:49:a0:58:00
    forcedeth 0000:00:08.0: highdma csum vlan pwrctl mgmt gbit lnktim desc-v3
    forcedeth 0000:00:09.0: PCI INT A -> Link[LMA2] -> GSI 17 (level, high) -> IRQ 17
    forcedeth 0000:00:09.0: setting latency timer to 64
    forcedeth 0000:00:09.0: ifname eth1, PHY OUI 0x5043 @ 2, addr 6c:f0:49:a0:58:01
    forcedeth 0000:00:09.0: highdma csum vlan pwrctl mgmt gbit lnktim desc-v3
    forcedeth 0000:00:08.0: eth0: no link during initialization
    forcedeth 0000:00:08.0: eth0: link up
     


  • OpenVZ mass ip update


    The file ipupdate.txt should look like this:

    ip.ip.ip.ip ctid


    while read -r; do
    ip=$REPLY
    setip=`echo $ip|awk '{print $1}'`
    ctid=`echo $ip|awk '{print $2}'`
    echo "vzctl set $ctid --ipadd $setip --save"
    vzctl set $ctid --ipadd $setip --save
    done < ipupdate.txt


  • Centos extremely secure iptables setup


    If you want to make sure only a certain IP can access your server for any service or protocol here is a way to do it (just be sure you have access to the IP(s) mentioned or you will be locked out).

     

    iptables -F
    iptables -A INPUT -i lo -j ACCEPT
    iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

    iptables -A INPUT -p tcp -s IP.IP.IP.IP -j ACCEPT

    iptables -A INPUT -j DROP
    service iptables save


  • OpenVZ Solution CPT ERR: c02fa000,73 :CPT: lock fd is closed incorrectly: 1 and vps-net_add ERROR: Unable to add route ip route add 192.168.5.2 dev venet0


    The only solution after trying many suggestions was to simply restart the "vz" service (definitely not preferable).

    Even doing an ifdown and ifup for venet0 did not help.

    ifup venet0
    Bringing up interface venet0:
    Configuring interface venet0:
    net.ipv4.conf.venet0.send_redirects = 0
    RTNETLINK answers: Network is down

    Some errors from log:

     

    CPT ERR: d2dc6000,54819 :Failed ot lookup path '/dev/shm'
    CPT ERR: d2dc6000,54819 :Failed to restore mount point: dev 'tmpfs', type 'tmpfs', path '/dev/shm'
    CPT ERR: d2dc6000,54819 :rst_namespace: -2

     

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


    CPT ERR: f3f70000,30222 :rst_file: -2 98752
    CPT ERR: f3f70000,30222 :rst_files: -2
    CPT ERR: f3f70000,30222 :make_baby: -2
    CPT ERR: f3f70000,30222 :rst_clone_children
    unregister net_device: 'tun0' not found
    unregister net_device: 'tun1' not found
    unregister net_device: 'tun2' not found
    unregister net_device: 'tun3' not found
    unregister net_device: 'tun4' not found
    kobject_add failed for tun0 with -EEXIST, don't try to register things with the same name in the same directory.
     [<c04eec02>] kobject_add+0x141/0x167
     [<c0561c1c>] class_device_add+0x9d/0x3b4
     [<fc1ff49e>] __ve_dev_move+0x17f/0x1b4 [vzmon]
     [<fc1ff534>] fini_venet+0x61/0x81 [vzmon]
     [<fc200731>] env_cleanup+0x3e/0x185 [vzmon]
     [<fc2008a0>] vzmond_helper+0x28/0x34 [vzmon]
     [<fc200878>] vzmond_helper+0x0/0x34 [vzmon]
     [<c062d243>] kernel_thread_helper+0x7

     

    CPT ERR: c02fa000,73 :CPT: lock fd is closed incorrectly: 1

    Starting container...
    Container is mounted
    Adding IP address(es): 192.168.5.2
    RTNETLINK answers: No such device
    vps-net_add ERROR: Unable to add route ip route add 192.168.5.2 dev venet0
    Container start failed (try to check kernel messages, e.g. "dmesg | tail")
    Killing container ...
    Container was stopped
    Container is unmounted

    Solution

    service vz restart


  • mdadm change wrong device name md127 fix and solution in Linux


    md127 issue, it should be /dev/md3 per mdadm.conf

    Any time something is mounted as md127 it almost always means there is no entry for this mdadm array in the mdadm.conf in initramfs (which is separate from your actual /etc/mdadm.conf).

    cat /etc/mdadm.conf
    ARRAY /dev/md3 metadata=1.2 UUID=b6722845:381cc94e:7a2c5b5f:8e3b7c4f


    The reason for this is something strange, most Linux OS's bizarrely always keep their own copy of /etc/mdadm.conf in the initram for the kernel, it will not automatically update or check the newest contents on your root partition.
    This is why so many people have the problem and try different hacks and fixes that I have never seen work (eg. reassembling etc...).

    Solution In Centos here is how you would fix the problem (assuming your /etc/mdadm.conf is correct/updated):


    dracat --force


  • /dev/drbd0: State change failed: (-2) Need access to UpToDate data solution


    Everytime I've seen this error "/dev/drbd0: State change failed: (-2) Need access to UpToDate data" it is because DRBD has no disk:


    cat /proc/drbd
    version: 8.3.13 (api:88/proto:86-96)
    GIT-hash: 83ca112086600faacab2f157bc5a9324f7bd7f77 build by root@sighted, 2012-10-09 12:47:51
     0: cs:Connected ro:Secondary/Secondary ds:Diskless/Inconsistent A r-----
        ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0

    Solution

    The reason is one of two, there is really no disk, your disk failed, or MOST commonly you've misconfigured DRBD to use a device or partition that does not exist.  In many cases this is simply because the device name has changed or the disk has been replaced etc.  So double check what disks are there and which is the correct device/partition and update /etc/drbd.conf accordingly.

     

     


  • forcedeth MCP55 Nforce3600 Nvidia Network NIC Card Not working in Linux at 1gigabit speeds


    Now many people report this card simply not working in various Linux distros and kernels.  My issue is different, it always works at 100mbit (eg. plugged into a 100mbit switch) but no matter what 1000M/gigabit switch I would try, it would never work.

    The link would be up (the lights were on) and the OS detected the link as being up as well but it wouldn't work at all and could not pass data in or out (not even a ack/ping).

    There is one simple solution and command I used on Linux Mint but should apply to most other kernels and distributions such as Debian, Ubuntu etc..:

     

    rmmod forcedeth;modprobe forcedeth msi=0 msix=0&
     

    *Do not forget the &/ampersand as if you are working remotely you will be cut off since the second part that brings the NIC back up will not get executed.

    Make the change permanent

    echo "rmmod forcedeth;modprobe forcedeth msi=0 msix=0&" >> /etc/rc.local


  • How to Normalize and Increase the Volume on M4A files in Linux


    M4A is a weird format, so you have to be creative here is a quick copy of what I did. 

    Basically you need to convert to .wav to make use of them and then I converted the resulting .wav into an mp3 (nice small file size and basically universally playable):

     

    =======

     

    sudo apt-get install mpg321 mp3gain faad normalize lame

     faad "Voice 002 (copy).m4a"

    faad "Voice 002 (copy).m4a"
     *********** Ahead Software MPEG-4 AAC Decoder V2.7 ******************

     Build: May  1 2012
     Copyright 2002-2004: Ahead Software AG
     http://www.audiocoding.com
     Floating point version

     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License.

     **************************************************************************

    Voice 002 (copy).m4a file info:

    LC AAC    4107.565 secs, 2 ch, 44100 Hz


    normalize-audio "Voice 002 (copy).wav"
    Computing levels...
     Voice 002 (copy). 100% done, ETA 00:00:00 (batch 100% done, ETA 00:00:00)
    Applying adjustment of 6.22dB to Voice 002 (copy).wav...
     Voice 002 (copy). 100% done, ETA 00:00:00 (batch 100% done, ETA 00:00:00)

      ---------------------
     | Config:  2 Ch       |
      ---------------------
     | Ch |    Position    |
      ---------------------
     | 00 | Left front     |
     | 01 | Right front    |
      ---------------------

    Decoding Voice 002 (copy).m4a took: 45.95 sec. 89.39x real-time.



    # not loud enough?
    #run again with the -g parameter and the manual decibel increase
    normalize-audio -g 20 "Voice 002 (copy).wav"

    #convert to mp3

    lame "Voice 002 (copy).wav"


  • DRBD Slow Performance - 99.99 % [jbd2/drbd0-8] highiowait solution


    Tired of checking iotop and seeing that your drbd partition is using 99.99% of io all the time and finding your drbd device performs slow in general?

    This is especially an issue in versions of DRBD in the 8.3 tree in particular one documented case is on "8.3.13" but it likely applies to other devices.

    The symptoms are that resyncing is fine and normal but any reasonable amount of activity is very slow and lagged and creates a high server load and consequently high io wait.  You may not notice it though until you apply a reasonable load or usage to the server and DRBD device.

    In some kernels and some versions you may get the following error in dmesg

    block drbd0: [drbd0_worker/1670] sock_sendmsg time expired, ko = 4294967295

    *But we have seen many cases where the above error is not present (perhaps an older kernel or module does not recognize it is being blocked).

    Here are some quick sysctl.conf kernel tuning tips that have changed a server's load from 10-18, to less than 1.

    Add or edit these in sysctl.conf to solve the issue

    net.ipv4.tcp_rmem = 131072  131072  10485760
    net.ipv4.tcp_wmem = 131072  131072  10485760
    vm.dirty_ratio = 10
    vm.dirty_background_ratio = 4

     

    This is a preferable way rather than hacking or changing DRBD settings by upgrading the userland or kernel manually or while it runs (results can be unpredictable) whereas this kernel tuning has virtually no risk or impact on DRBD except a positive one.


  • Linux how to enable and disable NCQ


    To disable NCQ in the Linux kernel (change sda to match your device).

    echo 1 > /sys/block/sda/device/queue_depth

    To enable NCQ (change sda to match your device).

    echo 31 > /sys/block/sda/device/queue_depth


  • error code:0xc0000005 windows 2012 datacenter


    When installing Windows 2012 I cannot get around that error for some reason it just keeps on happening.

     

    code:0xc0000005


  • cPanel how to change main IP to fix licensing issue


    Your cPanel may not work if you enter your non-main IP when setting it up.  The way to fix it is to go back to the setup screen by removing the following file:

    rm /etc/.whostgrft


  • How to completely remove mdadm array


    First you have to stop it.

    mdadm --stop /dev/md0

    Then you can remove it:

    mdadm --remove /dev/md0


  • mdadm zero-superblock to solve md device created on root device


    It is possible to tell mdadm to create an md device on a raw disk even though it will give you an error, it writes a superblock and this corrupts the partition table which can result in your system not booting.

    To fix it just zero the super-block on the offending device that you made the mistake in.

    Eg: /dev/sda

    mdadm --zero-superblock /dev/sda

    It is also a way of starting fresh if you wanted to create a new array.


  • grubby fatal error: unable to find a suitable template solution Centos


    vzkernel-2.6.32-042stab116.2.x86_64.rpm                                                                                                                                                                               |  33 MB     00:06    
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
      Installing : vzkernel-2.6.32-042stab116.2.x86_64                                                                                                                                                                                       1/1
    grubby fatal error: unable to find a suitable template


    #note how menu.lst is a normal file.  It should be a symlink to grub.conf
    #because of this grubby will use grub.conf which does not match the current setup in menu.lst used for booting
    #
     ls -al /boot/grub/
    total 292
    drwxr-xr-x 2 root root   4096 Aug 10 15:07 .
    dr-xr-xr-x 5 root root   4096 Aug 10 15:06 ..
    -rw-r--r-- 1 root root  13396 Jul  9  2015 e2fs_stage1_5
    -rw-r--r-- 1 root root  12636 Jul  9  2015 fat_stage1_5
    -rw-r--r-- 1 root root  11780 Jul  9  2015 ffs_stage1_5
    -rw------- 1 root root    798 Aug 10 15:07 grub.conf
    -rw-r--r-- 1 root root  11772 Jul  9  2015 iso9660_stage1_5
    -rw-r--r-- 1 root root  13284 Jul  9  2015 jfs_stage1_5
    -rw------- 1 root root    764 Aug  8 19:11
    menu.lst

    #to fix it you need to move menu.lst to grub.conf and make a symlink to menu.lst from grub.conf
    cd /boot/grub
    mv menu.lst grub.conf
    ln -s grub.conf menu.lst

     

    Now see that menu.lst is a symlink and the kernel will install.

    ls -al /boot/grub/menu.lst
    lrwxrwxrwx 1 root root 9 Aug 10 15:12 /boot/grub/menu.lst -> grub.conf

    vzkernel-2.6.32-042stab116.2.x86_64.rpm                                                                                                                                                                               |  33 MB     00:03    
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
      Installing : vzkernel-2.6.32-042stab116.2.x86_64                                                                                                                                                                                       1/1
      Verifying  : vzkernel-2.6.32-042stab116.2.x86_64                                                                                                                                                                                       1/1

    Installed:
      vzkernel.x86_64 0:2.6.32-042stab116.2                                                                                                                                                                                                     

    Complete!


  • Linux How To Recover Partition Table from Kernel and Restore Centos/Debian etc..


    We've all done this at some point, you work on the wrong shell window and this was my first time making this mistake but I deleted a partition table in fdisk, recreated it and saved it with "wq" and even ran partprobe!  If you haven't rebooted yet then you can still recover your partition table, otherwise you're in big trouble.

    Fortunately since it was a live system and in use the kernel still had to use the old table like below:

    Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda (Device or resource busy).  As a result, it may not reflect all of your changes until after reboot.
    Warning: Error fsyncing/closing /dev/md127: Input/output error
    Warning: Error fsyncing/closing /dev/md126: Input/output error
    Warning: Error fsyncing/closing /dev/md125: Input/output error

    Other places on the internet don't properly explain the procedure for recovery which can be done but you need the right side of instructions and info.

    Step 1 -Find your device directory in /sys/block/sda/sda1 (change the /sda and /sda1 to match your disk device name and partition number).

    You have to do a cat on the 'start' and 'size' which represents the starting sector of the partition and the 'size' represents how many sectors it is. 


    #take the size value and subtract 1 from it or you will not get the original or correct result
    fdisk /dev/sda
    #press u to change to sectors which is what /sys/block/sda goes by
     /sys/block/sda
    [root@server1 sda]# cat sda1/start
    2048
    [root@server1 sda]# cat sda1/size
    1024000

    [root@server1 sda]# cat sda2/start
    1026048
    [root@server1 sda]# cat sda2/size
    1464121344
     

     Step 2 -Use fdisk to take the above sector information and input it (remembering to subtract 1 from the size when telling fdisk the end sector)

    "Press u" to switch to sector mode once you run:

    fdisk /dev/sda



    Command (m for help): n
    Command action
       e   extended
       p   primary partition (1-4)
    p
    Partition number (1-4): 1
    First sector (63-1465149167, default 63): 2048
    Last sector, +sectors or +size{K,M,G} (2048-1465149167, default 1465149167): +1023999

    Command (m for help): n
    Command action
       e   extended
       p   primary partition (1-4)
    p
    Partition number (1-4): 2
    First sector (63-1465149167, default 63): 1026048
    Last sector, +sectors or +size{K,M,G} (1026048-1465149167, default 1465149167): +1464121343

    ##########


    and for those who do a normal fdisk -l /dev/sda and wonder why you can't duplicate the cylinder setup is because you need to press "u" and deal with sectors.

    Using sectors shows that you can actually end and start a partition on the same cylinder and in other ways cylinders will not work for:


       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1               1          64      512000   83  Linux
    Partition 1 does not end on cylinder boundary.
    /dev/sda2              64       91202   732060672   83  Linux




    ###########


  • weird mv error mv: inter-device move failed:


    mv -f /home/user/Downloads/android-studio/ /mnt/sda3/
    mv: inter-device move failed: ‘/home/user/Downloads/android-studio/’ to ‘/mnt/sda3/android-studio’; unable to remove target: Is a directory


  • Apache Log Error Message when starting


    Usage: geoiplookup [-h] [-?] [-d custom_dir] [-f custom_file] [-v] [-i] [-l] <ipaddress|hostname>
    Usage: geoiplookup [-h] [-?] [-d custom_dir] [-f custom_file] [-v] [-i] [-l] <ipaddress|hostname>
    grep: Address: No such file or directory
    grep: not: No such file or directory
    grep: found: No such file or directory
    sh: -c: line 1: syntax error near unexpected token `|'
    sh: -c: line 1: `|cut -d ',' -f 2'
     


  • OpenVZ Migration Hostnode Containers from Centos 5 to Centos 6


    migrating from an old OpenVZ (Centos 5) to new OpenVZ (Centos 6)
    Also if migrating from 32-bit HN to 64-bit your RAM will probably be much bigger than it should be!
    16x bigger

    eg. 32bit HN:

                 total       used       free     shared    buffers     cached
    Mem:           256         16        239          0          0          0
    -/+ buffers/cache:         16        239
    Swap:            0          0          0


    eg. 64bit HN with same config:


    free -m
                 total       used       free     shared    buffers     cached
    Mem:          3906         42       3863          0          0         33
    -/+ buffers/cache:          9       3897
    Swap:        28614          0      28614



    Error: required UB parameter swappages not set

     vzctl start 27000
    Starting container...
    Error: required UB parameter swappages not set
    Saving VE layout 'simfs' to the VE config file
    CT configuration saved to /etc/vz/conf/27000.conf
    [root@server18 conf]# vzlist
    Container(s) not found
    [root@server18 conf]# vzctl start 27000
    Starting container...
    Error: required UB parameter swappages not set

    vzctl set 27000 --swappages 0:unlimited --save

     vzctl set 27000 --swappages 0:unlimited --save
    CT configuration saved to /etc/vz/conf/27000.conf
    [root@server18 conf]# vzctl start 27000
    Starting container...
    stat(/vz/root/27000): No such file or directory
    stat(/vz/root/27000): No such file or directory
    stat(/vz/root/27000): No such file or directory
    Initializing quota ...
    Container is mounted
    Adding IP address(es): 98.158.135.57 98.158.135.58
    Setting CPU units: 1000
    Setting devices
    Container start in progress...


  • Linux Mint 17 How to Enable File Sharing Option in File Manager


    I still cannot understand how this would not be enabled by default and I struggled to find the reason why with manually installing samba etc.. wondering why the option for sharing was not in the menu.

    On Linux Mint "MATE" the package is called "caja-share" and on Cinnamon it is called "nemo-share" so edit the below command as necessary:

     

    apt-get install caja-share
    Reading package lists... Done
    Building dependency tree      
    Reading state information... Done
    The following package was automatically installed and is no longer required:
      libsctp1
    Use 'apt-get autoremove' to remove it.
    The following extra packages will be installed:
      caja-extensions-common caja-gksu caja-open-terminal
    The following NEW packages will be installed:
      caja-share
    The following packages will be upgraded:
      caja-extensions-common caja-gksu caja-open-terminal
    3 upgraded, 1 newly installed, 0 to remove and 469 not upgraded.
    Need to get 113 kB of archives.
    After this operation, 145 kB of additional disk space will be used.
    Do you want to continue? [Y/n] y
    Get:1 http://packages.linuxmint.com/ rafaela/import caja-open-terminal amd64 1.10.1-1+rafaela [10.8 kB]
    Get:2 http://packages.linuxmint.com/ rafaela/import caja-gksu amd64 1.10.1-1+rafaela [8,016 B]
    Get:3 http://packages.linuxmint.com/ rafaela/import caja-extensions-common all 1.10.1-1+rafaela [75.1 kB]
    Get:4 http://packages.linuxmint.com/ rafaela/import caja-share amd64 1.10.1-1+rafaela [19.2 kB]
    Fetched 113 kB in 0s (154 kB/s)      
    (Reading database ... 184362 files and directories currently installed.)
    Preparing to unpack .../caja-open-terminal_1.10.1-1+rafaela_amd64.deb ...
    Unpacking caja-open-terminal (1.10.1-1+rafaela) over (1.10.0-1+rafaela) ...
    Preparing to unpack .../caja-gksu_1.10.1-1+rafaela_amd64.deb ...
    Unpacking caja-gksu (1.10.1-1+rafaela) over (1.10.0-1+rafaela) ...
    Preparing to unpack .../caja-extensions-common_1.10.1-1+rafaela_all.deb ...
    Unpacking caja-extensions-common (1.10.1-1+rafaela) over (1.10.0-1+rafaela) ...
    Selecting previously unselected package caja-share.
    Preparing to unpack .../caja-share_1.10.1-1+rafaela_amd64.deb ...
    Unpacking caja-share (1.10.1-1+rafaela) ...
    Processing triggers for libglib2.0-0:i386 (2.40.2-0ubuntu1) ...
    Processing triggers for libglib2.0-0:amd64 (2.40.2-0ubuntu1) ...
    Setting up caja-extensions-common (1.10.1-1+rafaela) ...
    Setting up caja-open-terminal (1.10.1-1+rafaela) ...
    Setting up caja-gksu (1.10.1-1+rafaela) ...
    Setting up caja-share (1.10.1-1+rafaela) ...
    Processing triggers for libc-bin (2.19-0ubuntu6.6) ...
     


  • VBOX/Virtualbox how to resize the disk file image vdi


    VBoxManage modifyhd "my.vdi" --resize 60000
    
    Note the above will resize my.vdi to 60,000MB
    

  • OpenVZ Error: Failed to load 2nd level quota solution


    Syncing private
    Live migrating container...
    Syncing 2nd level quota
    11000: invalid option -- F
    Usage: vzdqload quotaid [-c file] commands
    Loads user/group qouta information from stdin into quota file.
        -c file    use given quota file
    Commands specify what user/group information to load:
        -G    grace time
        -U    disk limits
        -T    expiration times
    Error: Failed to load 2nd level quota


    #solution


    yum -y update vzctl

    The reason this seems to happen is because OpenVZ (vzctl) on the destination node is out of date and lacks some features or has changed compared to what the source node has. 

    Updating vzctl fixed the above problem.

     


  • 99.99 % [jbd2/drbd0-8] highiowait


    I have not found the source of this but essentially it seems like drbd and ext4 may not play well but I have to confirm still.

    In either case an older DRBD setup with older hard drives seems to have little to no iowait, but the main difference is the drbd partition is ext3 and not ext4.  I will experiment and see if that fixes this, then we will know that DRBD and ext4 have issues.


  • heartbeat cross talk


    I do not understand why heartbeat would try to communicate with another system not considered part of the node:

     

    heartbeat: [8280]: WARN: string2msg_ll: node [otherbox.com] failed authentication
     


  • Openvz error solutions Container already locked (error) can't lock quota file, some quota operations are performing for id 1200


    rm /vz/lock/1200.lck
    rm: remove regular file `/vz/lock/1200.lck'? y

    vzctl start 1200
    Container already locked



    vzctl start 1200
    Starting container ...
    vzquota : (error) can't lock quota file, some quota operations are performing for id 1200
    vzquota on failed [7]

    vzquota off 1200
    vzctl start 1200
    vzquota on 1200


    root@rttbox ~]# vzquota off 1200
    vzquota : (error) Quota off syscall for id 1200: Device or resource busy
    vzquota : (error)     Possible reasons:
    vzquota : (error)     - Container's root is not unmounted
    vzquota : (error)     - there are opened files inside container's root/private area
    vzquota : (error)     - your current working directory is inside a container directory
    vzquota : (error)       root/private area
    [root@rttbox ~]# vzctl start 1200
    Container is already running
    [root@rttbox ~]# vzquota on 1200
    vzquota : (warning) Quota is running for id 1200 already
     


    The above is what happens when everything is fine but it takes a long time for the quota update to complete, such after a live migration etc... you know it is often the case when the normal tricks don't work:

    eg. removing the .lck file, turning quota on and off.


  • blocked for more than 120 seconds issues with iowait and timeout on Live Linux distribution while writing to physical disk


    This happened while an mdadm array was syncing, all access from writing a new blank file to opening a small .txt file was very slow:

     

    [222117.312078] kjournald starting.  Commit interval 5 seconds
    [222117.685060] EXT3-fs (md0): using internal journal
    [222117.685096] EXT3-fs (md0): mounted filesystem with ordered data mode
    [222122.376847] kjournald starting.  Commit interval 5 seconds
    [222122.602825] EXT3-fs (md2): using internal journal
    [222122.602866] EXT3-fs (md2): mounted filesystem with ordered data mode
    [223081.568032] INFO: task kjournald:352 blocked for more than 120 seconds.
    [223081.568069] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
    [223081.568121] kjournald       D ef1e41c0     0   352      2 0x00000000
    [223081.568157]  eee0dac0 00000046 ef1e41c0 ef1e41c0 0000cab8 00000000 e971ee70 22650000
    [223081.568219]  e8c11c9f ccb941c0 eee0dc74 ccb941c0 eee0dac0 ccb941c0 ccb941c0 00000000
    [223081.568280]  eee0daf4 eee0daf4 ef1e4204 ff48eeaf c102e1e0 e971ee70 00000012 ff48eeaf
    [223081.568341] Call Trace:
    [223081.568375]  [<c102e1e0>] ? dequeue_task_fair+0x149/0x1d6
    [223081.568411]  [<c11939a6>] ? journal_commit_transaction+0x12c/0xd02
    [223081.568446]  [<c1605d15>] ? __schedule+0x5cb/0x5f2
    [223081.568478]  [<c1047ef5>] ? wake_up_bit+0x56/0x56
    [223081.568510]  [<c103bfe1>] ? lock_timer_base+0x19/0x34
    [223081.568541]  [<c103c48c>] ? try_to_del_timer_sync+0x5c/0x63
    [223081.568574]  [<c1197306>] ? kjournald+0xb5/0x1cc
    [223081.568604]  [<c1047ef5>] ? wake_up_bit+0x56/0x56
    [223081.568633]  [<c1197251>] ? commit_timeout+0x5/0x5
    [223081.568663]  [<c1047b9f>] ? kthread+0x63/0x68
    [223081.568692]  [<c1047b3c>] ? kthread_worker_fn+0x114/0x114
    [223081.568725]  [<c160cbbe>] ? kernel_thread_helper+0x6/0xd
    [223081.568756] INFO: task vi:530 blocked for more than 120 seconds.
    [223081.568787] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
    [223081.568838] vi              D 00000002     0   530  32563 0x00000004
    [223081.568873]  cc72dee0 00000086 00000003 00000002 c1098a00 00000000 00204033 22636000
    [223081.572601]  00000002 ccb941c0 cc72e094 ccb941c0 cc72dee0 ccb941c0 ccb941c0 eec86180
    [223081.572662]  c10284ce 00000002 00000001 00000005 cc263dec 00000000 00000001 eec03870
    [223081.572723] Call Trace:
    [223081.572751]  [<c1098a00>] ? __alloc_pages_nodemask+0x121/0x572
    [223081.572785]  [<c10284ce>] ? find_busiest_group+0x244/0x7e5
    [223081.572818]  [<c104e4e8>] ? timekeeping_get_ns+0x10/0x48
    [223081.572850]  [<c104f849>] ? ktime_get_ts+0x76/0x7d
    [223081.572880]  [<c1605fff>] ? io_schedule+0x6c/0xa4
    [223081.572911]  [<c10e40f0>] ? sleep_on_buffer+0x5/0x8
    [223081.572941]  [<c1606255>] ? __wait_on_bit_lock+0x2f/0x68
    [223081.572973]  [<c10e40eb>] ? unmap_underlying_metadata+0x41/0x41
    [223081.573005]  [<c10e40eb>] ? unmap_underlying_metadata+0x41/0x41
    [223081.573037]  [<c1606329>] ? out_of_line_wait_on_bit_lock+0x9b/0xa3
    [223081.573071]  [<c1047f1e>] ? autoremove_wake_function+0x29/0x29
    [223081.573103]  [<c10e4210>] ? __lock_buffer+0x1c/0x1e
    [223081.573133]  [<c1192e25>] ? do_get_write_access+0x4f/0x305
    [223081.573166]  [<c11928e1>] ? start_this_handle+0x27a/0x2d6
    [223081.573197]  [<c1196d5a>] ? journal_add_journal_head+0x85/0xec
    [223081.573230]  [<c11930f3>] ? journal_get_write_access+0x18/0x26
    [223081.573263]  [<c1154fde>] ? __ext3_journal_get_write_access+0x16/0x36
    [223081.573298]  [<c114ae9a>] ? ext3_orphan_add+0x78/0x13e
    [223081.573328]  [<c1192a4e>] ? journal_start+0x80/0xa7
    [223081.573359]  [<c1147da7>] ? ext3_setattr+0x180/0x2ad
    [223081.573391]  [<c10d627e>] ? notify_change+0x182/0x252
    [223081.573424]  [<c10c40d6>] ? do_truncate+0x61/0x77
    [223081.573455]  [<c10ce12b>] ? do_last+0x4c4/0x52f
    [223081.573485]  [<c10ce620>] ? path_openat+0x9f/0x285
    [223081.573514]  [<c10ce8aa>] ? do_filp_open+0x21/0x5d
    [223081.573545]  [<c10c10a8>] ? kmem_cache_alloc+0x21/0xd9
    [223081.573576]  [<c10cc7ed>] ? getname_flags+0x24/0xd5
    [223081.573606]  [<c10c3779>] ? do_sys_open+0x58/0xd1
    [223081.573636]  [<c10c3836>] ? sys_open+0x1e/0x23
    [223081.573666]  [<c160711c>] ? syscall_call+0x7/0x7


    [224161.572060] INFO: task kjournald:349 blocked for more than 120 seconds.
    [224161.572099] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
    [224161.572151] kjournald       D ef1e41c0     0   349      2 0x00000000
    [224161.572187]  eee0f7a0 00000046 ef1e41c0 ef1e41c0 0000cbae 00000000 e07bdd83 22650000
    [224161.572248]  dfcdf1fd ccb941c0 eee0f954 ccb941c0 eee0f7a0 ccb941c0 ccb941c0 00000000
    [224161.572310]  eee0f7d4 eee0f7d4 ef1e4204 ff52147a c102e1e0 e07bdd83 0000001d ff52147a
    [224161.572371] Call Trace:
    [224161.572405]  [<c102e1e0>] ? dequeue_task_fair+0x149/0x1d6
    [224161.572441]  [<c11939a6>] ? journal_commit_transaction+0x12c/0xd02
    [224161.572477]  [<c1605d15>] ? __schedule+0x5cb/0x5f2
    [224161.572509]  [<c1047ef5>] ? wake_up_bit+0x56/0x56
    [224161.572541]  [<c103bfe1>] ? lock_timer_base+0x19/0x34
    [224161.572573]  [<c103c48c>] ? try_to_del_timer_sync+0x5c/0x63
    [224161.572605]  [<c1197306>] ? kjournald+0xb5/0x1cc
    [224161.572635]  [<c1047ef5>] ? wake_up_bit+0x56/0x56
    [224161.572664]  [<c1197251>] ? commit_timeout+0x5/0x5
    [224161.572694]  [<c1047b9f>] ? kthread+0x63/0x68
    [224161.572723]  [<c1047b3c>] ? kthread_worker_fn+0x114/0x114
    [224161.572757]  [<c160cbbe>] ? kernel_thread_helper+0x6/0xd
    [224161.572789] INFO: task vi:791 blocked for more than 120 seconds.
    [224161.572821] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
    [224161.572872] vi              D 00000010     0   791    552 0x00000000
    [224161.572907]  cc47f380 00000086 00000040 00000010 c1820380 00000000 00000000 22629000
    [224161.572968]  00000002 ccb941c0 cc47f534 ccb941c0 cc47f380 ccb941c0 ccb941c0 ef1b8c40
    [224161.573029]  eec03870 eec44a40 c14747c5 eec03860 eec86100 c10284ce 00000002 00000001
    [224161.573090] Call Trace:
    [224161.573117]  [<c14747c5>] ? cpumask_next_and+0x20/0x2b
    [224161.573150]  [<c10284ce>] ? find_busiest_group+0x244/0x7e5
    [224161.573183]  [<c104e4e8>] ? timekeeping_get_ns+0x10/0x48
    [224161.573214]  [<c104f849>] ? ktime_get_ts+0x76/0x7d
    [224161.573244]  [<c1605fff>] ? io_schedule+0x6c/0xa4
    [224161.573275]  [<c10e40f0>] ? sleep_on_buffer+0x5/0x8
    [224161.573305]  [<c1606255>] ? __wait_on_bit_lock+0x2f/0x68
    [224161.573337]  [<c10e40eb>] ? unmap_underlying_metadata+0x41/0x41
    [224161.573370]  [<c10e40eb>] ? unmap_underlying_metadata+0x41/0x41
    [224161.573402]  [<c1606329>] ? out_of_line_wait_on_bit_lock+0x9b/0xa3
    [224161.573435]  [<c1047f1e>] ? autoremove_wake_function+0x29/0x29
    [224161.573468]  [<c10e4210>] ? __lock_buffer+0x1c/0x1e
    [224161.573498]  [<c1192e25>] ? do_get_write_access+0x4f/0x305
    [224161.573530]  [<c1196d5a>] ? journal_add_journal_head+0x85/0xec
    [224161.573562]  [<c11930f3>] ? journal_get_write_access+0x18/0x26
    [224161.573596]  [<c1154fde>] ? __ext3_journal_get_write_access+0x16/0x36
    [224161.573630]  [<c1145c46>] ? ext3_reserve_inode_write+0x2d/0x5a
    [224161.573663]  [<c114aeb2>] ? ext3_orphan_add+0x90/0x13e
    [224161.573693]  [<c1147da7>] ? ext3_setattr+0x180/0x2ad
    [224161.573726]  [<c10d627e>] ? notify_change+0x182/0x252
    [224161.573758]  [<c10c40d6>] ? do_truncate+0x61/0x77
    [224161.573790]  [<c10ce12b>] ? do_last+0x4c4/0x52f
    [224161.573819]  [<c10ce7b1>] ? path_openat+0x230/0x285
    [224161.573849]  [<c10ce8aa>] ? do_filp_open+0x21/0x5d
    [224161.573880]  [<c10cc7ed>] ? getname_flags+0x24/0xd5
    [224161.573910]  [<c10c3779>] ? do_sys_open+0x58/0xd1
    [224161.573940]  [<c10c3836>] ? sys_open+0x1e/0x23
    [224161.573970]  [<c160711c>] ? syscall_call+0x7/0x7
    [224161.573999] INFO: task grub:817 blocked for more than 120 seconds.
    [224161.574031] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
    [224161.574082] grub            D 00000002     0   817  32563 0x00000004
    [224161.574117]  cc47eb40 00000082 c109a37f 00000002 0000000e 00000000 c9eabec4 22643000
    [224161.574178]  00000000 ccb941c0 cc47ecf4 ccb941c0 cc47eb40 ccb941c0 ccb941c0 c9eabf1c
    [224161.574239]  c1093d65 0000000e 00000001 c9eabf38 00000000 c9eabf34 00000000 c8270270
    [224161.574300] Call Trace:
    [224161.574325]  [<c109a37f>] ? write_cache_pages+0x10d/0x2be
    [224161.574358]  [<c1093d65>] ? find_get_pages_tag+0x37/0xd1
    [224161.574390]  [<c1025f08>] ? __wake_up+0x2c/0x3b
    [224161.574419]  [<c1048067>] ? prepare_to_wait+0x14/0x52
    [224161.574450]  [<c11971b3>] ? log_wait_commit+0xa9/0xf1
    [224161.574480]  [<c1047ef5>] ? wake_up_bit+0x56/0x56
    [224161.574510]  [<c1153556>] ? ext3_sync_fs+0x5d/0x67
    [224161.574541]  [<c10f9d6f>] ? dquot_quota_sync+0x193/0x235
    [224161.574572]  [<c10f9bdc>] ? dquot_file_open+0x25/0x25
    [224161.574603]  [<c10e1fc4>] ? __sync_filesystem+0x69/0x69
    [224161.574634]  [<c10e1f8b>] ? __sync_filesystem+0x30/0x69
    [224161.574664]  [<c10c6a1f>] ? iterate_supers+0x4e/0x8d
    [224161.574695]  [<c10e2005>] ? sys_sync+0x36/0x49
    [224161.574724]  [<c160711c>] ? syscall_call+0x7/0x7

     


  • SELinux targeted policy relabel is required


    You may get this after a long time of not rebooting but especially if you have rsync'd a / partition or deployed an image to another VPS or computer, you will often have this issue.

    The good thing it usually just takes a reboot.

    Here is more info from Centos


  • possible SYN flooding on port 80. Sending cookies.


    Errors like this are shown on high usage servers and ports so it is common to see it on http and even imap ports:

    possible SYN flooding on port 80. Sending cookies.

    The Linux kernel will even detect flooding on OpenVZ containers:

    possible SYN flooding on ctid 6000, port 993. Sending cookies.

    In many cases this is not an issue and is more so simply a result of regular, but high usage traffic.


  • mdadm how to create mdadm.conf config file


    It is as simple as the command below, it will then update your mdadm.conf or create it in /etc/mdadm.conf

    mdadm --detail --brief --scan > /etc/mdadm.conf
     


  • Apache Centos Stopping httpd: [ OK ] Starting httpd: [Wed Jun 29 19:29:44 2016] [warn] _default_ VirtualHost overlap on port 80, the first has precedence [Wed Jun 29 19:29:44 2016] [warn] _default_ Virtual


    Stopping httpd:                                            [  OK  ]
    Starting httpd: [Wed Jun 29 19:29:44 2016] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
    [Wed Jun 29 19:29:44 2016] [warn] _default_ VirtualHost overlap on port 443, the first has precedence

    In order to avoid the above message and a conflict where only a default/first domain by alphabet gets served you need to use NameVirtualHost in httpd.conf

    Add the following to httpd.conf:

    NameVirtualHost *:80
    NameVirtualHost *:443


  • The connection was reset The connection to the server was reset while the page was loading.


    In Firefox I cannot connect to any website, proxy is disabled and outside network access is confirmed, no system or manual proxy was set on this Linux Mint/Ubuntu system.  Normally this can be caused by proxy or DNS problems and the weird thing is that traceroute and ping to other IPs worked fine but even connecting to sites by IP was not working.

    The connection was reset

    The connection to the server was reset while the page was loading.

        The site could be temporarily unavailable or too busy. Try again in a few moments.
        If you are unable to load any pages, check your computer's network connection.
        If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.


    This even causes apt-get to fail to install packages

     

    The solution:

    This was a virtual machine cloned in VirtualBox and for some silly reason it clones the MAC address, so there was the original machine running with the same MAC.  The solution is to regenerate a new MAC address from the VBOX config.


  • Openvz kernel: [10186978.064405] TCP: time wait bucket table overflow (CT3)


    kernel: [10186978.064405] TCP: time wait bucket table overflow (CT3)

    Varying opinions are out there but in general it seems like the most common culprit is a lack of privvmpages, with a modern OpenVZ system the best way is to set privvmpages as equal to what your RAM is and this has resolved the messages on another system.

    If it's truly a TCP issue you can adjust the following parameters:

    Source: Openvz forums

    1) Per-system tw_count is greater than per-system max_tw_buckets limit:
    tw_count < sysctl_max_tw_buckets
    net.ipv4.tcp_max_tw_buckets = 1800000
    IMHO very unlikely in your situation

    2) Per-VE counter is greater than per-VE max_tw_buckets limit:
    tw_count < sysctl_tcp_max_tw_buckets_ub
    net.ipv4.tcp_max_tw_buckets_ub = 165360


  • astrachat connection problems in Android 5.01 Lollipop


    I wanted to use Astrachat because it seems to be the only app that has video, pic and file sharing for Jabber but I cannot even connect despite any other client working fine including Xabber and others.

     

    astrachat "Oops.. We can't connect to the account that you provide above.  Please recheck your account detail".

    Unfortunately to make it worse there doesn't seem to be any error log or more details about the issue.

    The jabberd server requires start tls and I have hard coded the info into Astrachat as well and that didn't work.

    Here is the jabberd log:

    Jul 13 16:47:36 jabberbox jabberd/c2s[14145]: [8] [192.168.5.66, port=26400] connect
    Jul 13 16:47:37 jabberbox jabberd/c2s[14145]: [8] [192.168.5.66, port=26400] disconnect jid=unbound, packets: 0

     

    If I choose "NON-SASL Login" and disable "TLS/SSL (Establish secure connection on network) then I get a start tls error on the server:

     [8] got pre STARTTLS packet, dropping
     


  • sed how to avoid escaping


    sed gets to be a pain and a real mess and is hard to read and understand when you have to escape things like / etc.

    I did not realize until recently that you don't need to use / as a separator, you can use virtually any non letter or number character.

    Eg we have used # as the separator to avoid having to escape the forward slashes and in this way the command is plain, easy to understand, edit and saves time/hassle without the need for escaping.

    sed -i s#http://someurl.com#http://anotherurl.com#/g


  • Ubuntu/Debian OpenVZ Template Problems No Networking and SSH not starting


    It all comes down to a bug essentially where you are running an older kernel that doesn't support the newer Debian templates.  The solution is to update your OpenVZ kernel.

    Here are some symptoms of the problem/lack of kernel support:

     

    Ubuntu Template 12.04 requires a manual network start:
    service networking start

    sshd will not start:
    /usr/sbin/sshd
    PRNG is not seeded

    mknod /dev/random c 1 8

    service ssh start
    ssh start/running, process 30022

    #but netstat does not show it running

    #also no processes are started it looks like init is not getting called.

    init 2


  • HTML files in Apache still displaying as raw text even with DefaultType, ForceType etc.


    There was only one solution here and it was the following:

    edit /etc/httpd/conf/httpd.conf

    Comment the lines for the Mime Magic Module:


    #   MIMEMagicFile /usr/share/magic.mime
    #    MIMEMagicFile conf/magic

      *Don't forget to restart Apache and clear your browser cache twice

    I was using DefaultType and ForceType and the weird thing is for MOST files it was fine, but a few randomly did not like this becuase it appears Mime Magic was determing and rewriting the Mime Type and basically overruling the .htaccess I had (yes I had AllowOverride in the VHOST conf too).
     

    I hope this helps out someone else as it took me ages to sort out.


  • wget ignore robots.txt howto


    wget -e robots=off
    
    It is as simple as the above and this is something one must watch out carefully when using wget because you may think you have archived or downloaded content when you never did due to a nofollow/robots.txt statement.
    
    

  • Uploading Error HTTP error. Wordpress Upload Error Solution


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

    Uploading
    Error
    HTTP error.


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


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

    max_execution_time = 80
     


  • mysql_real_escape_string returns an empty string solution


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

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

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

    $var = mysql_real_escape_string($myself)

    mysql_connect();

    // returns null/empty

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

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

    mysql_connect();

    $var = mysql_real_escape_string($myself)

     

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

    Another way the problem can be created:

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

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

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


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


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

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

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

     


  • Cannot Read License File cPanel Solution


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

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

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

     



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

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

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

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

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


  • Centos and obfsproxy install errors


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

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

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

    #there is no python 2.7 package for Centos 6

    #build it ourselves


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



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

       No module named yum

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

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

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

     
    Solution

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


  • curl: (35) SSL connect error solution


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


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

     


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


    Simple solution install python-dev

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


  • find: missing argument to '-mtime'


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

    # (show everything older than 1 day)

    find . -mtime +1

     


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


    openvpn 2.3.10-1.el6 issues
     

    in the .conf

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


    auth-env does not work correctly in OpenVPN 2.3:


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

    But OpenVPN 2.2 does work as expected.

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


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


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

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

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

    In the order of the above

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

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

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


  • vps windows 2008 datacenter error code 0xc004c020


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


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


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

    -a preserves all file atributes and symlinks

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

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


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


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

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

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

    4.4. Apache HTTP Server

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

    The Solution/Replacement

    mod_disk_cache or mod_cache

    It is as simple as the following in httpd.conf

    CacheEnable disk /
     

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


  • Apache SSL Reverse Proxy Very Slow Solution


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

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

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

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

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

    Solution

     

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

    Additional Performance Improvements


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


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


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

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

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

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

    I used this .deb package for myself


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


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

    Error: database disk image is malformed

    It was easily fixed with the following command:

    yum clean all


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


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


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


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

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

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

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

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

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

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

     

    The Solution

     

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

     

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


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


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

     

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

        Adapter Selected is a LSI SAS: SAS2008(B2)  

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

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

        Finished Processing Commands Successfully.
        Exiting SAS2Flash.



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

        Adapter Selected is a LSI SAS: SAS2008(B2)  

        Executing Operation: Flash Firmware Image

            ERROR: Firmware Image does not have a Valid Signature.

            Firmware Image Validation Failed!

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


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


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

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

    Eg. originalsite.com and newsite.com

    /vhosts/originalsite.com/httpdocs

    You would symlink like this:

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

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


    This would be in your vhost.conf

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

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


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


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

    Caveats Issues To Take Into Account

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

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

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

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

     


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


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

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


  • Linksys PAP2T No delay in dialing recommended fast dial plan


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

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

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

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

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


  • Linksys PAP2T No Dialtone and Cannot Hear Caller


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

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

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

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


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

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

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


  • MySQL PHP adding a backslash/escaping apostrophes Solution


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

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

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

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

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

    In my case here is what I found:

    php_flag magic_quotes_gpc off
    php_flag magic_quotes_runtime on

    Solution, turn off magic quotes runtime:

    php_flag magic_quotes_gpc off
    php_flag magic_quotes_runtime off

    After that the problem should be solved.

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


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


    1.) Flash directly to this file:

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

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

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

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

    Latest versions here:

     

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

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

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

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

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

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

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

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

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


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

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

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


  • PAP2T Linksys VOIP strange ring problem


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

    How To Fix the Issue

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

         

    Set the following options:

    Ring Waveform: Sinusoid

    Ring Frequency: 25

    Now your phone will ring normally and properly.


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


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


  • Linux Mint/Ubuntu/Debian Window Controls Missing Solution


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

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

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

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


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

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

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



    ps aux|grep 28520

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

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


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


    The Scenario

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

    Everything will work fine at this point.

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

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

    Solution

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


  • Linux Mint Network Manager Connection Disconnect Option Grayed Out


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

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

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

     


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


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

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

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

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

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

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

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


  • Contact Us


    Thanks for your e-mail.

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

    To Contact Us Send Us A Message Below

    E-mail Address

    Your Message

    HTML; ?>

    Contact RealTechTalk


  • Redirect www host to non-www Linux Apache modrewrite


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

    Updated code:

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

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

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

    Bad code:

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

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


  • Force SSL for all URLs Apache htaccess modrewrite


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

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


  • WHMCS CC Encryption Hash Location


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


  • Debian Ubuntu Mint Samba Share config file location


    /var/lib/samba/usershares

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

    Here is an example file:

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


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




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


    vi /etc/ppp/peers/provpnaccounts.com

    enter (ignore the lines):

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

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

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

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

    route del default eth0
    route add default dev ppp0

    Connect:
    pppd call provpnaccounts.com

    Disconnect:
    killall pppd

    Customize it

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

    pppd call provpnaccounts.com

    Make it so the VPN reconnects by itself:

    vi /etc/ppp/options

    persist

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

     


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


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

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

    route del default eth0

    50.80.20.2 is the VPN server you connect to

    192.168.1.1 is your LAN default gateway/router

    ip route add 50.80.20.2 via 192.168.1.1

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

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


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


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

    The working solution

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

    echo "set nocompatible" > ~/.vimrc

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

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

     


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


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

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