Use IMAGE_FEATURES and EXTRA_IMAGE_FEATURES Correctly
Learn when to set IMAGE_FEATURES in an image recipe and EXTRA_IMAGE_FEATURES in local.conf, which features exist on Yocto 5.0, and how to verify the result.

IMAGE_INSTALL adds one package at a time. IMAGE_FEATURES adds a whole idea at once: an SSH server, the debug tools, a read-only root filesystem, development headers for everything in the image. One word in the list expands into several packages or flips a build-time setting, which is why almost every image recipe and every local.conf you will meet touches it. The confusing part for beginners is that there are two variables, IMAGE_FEATURES and EXTRA_IMAGE_FEATURES, that look interchangeable and are not quite. This post explains the difference on Yocto Project 5.0 (Scarthgap), lists the features you will use first, and shows how to check what an image really received. It builds on the earlier post about adding packages with IMAGE_INSTALL, because the two variables end up feeding the same package list.
What a feature is
An image feature is a name that image.bbclass knows how to act on. Most names map to a package group. Some, such as debug-tweaks and read-only-rootfs, are not packages at all: they change how the root filesystem is assembled. The Yocto Development Tasks Manual says the best reference for what each name does is meta/classes-recipe/image.bbclass, and it describes the effect as the build system adding "the appropriate packages or configurations" to IMAGE_INSTALL for you.
The list of valid names is fixed by the class. You cannot invent a feature in local.conf and expect it to do something. A name the build does not recognize is rejected at parse time, so a typo fails early instead of producing an image that quietly lacks what you wanted.
Two variables, one rule
The manual states the rule directly: the two variables are nearly equivalent, but best practice is to use IMAGE_FEATURES from within a recipe and EXTRA_IMAGE_FEATURES from your local.conf.
The split exists for the same reason :append exists for IMAGE_INSTALL. An image recipe owns its list, so it assigns IMAGE_FEATURES and keeps the list under version control with the recipe. The build directory's local.conf belongs to whoever is running the build today, so it gets a separate variable that is added on top and cannot overwrite the recipe's choices.
SUMMARY = "Image for the lab bench"
LICENSE = "MIT"
inherit core-image
IMAGE_FEATURES += "ssh-server-openssh package-management"EXTRA_IMAGE_FEATURES += "tools-debug"The recipe records what this image is: it has an SSH server and a package manager. The local line records what one developer wants while working: gdb and strace on the target. Neither line touches the other.
The default local.conf that Poky generates already sets EXTRA_IMAGE_FEATURES ?= "debug-tweaks", so a freshly created build directory ships images that allow passwordless root login. That is convenient on a bench and wrong for a product, a point the later post on removing debug-tweaks takes up.
The features you will use first
The Yocto Reference Manual lists the features available for all images, and a second group that only works when the recipe inherits core-image. These are the ones to learn first, with the manual's wording behind each:
| Feature | What it does | Available for |
|---|---|---|
ssh-server-dropbear | Installs the Dropbear minimal SSH server | core-image only |
ssh-server-openssh | Installs OpenSSH, which wins if both servers are listed | core-image only |
tools-debug | Installs debugging tools such as strace and gdb | core-image only |
package-management | Installs the package manager and keeps its database | all images |
dev-pkgs | Development packages (headers, extra library links) for everything installed | all images |
dbg-pkgs | Debug-symbol packages for everything installed | all images |
read-only-rootfs | Builds a read-only root filesystem | all images |
debug-tweaks | Development convenience: root login, empty passwords, post-install logging | all images |
Two of these have consequences worth knowing before you enable them. First, ssh-server-dropbear also recommends openssh-sftp-server from the 4.1 release onward, because current OpenSSH scp clients use the SFTP protocol, and the manual shows the way to opt out. Second, listing both SSH servers does not install both: OpenSSH takes precedence and Dropbear is left out.
Check what the image really got
A feature name that expands to nothing visible is hard to trust, so look at the evaluated variables before waiting for a build:
bitbake -e core-image-minimal | grep -E '^(IMAGE_FEATURES|EXTRA_IMAGE_FEATURES)='EXTRA_IMAGE_FEATURES="debug-tweaks tools-debug"
IMAGE_FEATURES="debug-tweaks tools-debug"The second line is the merged result. The class folds EXTRA_IMAGE_FEATURES into IMAGE_FEATURES and, as the manual puts it, the build system then adds the matching packages to IMAGE_INSTALL. Your output may list more names, because some recipes and distro configuration files add their own. If a feature you set does not appear in IMAGE_FEATURES, an override is replacing the variable somewhere, and the bitbake -e output shows the file and line in the comments above the assignment.
After a build, confirm the packages:
grep -E '^(strace|gdb) ' tmp/deploy/images/qemux86-64/*.manifestgdb core2-64 14.2-r0
strace core2-64 6.8-r0Versions and architecture strings depend on your checkout and machine, so read them as an example of the format: package name, package architecture, version.
Remove a feature
A feature that a layer or the distro enables can be taken away again with :remove, applied last:
IMAGE_FEATURES:remove = "x11"Use it sparingly. A removal in local.conf is invisible to anyone reading the image recipe, and it only works if the variable you are removing from is the one that holds the name. When both variables carry the same name, remove it from IMAGE_FEATURES, since that is the merged list the class acts on.
Features that need core-image
If a recipe sets IMAGE_FEATURES += "ssh-server-openssh" but does not inherit core-image, the name is not valid for that image, because those features are defined by the core-image class. This is the usual reason a hand-written image recipe that starts from inherit image finds that an SSH feature is rejected. The fix is to inherit core-image, which is what core-image-minimal and its relatives do, or to install the SSH server by package name with IMAGE_INSTALL instead.
Read-only root as a worked example
read-only-rootfs shows why features exist. No single package makes a root filesystem read-only. The class has to mount the root read-only, check that no post-install script is going to need to write on first boot, and arrange for volatile directories. Setting the one word handles the build side:
SUMMARY = "Image with a read-only root filesystem"
LICENSE = "MIT"
inherit core-image
IMAGE_FEATURES += "ssh-server-dropbear read-only-rootfs"If a package still has a post-install script that needs to run on the target, the build stops with an error naming it, and the companion feature read-only-rootfs-delayed-postinsts exists for the case where the root is made writable for the first boot. The Development Tasks Manual section on read-only root filesystems covers the details, and the later posts on read-only systems build on it.
When a feature is the wrong tool
Features are coarse. dev-pkgs and dbg-pkgs apply to every package in the image, so on a large image they can multiply its size, and the right tool for one library's headers is to add that single -dev package by name. If you need a package that no feature names, use IMAGE_INSTALL. If you need the same bundle in several images, a package group recipe gives it a name of its own. And a feature that weakens security, such as debug-tweaks, belongs in EXTRA_IMAGE_FEATURES on a developer's machine, never in the recipe of an image you ship.


