Category Archives: troubleshooting

Configuring proxy for APT in Ubuntu

Recently, I have a problem where when I tried to update Ubuntu package via apt-get, it shows HTTP 401 proxy error related.
Just a note, I’m running the VM using my office network which has a proxy servers.

From this site;

APT configuration file method
This method uses the apt.conf file which is found in your /etc/apt/ directory. This method is useful if you only want apt-get (and not other applications) to use a http-proxy permanently.
On some installations there will be no apt-conf file set up. This procedure will either edit an existing apt-conf file or create a new apt-conf file.
gksudo gedit /etc/apt/apt.conf
Add this line to your /etc/apt/apt.conf file (substitute your details for yourproxyaddress and proxyport).
Acquire::http::Proxy "http://username:[email protected]:proxyport";
Save the apt.conf file.

References :
http://askubuntu.com/questions/257290/configure-proxy-for-apt
http://askubuntu.com/questions/543616/why-does-add-apt-repository-now-fail-to-retrieve-keys-behind-my-proxy-server-bu

Fixing wp_termmeta doesn’t exist error

One day, I open my mailbox and see bunch of error mail written something like this:

PHP message: WordPress database error Table 'blog.wp_termmeta' doesn't exist for query SELECT term_id, meta_key, meta_value FROM wp_termmeta WHERE term_id IN (108) ORDER BY meta_id ASC made by require('wp-blog-header.php'), wp, WP->main, do_action_ref_array, call_user_func_array, Jetpack_RelatedPosts->action_frontend_init, Jetpack_RelatedPosts->_action_frontend_init_ajax, Jetpack_RelatedPosts->get_for_post_id, Jetpack_RelatedPosts->_get_related_posts, Jetpack_RelatedPosts->_get_related_post_data_for_post, Jetpack_RelatedPosts->_generate_related_post_context, get_the_category, get_the_terms, wp_get_object_terms, update_termmeta_cache, update_meta_cache

Upon diving in Google ocean, I found this solution that may solve the problem:

CREATE TABLE `wp_termmeta` (
  `meta_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `term_id` bigint(20) unsigned NOT NULL DEFAULT '0',
  `meta_key` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `meta_value` longtext COLLATE utf8mb4_unicode_ci,
  PRIMARY KEY (`meta_id`),
  KEY `term_id` (`term_id`),
  KEY `meta_key` (`meta_key`(191))
) ENGINE=InnoDB AUTO_INCREMENT=3255 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

Use this SQL query to add manually the wp_termmeta table in your WordPress database if there is the wp_termmeta table doesn’t exist in your DB.

Credit: http://zanca.it/tutorials/wp_termmeta-doesnt-exist-error-solved/

Shell script fails: Syntax error: “(” unexpected

The error when executing the bash code:

install.sh: Syntax error: "(" unexpected

The script does not begin with a shebang line, so the kernel executes it with /bin/sh. On Ubuntu, /bin/sh is dash, a shell designed for fast startup and execution with only standard features. When dash reaches the line, it sees a syntax error: that parenthesis doesn’t mean anything to it in context.

Since dash (like all other shells) is an interpreter, it won’t complain until the execution reaches the problematic line. So even if the script successfully started at some point in your testing, it would have aborted once the problematic line was reached.

The shebang line must be the very first thing in the file. Since you use bash features, the first line of the file must be #!/bin/bash or #!/usr/bin/env bash.

Credit: http://unix.stackexchange.com/questions/45781/shell-script-fails-syntax-error-unexpected

Python Error – InsecurePlatformWarning

There is one time I see this kind of error:

          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

If you’re on ubuntu, you may run into trouble installing pyopenssl, you’ll need these dependencies:

apt-get install libffi-dev libssl-dev

You only need to install the security package extras:

pip install requests[security]

or, install them directly:

pip install pyopenssl ndg-httpsclient pyasn1

Requests will then automatically inject pyopenssl into urllib3

Credit: http://stackoverflow.com/questions/29134512/insecureplatformwarning-a-true-sslcontext-object-is-not-available-this-prevent

Python Error – ImportError: No module named pkg_resources

There is one time I tried to install some python package via pip install requirement. But I encountered some error like this:

    from pkg_resources import load_entry_point
ImportError: No module named pkg_resources

To fix the issue, run the setup script for setuptools:

wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - | python

Yeah. it solve my problem. Probably. XD

Credit: http://stackoverflow.com/questions/7446187/no-module-named-pkg-resources

Fix Locale problem on Ubuntu

Recently, I saw this kind or error quite frequent. At first I thought that it was nothing.
But eventually, it’s kinda bothering me when I see the error message. :p

Jul  6 15:18:01 lel CRON[25571]: pam_env(cron:session): Unable to open env file: /etc/default/locale: No such file or directory
Jul  6 15:31:50 lel sshd[29217]: pam_env(sshd:session): Unable to open env file: /etc/default/locale: No such file or directory

So, here is the solution to solve this problem.
First, run this command:

sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8

It updates /etc/default/locale with provided values.

If you see the /etc/default/locale file, it shows something like this:

#  File generated by update-locale
LANG=en_US.UTF-8
LC_ALL=en_US.UTF-8

If the problem still occur, maybe you can try this first before running the command above again:

sudo locale-gen en_US.UTF-8
sudo dpkg-reconfigure locales

Credit to http://askubuntu.com/questions/162391/how-do-i-fix-my-locale-issue/505424#505424

SNMP Cannot Find Module on Ubuntu 14.04

If you encounter error something like this:

Cannot find module (SNMPv2-MIB): At line 0 in (none)
Cannot find module (SNMPv2-SMI): At line 0 in (none)
Cannot find module (SNMP-NOTIFICATION-MIB): At line 0 in (none)
Cannot find module (SNMPv2-TM): At line 0 in (none)

Then, where are in the same path. Path where we searching for the answers. XD
So, here is the solution to solve this error.

First, edit this sources.list file:

sudo vi /etc/apt/sources.list

add this line to the end of file:

deb http://fr.archive.ubuntu.com/ubuntu precise main multiverse

:w to save and :q to exit vi editor

Then, install this packages:

sudo apt-get install snmpd snmp-mibs-downloader

And then run this:

sudo download-mibs

Voila! Done. Hope it helps. 🙂

Ubuntu – Authentication token manipulation error

Authentication token manipulation error on Ubuntu

Authentication token manipulation error on Ubuntu

Recently, I forgot my “root” password for my Ubuntu (duh!). So I try attempting to change my “root” password by selecting recovery mode on the grub menu and dropped into a root shell prompt.

Everything works perfect until I try to change the password. The picture above is what I get when i try to change the password. 🙁

So, to solve this, just run this on the prompt:

mount -rw -o remount /

Anddddd… Walla! Try to reset the password again and it works! 🙂

Hash sum mismatch error on Ubuntu

I think most of you will encounter with this kind of problem if you are using the previous version of Ubuntu.

W: Failed to fetch gzip:/var/lib/apt/lists/partial/us.archive.ubuntu.com_ubuntu_dists_natty_main_source_Sources  Hash Sum mismatch, 
E: Some index files failed to download. They have been ignored, or old ones used instead.

The solution is to remove the content of /var/lib/apt/lists directory:

sudo rm /var/lib/apt/lists/*

then run:

sudo apt-get update

Credit to askubuntu.com