You are here

Linux

Drupal XMLSiteMap: public://xmlsitemap/ not found or not writable

I ran into the following error (or something like it) while setting up Drupal's xmlsitemap module:

public://xmlsitemap/lOtsOfgoBBlDegOOk not found or not writable

This is as expected some kind of permissions issue. Why the module can't sort this on its own, I do not know. As with everything Drupal, clear the cache first to see if that fixes things. It sometimes does. If not, you will need to get your hands dirty on the commandline (if linux):

Postfix: queue management commands

Here are some postfix queue management commands that I find myself using regularly (on an Ubuntu server):

Slow login into Ubuntu via SSH

Fresh install of Ubuntu Server 12.04 LTS: After installed SSHD, I found that logging in remotely was a time-consuming process as the password prompt took ages to pop up after the username prompt. Binging about, I found that this was due to SSHD performing a reverse DNS lookup of my IP to potentially check if all is kosher. Turning this check off fixes the issue:

Screen .screenrc configuration

All those who SSH into servers ought to use GNU Screen. The following is some additional configuration that can be added to a .screenrc file in your home directory. These lines do wonders to the usability of the system:

caption string "%?%F%{= Bk}%? %C%A %D %d-%m-%Y %{= kB} %t%= %?%F%{= Bk}%:%{= wk}%? %n "
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]'

What to do when 'dpkg --configure -a' does not work?

I recently had trouble with a MySQL installation in Ubuntu. For some reason or the other, during an upgrade to a newer version of mysql-server, the upgrade script had issues stopping the server and the script failed. This meant that apt could no longer function as it kept raising a red flag over the broken upgrade with the following instructions:

dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem.

Tranferring a file using PuTTY's pscp

Instead of trying to recollect what the exact syntax for pscp is, here's a list of examples for future reference. In these examples, I'm transferring a file (bar.zip) from a Windows host to a Linux server (with the destination path of /home/druss/Desktop/).

"C:\Program Files (x86)\PuTTY\pscp.exe" -scp -P 2134 -pw mypassword bar.zip druss@foo.dyndns.info:/home/druss/Desktop/

MySQL encoding error: Warning (Code 1366): Incorrect string value: '\xE9, a <...' for column 'body' at row 3

While performing a CSV import recently, I ran into the following error messages:

Warning (Code 1366): Incorrect string value: '\xE9, a <...' for column 'body' at row 3
Warning (Code 1366): Incorrect string value: '\xE6. He ...' for column 'body' at row 24
Warning (Code 1366): Incorrect string value: '\xE9, and...' for column 'body' at row 26

The first message was triggered due to the accented é in the word, protegé, in the input. The rest of the field was not imported. The others were similarly triggered.

Changing a file's encoding using Vim

During imports and stuff, it's imperative that all steps utilise the same encoding/character set. If a text file is not using the preferred encoding, we can use Vim to change it during its save action as follows:

:set fileencoding=utf8
:w

or if you want to save it to a different file and leave the current file unchanged:

:w ++enc=utf-8 newfile.txt

Upgrading KTorrent in Kubuntu Precise

KTorrent on the LTS release of Kubuntu—Precise Pangolin aka 12.04—is perfectly fine except for the fact that it comes only with version 4.1. Unfortunately, this package is missing a few features that I was looking for, especially the option to add magnet links via its web interface.

Upgrading from 4.1 to 4.3 (the latest version at the time of writing) is pretty straightforward if one is happy to accept PPA sources.

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:

sed 's#foo#bar#g' *.txt

This will replace the strings. However, it won't actually save the changes and will instead output the modified text to the screen. To retain the changes or, in other words, to perform the replacements in place within the file, use the -i switch:

Pages

Subscribe to RSS - Linux