Failed to stop postfix.service: Unit postfix.service not loaded

8,325

Solution 1

This Worked for me:

After creating a postfix file, run this command:

sudo apt-get purge postfix 

And then reinstall postfix:

sudo apt-get --reinstall install postfix

Solution 2

The reason was because /etc/init.d/postfix did not exist.

I created a blank /etc/init.d/postfix file and made it executable using sudo chmod +x /etc/init.d/postfix, then problem solved.

Share:
8,325

Related videos on Youtube

Omid
Author by

Omid

Contact me on facebook or visit my website and WebAdvice

Updated on September 18, 2022

Comments

  • Omid
    Omid 9 months

    When I try to remove postfix I get this error:

    Removing postfix (3.1.0-3) ...
    Failed to stop postfix.service: Unit postfix.service not loaded.
    invoke-rc.d: initscript postfix, action "stop" failed.
    dpkg: error processing package postfix (--remove):
     subprocess installed pre-removal script returned error exit status 5
    Processing triggers for libc-bin (2.23-0ubuntu3) ...
    Errors were encountered while processing:
     postfix
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    
  • Rick
    Rick almost 4 years
    This works for me. Though don't know why :) Thanks
  • wuseman
    wuseman almost 2 years
    This also works for my setup. everything I tried failed but this one worked fine. Thanks alot. --reinstall did it.