Re: Linux subsystem requirement

From: Edward Sanford Sutton, III <mirror176_at_hotmail.com>
Date: Sat, 28 Jun 2025 11:06:59 UTC
On 6/27/25 16:29, Walter Parker wrote:
> Hi,
> 
> A friend just had something different happen to his new FreeBSD box.
> When he tries to install packages, pkg seems to want to install the 
> linux-compat-rl9 package with many of the packages that he is trying to 
> install.
> This leads to a few questions:
> How do you find which installed packages require the linux compatibility 
> package?

   Linux compatibility comes from base; maybe something about pkgbase 
can help sort it out but I am not familiar enough with that.
   If you otherwise mean to ask what depended on linux-base_rl9 instead 
of linux compatibility in general, try `pkg required-depends 
linux_base-rl9`.
   You can find some other things you can do with pkg but aren't given 
official commands with `pkg alias -l` and what command is really used 
with `pkg alias required-depends` and similar.
   To filter the required-depends list down to what you installed and 
help ignore dependencies, I'd try something like write the output of 
`pkg query -e '%#r == 0' '%n'` (like required-depends but without 
version #s) to a file, then append `pkg prime-list` to the file, and 
finally pass the file through `unique -d`.

> Is there a way to find this for packages in general?

   My previous answer can be used in a more general sense, but some 
other approaches:
   ports-mgmt/pkg_tree and ports-mgmt/porttree will likely help. The 
ports framework also has *-depedns-list targets that may help.
   You can also review build logs at https://pkg-status.freebsd.org ; 
just make sure you look at the right 'builds' category (check others if 
it doesn't have what you are after or not loading properly), find the 
'jail' for the OS version + hardware you are interested in, and then 
open the date+time link in the build column. From there, open the log 
link on the right. This will have the complete build log to create the 
package. You do not have full build logs of each dependency in that log 
but you will see the log of what dependencies were installed both 
directly and indirectly. It has a ascii art tree-like view provided by 
the ports pretty print depends list target. Building the port yourself 
will show that too but I think if it is not built in a clean environment 
then preinstalled items will cause the tree to not display.
   Custom built ports may offer some dependencies as optional. Some 
Linux things install more than is necessary but fixing that requires 
fixing the port (main or dependency port), splitting the dependencies 
into separate pieces, or deleting the pkg with -f (causes pkg to see 
dependency issues, expect to have to repeat after updates).

 > Has FreeBSD made any changes to packages to increase the use of linux
 > compat?

   The use of Linux WiFi and video drivers comes to mind. Not sure if 
more or less ports have added additional dependencies against Linux 
binaries or not.
   There has been a trend to merge more and more of the -rl9 
dependencies into one single package so installing will bring in more 
bloat as I understand it, but it will also look 'cleaner' for total 
package count involved.

> If finding the packages that use/require linux compat isn't easy, how 
> many use it it and what are the common packages that use it?
   It would be easier to answer how the dependency gets pulled in by 
knowing what you and your friend try to install than trying to type up a 
list of everything that uses the linux compatibility layer. Linux 
compatibility is used with some wifi and video drivers as some of them 
are just the linux driver + linux kpi but I don't know if that triggers 
a need for any linux-* packages. NVIDIA being a native FreeBSD video 
driver has optional additional linux support.
   Not every port that is a Linux binary has Linux in its name so there 
isn't an easy way that I know of to sort it out without more thought.

> Thank you,
> 
> Walter
> 
> -- 
> The greatest dangers to liberty lurk in insidious encroachment by men of 
> zeal, well-meaning but without understanding.   -- Justice Louis D. Brandeis