Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 890491 - sys-apps/portage-3.0.41-r2: getbinpkg fails if binhost is offline
Summary: sys-apps/portage-3.0.41-r2: getbinpkg fails if binhost is offline
Status: UNCONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Binary packages support (show other bugs)
Hardware: All Linux
: Normal major (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-11 16:18 UTC by APN-Pucky
Modified: 2023-12-30 00:32 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description APN-Pucky 2023-01-11 16:18:08 UTC
I am using the feature="getbinpkg", such that the binhost's Packages lists are synced. However, if the binhost is not online it won't fallback to a source build and fails the install.



Reproducible: Always

Steps to Reproduce:
1. setup binhost
2. have some binaries on binhost
3. sync binhost at least once (/var/cache/edb/binhost/XXX/ is required)
4. disable the connection to an existing binhost (artificially via /etc/hosts) 
5. emerge using getbinpkg feature a package that the binhost should provide
Actual Results:  
Fails during install as binary can't be fetched from binhost

Expected Results:  
Should fall back to a source build.

I think it would make sense to disable a binhost if the package info can not be fetched at the start of emerge (currently there only a warning is printed).
Comment 1 APN-Pucky 2023-01-11 16:18:59 UTC
$ emerge install something
!!! Error fetching binhost package info from 'http://mybinhost:XXXX/packages'
!!! <urlopen error [Errno 113] No route to host>


Local copy of remote index is up-to-date and will be used.

These are the packages that would be merged, in order:

Calculating dependencies... done!
[binary  r  U  ] app-text/libpaper-2.0.4:0/2::gentoo [1.1.28:0/0::gentoo] ABI_X86="(-32%) (-64%*) (-x32%)" 37 KiB
[binary     U  ] app-misc/ca-certificates-20211016.3.86::gentoo [20211016.3.83::gentoo] USE="-cacert" 209 KiB
[ebuild  N     ] dev-util/vulkan-headers-1.3.231::gentoo  1,652 KiB
[ebuild  N     ] media-libs/vulkan-loader-1.3.231::gentoo  USE="X -layers -wayland" ABI_X86="(64) -32 (-x32)" 1,572 KiB
[ebuild  N     ] dev-util/glslang-1.3.231-r2:0/1::gentoo  ABI_X86="(64) -32 (-x32)" 3,572 KiB
[binary     U  ] dev-python/platformdirs-2.6.2::gentoo [2.5.4::gentoo] USE="-test" PYTHON_TARGETS="python3_8 python3_9 python3_10 (-pypy3) -python3_11" 69 KiB
[binary  rR    ] net-print/cups-2.4.2-r6::gentoo  USE="X acl dbus pam ssl usb -debug -kerberos -openssl (-selinux) -static-libs -systemd -test -xinetd -zeroconf" ABI_X86="(64) -32 (-x32)" 5,699 KiB
[binary  rR    ] app-text/ghostscript-gpl-10.0.0-r5:0/10.0::gentoo  USE="X cups dbus gtk (unicode) -static-libs" L10N="de (-ja) -ko -zh-CN -zh-TW" 18,343 KiB
[ebuild  N     ] dev-qt/qthelp-5.15.7:5/5.15::gentoo  USE="-debug -test" 0 KiB
[binary     U  ] dev-python/setuptools-65.6.3-r1::gentoo [65.6.3::gentoo] USE="-test" PYTHON_TARGETS="python3_8 python3_9 python3_10 (-pypy3) -python3_11" 3,885 KiB
[ebuild     U  ] net-misc/yt-dlp-2023.1.6::gentoo [2022.11.11::gentoo] USE="-test" PYTHON_TARGETS="python3_8 python3_9 python3_10 -python3_11" 2,471 KiB
[ebuild     U  ] dev-util/kbuild-0.1.9998.3499-r2::gentoo [0.1.9998.3407::gentoo] 2,316 KiB
[ebuild     U  ] app-emulation/virtualbox-modules-7.0.4:0/7.0::gentoo [6.1.40:0/6.1::gentoo] USE="-dist-kernel (-pax-kernel%)" 703 KiB
[ebuild     U  ] app-emulation/virtualbox-7.0.4-r1:0/7.0::gentoo [6.1.40:0/6.1::gentoo] USE="alsa dbus%* gui%* opengl pam pulseaudio sdk sdl udev -debug -doc -dtrace -java -lvm (-pch) -python -vboxwebsrv -vde% -vnc (-headless%) (-opus%*) (-pax-kernel%) (-qt5%*)" PYTHON_SINGLE_TARGET="python3_9 -python3_8 -python3_10 -python3_11%" 194,979 KiB
[ebuild  rR    ] app-text/texlive-core-2021-r5::gentoo  USE="X luajittex tk xetex -cjk -doc -source -xindy" 0 KiB

Total: 15 packages (8 upgrades, 4 new, 3 reinstalls, 6 binaries), Size of downloads: 235,502 KiB

WARNING: One or more updates/rebuilds have been skipped due to a dependency conflict:

[...]

Would you like to merge these packages? [Yes/No] Yes
>>> Verifying ebuild manifests
>>> Running pre-merge checks for app-emulation/virtualbox-7.0.4-r1
 * You have disabled the "python" USE flag. This will only
 * disable the python bindings being installed.
>>> Emerging binary (1 of 15) app-text/libpaper-2.0.4::gentoo
>>> Failed to emerge app-text/libpaper-2.0.4, Log file:
>>>  '/var/tmp/portage/app-text/libpaper-2.0.4/temp/build.log'
>>> Jobs: 0 of 15 complete, 1 failed                Load avg: 1.24, 1.16, 0.99


$ sudo cat /var/tmp/portage/app-misc/ca-certificates-20211016.3.86/temp/build.log
--2023-01-11 16:11:28--  http://mybinhost:XXXX/packages/app-misc/ca-certificates-20211016.3.86.tbz2
Resolving mybinhost... 192.168.X.X
Connecting to mybinhost|192.168.X.X|:XXXX... failed: No route to host.
Comment 2 John Helmert III archtester Gentoo Infrastructure gentoo-dev Security 2023-01-11 16:36:31 UTC
I don't think it makes sense to automagically revert to using source builds if the binhost is unavailable. The errors that Portage gives you make sense to me, easy to see what the problem is, and then if you want to revert to source builds, you can manipulate FEATURES and such as necessary.

I suppose if a binhost is permanently gone, we could make the local caches for it disappear, but it would have to be done by the user and that's surely unecessary if the user just removes the binhost from PORTAGE_BINHOST anyway.
Comment 3 APN-Pucky 2023-01-11 16:44:34 UTC
Thanks for the quick reply.

I think falling back to source builds is the intuitive way, since this also happens if the binhost does not provide a specified package.

It is also what I would expect from the description here (https://wiki.gentoo.org/wiki/Binary_package_guide): 

   --getbinpkg (-g) 	Download the binary package(s) from a remote binary package host. If the binary packages are not found, a regular (source-based) installation will be performed.

Depending of course if 'found' means existing in the binhost or available for download in the binhost.
But maybe a third option would be clearer and backward-compatible, whilst more complicated.
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-01-11 22:57:36 UTC
My intuition was/is that getbinpkg should be opportunistic, unlike getbinpkgonly.
Comment 5 APN-Pucky 2023-05-16 17:12:36 UTC
Here my admittedly sub optimal patch. It is to just clear the edb/binhost/../packages/Package if the host is already down during the initial sync. Then the binary won't even be considered. I guess it would be a bit better to only reset the packages if getbinpkg and not getbinpkgonly is used.

--- a/lib/portage/dbapi/bintree.py	2023-01-15 23:11:19.000000000 +0100
+++ b/lib/portage/dbapi/bintree.py	2023-05-16 18:58:19.902517636 +0200
@@ -1477,7 +1477,8 @@
                     error_msg = str(uerror.object, encoding="utf_8", errors="replace")
                 writemsg(f"!!! {error_msg}\n\n")
                 del e
-                pkgindex = None
+                pkgindex = self._new_pkgindex()
+                rmt_idx = pkgindex
             if proc is not None:
                 if proc.poll() is None:
                     proc.kill()

As a disclaimer I have no clue about potential side effects.