0

I am trying to add a recipe that creates a user and a directory and changes its ownership to it. Note, I'm using kirkstone Here's my newuser_1.0.bb recipe

SUMMARY = "Example recipe for using inherit useradd"
DESCRIPTION = "This recipe serves as an example for using features from useradd.bbclass"
PR = "r0"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

S = "${WORKDIR}"

inherit useradd

USERADD_PACKAGES = "${PN}"

PASSWD = "HKygs03Q6Cwsk"

USERADD_PARAM:${PN} = "-u 1000 -d /home/user1 -m -s /bin/sh -p '${PASSWD}' user1"

do_install(){
    install -d -m 0755 ${D}home/user1/.ssh
    chown -R user1 ${D}home/user1
}

FILES:${PN} = "/home/user1/.ssh"

This recipe file is under meta-mylayer/recipes-misc/newuser/newuser_1.0.bb

The meta-mylayer is in the same directory as poky I also added meta-mylayer to the bblayers.conf file and appended these lines to the build/conf/local.conf file IMAGE_INSTALL:append = " newuser"

but whenever I run bitbake core-image-base I get this nasty error

ERROR: core-image-base-1.0-r0 do_rootfs: Could not invoke dnf. Command '/home/rechem/rechem-workbench/yocto-tests/poky/build/tmp/work/qemux86_64-poky-linux/core-image-base/1.0-r0/recipe-sysroot-native/usr/bin/dnf -v --rpmverbosity=info -y -c /home/rechem/rechem-workbench/yocto-tests/poky/build/tmp/work/qemux86_64-poky-linux/core-image-base/1.0-r0/rootfs/etc/dnf/dnf.conf --setopt=reposdir=/home/rechem/rechem-workbench/yocto-tests/poky/build/tmp/work/qemux86_64-poky-linux/core-image-base/1.0-r0/rootfs/etc/yum.repos.d --installroot=/home/rechem/rechem-workbench/yocto-tests/poky/build/tmp/work/qemux86_64-poky-linux/core-image-base/1.0-r0/rootfs --setopt=logdir=/home/rechem/rechem-workbench/yocto-tests/poky/build/tmp/work/qemux86_64-poky-linux/core-image-base/1.0-r0/temp --repofrompath=oe-repo,/home/rechem/rechem-workbench/yocto-tests/poky/build/tmp/work/qemux86_64-poky-linux/core-image-base/1.0-r0/oe-rootfs-repo --nogpgcheck install iptables newuser openssh packagegroup-base-extended packagegroup-core-boot procps psplash run-postinsts strongswan locale-base-en-us locale-base-en-gb' returned 1:
DNF version: 4.11.1
cachedir: /home/rechem/rechem-workbench/yocto-tests/poky/build/tmp/work/qemux86_64-poky-linux/core-image-base/1.0-r0/rootfs/var/cache/dnf
Added oe-repo repo from /home/rechem/rechem-workbench/yocto-tests/poky/build/tmp/work/qemux86_64-poky-linux/core-image-base/1.0-r0/oe-rootfs-repo
User-Agent: falling back to 'libdnf': could not detect OS or basearch
repo: using cache for: oe-repo
oe-repo: using metadata from Mon 31 Jul 2023 11:30:35 AM UTC.
No match for argument: newuser
Error: Unable to find a match: newuser

ERROR: Logfile of failure stored in: /home/rechem/rechem-workbench/yocto-tests/poky/build/tmp/work/qemux86_64-poky-linux/core-image-base/1.0-r0/temp/log.do_rootfs.4168943
ERROR: Task (/home/rechem/rechem-workbench/yocto-tests/poky/meta/recipes-core/images/core-image-base.bb:do_rootfs) failed with exit code '1'

I searched the internet for countless hours but nothing worked...

Rechem MEG
  • 311
  • 1
  • 10

1 Answers1

0

I can't believe it took me so long to figure it out.

I stumbled upon this website which stated :

Not installed package

When a required package is not installed, do_rootfs will fail with errors.

The most happened error is Could not invoke dnf or No match for argument: , which is caused by do_install was not run, or by do_compile did not produce any output.

Which made me look back at the do_install() portion of my code only to realize that I had a slash "/" missing after every ${D} * facepalm *

This is the new and working do_install() block is

do_install(){
    install -d -m 0755 ${D}/home/user1/.ssh
    chown -R user1 ${D}/home/user1
}
Rechem MEG
  • 311
  • 1
  • 10