Reason for no /usr/local? reddit / BSD ---------------------------------------------------------------------- CoolHwhipMike · 2020-05-04 16:38 I like to try the different Linux and BSDs just to see the different ways of doing things. On NetBSD by default binaries are in /usr/pkg which has the same structure as /usr/local. Since usr/local seems a little more standardized is there any reasoning for netbsd's choice? I'm assuming it's because pkgsrc can be used on multiple platforms and using usr/pkg may prevent some sort of conflict on those systems? ---------------------------------------------------------------------- PsychologicalTortois · 2020-05-04 16:50 I think it's a good idea not to have pkgsrc in /usr/local because it's a cleaner solution than having all binaries in one place. If something goes wrong, you can just delete /usr/pkg and make a new bootstrap. But if you want your binaries in /usr/local, you can bootstrap with --prefix=/usr/local. ---------------------------------------------------------------------- dressupgeekout · 2020-05-04 17:21 Yeah, avoiding conflicts with special directories on non-NetBSD systems is definitely one of pkgsrc's biggest concerns. Ultimately, though, it's an arbitrary choice, since pkgsrc can be bootstrapped into any directory you want. Nevertheless, I've always thought "/usr/pkg" is a sensible default, since it's a "system" directory of sorts, thus all users on a system can use the packages. ---------------------------------------------------------------------- qik · 2020-05-04 17:52 Pkgsrc started as a fork of FreeBSD ports. (both still use `LOCALBASE` as the key name for `/usr/pkg` / `/usr/local`) My assumption is that devs chose a new prefix to avoid conflicts with the original ports. Maybe ask in r/netbsd? :) Also, keep in mind that Pkgsrc is portable across operating systems so if it were to use `/usr/local` it would create confusion on systems like FreeBSD, Linux and so on. I install Pkgsrc on all my Linux and OSX machines for example. `/usr/pkg` makes sense to me though - it's the place for packages. I would use `/usr/local` for software I install or compile manually. The distinction makes it easy to keep my directory structure clean and organized. There's nothing stopping you from configuring your pkgsrc `LOCALBASE` to be `/usr/local` AFAIK ---------------------------------------------------------------------- CoolHwhipMike · 2020-05-04 18:42 Yes the setup makes sense to me too and I like the kind of organization it provides. I was going to cross-post this in r/netbsd but it would let me (more likely is just that I don't know how to use reddit). ---------------------------------------------------------------------- lbmn · 2020-05-05 00:39 Doesn't matter if you call it "pkg" or "local", but the former is clearer. I use "pkg" for my own personal Unix distro that I've made, even though it's not based on NetBSD. IMHO, the ideal is to have ``/usr/pkg`` for shared packages, and ``$HOME/pkg`` for packages limited to a single user. Using "local" would be visually confusing with the established ``$HOME/.local`` [default dot-folder used for settings](https://specifications.freedesktop.org/basedir-spec/basedir- spec-latest.html). This way ``~root/pkg/bin`` also replaces the ``/sbin``s. It's best to organize your system so that there's a separate user for everything: only the ``xorg`` user can ``startx``, only the ``www- client`` user can run the browser (and thus have access to your Web- related private data), only the ``bitcoin`` user can access your wallet, only the ``www-server`` user can run the Web server, etc, etc, etc. This prevents you from accidentally starting an app as the wrong user (esp root), because it wouldn't be in your $PATH. You can take it further with chroot, jail, etc - but user separation is the first and most fundamental step. If one package happens to have malicious or remotely exploitable code, then its access to the rest of the system should be as limited as possible. ---------------------------------------------------------------------- CoolHwhipMike · 2020-05-05 01:20 I'll have to learn more about setting up a system that way. It sounds interesting. I'm not doing anything important or sensitive but I'm sure I have tons of bad practices and hacks all over. ---------------------------------------------------------------------- FUZxxl · 2020-05-05 16:14 I always disliked how FreeBSD placed its packages into `/usr/local`. This way, I cannot easily distinguish packages from programs I installed manually. The NetBSD approach is much nicer in this regard. ---------------------------------------------------------------------- mwgkgk · 2020-05-06 00:34 Nope, reddit cross-posts require the target subreddit to have them enabled, and there are some reports of it bugging out even then. The error on posting does not indicate crossposting being disabled or enabled either. ---------------------------------------------------------------------- CoolHwhipMike · 2020-05-06 01:07 Good to know. Only took about 6 years to find out.