/
binhost-guide-v1.txt
99 lines (79 loc) · 4.88 KB
/
binhost-guide-v1.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# binhost-guide-v1.txt : gentoo-chroot-binhost-ideas-July0423.txt
##### by genr8eofl @gentoo IRC - 2023 LICENSE - Creative Commons 4.0, Attribution
Main Idea:
--------
binhosts (binpkgs)
FEATURES="binpkg-multi-instance" for .xpak by default; check
normal way to create binpkgs:
FEATURES="buildpkg"
build on your main machine
or, set up various sub-chroots (various methods below)
eventually serve them to the clients.
manual process currently.
Intro to BinPKGs:
----------------
files ending in .xpak's(.tbz2 + metadata) are created locally as packages
unless GPKG signing is turned on then its .gpkg
That will complicate things but signing can be turned on if you follow the guide
https://wiki.gentoo.org/wiki/Binary_package_guide#Binary_package_OpenPGP_signing
also suggest reading the rest of that page, its comprehensive.
default is PKGDIR=/var/cache/binpkgs
local index: /var/cache/binpkgs/Packages
Rewrite the Packages index file:
$# emaint binhost --fix
From here, its very easy to start serving what you've created.
$# cd /var/cache/binpkgs #start in this PKGDIR
$# ls Packages #confirm Packages index file exists
$# emaint binhost --check # check Packages index file is valid
$# python -m http.server 8008 #start basic HTTP server(plaintext, hide behind LAN/nginx/proxy)
is enough to serve a binhost. then,
export PORTAGE_BINHOST="http://192.168.1.1"
or
export PORTAGE_BINHOST="http://127.0.0.1:8008 http://192.168.1.1"
(you can set up multiple repositories by separating eachs' URL with a space char )
(theres also another method to set it up, using binrepos.conf instead of the env var)
$# emerge -g @world option on the client,
will download the binhost index, and take it into account.
(theres also another FEATURES variable named getbinpkg , basically forces on -g mode )
FEATURES="buildpkg"
the process downloads the Packages file from the remote host and caches it locally stored @
remote index: /var/cache/edb/binhost/${REMOTEHOSTNAME}/Packages
sometimes you need to clear the client's cache if you do too many updates on the other end, and portage (somehow) doesnt notice.
$# rm -rf /var/cache/edb/binhost/*/
sometimes the binhost gets cranky about USE flags or deps not matching, so theres two flags for emerge:
--binpkg-respect-use=y
--binpkg-changed-deps=y
this will force it to happen
the emerge -G option (capital G this time) will try to force it to use binpkgs ONLY (both local + remote) things may be skipped or rejected
Gentoo can compile all its source packages into a different directory.
We can create a destination directory and ask gentoo to compile a software and all the dependencies, and put it into a new root fs.
the variable for this is emerge --root=/SOMEDESTDIR
(not all packages ebuilds have been sanitized to allow for this)
See https://wiki.gentoo.org/wiki/User:Spawns/Bootstrap_with_emerge for more details on that. Also see my other doc .txt files.
It's up to you to bear the responsibility for building and getting the correct binpkgs as requested.
This can be complicated:
mixing CFLAGS from the wrong -march= is one of my current nightmares that I'm working on fixing, by sorting through and filtering them out. TBA.
The most common advice would be to maintain an identical /etc/portage/* configuration on all machines being served the binhost in question.
My current theory is now that each binhost needs its --configroot frozen and packaged up for re-deployment.
The main machine can build for many machines, but they all need their own root and config.
This is the point at which multiple chroots become necessary.
Work in Progress
chroot prior art
-----------------
chroot's = this began with arch-chroot and it was forked
Kangie fork @ https://gitlab.com/Matt.Jolly/kangie-gentoo-scripts/-/blob/master/gentoo-chroot/gentoo-chroot.sh
genr8 fork @ https://github.com/genbtc/gentoo-public/blob/main/chroot/genr8-chroot.sh
bootstrap -- just portage , documentation by Spawns_Carpeting @ https://wiki.gentoo.org/wiki/User:Spawns/Bootstrap_with_emerge
bwrap's -- sys-apps/bubblwrap = unpriveleged sandboxing tool + user namespaces
unshare's -- more namespaces
VM's -- QEMU, (virtualbox, vmware), etc. entire linux system, can boot with a EFI + UKI
container's -- choose between docker, podman, lxc/lxd
kubler -- NEW !!!! full fledged gentoo container orchestrator system - documentation by Kangie @ https://lemmy.srcfiles.zip/post/3841
cross-boss -- New gentoo user project (crossdev) https://github.com/chewi/cross-boss/
chroot-build-helper -- hairu's gentoo user project combines everything (currently not hosted) COMING SOON!!
I am currently using "genr8-chroot" for everything and its 1 command to get in and out of the chroots.
I am also developing ways to start from stage3's
Making use of virtual disk images to mount a loop device for to package it up.
Continue Reading @
see
@ https://github.com/genbtc/gentoo-public/blob/main/myscripts/README.md