Tony Narlock Living life in the cloud

23Mar/100

Debugging and troubleshooting postfix

Error: Postfix isn't working with mail() on PHP automatically.

Common problem: You have exim or something else running.

Solution: try lsof -i :25. If you intend on using postfix, kill the pid of the app, remove the package of exim or sendmail if you have it installed. See This postfix thread on Ubuntu Forums.


Other issue: Postfix isn't working (miscellaneous)

Solution: tail /var/log/maillog or tail /var/log/mail.err (source)

Error: fatal: open lock file /var/lib/postfix/master.lock: unable to set exclusive lock: Resource temporarily unavailable

You may have another copy of postfix still open. Use lsof -i :25 to track down which process. kill the pid and postfix reload.


Error: postfix set-permissions returns
chown: cannot access `/usr/lib/postfix/dict_cdb.so': No such file or directory.

May be by design, #274108 in ubuntu launchpad says this command doesn't necessarily mean something's wrong.

Helpful resources

Ubuntu handbook page: https://help.ubuntu.com/community/Postfix

17Mar/100

Add your user groups to sudoers file

sudo allows system administrators to delegate authority to other users on a server. In this post, we will show how user groups can sudo.

Sudo (su "do") allows a system administrator to delegate authority to give certain users (or groups of users) the ability to run some (or all) commands as root or another user while providing an audit trail of the commands and their arguments.

Some users mistakenly attempt to add themselves to the /etc/sudoers file directly. This doesn't work. Use the command visudo.

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

You can have add a user called penguin to users: useradd -G users penguin

Then, you can add penguin to the admin admin group. usermod -a -G admin penguin

Now penguin can sudo.

You can also give users ability to sudo without a password (for cron-type stuff).

Type visudo in terminal.

Uncomment # %sudo ALL=NOPASSWD: ALL by removing the #, or add %sudo ALL=NOPASSWD: ALL

Now add penguin to sudo group.

usermod -a -G sudo penguin

For more information on sudo, you can see the manual pages at man sudo.

10Mar/100

Remove services (mpd) from system startup in Linux

I'm using MPD on Ubuntu and Debian and get annoyed by mpd starting at boot time under root.

Your startup services lie in the /etc/rc.d folder. You will observe that ls -l /etc/rc4.d for instance, will show you these files are weighted to run in order and symlink to their corresponding startup scripts in /etc/init.d.

To disable mpd, for instance, update-rc.d can help:

sudo update-rc.d -f mpd remove

Now you will be able to add mpd to a local user script on startup without having to sudo mpd --kill or sudo killall mpd.

5Mar/100

Troubleshooting locales in the cloud on debian and ubuntu

If you use Amazon EC2 or Rackspace Cloud Servers, you may end up running into this after your create your instance. I often get these on Debian and Ubuntu (since it's debian based also).

lennycloud:~# perl
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

You're missing locales.

Update your apt database. sudo apt-get update

Download locales. sudo apt-get install locales

Now configure it, and download what locales you need. dpkg-reconfigure locales on Debian. sudo locale-gen en_US.UTF-8 on Ubuntu Hardy Heron 8.04 (Note: on server, you may be logged in as root).

I pick en_US ISO-8859-1, en_US.ISO-8859-15 ISO-8859-15 and en_US.UTF-8 UTF-8.

And that solves it.

Updated April 03, 2010 to include locale-gen.