The Linux Endgame (feat. Gentoo Linux)

Feb 04, 2024

#linux #gentoolinux


Gentoo is a highly configurable, flexible, powerful and unique linux distro. The backbone of Gentoo rely on portage package manager which is by far the best package manager ever writter on Earth.

When comes to running Gentoo as a daily driver, user must know some of the basics from kernel upgradation, update of packages to troubleshooting.

Maintaining

Kernel upgrade

Commands for upgrading a linux kernel from previous version

cp /boot/config-6.x.x-gentoo /usr/src/linux/.config
cd /usr/src/linux 
make oldconfig
make modules_prepare
emerge @module-rebuild
make -j8
make -j8 modules_install
make install
grub-mkconfig -o /boot/grub/grub.cfg

Python upgrade

Safer upgrade procedure:
First, enable both Python 3.9 and Python 3.10, and then run the upgrade
put this lines in /etc/portage/package.use

*/* PYTHON_TARGETS: -* python3_9 python3_10
*/* PYTHON_SINGLE_TARGET: -* python3_9

then clean and update the system

emerge --depclean
emerge --ask --verbose --update --deep --changed-use @world

Now switch to PYTHON_SINGLE_TARGET and run the second batch of upgrades:

*/* PYTHON_TARGETS: -* python3_9 python3_10
*/* PYTHON_SINGLE_TARGET: -* python3_10

Again update the system with --changed-use flag

emerge --depclean
emerge --ask --verbose --update --deep --changed-use @world

Finally, switch to the final version and upgrade by:

*/* PYTHON_TARGETS: -* python3_10
*/* PYTHON_SINGLE_TARGET: -* python3_10

Upgrade for the last time

emerge --depclean
emerge -1vUD @world
emerge --depclean

System update

Update whole system with changed flag

emerge --ask --verbose --update --deep --changed-use @world

Sometimes portage throws errros due to slots conflict

doas emerge --ask --verbose --update --deep --backtrack=100 --keep-going=y --with-bdeps=y @world

Portage configuration

Overlay

This are the useful overlay/repos that one can consider to add in repos.conf

# FILE /etc/portage/repos.conf/eselect-repo.conf
# created by eselect-repo

[guru]
location = /var/db/repos/guru
sync-type = git
sync-uri = https://github.com/gentoo-mirror/guru.git

[kde]
location = /var/db/repos/kde
sync-type = git
sync-uri = https://github.com/gentoo-mirror/kde.git

[pf4public]
location = /var/db/repos/pf4public
sync-type = git
sync-uri = https://github.com/gentoo-mirror/pf4public.git

[nix-guix]
location = /var/db/repos/nix-guix
sync-type = git
sync-uri = https://github.com/gentoo-mirror/nix-guix.git

portage tree sync

Instead of rsync method one can opted for git (which is way more faster)

# FILE /etc/portage/repos.conf/gentoo.conf

[DEFAULT]
main-repo = gentoo

[gentoo]
location = /var/db/repos/gentoo
sync-type = git
sync-uri = https://github.com/gentoo-mirror/gentoo.git
sync-git-verify-commit-signature = true
sync-depth = 1
auto-sync = yes
sync-openpgp-key-path = /usr/share/openpgp-keys/gentoo-release.asc
sync-openpgp-key-refresh-retry-count = 40
sync-openpgp-key-refresh-retry-overall-timeout = 1200
sync-openpgp-key-refresh-retry-delay-exp-base = 2
sync-openpgp-key-refresh-retry-delay-max = 60
sync-openpgp-key-refresh-retry-delay-mult = 4