Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8303365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:30:47+00:00 2026-06-08T17:30:47+00:00

I have a custom built Debian package which right now installs and uninstalls fine

  • 0

I have a custom built Debian package which right now installs and uninstalls fine but have a couple of issues:

  1. I would like to know how I can make the uninstall process check for a file on the disk. Let’s say if file /etc/file.conf exists, I don’t want the package to be uninstalled. Is that possible? I tried adding the check to prerm and postrm, but all the files installed by the package get removed anyway even IF prerm and postrm scripts exits with an error.

I am guessing there is probably a specific exit code that I should be using in those scripts?

  1. During uninstall sometimes some directories created by packages are NOT removed as they are not empty. The error is like: “dpkg: warning: while removing packagename, directory ‘/opt/packagename/’ not empty so not removed.” Is there a way to forcefully remove all files installed by the package despite the contents?

I have been through documentation a few times looking for answers, but it seems I haven’t been looking at the right place.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T17:30:49+00:00Added an answer on June 8, 2026 at 5:30 pm

    I would like to know how I can make the uninstall process check for a file on the disk.
    Let’s say if file /etc/file.conf exists, I don’t want the package to be uninstalled. Is
    that possible? I tried adding the check to prerm and postrm, but all the files installed by > the package gets removed anyway even IF prerm and postrm scripts exits with an error.

    A non zero exit from the prerm script will not delete all the installed files.

    #!/bin/sh
    if [ -x /etc/file.conf ]; then
      echo "You shall not remove me" >&2
      exit 1
    fi
    

    During uninstall sometimes some directories created by packaged are
    NOT removed as they are not empty. The error is like: “dpkg: warning:
    while removing packagename, directory ‘/opt/packagename/’ not empty so
    not removed.” Is there a way to forcefully remove all files installed
    by the package despite the contents?

    The file installed by the package will be removed. That warning signals
    files created during the application’s lifetime. You can use the postrm
    script to remove them.

    As a side note, a package shouldn’t put stuff into /opt.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom built menu system in which I would like to load
I have a custom built application framework written in PHP which I have been
I have built a custom component using some containers and a TileList. Now when
I have customer that uses older, custom built ERP application for which they don't
I have a custom built sign up component that I would like to enhance.
I have built a custom dialog box. All the functionality is just working fine
I have a custom component built for a Joomla 2.5 website. It is working
I have an ASP control custom built and I need to pass a value
i have wordpress blog in my custom built website, i am displaying some posts
I have built a Custom MaskedTextBox , changing the values of BeepOnError and AsciiOnly

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.