It may not be complete as of now, but I am willing to amend it is something is pointed out.
I would not advise anyone who just installed gentoo to jump right into this, as you will need to know what USE flags you want, how to resolve portage blockers and general debugging.
Motivation:
When installing gentoo, one of the first things we do is chose a profile. That will set some USE flags and USE_EXPAND variables.
Most of those flags are easily modifiable through make.conf and package.use. There are also USE flags not modifiable through make.conf and package.use.
I will not be talking about those.
Profiles mostly set sane defaults that work with a lot of configurations. However, that also means that a lot of unneeded things get pulled in by default.
The usual way of dealing with this is to use the profile USE flags, unless specified otherwise in make.conf or pacakge.use.
While this mostly works, this fails when new use flags are added, which happens often enough.
This also fails when USE flags are toggled in the profile used.
To solve all this, I Have USE="-*" as the first USE flag in make.conf.
What this does is more or less ignore profile USE flags, by only enabling what I explicitly enable, regardless of USE flag changes.
So everything is disabled unless I enable it.
While it is possible to do this without USE="-*", you will have to follow USE flag changes and look really closely at updates.
Even then, it is very easy for things to slip through the cracks and you will likely have at least 3-4 lines on disabled USE flags in make.conf.
When I made the change from the default way of managing USE flags to using USE="-*", I got rid of 50-100 packages from my system.
As of writing this, I have 651 packages installed, which means I got rid of between 6.5 % and 13% of packages.
I would assume that most people here would want to get rid of that many useless packages from their systems.
How to:
PLEASE READ ALL OF THIS POST BEFORE STARTING. IT MIGHT SAVE YOUR SKIN LATER.
In case you didn't update recently, you will want to update @world to not have to deal with broken updates and to reduce sources of error.
You don't have to sync the repos before doing this.
You just want to make sure that no version updates happen when you update @world according to this guide, only USE flag changes.
The process is pretty self-explanatory.
You get rid of all the disabled use flags from make.conf and add -* as the first use flag.
I would also advise to switch to a minimal profile, but it's not needed.
I use:
Code: Select all
$ eselect profile list
Available profile symlink targets:
[1] default/linux/amd64/17.1 (stable) *
Here is the USE= line in my make.conf:
Code: Select all
USE="-* git verify-sig rsync-verify man alsa X samba grub ssl ipv6 lto pgo libressl olde-gentoo asm native-symlinks threads jit jumbo-build"To manage USE-flags more than this, I use package.use.
Code: Select all
$ wc -l /etc/portage/package.use
122 /etc/portage/package.useAfter this, do a @world update. You will probably get a ton of blockers because you forgot to set a USE flag or because you didn't know you needed it.
When this happens, add the missing USE flags and try again. Rinse and repeat.
Another way to solve these is to remove everything that needs the missing USE flag.
You should double-check what USE flags get disabled when you update @world.
You may end up disabling a USE flag you didn't know you needed and break you system in hard to debug ways.
It might help you to note all the changes the @world update makes and maybe take a screenshot.
Possible pitfalls:
You will be among the first to know if someone improperly set USE flag dependencies.
One recent example was with imlib2, when after a reboot I was left without a wallpaper, because of a missing USE flag dependency.
In this particular case, USE="text" was needed, but the feh ebuild didn't have a dependency on it.
Another thing to keep in mind are USE_EXPAND variables.
You need to set these too.
If you don't, you will get a ton of blockers on @world updates.
Here are the USE_expand variables I have in make.conf:
Code: Select all
PYTHON_TARGETS="python3_11"
PYTHON_SINGLE_TARGET="python3_11"
RUBY_TARGETS="ruby31"
LUA_SINGLE_TARGET="luajit"
FFTOOLS="aviocat cws2fws ffescape ffeval ffhash fourcc2pixfmt graph2dot ismindex pktdumper qt-faststart sidxindex trasher"
CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sse sse2 sse3 sse4_1 sse4_2 ssse3"You will also need to set on multilib systems
Code: Select all
ABI_X86=I still need this because I use steam and they don't have a 64-bit client. It may not be needed on a lot of systems.
You should also set these variables, regardless of whether you use USE="-*" or not:
Code: Select all
VIDEO_CARDS="nvidia"
INPUT_DEVICES=""Cleanup and closing mention:
After doing this, remember to run emerge -ca or a variation of this, as you should after every @world update.
You can also remove all disabled USE flags from make.conf and package.use.
If something changes, investigate. You may have something you shouldn't in make.conf, or a USE flag listed twice, both enabled and disabled.
This will shift your system from managing everything through make.conf to using package.use.
This should be the case even without USE="-*", but a lot of people just use make.conf for everything, even at the price of extra bloat.





