From patchwork Fri Jun 5 17:56:35 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Randolph Sapp X-Patchwork-Id: 89382 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F4F5CD6E7B for ; Fri, 5 Jun 2026 17:57:38 +0000 (UTC) Received: from SN4PR2101CU001.outbound.protection.outlook.com (SN4PR2101CU001.outbound.protection.outlook.com [40.93.195.32]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.1078.1780682253444519216 for ; Fri, 05 Jun 2026 10:57:33 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@ti.com header.s=selector1 header.b=gsuCKQwW; spf=pass (domain: ti.com, ip: 40.93.195.32, mailfrom: rs@ti.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=L3uTcLtZr8IO1aE+feQ+aVG3FzG2qr9Ht0njMqvtLQapYY6/0oTuWtdKGTJjUuAkhQuO5auvyZHsd0fcxsPGpljyFHNUx8S161yYtNjnGCYgrHIzXmTSMcn49db4pcFbpeiAKfCb34EuyeUX3a5xIp2uTxBEFULiuo+JO4CyvbkXwN2Vceeg61AGpNvTb2s4ckzyr9xAUkMdID4Zy5WtJwBfS8qpUeL6VbVIXjUFyT5RQZyFV/ldHbmXfR3xSU4Mb0rIwcUX+J94IG6mfa5SNeCmFhFBnqWS7MAUcMKv4Nj2IjpBSfxN6Ju4PISl6ImSX2YTbk0YoRnVCF2v4Leczg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RuIwNfFcUolGCid/gCKzBGzIBQr6XCinopCCeNn93vk=; b=s7I1TWMbUE4nJJzPJP91foToLdQkQgLu+XyuiPT7IbnvK8TahvuNUJFZwESwQBsDbSSjUR4UQh1PoJ9Bfpz7hdvkMAFYab5G7jTuduBQkFGCFZKw8Cs+xS0l2liJBRB7ShnF9bhMvQW2NmXzKw3jovTNJ8NMYcKda24iYp+TQtUY7uXt8iIdN5AO5QSGQ8zuJmpoWXCd9EYw+cqUKf+WFq3q2A74FIK8Y8Py3eYlIt5akR+E8wnu88C+XRDarSxwnzxWdzG7XKZ+i5AnaySot7B9AmBCXr1ieCCq7PbsPeyRFYsS9PEKxyDNs3gRJPWtOVMT+KBPeDx1yKKfEJG5lg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 198.47.23.195) smtp.rcpttodomain=lists.openembedded.org smtp.mailfrom=ti.com; dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=ti.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RuIwNfFcUolGCid/gCKzBGzIBQr6XCinopCCeNn93vk=; b=gsuCKQwWOI0CuXbtc4VvC3t9t5mxMEjuz7ZXWUg5798qWKS2QJu6kA/dYbnCd1VJVH8eJm6p/eaqeevFUXD/C5nXsG4xmM21Pd3YCk8KMlCi8JMrK4X3mdfewnw4k99BTbgcSuxB7yjLW3oJm1T5+lgnBPj7F4Bwz5kr0Ll84l0= Received: from SJ0PR03CA0298.namprd03.prod.outlook.com (2603:10b6:a03:39e::33) by MN2PR10MB4366.namprd10.prod.outlook.com (2603:10b6:208:1dd::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.71.11; Fri, 5 Jun 2026 17:57:30 +0000 Received: from SJ5PEPF000001E9.namprd05.prod.outlook.com (2603:10b6:a03:39e:cafe::98) by SJ0PR03CA0298.outlook.office365.com (2603:10b6:a03:39e::33) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.92.8 via Frontend Transport; Fri, 5 Jun 2026 17:57:30 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 198.47.23.195) smtp.mailfrom=ti.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ti.com; Received-SPF: Pass (protection.outlook.com: domain of ti.com designates 198.47.23.195 as permitted sender) receiver=protection.outlook.com; client-ip=198.47.23.195; helo=lewvzet201.ext.ti.com; pr=C Received: from lewvzet201.ext.ti.com (198.47.23.195) by SJ5PEPF000001E9.mail.protection.outlook.com (10.167.242.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.92.5 via Frontend Transport; Fri, 5 Jun 2026 17:57:29 +0000 Received: from DLEE214.ent.ti.com (157.170.170.117) by lewvzet201.ext.ti.com (10.4.14.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.37; Fri, 5 Jun 2026 12:57:29 -0500 Received: from DLEE208.ent.ti.com (157.170.170.97) by DLEE214.ent.ti.com (157.170.170.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.37; Fri, 5 Jun 2026 12:57:28 -0500 Received: from lelvem-mr05.itg.ti.com (10.180.75.9) by DLEE208.ent.ti.com (157.170.170.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.37 via Frontend Transport; Fri, 5 Jun 2026 12:57:28 -0500 Received: from rs-desk.dhcp.ti.com (rs-desk.dhcp.ti.com [128.247.81.39]) by lelvem-mr05.itg.ti.com (8.18.1/8.18.1) with ESMTP id 655HvSe72402673; Fri, 5 Jun 2026 12:57:28 -0500 From: To: , , , , , CC: , , , , Subject: [oe-core][RFCv3] xuser-account: convert to standard-user-account Date: Fri, 5 Jun 2026 12:56:35 -0500 Message-ID: <20260605175634.1532123-2-rs@ti.com> X-Mailer: git-send-email 2.54.0 MIME-Version: 1.0 X-C2ProcessedOrg: 333ef613-75bf-4e12-a4b1-8e3623f5dcea X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001E9:EE_|MN2PR10MB4366:EE_ X-MS-Office365-Filtering-Correlation-Id: 98ae9883-55dc-41b1-1049-08dec32be965 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700016|1800799024|376014|20052099010|3023799007|6133799003|18002099003|56012099006; X-Microsoft-Antispam-Message-Info: /GT7FQVD4F6N87XHgvQ/PZxYUWy++Gv4IJ9tZz4zyGjmCVQl0DB8jJ5GYXCBqBS+/l5qDZILJkpVFZlAYpxTEZwxipaHhCpYx6i+8YVLwKSZuh7giE2P2I9b+TlOolADuG4GgvSc5D1Un05IFRuvq5/fGrkgFPCmeTI+peuSQqgGzdYXny3w/XV5pGPtmacB5zEtWOZy9Y+gLe6NRAiSAtFsnb5GTOpRKslWFn8CNKBHT7//7JoCSd0+gXOffD4zJ34cBKaeA2jmAX4qVbjqthzzMKLSfB5fAqV0xm0t71FYr7IkIFKJzStAXWVAc8+mUsYIk8UQMW0x62KV+ko7bPHsKNyj4lh/aFlYU0fdzoaVTDzLik3o/BrnXCL2NEBZ/eWbSHl/H3GTtjeB+qRg7QDZCka4PxMCo42r7seHysYx/g4yZmRQsY6KU6gIy+EVoaw1RVgx1Apwwlo/s83EP7hoBai7uu9q6DL7ml3q9dqyYBqH0b0oeEPZgXxQovxMf/Xw4niKwxGb2MBDRErbImLFMpaEJBbeAJcD4aJRDYUe4HehDfmiwgUemSdePBlILE7JZfabcy8T57Ai7FtPdrD91rJvLcYGhIW8zYd6QVZlLE4NIoLyVlu4euXFSvs471vIwJNfyOf0wFVvlOfDG26r9Zg9olNPckFTCSHJYdUGVz4yTk9Kg4kScLYhBdLU X-Forefront-Antispam-Report: CIP:198.47.23.195;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:lewvzet201.ext.ti.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(36860700016)(1800799024)(376014)(20052099010)(3023799007)(6133799003)(18002099003)(56012099006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fwCo8N9pQXyoAg13OYu7Jtsye3EQtaKKPr0mQ15KqLx67LnrWLe0DPWERTZF8UpePa41EzIxlQl1S5ZF0eOPZtC9tLHHYO+Gp7Yg2K/nrtFIvkgcyTiy95A4aAb9MFnMB9wRoUh/YUWSnJRZ8lSfPzbOlQkrWB6q3GBKbX/MIQ8DivmqCRUz9DNtXJxxv0Ruf1NLZ35QUl4Hg1xu8Y3H1VYcuBYo89jQs5i5ZE0Ws1C8RX7w+srmkjh+jEP2vVOARz9wxYusjw56jkbVtBZ+UZWbmpbpM4D9VaJvrp3mN0hwgwrtRr7lYMyJsgQgdFAlVq1nxTrnKiSiH1H4MkaGGdJG9eTuHkQZ6hjSAJ7bJjlLMp1erSG/P8CvWBabE5O/WX03vtRjOAdur6DvAnl5XQ6sokP4hYSg8hbWgVICcC5OrLQvsn01apTqtnQ7n+ZN X-OriginatorOrg: ti.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jun 2026 17:57:29.8568 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 98ae9883-55dc-41b1-1049-08dec32be965 X-MS-Exchange-CrossTenant-Id: e5b49634-450b-4709-8abb-1e2b19b982b7 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=e5b49634-450b-4709-8abb-1e2b19b982b7;Ip=[198.47.23.195];Helo=[lewvzet201.ext.ti.com] X-MS-Exchange-CrossTenant-AuthSource: SJ5PEPF000001E9.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4366 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 05 Jun 2026 17:57:38 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/238181 From: Randolph Sapp Change this single xuser account template into a generic standard-user-account that uses distro level variables for configuration. This allows for seamless configuration of multiple out-of-box scripts and tests across layers without having to implicitly hope that the username or groups haven't been changed by a bbappend or recipe override. This also adds a class and a variable to allow recipes to assert that the user is in requested groups. This was proposed specifically to remove some issues highlighted in: https://lists.openembedded.org/g/openembedded-core/message/230665 Signed-off-by: Randolph Sapp --- Sorry about the previous version. Had an unstaged change that was related. meta-selftest/files/static-group | 3 +- meta-selftest/files/static-passwd | 3 +- meta/classes-recipe/standard-user.bbclass | 26 +++++++++++ .../distro/include/default-distrovars.inc | 12 +++++ meta/conf/distro/include/maintainers.inc | 2 +- meta/conf/documentation.conf | 4 ++ meta/recipes-graphics/wayland/weston-init.bb | 12 ++--- .../x11-common/xserver-nodm-init_3.0.bb | 8 ++-- .../{system-xuser.conf => system-user.conf} | 2 +- .../standard-user-account_0.1.bb | 46 +++++++++++++++++++ .../user-creation/xuser-account_0.1.bb | 30 ------------ scripts/sstate-sysroot-cruft.sh | 6 +-- 12 files changed, 105 insertions(+), 49 deletions(-) create mode 100644 meta/classes-recipe/standard-user.bbclass rename meta/recipes-support/user-creation/files/{system-xuser.conf => system-user.conf} (90%) create mode 100644 meta/recipes-support/user-creation/standard-user-account_0.1.bb delete mode 100644 meta/recipes-support/user-creation/xuser-account_0.1.bb diff --git a/meta-selftest/files/static-group b/meta-selftest/files/static-group index 6a9ece20a8..9ef91bbdca 100644 --- a/meta-selftest/files/static-group +++ b/meta-selftest/files/static-group @@ -20,12 +20,11 @@ pulse:x:520: bind:x:521: builder:x:522: weston-launch:x:524: -weston:x:525: wayland:x:526: render:x:527: sgx:x:528: ptest:x:529: -xuser:x:530: +user:x:530: seat:x:531: audio:x:532: empower:x:533: diff --git a/meta-selftest/files/static-passwd b/meta-selftest/files/static-passwd index 98017c8153..cddf095ff2 100644 --- a/meta-selftest/files/static-passwd +++ b/meta-selftest/files/static-passwd @@ -16,8 +16,7 @@ pulse:x:520:520::/:/bin/nologin bind:x:521:521::/:/bin/nologin builder:x:522:522::/:/bin/nologin _apt:x:523:523::/:/bin/nologin -weston:x:525:525::/:/bin/nologin ptest:x:529:529::/:/bin/nologin -xuser:x:530:530::/:/bin/nologin +user:x:530:530::/:/bin/nologin cmake-example:x:534:534::/var/lib/cmake-example:/bin/false meson-example:x:535:535::/var/lib/meson-example:/bin/false diff --git a/meta/classes-recipe/standard-user.bbclass b/meta/classes-recipe/standard-user.bbclass new file mode 100644 index 0000000000..ff931b8092 --- /dev/null +++ b/meta/classes-recipe/standard-user.bbclass @@ -0,0 +1,26 @@ +# +# Copyright OpenEmbedded Contributors +# +# SPDX-License-Identifier: MIT +# + +STANDARD_USER_PACKAGES ?= "${PN}" +REQUIRED_STANDARD_USER_GROUPS ?= "" + +python __anonymous() { + d.appendVar("DEPENDS", " standard-user-account") + + for pkg in d.getVar('STANDARD_USER_PACKAGES').split(): + d.appendVar("RDEPENDS:" + pkg, " standard-user-account") + + active_groups = set(d.getVar('STANDARD_USER_GROUPS').split()) + active_groups.update(d.getVar('STANDARD_USER_SYSTEM_GROUPS').split()) + required_groups = set(d.getVar('REQUIRED_STANDARD_USER_GROUPS').split()) + + if not required_groups.issubset(active_groups): + raise bb.parse.SkipRecipe( + "one of '%s' needs to be in STANDARD_USER_GROUPS or " + "STANDARD_USER_SYSTEM_GROUPS" + % ' '.join(required_groups) + ) +} diff --git a/meta/conf/distro/include/default-distrovars.inc b/meta/conf/distro/include/default-distrovars.inc index 69c6db589b..88c3bc38be 100644 --- a/meta/conf/distro/include/default-distrovars.inc +++ b/meta/conf/distro/include/default-distrovars.inc @@ -66,3 +66,15 @@ KERNEL_IMAGETYPES ??= "${KERNEL_IMAGETYPE}" # the variable to be empty. # Git example url: git://git.yoctoproject.org/yocto-firewall-test;protocol=git;rev=master;branch=master CONNECTIVITY_CHECK_URIS ?= "https://www.yoctoproject.org/connectivity.html" + +# The STANDARD_USER_NAME is the default underprivileged user account name. +# The STANDARD_USER_GROUPS is a space delimited list of user groups that account +# should belong to, and STANDARD_USER_SYSTEM_GROUPS is the same but for system +# groups. +# +# Please take note that not all tooling currently supports changing these +# variables. Scripts like sstate-sysroot-cruft.sh and reproducible builds expect +# these values to be the defaults listed below. +STANDARD_USER_NAME ??= "user" +STANDARD_USER_GROUPS ??= "" +STANDARD_USER_SYSTEM_GROUPS ??= "video render tty audio input shutdown disk wayland" diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc index 66902616f5..8d2a92f041 100644 --- a/meta/conf/distro/include/maintainers.inc +++ b/meta/conf/distro/include/maintainers.inc @@ -814,6 +814,7 @@ RECIPE_MAINTAINER:pn-spirv-tools = "Jose Quaresma " RECIPE_MAINTAINER:pn-sqlite3 = "Unassigned " RECIPE_MAINTAINER:pn-squashfs-tools = "Robert Yang " RECIPE_MAINTAINER:pn-ssh-pregen-hostkeys = "Richard Purdie " +RECIPE_MAINTAINER:pn-standard-user-account = "Unassigned " RECIPE_MAINTAINER:pn-startup-notification = "Unassigned " RECIPE_MAINTAINER:pn-strace = "Robert Yang " RECIPE_MAINTAINER:pn-stress-ng = "Unassigned " @@ -940,7 +941,6 @@ RECIPE_MAINTAINER:pn-xserver-xf86-config = "Unassigned - + diff --git a/meta/recipes-support/user-creation/standard-user-account_0.1.bb b/meta/recipes-support/user-creation/standard-user-account_0.1.bb new file mode 100644 index 0000000000..558f1c70da --- /dev/null +++ b/meta/recipes-support/user-creation/standard-user-account_0.1.bb @@ -0,0 +1,46 @@ +SUMMARY = "Creates a standard user account" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +SRC_URI = "file://system-user.conf" + +inherit allarch useradd + +S = "${UNPACKDIR}" + +do_configure[noexec] = "1" +do_compile[noexec] = "1" + +COMMON_ARGS = "--create-home --user-group" + +python __anonymous() { + common_args = d.getVar("COMMON_ARGS") or "" + user = d.getVar("STANDARD_USER_NAME") or "" + pn = d.getVar("PN") or "" + + unique_groups = sorted(set((d.getVar("STANDARD_USER_GROUPS") or "").split())) + unique_system_groups = sorted(set((d.getVar("STANDARD_USER_SYSTEM_GROUPS") or "").split())) + + if unique_groups or unique_system_groups: + joined_groups = ','.join(unique_groups + unique_system_groups) + d.setVar(f"USERADD_PARAM:{pn}", f"{common_args} --groups {joined_groups} {user}") + + # make sure all the groups exist + groupadd_str = "" + for group in unique_groups: + groupadd_str += f" {group} ;" + for group in unique_system_groups: + groupadd_str += f" --system {group} ;" + d.setVar(f"GROUPADD_PARAM:{pn}", f"{groupadd_str}") +} + +# default case, and a requirement to satisfy the parser check +USERADD_PACKAGES = "${PN}" +USERADD_PARAM:${PN} = "${COMMON_ARGS} ${STANDARD_USER_NAME}" + +do_install () { + install -D -m 0644 ${UNPACKDIR}/system-user.conf ${D}${datadir}/dbus-1/system.d/system-user.conf + sed -i -e 's|@STANDARD_USER_NAME@|${STANDARD_USER_NAME}|g' ${D}${datadir}/dbus-1/system.d/system-user.conf +} + +FILES:${PN} = "${datadir}/dbus-1/system.d/system-user.conf" diff --git a/meta/recipes-support/user-creation/xuser-account_0.1.bb b/meta/recipes-support/user-creation/xuser-account_0.1.bb deleted file mode 100644 index 04f506e7a3..0000000000 --- a/meta/recipes-support/user-creation/xuser-account_0.1.bb +++ /dev/null @@ -1,30 +0,0 @@ -SUMMARY = "Creates an 'xuser' account used for running X11" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" - -SRC_URI = "file://system-xuser.conf" - -inherit allarch useradd - -S = "${UNPACKDIR}" - -do_configure() { - : -} - -do_compile() { - : -} - -do_install() { - install -D -m 0644 ${UNPACKDIR}/system-xuser.conf ${D}${sysconfdir}/dbus-1/system.d/system-xuser.conf -} - -FILES:${PN} = "${sysconfdir}/dbus-1/system.d/system-xuser.conf" - -USERADD_PACKAGES = "${PN}" -USERADD_PARAM:${PN} = "--create-home \ - --groups video,tty,audio,input,shutdown,disk \ - --user-group xuser" - -ALLOW_EMPTY:${PN} = "1" diff --git a/scripts/sstate-sysroot-cruft.sh b/scripts/sstate-sysroot-cruft.sh index b2002badfb..5e1ae9c535 100755 --- a/scripts/sstate-sysroot-cruft.sh +++ b/scripts/sstate-sysroot-cruft.sh @@ -127,9 +127,9 @@ WHITELIST="${WHITELIST} \ # generated by useradd.bbclass WHITELIST="${WHITELIST} \ [^/]*/home \ - [^/]*/home/xuser \ - [^/]*/home/xuser/.bashrc \ - [^/]*/home/xuser/.profile \ + [^/]*/home/user \ + [^/]*/home/user/.bashrc \ + [^/]*/home/user/.profile \ [^/]*/home/builder \ [^/]*/home/builder/.bashrc \ [^/]*/home/builder/.profile \