Debian / Ubuntu: How to mark dpkg package like it was never installed before?
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Debian / Ubuntu: How to mark dpkg package like it was never installed before?
I have had problems in the past with reinstalling packages, trying to get the default config files reinstalled.
What I learned was, that Debian notes if config files get erased (my attempt to get them pulled from the package default) and that information even gets remembered when deinstalling and purging the package.
Now my question: How can I tell the apt / dpkg database that package xzy is wiped off the system and should not be remembered, that it was ever installed, so that when I install it, the system feels that it is the first time ever and the default config files get properly created?
I have been in the absurd situation where I erased a config file and then Debian refused to ever create it again.
This hinders the situation where after an dist-upgrade (or several) I want to reset a package to factory defaults, so all old leftovers are properly removed.
Thanks for the link, I found another link that let's reset a package likeit was never installed, which is the easiest way without having to specify tons of options. Is there a dpkg command that lets the database forget that a package was ever installed, instead of having to edit the database by hand, which is very ugly?
Last edited by browny_amiga; 01-20-2017 at 06:24 PM.
your registered date instils some respect, nevertheless i have to ask:
- how are you editing which database manually?
- did you read 'man dpkg'?
- are you sure dpkg actually "remembers" packages after they have been purged? show us?
- how are you un/installing?
I've had scripts in a live system that would pump the contents of all packages required to support hardware features found early in the boot process based on vendor and hardware ids present. As it was a live system, hardware varies, and by pumping the contents of all packages needed for proprietary Nvidia support for example, during the boot process would give a desktop with full proprietary support.
With the exception of the kernel module and xorg.conf file which had to be pre-built, all other configuration files, libraries, etc. were extracted from the packages. When you open the package with an archiver you will find the files that would be installed in a directory tree equal to root directory so you know exactly where the file belongs.
I'm aware that I can take the config files directly from the package, I chose not to, as I want to use dpkg to do it. I want a systematic scalable way to do this in the future.
What my aim is to remove a package 100%, like it was never installed in the first place. That dpkg thinks that this is a fresh system, where package xzy was never before installed. The dpkg man file does not say anything about that, reseting and making dpkg forget that a package was ever installed. Once I had it installed, it is no longer fully deinstallable by dpkg itself. I have no idea where and how the dpkg database works, I have interfaced with it via apt and dpkg so far and cannot find any documentation about the workings and file structure of the db. At this point, I would assume that /var/lib/dpkg/status is a flat file that is called database, but I have to do more testing.
How I know that dpkg remembers a deinstalled file?
Well, I have tried this some years back, trying to reset a package to its fully uninstalled state, so that a new install will create the standard default config files, but I could not make this happen. dpkg did not want to recreate the config files, even after purging the package with apt. I then erased one config file when the package was installed, which caused the consecutive purge to also remember that I erased that file and assumed, that this was intentional on my side and from then on never again replaced the missing file with the default config file.
I might have to completely erase an entry of the package in /var/lib/dpkg/status by hand so that a fresh clean reinstall is possible. I wish a dpkg command could do that, ask dpkg to completely forget about the history of a package.
interesting.
however, that superuser thread does NOT mention that "even purging" doesn't help here.
moreover, doesn't tell us where that crucial log file entry came from...
the bug report was closed because dpkg works as expected.
i still don't see anything that 'purge' wouldn't fix.
also, looking at 'man dpkg' and searching for 'status' there's quite a few interesting entries, pertaining to removing entries from /var/lib/dpkg/status and more.
are you sure you saw all that and tried all options available?
I have not had this problem for a while, but now it is back and I can talk in detail about it, it is on a raspberry Pi, using Raspian.
I'm having a problem with the network configuration and especially wpa_supplicant.
I wanted to do a complete reset of the config, so I erased the whole wpa_supplicant directory on /etc/.
Using the option force_confmiss, I'm trying to make dpkg regenerate the config files, it does work for some of the conf files, but not the most important one, wpa_supplicant.conf
dpkg -i --force-confmiss wpasupplicant_2.3-1+deb8u4_armhf.deb
(Reading database ... 123761 files and directories currently installed.)
Preparing to unpack wpasupplicant_2.3-1+deb8u4_armhf.deb ...
Unpacking wpasupplicant (2.3-1+deb8u4) over (2.3-1+deb8u4) ...
Setting up wpasupplicant (2.3-1+deb8u4) ...
Configuration file `/etc/wpa_supplicant/action_wpa.sh', does not exist on system.
Installing new config file as you requested.
Configuration file `/etc/wpa_supplicant/functions.sh', does not exist on system.
Installing new config file as you requested.
Configuration file `/etc/wpa_supplicant/ifupdown.sh', does not exist on system.
Installing new config file as you requested.
then,
ifup wlan0
wpa_supplicant: cannot read contents of /etc/wpa_supplicant/wpa_supplicant.conf
run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1
Failed to bring up wlan0.
In the version of wpasupplicant you're trying to configure from (2.3-1+deb8u4), the conffile wpa_supplicant.conf is unpacked to /etc/dbus-1/system.d/, not /etc/wpa_supplicant/ where your copy of wpa_supplicant appears to be looking for it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.