User:Lekto/Tricks

From Gentoo Wiki
Jump to:navigation Jump to:search

Here some different tips and trick useful when working with Gentoo/Linux, without any particular order.

Passing environmental variables to emerge when using doas

You can pass environmental variables to emerge:

user $USE="experimental" emerge -p gentoo-sources

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

Calculating dependencies... done!
Dependency resolution took 5.08 s (backtrack: 0/20).

[ebuild   R   ~] sys-kernel/gentoo-sources-6.5.13-r1  USE="experimental*"

This method of passing variables will fail, when using doas:

user $doas USE="experimental" emerge -p gentoo-sources
doas: USE=experimental: command not found
user $USE="experimental" doas emerge -p gentoo-sources

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

Calculating dependencies... done!
Dependency resolution took 2.24 s (backtrack: 0/20).

[ebuild   R   ~] sys-kernel/gentoo-sources-6.5.13-r1

To bypass this use env command:

user $doas env USE="experimental" emerge -p gentoo-sources

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

Calculating dependencies... done!
Dependency resolution took 4.98 s (backtrack: 0/20).

[ebuild   R   ~] sys-kernel/gentoo-sources-6.5.13-r1  USE="experimental*"


Emerge wants to install something big, that I don't need

Sometimes when installing something, emerge wants to install something big, that doesn't look useful:

user $emerge -p cifs-utils

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

Calculating dependencies... done!
Dependency resolution took 2.98 s (backtrack: 0/20).

[ebuild  N     ] dev-db/lmdb-0.9.30  USE="-static-libs" ABI_X86="(64) -32 (-x32)" 
[ebuild  N     ] sys-libs/talloc-2.4.0  USE="python -compat -valgrind" ABI_X86="(64) -32 (-x32)" PYTHON_SINGLE_TARGET="python3_11 -python3_10" 
[ebuild  N     ] sys-apps/keyutils-1.6.3  USE="(-split-usr) -static -static-libs -test" ABI_X86="(64) -32 (-x32)" 
[ebuild  N     ] dev-perl/common-sense-3.750.0 
[ebuild  N     ] dev-perl/Parse-Yapp-1.210.0-r1  USE="-examples -test" 
[ebuild  N     ] dev-perl/Canary-Stability-2013.0.0 
[ebuild  N     ] dev-libs/libev-4.33  USE="-static-libs" ABI_X86="(64) -32 (-x32)" 
[ebuild  N     ] sys-libs/tdb-1.4.8  USE="-python" ABI_X86="(64) -32 (-x32)" PYTHON_SINGLE_TARGET="python3_11 -python3_10" 
[ebuild  N     ] sys-libs/tevent-0.14.1  USE="-python -test" ABI_X86="(64) -32 (-x32)" PYTHON_SINGLE_TARGET="python3_11 -python3_10" 
[ebuild  N     ] dev-perl/Types-Serialiser-1.10.0  USE="-test" 
[ebuild  N     ] dev-libs/libverto-0.3.1-r1  USE="libev threads -glib -libevent -static-libs -tevent" ABI_X86="(64) -32 (-x32)" 
[ebuild  N     ] app-crypt/mit-krb5-1.20.1  USE="keyutils nls pkinit threads -doc -lmdb -openldap (-selinux) -test -xinetd" ABI_X86="(64) -32 (-x32)" CPU_FLAGS_X86="aes" 
[ebuild  N     ] sys-libs/ldb-2.7.2  USE="lmdb -doc -ldap -python -test" ABI_X86="(64) -32 (-x32)" PYTHON_SINGLE_TARGET="python3_11 -python3_10" 
[ebuild  N     ] dev-perl/JSON-XS-4.30.0  USE="-examples -test" 
[ebuild  N     ] dev-perl/JSON-4.100.0  USE="xs -examples -test" 
[ebuild  N     ] virtual/krb5-0-r1  ABI_X86="(64) -32 (-x32)" 
[ebuild  N     ] net-fs/cifs-utils-7.0  USE="acl ads caps pam python systemd -creds" PYTHON_SINGLE_TARGET="python3_11 -python3_10" 
[ebuild  N     ] net-fs/samba-4.18.8  USE="acl client cups pam regedit system-mitkrb5 systemd -addc -ads -ceph -cluster -debug (-fam) -glusterfs -gpg -iprint -json -ldap -llvm-libunwind -profiling-data -python -quota (-selinux) -snapper -spotlight -syslog (-system-heimdal) (-test) -unwind -winbind -zeroconf" ABI_X86="(64) -32 (-x32)" CPU_FLAGS_X86="aes" PYTHON_SINGLE_TARGET="python3_11 -python3_10"

In this case I want to install onlycifs-utils, which allows me to mount samba shares. Portage wants for some reason install samba, which is huge program that allows to host samba shares, which I don't need. To check why portage wants to install it you need to exclude it:

user $emerge -p cifs-utils --exclude=samba

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

Calculating dependencies... done!
Dependency resolution took 5.18 s (backtrack: 2/20).


!!! All ebuilds that could satisfy ">=net-fs/samba-4.0.0_alpha1" have been masked.
!!! One of the following masked packages is required to complete your request:
- net-fs/samba-4.19.3::gentoo (masked by: ~amd64 keyword)
- net-fs/samba-4.19.2::gentoo (masked by: ~amd64 keyword)
- net-fs/samba-4.19.1::gentoo (masked by: ~amd64 keyword)
- net-fs/samba-4.19.0-r1::gentoo (masked by: ~amd64 keyword)
- net-fs/samba-4.18.8::gentoo (masked by: exclude option)
- net-fs/samba-4.18.7::gentoo (masked by: ~amd64 keyword)
- net-fs/samba-4.18.6-r1::gentoo (masked by: ~amd64 keyword)
- net-fs/samba-4.18.5-r1::gentoo (masked by: ~amd64 keyword)
- net-fs/samba-4.18.4-r1::gentoo (masked by: exclude option)

(dependency required by "net-fs/cifs-utils-7.0::gentoo[acl]" [ebuild])
(dependency required by "cifs-utils" [argument])
For more information, see the MASKED PACKAGES section in the emerge
man page or refer to the Gentoo Handbook.

As you can see, portage wants to install samba, because cifs-utils has acl use flag. When trying to install cifs-utils without acl:

user $USE="-acl" emerge -p cifs-utils

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

Calculating dependencies... done!
Dependency resolution took 2.72 s (backtrack: 0/20).

[ebuild  N     ] sys-apps/keyutils-1.6.3  USE="(-split-usr) -static -static-libs -test" ABI_X86="(64) -32 (-x32)" 
[ebuild  N     ] sys-libs/talloc-2.4.0  USE="python -compat -valgrind" ABI_X86="(64) -32 (-x32)" PYTHON_SINGLE_TARGET="python3_11 -python3_10" 
[ebuild  N     ] dev-libs/libev-4.33  USE="-static-libs" ABI_X86="(64) -32 (-x32)" 
[ebuild  N     ] dev-libs/libverto-0.3.1-r1  USE="libev threads -glib -libevent -static-libs -tevent" ABI_X86="(64) -32 (-x32)" 
[ebuild  N     ] app-crypt/mit-krb5-1.20.1  USE="keyutils nls pkinit threads -doc -lmdb -openldap (-selinux) -test -xinetd" ABI_X86="(64) -32 (-x32)" CPU_FLAGS_X86="aes" 
[ebuild  N     ] virtual/krb5-0-r1  ABI_X86="(64) -32 (-x32)" 
[ebuild  N     ] net-fs/cifs-utils-7.0  USE="ads caps pam python systemd -acl -creds" PYTHON_SINGLE_TARGET="python3_11 -python3_10"