How to Fix “Error in PREUN Scriptlet” When Removing Zarafa Packages via YUM


1 views

When attempting to remove Zarafa mail server packages using yum erase zarafa*, you might encounter PREUN scriptlet execution errors. This occurs during the pre-uninstallation phase of RPM package removal, where the package's pre-uninstall scripts fail to execute properly.

Error in PREUN scriptlet in rpm package zarafa-dagent
Error in PREUN scriptlet in rpm package zarafa-gateway
[...]
zarafa-ical-7.1.9-1.el6.i686 was supposed to be removed but is not!

The PREUN scriptlet (pre-uninstall script) is part of the RPM specification that runs before package removal. Common causes include:

  • Services still running during removal
  • Missing dependencies required for clean removal
  • Permission issues preventing script execution
  • Broken package database entries

1. First Attempt - Force Removal:

sudo rpm -e --noscripts zarafa-dagent zarafa-gateway zarafa-ical \
zarafa-monitor zarafa-server zarafa-spooler

2. Clean Up Remaining Package Files:

sudo yum clean all
sudo package-cleanup --problems
sudo package-cleanup --cleandupes

3. Manual Service Stop (if needed):

for service in zarafa-dagent zarafa-gateway zarafa-monitor \
zarafa-server zarafa-spooler; do
    sudo service $service stop
    sudo chkconfig $service off
done

If the problem persists, examine the specific scriptlet causing the issue:

rpm -q --scripts zarafa-server | less

For a complete clean slate, you might need to manually remove remnants:

sudo rm -rf /etc/zarafa
sudo rm -rf /var/lib/zarafa
sudo rm -f /etc/init.d/zarafa-*

For future package management:

  • Always stop services before removal: sudo service packagename stop
  • Consider using yum remove instead of erase for better dependency handling
  • Regularly clean your package database: sudo yum clean all

When attempting to remove Zarafa mail server packages using yum erase zarafa*, you encounter PREUN scriptlet errors that prevent successful package removal. The system reports that packages were "supposed to be removed but are not," leaving the packages in a problematic state.

RPM packages execute scripts at different phases of installation/removal. The PREUN script runs before package removal and often contains cleanup routines. When these scripts fail, the package manager aborts the removal process to prevent system instability.

Common causes include:

  • Missing dependencies required by the script
  • Syntax errors in the script
  • Permission issues
  • Services that refuse to stop

Try these approaches to force removal:

# Method 1: Skip scriptlets during removal
sudo rpm -e --noscripts zarafa-dagent zarafa-gateway zarafa-monitor zarafa-server zarafa-spooler zarafa-ical

# Method 2: Use nodeps (only if you're sure about dependencies)
sudo rpm -e --nodeps zarafa-*

# Method 3: Clean up first then remove
sudo systemctl stop zarafa-*
sudo rpm -e zarafa-*

For a cleaner resolution that maintains system integrity:

  1. First check if Zarafa services are running:
    systemctl list-units | grep zarafa
  2. Stop all related services:
    sudo systemctl stop zarafa-dagent zarafa-gateway zarafa-monitor \
    zarafa-server zarafa-spooler zarafa-ical
  3. Attempt removal again with verbose logging:
    sudo yum -v remove zarafa-\*
  4. If still failing, examine the problematic script:
    rpm -q --scripts zarafa-server | grep -A20 "preun scriptlet"

To identify why the PREUN script fails:

# Check RPM database for corruption
sudo rpm -Va | grep zarafa

# View scriptlet content
rpm -q --scripts zarafa-dagent

# Test script execution manually (dangerous - use in test environment)
sudo rpm --eval '%preun'

When working with complex packages:

  • Always check rpm -q --scripts before removal
  • Maintain proper service shutdown procedures
  • Consider using yum history for rollback capability
  • Document custom modifications to packages

If standard methods fail completely:

# Reinstall then remove (resets scripts)
sudo yum reinstall zarafa-*
sudo yum remove zarafa-*

# Manual database cleanup (advanced)
sudo rpm --rebuilddb
sudo package-cleanup --problems
sudo package-cleanup --dupes

Remember that forced removals may leave configuration files behind. Check /etc/zarafa and other locations for residual files after removal.