Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Jan 2025 15:45:27 +0900
From:      Tomoaki AOKI <junchoon@dec.sakura.ne.jp>
To:        Yuri <yuri@FreeBSD.org>
Cc:        "ports@freebsd.org" <ports@freebsd.org>
Subject:   Re: Regression in pkg: it complains about missing pkg files instead of downloading them
Message-ID:  <20250126154527.c69822d6202e7be2192c5dc2@dec.sakura.ne.jp>
In-Reply-To: <735b527d-0483-4e61-a3af-36e665ead815@FreeBSD.org>
References:  <735b527d-0483-4e61-a3af-36e665ead815@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 25 Jan 2025 21:21:47 -0800
Yuri <yuri@FreeBSD.org> wrote:

> Since pkg was updated to 2.x I am experiencing the errors like in the 
> log below.
> 
> Instead of downloading a *.pkg file pkg complains that it can't find it 
> and fails.
> 
> It complains about different *.pkg files, not just the one in the log below.
> 
> This didn't happen with pkg-1.x.
> 
> This makes pkg unusable.
> 
> 
> Does anybody know how to work around this problem?
> 
> 
> Thanks,
> 
> Yuri
> 
> 
> -----log------
> 
> $ sudo pkg install rust
> Updating FreeBSD repository catalogue...
> FreeBSD repository is up to date.
> All repositories are up to date.
> Checking integrity... done (1 conflicting)
>   - rust-1.84.0 conflicts with rust-nightly-1.84.0.20241104 on 
> /usr/local/bin/rust-gdbgui
> Checking integrity... done (0 conflicting)
> The following 4 package(s) will be affected (of 0 checked):
> 
> New packages to be INSTALLED:
>         rust: 1.84.0
> 
> Installed packages to be DOWNGRADED:
>         pkg: 2.0.3 -> 2.0.0
> 
> Installed packages to be REINSTALLED:
>         qt5-webchannel-5.15.16p3
> 
> Installed packages to be REMOVED:
>         rust-nightly: 1.84.0.20241104
> 
> Number of packages to be removed: 1
> Number of packages to be installed: 1
> Number of packages to be reinstalled: 1
> Number of packages to be downgraded: 1
> 
> The operation will free 559 MiB.
> 12 MiB to be downloaded.
> 
> Proceed with this action? [y/N]: y
> pkg: 
> archive_read_open_filename(/var/cache/pkg/pkg-2.0.0~6aabda4535.pkg): 
> Failed to open '/var/cache/pkg/pkg-2.0.0~6aabda4535.pkg'

This could be causing unintended (in some cases massive)
deinstallations of pkgs, especially it happenes on pkg to be
"reinstalled". Reinstall happenses with the pairs of deinstallation and
installation, thus, losing track with pkgs to be used for reinstall
causes the pkgs to be lost.

I think topics in forums.freebsd.org below would be relevant.

  https://forums.freebsd.org/threads/pkg-2-0-0-problems.96540/#post-687349

  https://forums.freebsd.org/threads/pkg-2-0-0-problems.96540/page-2#post-687378

There could be multiple options.

One is as Yuri described. Forcibly fetch (again) all needed pkgs before
starting actual processes.

Another I can think of is what (at least) portupgrade[-devel] and
pkg_replace is doing. Backup (by `pkg create` or archive files listed
in [previous] pkg-plist saved), deinstall, and once reinstall fails,
restore from backup. Then the admin can wait for the updates with the
system working.

Maybe more (better, I expect) options would be existing.

Anyway, according to the error, pkg seems to looking for its cache
(/var/cache/pkg/) only and the issue persists, IMHO.
And according to this behaviour, I'm currently using `pkg_replace -R -PP
<leaves that were unintentionally lost>` to restore my computer.
I have copies of all locally built pkgs with poudriere
in /usr/ports/packages/All/ including older versions. So this is
possible for me. (Using sysutils/clone to copy updated files from local
repo by poudriere.)

Regards.

-- 
Tomoaki AOKI    <junchoon@dec.sakura.ne.jp>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20250126154527.c69822d6202e7be2192c5dc2>