Repair auto-installed state of packages

If none of the more specific forums is the right place to ask

Repair auto-installed state of packages

Postby TaaTT4 » 2018-01-22 18:34

I need to fix package dependencies of a system of which I became administrator.
The former sysadmin has broken many of the auto-installed relationships between packages for apparently no reason.

I want to automate (with a script) the repair process as much as possible.
The idea is to build a list of the installed packages which are dependency (because recommended or dependent/pre-dependent) of another package.
Subsequently, calling aptitude markauto on every package of the list should bring back the system to a saner configuration.

A command to retrieve the dependent packages is:
Code: Select all
aptitude search '~i !~M !~E (~Rpredepends:~i | ~Rdepends:~i | ~Rrecommends:~i)'

Unfortunately, this doesn't take in account recursive dependencies (e.g. apport Depends python3-apport, but python3-apport recommends apport).
How can I intercept this loop and exclude those packages from the list?


Thanks,
Raffaele.
TaaTT4
 
Posts: 2
Joined: 2018-01-22 13:56

Re: Repair auto-installed state of packages

Postby bw123 » 2018-01-22 20:55

TaaTT4 wrote:I need to fix package dependencies of a system of which I became administrator. The former sysadmin has broken many of the auto-installed relationships between packages for apparently no reason.


It's really not that hard to break this functionality. I have had to repair mine several times on different installs. Using dpkg -i with several packages, removing/purging specific pkgs and I know not what else can get them out of whack.

I like your idea, but I haven't found an easy way to do it. I usually use aptitude-curses and fix them the way I want. I don't like recommends marked auto, but that's just my preference. I don't like 'required' priority marked auto either. Also, I don't consider pkgs that 'provide' a virtual pkg as automatic because that was a choice.

I usually open the pkgs listed in aptitude one-by-one and 'M' on the depends list. Yeah, it takes a long time, I hope you can get me a script working that is an awesome idea.

Be sure and search the forum, there are some members on here that are real geniuses with apt/aptitude. There may be some help in older posts.

Good Luck!
User avatar
bw123
 
Posts: 2768
Joined: 2011-05-09 06:02
Location: TN_USA

Re: Repair auto-installed state of packages

Postby TaaTT4 » 2018-01-22 22:36

bw123 wrote:I usually open the pkgs listed in aptitude one-by-one and 'M' on the depends list. Yeah, it takes a long time, I hope you can get me a script working that is an awesome idea.

Yes, I could do it by hand, but there are over 1000 packages installed and just about 300 are marked as auto.
It would be a long, tedious and error prone task.

bw123 wrote:Be sure and search the forum, there are some members on here that are real geniuses with apt/aptitude. There may be some help in older posts.

I looked before posting (both in Debian forum and with Google), but I haven't find anything useful :(
TaaTT4
 
Posts: 2
Joined: 2018-01-22 13:56

Re: Repair auto-installed state of packages

Postby bw123 » 2018-01-22 22:51

TaaTT4 wrote:Yes, I could do it by hand, but there are over 1000 packages installed and just about 300 are marked as auto.
It would be a long, tedious and error prone task.


Well, I just did it last month on 1875 pkgs that all were marked manual. It took me about 3 martinis and by the third one I was ready to take a nap.. It really wasn't that bad. A couple or four hours... even if you had a script, I'd probably want to go back in and check them all anyway.


oh yeah, btw have you seen this /var/log/apt/eipp.log.xz file? I have been wondering what the heck it is. It lists a lot of depends and conflicts for installed pkgs. A List like that might be helpful...
User avatar
bw123
 
Posts: 2768
Joined: 2011-05-09 06:02
Location: TN_USA

Re: Repair auto-installed state of packages

Postby dryden » 2018-02-09 14:49

I don't know if this is useful, but this shows all packages that have no packages that depend on them:

Code: Select all
dpkg -l | grep ^ii | awk '{print $2}' | while read p; do [ $(apt-rdepends -r $p -f Depends,Recommends --state-follow=Installed --state-show=Installed 2> /dev/null | wc -l) -eq 1 ] && echo $p; done


Note: if something was installed using a meta-package, and then the meta-package was removed, this list might show those items.
dryden
 
Posts: 78
Joined: 2015-02-04 08:54


Return to General Questions

Who is online

Users browsing this forum: No registered users and 5 guests

fashionable