Renaming a Mailman list

This evening I renamed a number of UWCS's mailing lists for a few reasons, mostly due to the annoying ambiguity of the old names. Mailman doesn't make this particularly easy - this how you can do it under Etch;

  • First, define variables to avoid stupid mistakes:
$ OLD=old-list-name
$ NEW=new-list-name
$ set -u
  • Next, take down Mailman and do a quick sanity check. The MTA should queue any incoming mails when qrunner stops responding:
$ sudo /etc/init.d/mailman stop
$ sudo test -a /var/lib/mailman/archives/private/${NEW} && echo '*** That mailing list name already exists. ***'
  • Now move the list data and regenerate the archives for that list:
$ sudo mv /var/lib/mailman/lists/${OLD} /var/lib/mailman/lists/${NEW}
$ sudo mv /var/lib/mailman/archives/private/${OLD} /var/lib/mailman/archives/private/${NEW}
$ sudo mv /var/lib/mailman/archives/private/${OLD}.mbox /var/lib/mailman/archives/private/${NEW}.mbox
$ sudo mv /var/lib/mailman/archives/private/${NEW}.mbox/${OLD}.mbox /var/lib/mailman/archives/private/${NEW}.mbox/${NEW}.mbox
$ sudo /var/lib/mailman/bin/arch ${NEW}
  • You should probably provide legacy aliases:
$ sudo cp /etc/aliases `mktemp aliases-backup.XXXX`
$ sudo printf "\\n# '${OLD}' -> '${NEW}' mailing list rename \\n" | sudo tee --append /etc/aliases
$ echo "${OLD}: ${NEW}" | sudo tee --append /etc/aliases
$ for SUFFIX in admin bounces confirm join leave owner request subscribe unsubscribe; do echo "${OLD}-${SUFFIX}: ${NEW}-${SUFFIX}" | sudo tee --append /etc/aliases; done
  • Now go to the administrator interface and change:
  • General / real_name: NEW
  • General / subject_prefix: "[NEW] " (or similar)
  • Privacy / Recipient filters / acceptable_aliases: Add OLD
  • Now, bring everything back online with:
$ sudo newaliases
$ sudo /var/lib/mailman/bin/genaliases
$ sudo /etc/init.d/mailman start

# For bonus points, generate yourself Apache redirect for the new name:

$ echo "RewriteRule ^/([^/]*)/${OLD}($|(/.*)) /\\$1/${NEW}\\$2\\$3 [R=301,L]"

Ta-da, nice new names. You will need to warn your users as their filtering will now have broken.

Comments (7)

Thanks for this article. You saved me a lot of time trying to figure it out myself.

It almost works as written for Ubuntu (7.04), except:
sudo /etc/init.d/mailman <i>stop</i>
sudo <i>bash</i> -c "[[ -a /var/lib/mailman/archives/private/${NEW} ]] &amp;&amp; echo '*** That mailing list name already exists. *** '"

And add backslashes
echo "RewriteRule ^/([^/]*)/${OLD}(\$|(/.*)) /\$1/${NEW}\$2\$3 [R=301,L]"

Oct. 8, 2007, 1:21 p.m. #

Thanks. I've reworked the ``sudo bash -c..`` line now to use ``test`` explicitly. I had added those slashes, but Wordpress eated it.

Oct. 8, 2007, 1:40 p.m. #
Tyler Mitchell

Great tutorial, thanks. On my instance of mailman I can't change the real_name attribute: "Error: real_name attribute not changed! It must differ from the list's name by case only." Is there a way to force this so that I can get past step 5? :)

Oct. 9, 2007, 8:10 p.m. #

@Tyler: Not sure. Can you reply with your version of Mailman and distribution? You could probably just get away with editing the database but Mailman is very funny these sorts of things (lots of stuff generated from the database might not be updated until you run some esoteric command).

Oct. 9, 2007, 8:17 p.m. #
Steven Bakker

Wow, this just saved me lots of headaches. I pretty much copy/pasted all the steps and it worked without a problem.


July 14, 2008, 9:13 a.m. #
Tom M

Did I miss where you setup the NEW aliases, or does one of those commands do it automatically?

Aug. 3, 2009, 7:56 p.m. #
I believe genaliases does that for you, but I don't have a working mailman instance handy to try.

If you run into the error updating the real_name attribute - real_name attribute: "Error: real_name attribute not changed! It must differ from the list's name by case only"

The fix for it is documented at this link -…

Nov. 3, 2012, 8:45 p.m. #