Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Installing Gentoo
  • Search

Having trouble understanding USE flags

Having problems with the Gentoo Handbook? If you're still working your way through it, or just need some info before you start your install, this is the place. All other questions go elsewhere.
Post Reply
Advanced search
7 posts • Page 1 of 1
Author
Message
epenguin
n00b
n00b
User avatar
Posts: 25
Joined: Tue Dec 07, 2021 7:56 pm
Location: US
Contact:
Contact epenguin
Website

Having trouble understanding USE flags

  • Quote

Post by epenguin » Thu Dec 09, 2021 10:02 pm

I'm going to try and draw out my train of though as best as possible. I'm a little confused regarding local use flags vs. temporary use flags vs. global use flags. I'm trying to install Xorg right now, and I'm reading the documentation.

I've added "X" into my global use flags inside of /etc/portage/make.conf.

Then it says "USE flags for x11-base/xorg-xserver" (https://wiki.gentoo.org/wiki/Xorg/Guide). Are these flags I should be adding to my /etc/portage/make.conf? I clicked "More information about USE flags" (https://wiki.gentoo.org/wiki/Handbook:AMD64/Working/USE) and it took me to a part of the documentation that says I could use /etc/portage/package.use for USE flags specific to a package, which is exactly what I need I think. The problem is that the page I'm looking at seems to imply /etc/portage/package.use is a file, which it is a directory on my system by default. How does the hierarchy work when adding new package.use files?

I'm guessing it is something like /etc/portage/package.use/x11-base/xorg-drivers and in that I list a bunch of flags. The problem is I don't know how to test this with accuracy. I tried this and added "elogind" to my /etc/portage/package.use/x11-base/xorg-server file, and something seemed to change, but I'm not sure if it worked.

I know I can add USE="..." when installing via emerge, but does that persist through the next time I use emerge? Like if I call
emerge USE="elogind" --ask x11-base/xorg-server
and then later I say
emerge --sync
won't emerge try to recompile x11-base/xorg-server without elogind?
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56094
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Thu Dec 09, 2021 10:24 pm

epenguin,

Welcome to Gentoo.

Lets rewind a little and talk about profiles, so we have some context to explain about USE flags.

You profile, as set or displayed by

Code: Select all

eselect profile
chooses some default setting for your install.
Which profile you should choose depends on the intended purpose of the install.
One of the features of a profile is to provide some pre set USE flags, that you then tune (add or remove) in make.conf for global setting or in package.use to apply USE settnigs on a per package basis.

package.use can be a file or a directory. I don't know if a directory of directories works.
When its a file, entries are processed in order.
If one entry sets a flag on a package and a later entry removes it, the flag is off. Hold that thought.
When package.use in a directory, the files it contains are concatenated together in lexical order, the result is then processed as if it was a file.
Lexical order is important. That means its locale sort order dependent.

Coming back to profiles, its a good idea to select one closest to your intended purpose. Not all combination are provided.
There are a good selection of run of the mill desktop profiles.

Code: Select all

  [5]   default/linux/amd64/17.1/desktop (stable)
  [6]   default/linux/amd64/17.1/desktop/gnome (stable)
  [7]   default/linux/amd64/17.1/desktop/gnome/systemd (stable)
  [8]   default/linux/amd64/17.1/desktop/plasma (stable)
  [9]   default/linux/amd64/17.1/desktop/plasma/systemd (stable)
  [10]  default/linux/amd64/17.1/desktop/systemd (stable)
but if you want a desktop on hardened or selinux there isn't a ready made profile.

Code: Select all

  [2]   default/linux/amd64/17.1/selinux (stable)
  [3]   default/linux/amd64/17.1/hardened (stable)
  [4]   default/linux/amd64/17.1/hardened/selinux (stable)
Its possible to combine them.

If you need to set USE=X in make.conf you probably need to select a different profile.

If its not that simple, please explain what you want to achieve.
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
epenguin
n00b
n00b
User avatar
Posts: 25
Joined: Tue Dec 07, 2021 7:56 pm
Location: US
Contact:
Contact epenguin
Website

  • Quote

Post by epenguin » Thu Dec 09, 2021 10:37 pm

NeddySeagoon wrote:epenguin,

Welcome to Gentoo.

Lets rewind a little and talk about profiles, so we have some context to explain about USE flags.

You profile, as set or displayed by

Code: Select all

eselect profile
chooses some default setting for your install.
Which profile you should choose depends on the intended purpose of the install.
One of the features of a profile is to provide some pre set USE flags, that you then tune (add or remove) in make.conf for global setting or in package.use to apply USE settnigs on a per package basis.

package.use can be a file or a directory. I don't know if a directory of directories works.
When its a file, entries are processed in order.
If one entry sets a flag on a package and a later entry removes it, the flag is off. Hold that thought.
When package.use in a directory, the files it contains are concatenated together in lexical order, the result is then processed as if it was a file.
Lexical order is important. That means its locale sort order dependent.

Coming back to profiles, its a good idea to select one closest to your intended purpose. Not all combination are provided.
There are a good selection of run of the mill desktop profiles.

Code: Select all

  [5]   default/linux/amd64/17.1/desktop (stable)
  [6]   default/linux/amd64/17.1/desktop/gnome (stable)
  [7]   default/linux/amd64/17.1/desktop/gnome/systemd (stable)
  [8]   default/linux/amd64/17.1/desktop/plasma (stable)
  [9]   default/linux/amd64/17.1/desktop/plasma/systemd (stable)
  [10]  default/linux/amd64/17.1/desktop/systemd (stable)
but if you want a desktop on hardened or selinux there isn't a ready made profile.

Code: Select all

  [2]   default/linux/amd64/17.1/selinux (stable)
  [3]   default/linux/amd64/17.1/hardened (stable)
  [4]   default/linux/amd64/17.1/hardened/selinux (stable)
Its possible to combine them.

If you need to set USE=X in make.conf you probably need to select a different profile.

If its not that simple, please explain what you want to achieve.
Thanks for responding so quickly! I'm coming from arch where I use xorg with i3 for my desktop. When installing gentoo, I used the default profile where it didn't add anything. I thought this made sense at the time because in arch, after installation of arch itself, I install xorg, alsa, and other stuff. Maybe I should've gone with the desktop profile.
If its not that simple, please explain what you want to achieve.
Based off what you said, it probably is that simple. I think I'm going to blank everything and restart so I understand the process better.

I think I'm going to try and make my package.use a file this time. I'm not sure why it was a directory by default. There are many many examples of package.use as a file, but I can't seem to find any for package.use as a directory.
Top
Hu
Administrator
Administrator
Posts: 24398
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Thu Dec 09, 2021 10:51 pm

epenguin wrote:I'm coming from arch where I use xorg with i3 for my desktop.
That should be straightforward to get working in Gentoo.
epenguin wrote:When installing gentoo, I used the default profile where it didn't add anything. I thought this made sense at the time because in arch, after installation of arch itself, I install xorg, alsa, and other stuff. Maybe I should've gone with the desktop profile.
Perhaps you should have, but that's OK. As Neddy says, the profile just sets defaults for when you run emerge. You could change your profile to desktop now, run emerge with the right options, and you will end up in the same place as you would have if you had chosen desktop at the beginning.
epenguin wrote:Based off what you said, it probably is that simple. I think I'm going to blank everything and restart so I understand the process better.
You can do that if you want, but there's no need to do so. Gentoo is quite hard to break irreparably, and as long as it is not broken, you can remake it incrementally from inside the running system.
epenguin wrote:I think I'm going to try and make my package.use a file this time. I'm not sure why it was a directory by default. There are many many examples of package.use as a file, but I can't seem to find any for package.use as a directory.
Preferences vary as to which to use, and I think some tools are fussy and insist on having it be a directory, so that they can claim one filename within that directory for their own. They then assume they can rewrite that one file at will without breaking your changes. You would keep your personal preferences in a different filename, which they would not touch. If you use a file for package.use, then they would need much fancier editing capabilities. To avoid that, they just check if it is a file, and if so, abort with an error message telling you to switch to a directory.
Top
epenguin
n00b
n00b
User avatar
Posts: 25
Joined: Tue Dec 07, 2021 7:56 pm
Location: US
Contact:
Contact epenguin
Website

  • Quote

Post by epenguin » Thu Dec 09, 2021 11:06 pm

Hu wrote:
epenguin wrote:I'm coming from arch where I use xorg with i3 for my desktop.
That should be straightforward to get working in Gentoo.
epenguin wrote:When installing gentoo, I used the default profile where it didn't add anything. I thought this made sense at the time because in arch, after installation of arch itself, I install xorg, alsa, and other stuff. Maybe I should've gone with the desktop profile.
Perhaps you should have, but that's OK. As Neddy says, the profile just sets defaults for when you run emerge. You could change your profile to desktop now, run emerge with the right options, and you will end up in the same place as you would have if you had chosen desktop at the beginning.
epenguin wrote:Based off what you said, it probably is that simple. I think I'm going to blank everything and restart so I understand the process better.
You can do that if you want, but there's no need to do so. Gentoo is quite hard to break irreparably, and as long as it is not broken, you can remake it incrementally from inside the running system.
epenguin wrote:I think I'm going to try and make my package.use a file this time. I'm not sure why it was a directory by default. There are many many examples of package.use as a file, but I can't seem to find any for package.use as a directory.
Preferences vary as to which to use, and I think some tools are fussy and insist on having it be a directory, so that they can claim one filename within that directory for their own. They then assume they can rewrite that one file at will without breaking your changes. You would keep your personal preferences in a different filename, which they would not touch. If you use a file for package.use, then they would need much fancier editing capabilities. To avoid that, they just check if it is a file, and if so, abort with an error message telling you to switch to a directory.
Gotcha. I might even switch to something like kde just so I can see examples of useful /etc/portage/make.conf setups. Restarting from scratch isn't a big deal for me because the reason I'm switching to gentoo is so I can start working on using gentoo for embedded and hopefully get some weird boards working with gentoo. I'll have to go through the process a million times there anyways so I might as well learn it through and through.

It is useful to know I could've just switched profiles right then and there though... slight regret lol. Thanks!
Top
pietinger
Administrator
Administrator
Posts: 6629
Joined: Tue Oct 17, 2006 5:11 pm
Location: Bavaria

  • Quote

Post by pietinger » Fri Dec 10, 2021 1:22 am

epenguin wrote:Gotcha. I might even switch to something like kde just so I can see examples of useful /etc/portage/make.conf setups.
Dont forget what @Neddy said: You can set an use-flag globally in /etc/portage/make.conf (for all packages which uses this flag) or just for one special package. The desktop-profiles uses this per-package-setting for some important use-flags. For example: If you set desktop-plasma (=KDE) you will see no use-flag "wayland" in your global settings (check with "emerge --info"), but if you look with "emerge -pvD plasma-meta kdecore-meta" (the "p" is important) what portage WOULD install, you see this use-flag "wayland" is activated for some packages. So, it is better to activate your needed profile.
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56094
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Fri Dec 10, 2021 8:34 am

epenguin,

Its safe to 'audition' profiles.

Choose one, run

Code: Select all

emerge --info
that shows the profile settings as modified by make.conf.
It does not show any per package settings. This does not change your install in any way.

Choose another and review the setting now. Go through them all if you like.

At the end, choose a profile that you like then run

Code: Select all

emerge -uDNav @world
to have the settings take effect.
Review the output before you let it run and do any USE flag tuning you feel is needed.
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
Post Reply

7 posts • Page 1 of 1

Return to “Installing Gentoo”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic