helloSystem / hello

Desktop system for creators with a focus on simplicity, elegance, and usability. Based on FreeBSD. Less, but better!
2.29k stars 56 forks source link

Thoughts on the FreeBSD ports/package system #161

Open probonopd opened 3 years ago

probonopd commented 3 years ago

While we have been working with FreeBSD packages for a while, it seems like the structure of how packages get built and distributed leaves a few aspects to be deserved. This issue describes our gripes in the hope that someone can help us find solutions.

crees commented 3 years ago

On your third point, this is exactly how quarterly branches work. Breakage is rare and high priority, though I know you were hit by an incident in the past.

For the first point... yes, separation of base and ports is pretty much the number one interesting Thing about FreeBSD. Pkgbase is still very new.

In short, we know about these issues and have been working on them for a while.

probonopd commented 3 years ago

Not sure what is going on here.


% cat /etc/pkg/FreeBSD.conf 
(...)
  url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly",
(...)

% sudo pkg install firefox
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 1 package(s) will be affected (of 0 checked):

Installed packages to be UPGRADED:
        firefox: 86.0_2,2 -> 87.0,2
probonopd commented 3 years ago

The FreeBSD base system and packages should feel like one consistent system, not like a "split personality".

This also means that there should be a set of packages e.g., for 12.1 that do not suddenly stop working once 12.2 is released.

I fell into the exact issue here:

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=253452

Even if a FreeBSD minor version is no longer supported, the packages for it should not vanish. Some of us want to set up a system and freeze it in time, sometimes even for decades.

kettle-7 commented 3 years ago

So, in other words, what you're saying is that we should have different repositories for different versions, right?

probonopd commented 3 years ago

At least different versions of the packages for different FreeBSD versions for those packages that interact with the kernel directly or are otherwhise dependent on the exact FreeBSD version.

probonopd commented 3 years ago

py37-xdg has been broken in latest packages for FreeBSD 13 on amd64 for quite a while now. This has been breaking our FreeBSD 13 based builds for weeks now.

Turns out that depending on the architecture, the package is now called differently: py38-xdg for amd64 but not for e.g, aarch64. Which both are supposedly "tier 1".

What gives?!?

image

Suggestions:

Workaround: Use the pkg install devel/py-xdg nomenclature? (This is a pain, because you have to look up the part before the / for every package.)

grahamperrin commented 3 years ago

py37-xdg … latest …

Please see https://cgit.freebsd.org/ports/tree/UPDATING?id=210ee04dd3c3f2e82cd3130e412866a182066859#n8

probonopd commented 3 years ago

Thanks @grahamperrin. It seems that things are more robust if we use the port names rather than the package names for specifying which packages shall be installed? E.g., pkg install devel/py-xdg will hopefully not break once Python 3.9 is there.

grahamperrin commented 3 years ago

https://github.com/helloSystem/hello/issues/161#issuecomment-846394637

What gives?

Maybe a combination of issues with FreshPorts; see https://github.com/FreshPorts/freshports/issues/287#issuecomment-846322008


https://www.freshports.org/devel/py-xdg/#add

To install the port: cd /usr/ports/devel/py-xdg/ && make install clean To add the package: pkg install py37-xdg

root@mowa219-gjp4-8570p:~ # pkg install -n py37-xdg
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
Updating poudriere repository catalogue...
poudriere repository is up to date.
All repositories are up to date.
pkg: No packages available to install matching 'py37-xdg' have been found in the repositories
root@mowa219-gjp4-8570p:~ # git -C /usr/doc pull --ff-only && git -C /usr/ports pull --ff-only && git -C /usr/src pull --ff-only
Already up to date.
Already up to date.
Already up to date.
root@mowa219-gjp4-8570p:~ # cd /usr/ports/devel/py-xdg/
root@mowa219-gjp4-8570p:/usr/ports/devel/py-xdg # make -V FLAVORS
py38 
root@mowa219-gjp4-8570p:/usr/ports/devel/py-xdg # pkg info -x py-xdg
pkg: No package(s) matching py-xdg
root@mowa219-gjp4-8570p:/usr/ports/devel/py-xdg # pkg install -n devel/py-xdg
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
Updating poudriere repository catalogue...
poudriere repository is up to date.
All repositories are up to date.
Checking integrity... done (0 conflicting)
The most recent versions of packages are already installed
root@mowa219-gjp4-8570p:/usr/ports/devel/py-xdg # pkg info -x py38-xdg
py38-xdg-0.27
root@mowa219-gjp4-8570p:/usr/ports/devel/py-xdg # 
probonopd commented 2 years ago

Point in case today: https://github.com/helloSystem/hello/issues/203

TL;DR: Installed some applications, which upgraded some system libraries. As a result, was forced to upgrade Firefox. Cannot access meet.jit.si anymore as a result. No obvious way to downgrade.

grahamperrin commented 2 years ago

… upgrade Firefox.

To which version, exactly?

Latest repo, or quarterly?

Which version of helloSystem?

Which version of FreeBSD?

freebsd-version -kru && uname -aKU

Cannot access meet.jit.si anymore as a result.

With recently upgraded firefox-92.0_2,2, the site is accessible:

image

– and (after clicking Allow) meet.jit.si does recognise the camera and microphone.

https://www.freshports.org/www/firefox/#history there's no more recent version.

No obvious way to downgrade.

Don't forget the boot environment that you created before the upgrade.

If you forgot, then try your cached packages.

xk2600 commented 2 years ago

I have often posed the same questions in my head. It feels like there should maybe be an assertion that happens when performing an upgrade but how can the system be aware of where the modules in /boot/modules came from and whether it was a pkg install placed module, ports built module, or compiled from source by the user?

I am personally a huge fan of the pkg and ports system. I believe a lot of the problems with packages/ports getting ousted or breaking stems from lack of developers and maintainers if anything.

My thoughts on sweeping changes... lots of recommendations have been made in the past to overhaul/reorganize the ports system. This would be a pretty complicated endeavor and would probably require a fork of the ports tree. Anything that further segments the BSDs I believe is a disservice to the community. I think there exists enough which can be gleaned from the ports tree to help us make assertions to assist in extending the freebsd-update system. From my perspective, helloSystem is a beautiful distribution of FreeBSD and I would like to see it stay that way. The less we change the more collaboration can exist across both teams on a common code base.

Do not hardcode the Python minor version in the package name, e.g., call it py3-xdg Do not have different versions of the same packages depending on architectures

On the systems that I must support running linux, I have often seen what you are suggesting break in release systems when addition of a module requires updating the interpreter's package. The virtual-environments (as they use symlinks and aren't a copy of the binary) don't protect against this breakage either. My personal opinion is there is too much codependancy on minor versions of python between modules and the binary, especially when modules are backed by C/C++ based libaries. The same goes for perl and tcl/tk, but my guess would be most interpreters suffer the same plight if they allow modules to be backed by C/C++ binaries. My suggestion would be to try and leverage Meta-ports for this mechanism. Discussed below.

So arguments aside, solutions:

Anyways just wanted to dig into my thoughts for a moment and get an idea on what others think. I've got a working install, and plan on contributing. What has been done thus far is beyond impressive.

probonopd commented 2 years ago

Thanks for your thoughtful comments @xk2600. As you may have guessed, I am still relatively new to FreeBSD, having spent many years on the Mac and in the Linux universe before. I do see clear advantages in using FreeBSD, and I fully agree that helloSystem should stay a "true FreeBSD", albeit one preconfigured in an opinionated way to work out-of-the-box as a "desktop appliance" (while providing raw FreeBSD power under the hood for those who know what they are doing). For this very reason, I'd like to see those issues to be solved on a FreeBSD level ("for everyone") rather than in helloSystem-specific ways.

Poudriere-- Build a autoscaling cluster on cloud infrastructure that runs when CI requires it, to host a pkg distribution for helloSystem

We are currently not doing this, and I'd like to avoid this for multiple reasons:

So, right now helloSystem gets built by a shell script from the official FreeBSD binary ingredients plus official FreeBSD ports, at least for the core parts of the system (which for me includes the graphics stack and graphics drivers).

On the subject of graphics drivers, it seems like FreeBSD leadership is aware of the problem and "absolutely need to solve this before FreeBSD 12.3 or 13.1". Your idea to move all "kld" ports to base.tgz or something like it seems reasonable to me - if FreeBSD does it.

kettle-7 commented 2 years ago

Maybe while we're trying to figure out a better long term updating option, run the install shell script after pkg upgrade is called?

kettle-7 commented 2 years ago

or make a new package manager

probonopd commented 2 years ago

Making a proof-of-concept Firefox.app

mszoek commented 2 years ago

How can we do this?

I would try using a chrooted package build where the chroot environment is a pristine helloSystem install. That way you will only get packages that are not part of the default system.

kettle-7 commented 2 years ago

Again, that gnumeric POC comes to mind, I think that's the way to go here.

kettle-7 commented 2 years ago

So basically there's a read-only directory containing a pristine helloSystem copy, that is mounted from an image file, then using unionfs mounts we could get the root filesystem used by the system, with /home, /var, /etc etc. mounted from separate ZFS subvolumes, /tmp mounted tmpfs, and use a similar overlay for apps.

probonopd commented 2 years ago

(Moving the bundle-related topics to #203)

grahamperrin commented 2 years ago

the FreeBSD ports/package system

From Technology Roadmap | FreeBSD Foundation (2021-09-17):

… the pkgbase project is very important, and are ready to help with the effort.


https://github.com/helloSystem/hello/issues/161#issuecomment-926129279

graphics drivers

Also from the Roadmap:

image

– and:

… per-release repositories have been proposed. Release-specific overlays could be used to, e.g., offer DRM packages simultaneously for 13.0 and 13.1 while both point releases are supported. …

probonopd commented 2 years ago

Why does sudo pkg install mtools mess around with LibreOffice? That kind of stuff is driving me insane.

image

grahamperrin commented 2 years ago

It's impossible to help without relevant details. Kind of stuff.

probonopd commented 2 years ago

Like, which ones?

FreeBSD% uname -v
FreeBSD 12.2-RELEASE r366954 GENERIC 

FreeBSD% cat /etc/pkg/FreeBSD.conf 
# $FreeBSD: releng/12.2/usr.sbin/pkg/FreeBSD.conf.quarterly 346780 2019-04-27 04:00:50Z cperciva $
#
# To disable this repository, instead of modifying or removing this file,
# create a /usr/local/etc/pkg/repos/FreeBSD.conf file:
#
#   mkdir -p /usr/local/etc/pkg/repos
#   echo "FreeBSD: { enabled: no }" > /usr/local/etc/pkg/repos/FreeBSD.conf
#

FreeBSD: {
  url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly",
  mirror_type: "srv",
  signature_type: "fingerprints",
  fingerprints: "/usr/share/keys/pkg",
  enabled: yes
}
grahamperrin commented 2 years ago

Thanks. Re: the set of questions above https://github.com/helloSystem/hello/issues/161#issuecomment-919581612, which version of helloSystem was it on this occasion? Knowing the origin i.e. which .iso might be relevant.

When was the installation attempted (date and time)?

probonopd commented 2 years ago

My local developer system which has been set up from an experimental ISO (not preserved) in April. Installation was attempted on Sept 15.

grahamperrin commented 2 years ago

Thanks. Did you keep a fuller record of the attempt?

If you refrained from installing: what, now, happens when you remake the attempt?

It's difficult to diagnose things without context but essentially: I don't imagine a problem with FreeBSD pkg in this case.

Bugs do exist e.g. some of what's under https://github.com/freebsd/pkg/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc, however there was probably a good reason for the attention to polish/libreoffice.

probonopd commented 2 years ago

My question was more in general, why would a totally unrelated Polish translation package get updated just because I install some tool. It's not so much about this one instance (which is not really reproducible anyway) but an example of things I don't understand and/or find "complicated" when working with pkg.

grahamperrin commented 2 years ago

https://github.com/helloSystem/hello/issues/161#issuecomment-932960709

FreeBSD% uname -v FreeBSD 12.2-RELEASE r366954 GENERIC

Most remarkable is the outdated OS. At some point you might have ignored an ABI mismatch, and so on.

Next time something seems complicated, please keep a more complete record; some useful context, complete texts (not a screenshot that obscures things of relevance). Thanks.

probonopd commented 2 years ago

12.2 is "outdated"? It's what helloSystem is using due to https://github.com/helloSystem/ISO/issues/198.

grahamperrin commented 2 years ago

12.2 is "outdated"?

Yes, FreeBSD 12.2-RELEASE r366954 lacks updates. Run:

uname -KU

uname(1)

Home page https://www.freebsd.org/ draws attention to SECURITY ADVISORIES and ERRATA NOTICES.

February's https://github.com/helloSystem/ISO/issues/135#issuecomment-781002580 and subsequent comments drew attention to 12.2-RELEASE-p3 and the importance of updates.

An updated system: image

probonopd commented 2 years ago

Ah right. Somehow I would find it easier if there was 12.2, 12.2.1, 12.2.2,... I tend to never even notice the number after RELEASE-....

12.2-RELEASE-p3 being named 12.2.3 would feel most "natural" to me.

So I guess I will try:

Fingers crossed that the system will still work.

...aaand promptly running into issues.

Screen looks like this now:

image

and the update does not continue.

Our "mere mortals" users have not the slightest clue what this screen wants to tell them, it is going to frighten them away, and even I as a not-quite-entirely-noob have no clue how to answer the question that was not asked to be with yes.

probonopd commented 2 years ago

After consulting the man page, blindly guessing that sudo freebsd-update fetch --not-running-from-cron might help, although I find the name of that option utmost confusing. And no, it does not "just work" without asking questions, as I still am dropped to a screen that ends with

(END)

or

:

with absolutely no indication of what to enter there to continue.

Enter key? Y? q?

I have tried multiple times and every time I have given up at this point. Things like this are a major source of frustration for "normal users" imho.

probonopd commented 2 years ago

Now I am just running sudo freebsd-update install without caring for the above, let's see what happens.

probonopd commented 2 years ago

After having restarted it looks like the result is that I am now on FreeBSD 12.2-RELEASE-p7 GENERIC.

grahamperrin commented 2 years ago

https://github.com/helloSystem/hello/issues/161#issuecomment-944933818

… does not "just work" without asking questions, …

Follow the example in my screenshot above.

grahamperrin commented 2 years ago

https://github.com/helloSystem/hello/issues/161#issuecomment-944935083

… now on FreeBSD 12.2-RELEASE-p7 GENERIC.

Now:

  1. uname -KU
  2. freebsd-version -kru
  3. keep a note of the results
  4. restart the OS
  5. re-run both commands.
probonopd commented 2 years ago

As of now:

FreeBSD% uname -KU
1202000 1202000
FreeBSD% freebsd-version -kru
12.2-RELEASE-p7
12.2-RELEASE-p7
12.2-RELEASE-p10

Trying

setenv PAGER cat && freebsd-update fetch install

now.

grahamperrin commented 2 years ago

You missed the csh command. A different shell might not work with setenv.

probonopd commented 2 years ago

It's probably doing what I would do using

sudo env PAGER=cat freebsd-update fetch install

?

Says:

root@FreeBSD:/usr/home/user # sudo env PAGER=cat freebsd-update fetch install
Looking up update.FreeBSD.org mirrors... 2 mirrors found.
Fetching metadata signature for 12.2-RELEASE from update1.freebsd.org... done.
Fetching metadata index... done.
Inspecting system... done.
Preparing to download files... done.

No updates needed to update system to 12.2-RELEASE-p10.
No updates are available to install.
grahamperrin commented 2 years ago

https://github.com/helloSystem/hello/issues/161#issuecomment-944935649 was without you mentioning that you had already restarted the system.

probonopd commented 2 years ago

Whoever designed this was thinking way too complicated.

No updates needed to update system to 12.2-RELEASE-p10.
No updates are available to install.
root@FreeBSD:/usr/home/user # uname -v
FreeBSD 12.2-RELEASE-p7 GENERIC 

So I am on p7, "no updates" are needed to get p10, but how do I get it?

probonopd commented 2 years ago

I had restarted before, added this piece of information in https://github.com/helloSystem/hello/issues/161#issuecomment-944935083

grahamperrin commented 2 years ago

how do I get it?

You have it. See your https://github.com/helloSystem/hello/issues/161#issuecomment-944935817

probonopd commented 2 years ago

Do I need to reboot again so that uname -v will show p10? Or do I have the latest version of the kernel which is p7 and the latest version of "userland" (which I read as: the non-kernel parts of base.txz) which is p10?

In any case, all these operations seem to be entirely independent with what was going on with my pkg gripes, isn't it?

grahamperrin commented 2 years ago

Do I need to reboot again so that uname -v will show p10?

No.

https://github.com/helloSystem/hello/issues/161#issuecomment-944930048 there's a link to the manual page for uname(1).

In your https://github.com/helloSystem/hello/issues/161#issuecomment-944935817, 12.2-RELEASE-p10 was in partial response to freebsd-version -kru

freebsd-version(1)

grahamperrin commented 2 years ago

https://github.com/helloSystem/hello/issues/161#issuecomment-944937053 (edited)

… 𡀦these operations seem to be entirely independent with what was going on with my pkg gripes, …

Please recall:

https://github.com/helloSystem/hello/issues/161#issuecomment-944880460

Most remarkable is the outdated OS. At some point you might have ignored an ABI mismatch, and so on.

Recall the output from uname -KU, which you ran before updating the system.

probonopd commented 2 years ago

I have summarized what I believed to have learned from you in https://github.com/helloSystem/Utilities/issues/33#issuecomment-944939306. Hope it is factually correct. Thanks for your patience.

probonopd commented 2 years ago

Seems like I am not the only one who has trouble understanding what is meant by "userland" in this context.

https://forums.freebsd.org/threads/what-is-userland.57354/

grahamperrin commented 2 years ago

https://github.com/helloSystem/Utilities/issues/33#issuecomment-944939306 (edited)

Packages

(still to be found out how to update those without them asking questions, …

--yes