Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Jan 2019 15:16:32 +0000
From:      Matthew Seaman <matthew@FreeBSD.org>
To:        freebsd-questions@freebsd.org
Subject:   Re: Replacing base commands with pkg versions
Message-ID:  <a93c5b59-935c-ee25-b188-e3f5cb82c5ec@FreeBSD.org>
In-Reply-To: <317f2ef8-35ff-5d3d-8f2f-50714eda729f@qeng-ho.org>
References:  <b0671230-ef4f-3337-71c6-d23bdfd3aff8@qeng-ho.org> <2WSWeqA769U9_j-YlfypjYKPgycGgCJH_5-w2PzJSegmBaHtZtTie7Kht_IANZU2s9xDJSE8kiDBP_9EvUj7ccQa1uevCPPiyoOAIm03fPo=@protonmail.ch> <e535aab1-1202-a032-d875-069da9f8e0a6@qeng-ho.org> <sdSphMxH_ChBfTOyjbEvG2YR_IgQawMrYJfOBXWBlgyUVZdPJr53s7niP3iOkJds_iXD4xRxSBXjj_p2nPVFSlKF-Qaw-3c5AZ9pSvMpoJs=@protonmail.ch> <317f2ef8-35ff-5d3d-8f2f-50714eda729f@qeng-ho.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 29/01/2019 15:02, Arthur Chance wrote:
> On 29/01/2019 12:46, Lorenzo Salvadore via freebsd-questions wrote:
>>> On 29/01/2019 12:31, Lorenzo Salvadore via freebsd-questions wrote:
>>>
>>>>> What is the recommended way of dealing with the base versions of
>>>>> commands when installing a package version instead? Should I chmod -x
>>>>> the base executable(s), delete them or rename them? What happens if I
>>>>> subsequently do a freebsd-update - do the base executables get
>>>>> reinstated or are they ignored?
>>>>> The specific case I'm interested in is unbound under 11.2, but this
>>>>> applies to a variety of programs (CUPS vs base lpr, or base vs pkg llvm
>>>>> come to mind) and if there's any official guidance on this I've missed it.
>>>>
>>>> I cannot give you an official answer, but if you always want to have the pkg
>>>> version getting precedence on the base version, I would reorder the PATH
>>>> variable.
>>>> If instead you want to mix versions, I would not change the base system, I
>>>> would rather create aliases for the shell.
>>>
>>> In this case I specifically want to disable the base commands, and want
>>> them to be disabled under all circumstances, hence the suggestions of
>>> chmod -x, etc.
>>
>> If you really know what you're doing then locate the base program, rename it (to
>> keep a backup) and make a link to the pkg version in the base location with the
>> original name. (Again, there is nothing official about this approach.)
>>
>> Be carefull: packages are tested with a base system unchanged, hence there is no
>> guarantee that if a software you install depends on a command in base that you
>> changed it will still work.
>>
>> Maybe you should think if there is a better way to achieve your goal than
>> using pkg versions instead of base. Can you tell us what's the reason base is
>> not good enough for you?
> 
> To quote the Handbook:
> 
> "Unbound is provided in the FreeBSD base system. By default, it will
> provide DNS resolution to the local machine only. While the base system
> package can be configured to provide resolution services beyond the
> local machine, it is recommended that such requirements be addressed by
> installing Unbound from the FreeBSD Ports Collection."
> 
> I need to provide resolvers for a few dozen clients so I'm following the
> Handbook's advice and installing the ports/pkg version. Unfortunately
> I'm on 11.2 where the base versions of the unbound suite of programs
> retain their original names. I gather 12.0 renames them all to
> local_unbound* to avoid name collisions, but that's not helpful to me
> right now.
> 
> Specifically, I'm worried about the possibility of freebsd-update
> reinstating the base versions if I remove or disable them, so if anybody
> who's familiar with the workings of freebsd-update can comment on it,
> I'd be grateful.
> 

In the specific case of unbound -- you'll be running that as a daemon, 
and you can only run one out of local_unbound or the unbound from ports. 
  So all you need to do is adjust settings in /etc/rc.conf one time.

(Well, if you were previously using local_unbound, you might need to 
review /etc/resolv.conf but even that should work with a ports version 
of unbound.)

The only tricky thing is if you need to run such as unbound-control -- 
in that case you can control which variant you get by default by 
adjusting your $PATH or if necessary by creating shell aliases or 
functions.  However these unbound adjunct commands should be relatively 
rarely used, and using the wrong one will generally fail harmlessly.

	Cheers,

	Matthew




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a93c5b59-935c-ee25-b188-e3f5cb82c5ec>