DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD Packages and Ports

OpenBSD Packages and Ports Installation and upgrading of packages and ports on OpenBSD.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 3rd June 2019
beavers beavers is offline
Shell Scout
 
Join Date: Nov 2017
Posts: 85
Default `pkg_info -m` incorrect

`pkg_info -m` is currently showing dependencies that were not manually installed. This seems to happen every so often, and the only way I can think to fix it is to remove the main package that pulled in the dependencies, then `pkg_delete -a`, then reinstall the main package. Although quite often, a dependency listed by `pkg_info -m` belongs to a number of main packages, each discovered in turn as I go through this process.

Is there a simpler way of accomplishing this? Manually editing the pkg db somehow?
Reply With Quote
  #2   (View Single Post)  
Old 3rd June 2019
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

You can switch any installed package from "manually installed" to "automatically installed" with the -aa flag of pkg_add(1).


From the man page:
Code:
   Manual installation
     pkg_add differentiates between packages specified on the command line,
     and packages installed automatically because of inter-dependencies: the
     first kind will be tagged as `installed manually'.  The -a option is used
     internally by the ports(7) infrastructure and dpb(1) to handle
     dependencies.

     It is also possible to tweak the `installed manually' status of a package
     after the fact.  Running pkg_add on an already installed package will tag
     it as `installed manually', even if it was already there as a dependency
     of something else, and doubling the -a option will remove the `installed
     manually' tag from installed packages.
Reply With Quote
  #3   (View Single Post)  
Old 4th June 2019
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

I've been thinking about the initial problem.
Quote:
Originally Posted by beavers View Post
`pkg_info -m` is currently showing dependencies that were not manually installed. This seems to happen every so often...
The only way I can think of to cause this to happen is to build dependencies locally via the ports tree.
Reply With Quote
  #4   (View Single Post)  
Old 4th June 2019
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 1,027
Default

A minor note: the thread title refers to pkg_add instead off pkg_info. Fixing this could help future searchers.
Reply With Quote
  #5   (View Single Post)  
Old 4th June 2019
beavers beavers is offline
Shell Scout
 
Join Date: Nov 2017
Posts: 85
Default

Perfect, thanks! As always, a closer reading of the man page would have fixed my issue.

Quote:
Originally Posted by jggimi View Post
I've been thinking about the initial problem.The only way I can think of to cause this to happen is to build dependencies locally via the ports tree.
As a rule I stick to packages entirely, so nothing is being built on these particular machines. I don't even keep a copy of the ports tree.

It seems to correlate with major bumps to package versions.

Quote:
Originally Posted by IdOp View Post
A minor note: the thread title refers to pkg_add instead off pkg_info. Fixing this could help future searchers.
Good catch, thanks.
Reply With Quote
  #6   (View Single Post)  
Old 4th June 2019
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

Quote:
Originally Posted by beavers View Post
It seems to correlate with major bumps to package versions.
It doesn't happen to me. You might consider running pkg_check(8) to check and correct any package inconsistencies.
Reply With Quote
  #7   (View Single Post)  
Old 4th June 2019
beavers beavers is offline
Shell Scout
 
Join Date: Nov 2017
Posts: 85
Default

Yeah, I must be doing something to cause it, I just can't imagine what.

pkg_check cleaned up a few permissions in /var/db/pkg. Will keep an eye on things and report back if I find any clues.
Reply With Quote
  #8   (View Single Post)  
Old 4th June 2019
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

Quote:
Originally Posted by beavers View Post
Yeah, I must be doing something to cause it, I just can't imagine what.
pkg_add -r instead of -u, perhaps?
Reply With Quote
  #9   (View Single Post)  
Old 4th June 2019
beavers beavers is offline
Shell Scout
 
Join Date: Nov 2017
Posts: 85
Default

Nah, I always use `pkg_add -ui`.
Reply With Quote
Old 12th June 2019
brudan brudan is offline
Fdisk Soldier
 
Join Date: Dec 2018
Posts: 82
Default

I wrote a little shell script that tells me why a particular package was installed (manual vs. automatic) and which other packages depend on it, if any. Here it is in case it is of use to anyone:

Code:
#!/bin/sh

cd /var/db/pkg

grep -q '@option manual-installation' ${1}-*/+CONTENTS 2>/dev/null
result=$?
case $result in
	0)	echo "Manually installed." ;;
	1)	echo "Automatically installed." ;;
	2)	echo "Not installed."; exit ;;
esac

if grep -q -r "@depend .*:${1}-" *; then
	echo "The following packages depend on it:"
	grep -r "@depend .*:${1}-" * | awk -F'/' '{print $1}' | uniq
else
	echo "No packages depend on it."
fi
To use it, save the script somewhere in your PATH, name it why and make it executable. Here is an example run:

Code:
bruno@thinkpad:~$ why ffmpeg
Manually installed.
The following packages depend on it:
mplayer-20190330p0
mpv-0.29.1
I choose ffmpeg as an example on purpuse: It shows the unusual situation where a manually-installed package also happens to be a dependency of other packages.

Last edited by brudan; 18th June 2019 at 06:28 PM.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
"pkg_info -W" in OpenBSD? yezster OpenBSD Packages and Ports 3 13th February 2018 04:23 AM
/etc/daily gives incorrect warning acampbell OpenBSD General 8 12th May 2017 04:12 AM
patch for CVE-2012-2110 - incorrect? jsmith6134 OpenBSD Security 2 23rd April 2012 12:15 PM
Incorrect df results (not -h, not a FAQ) nathang FreeBSD General 5 8th June 2008 06:44 AM


All times are GMT. The time now is 11:42 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick