You are here

Linux

Replacing all occurences of a string in a file with another

In Linux, replacing all instances of a string with another string is easy thanks to sed. A simple example is as follows:

To replace the string foo with the string bar in all .txt files:

PDOException: SQLSTATE[HY000]: General error: 144 Table 'cache_menu' is marked as crashed and last (automatic?) repair failed: DELETE FROM {cache_menu};

While trying to edit a menu on a Drupal site, I found that none of my changes were being saved. Looking at the logs led me to the following error message:

PDOException: SQLSTATE[HY000]: General error: 144 Table 'cache_menu' is marked as crashed and last (automatic?) repair failed: DELETE FROM {cache_menu};

Simply restarting MySQL did not fix things and it looked like I had to get my hands a li'l dirty.

flashplugin-installer: Unable to download plugin from archive.canonical.com

Attempting to update flashplugin on Ubuntu Precise resulted in an error. Removing the package and reinstalling it resulted in the following:

MySQL will not start due to corrupt InnoDB tables

After a recent server migration, I found that my MySQL instance was not starting up (on Debian Squeeze). A look in the logs revealed that MySQL was having issues with corrupt InnoDB tables and therefore refusing to start. A number of forums informed me to do the following.

dpkg cannot install as there's no space left on the device even though there is

I ran into this issue a couple of days ago and cannot recall the exact error message. However, the problem was effectively that aptitude could not install the new kernel update because my partition had apparently run out of space. An interrupted update to Klipper is one thing and the Linux kernel a whole 'nother kettle of fishies. Thinking that I simply needed to free up some space on my partition, I checked the current status via df.

Scrolling within Screen's buffer

Since I keep forgetting this shortcut, here it is for posterity. Activating GNU Screen's scrollback feature can be done by pressing CTRL + a + [. This is especially handy when you are using Screen from within PuTTY.

While a number of sites provide additional Vim-esque shortcuts to navigate within the buffer, I've been able to get by fine with just the navigational arrow keys on my keyboard.

Cron: pam_unix (cron:session): session opened/closed for user root by (uid=0)

This is my week of playing around with mail servers and I have been keeping an eye on the logs on a regular basis. I noticed that the auth.log was riddled with millions of these pointless (from my POV anyhow) log entries:

CRON: pam_unix(cron:session): session opened for user root by (uid=0)
CRON: pam_unix(cron:session): session closed for user root

Cyrus sasld testsaslauthd connect() : No such file or directory 0

While trying to debug a postfix authentication issue in Debian 6, I had to use testsaslauthd to test things out:
testsaslauthd -s smtp -u foo@example.com -p test

only to get the following error:
connect() : No such file or directory 0

This is apparently because a lot of people (and authors) follow the same guide for configuring postfix and saslauthd. One of the steps missing is to symlink and saslauthd directory to a location within postfix. To fix:

Debian/Ubuntu: Loading iptables rules on boot

If you've ever worked with Debian or Ubuntu servers, you've very likely had to set up a firewall at some point or the other. However, any changes that are made are not saved and loaded if the server is ever rebooted. The following is a quick guide on how to get this happening:

(root or sudo access is required)

Kubuntu Precise: No apport report written because MaxReports is reached already

My upgrade from Lucid to Precise did not go well and I've been battling errors ever since. I ran into the following error when trying to reinstall the php5-gd extension for PHP:
No apport report written because MaxReports is reached already

Pages

Subscribe to RSS - Linux