User:Sam/Portage help/Maintaining a Gentoo system
Upgrades are not supposed to be hard. Furthermore, they're not hard for most Gentoo users.
But I don't deny that some people experience issues. A fair amount of such cases are because of old, outdated, or bad habits, which then lead to people avoiding upgrades, and then the problem gets worse.
World file hygiene
This is easily the most important point: your world file at /var/lib/portage/world should only contain things you personally want.
It should not contain (non-exhaustive list):
- libraries (unless you want them for development), e.g. *-libs/*;
- packages you had to re-emerge to try fix something (use emerge --oneshot ... when doing that!)
- possibly dev-python/* unless you personally use it
- anything you don't personally want/use/need
Erroneous entries in your world file will lead to blockers when e.g. a library becomes obsolete or replaced, leading you to have to fix the problem when for most people, it'll be resolved automatically.
If one has sys-libs/e2fsprogs-libs in your world file, you are telling Portage you must have it. And it will try very, very hard to honour your request, like so:
emerge -p -uvDU @world
[...] [blocks B ] >=sys-fs/e2fsprogs-1.46.4-r51 (">=sys-fs/e2fsprogs-1.46.4-r51" is soft blocking sys-libs/e2fsprogs-libs-1.46.4-r1) [blocks B ] sys-libs/e2fsprogs-libs ("sys-libs/e2fsprogs-libs" is soft blocking sys-fs/e2fsprogs-1.46.5) * Error: The above package list contains packages which cannot be * installed at the same time on the same system. (sys-fs/e2fsprogs-1.46.5:0/0::gentoo, ebuild scheduled for merge) pulled in by >=sys-fs/e2fsprogs-1.27 required by (sys-block/parted-3.4:0/0::gentoo, installed) USE="debug nls readline -device-mapper -verify-sig" ABI_X86="(64)" sys-fs/e2fsprogs required by (app-arch/libarchive-3.5.2:0/13::gentoo, installed) USE="acl bzip2 e2fsprogs iconv lzma xattr zlib -blake2 -expat -lz4 -lzo -nettle -static-libs -zstd" ABI_X86="32 (64) (-x32)" sys-fs/e2fsprogs sys-fs/e2fsprogs required by @system (sys-libs/e2fsprogs-libs-1.46.4-r1:0/0::gentoo, installed) pulled in by sys-libs/e2fsprogs-libs required by @selected sys-libs/e2fsprogs-libs[abi_x86_32(-),abi_x86_64(-)] required by (net-fs/samba-4.15.3:0/0::gentoo, installed) USE="acl client cups pam regedit system-mitkrb5 winbind -addc -ads -ceph -cluster -debug (-dmapi) (-fam) -glusterfs -gpg -iprint -json -ldap -profiling-data -python -quota (-selinux) -snapper -spotlight -syslog (-system-heimdal) -systemd (-test) -zeroconf" ABI_X86="32 (64) (-x32)" PYTHON_SINGLE_TARGET="python3_9 -python3_10 -python3_8" >=sys-libs/e2fsprogs-libs-1.42.9[abi_x86_32(-),abi_x86_64(-)] required by (app-crypt/mit-krb5-1.19.2:0/0::gentoo, installed) USE="keyutils nls pkinit threads -doc -lmdb -openldap (-selinux) -test -xinetd" ABI_X86="32 (64) (-x32)" CPU_FLAGS_X86="-aes"
Note that the main reason it is pulling in e2fsprogs-libs here is:
sys-libs/e2fsprogs-libs required by @selected. This means it's in your world file! It's trying hard to hold onto it because you told it to.
The output mentions Samba and mit-krb5 but these should be noise as a result of it discounting changing to e2fsprogs due to
-libsbeing in world.
The solution ("deselect it", i.e. remove it from the world file):
emerge --deselect sys-fs/e2fsprogs-libs
Now Portage is no longer being instructed to keep
-libs and should proceed to upgrade.
Depcleaning (emerge --ask --depclean) after every world upgrade is essential. This removes unnecessary packages from your system and keeps the dependency graph clean.
Failure to do so may result in:
- older versions of toolchain versions being used unnecessarily (e.g. gcc, binutils)
- packages misbehaving when they detect a package installed which has been removed from the tree
- possibly confusing emerge output on upgrades.
If Portage tries to remove packages you need, you should tell it that you need them:
emerge --ask --noreplace foo
Never unmerge anything
Consider emerge --unmerge banned. Removing packages without --depclean may result in removing something which is needed will only lead to broken packages and a possibly bricked install.
If you no longer want a package, run:
emerge --ask --depclean foo
Portage will ask you if you wish to remove it only if it is safe to do so (nothing depends on it). It will bail out if it is unsafe.