From patchwork Sun Oct 4 22:41:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Norbert Lange X-Patchwork-Id: 1376554 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=RGdyiwBm; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4C4JdG5GfSz9sSC for ; Mon, 5 Oct 2020 09:42:08 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 3282C84921; Sun, 4 Oct 2020 22:42:05 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dUpaC4hduyli; Sun, 4 Oct 2020 22:42:03 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id E7FA48453F; Sun, 4 Oct 2020 22:42:02 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 0BA891BF37C for ; Sun, 4 Oct 2020 22:42:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 082D985381 for ; Sun, 4 Oct 2020 22:42:01 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Hb5tRMxRhjZg for ; Sun, 4 Oct 2020 22:42:00 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by whitealder.osuosl.org (Postfix) with ESMTPS id 1768B8527F for ; Sun, 4 Oct 2020 22:42:00 +0000 (UTC) Received: by mail-wm1-f65.google.com with SMTP id j136so6927426wmj.2 for ; Sun, 04 Oct 2020 15:42:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=lBoQCuwgP5MOOEKlL0UfHDOcKaVb4+ffEeRdFz4me8w=; b=RGdyiwBmQo3VDczG3xYnrKU0IhSdjgD/ykBIuRzOMlvK5d+08x761rDBiotdIHNQ/R Fe4GKJfFaH2vZk2lZ93eUYi34344sXS7toUMvC8sFsJTCwIKz+Vh2K1v8UrnIC1V+Jgf B6n2epMiizA+dDoxGBnnA38fLFJCb2y/Ko5mBiWtyGW4IYg1VwGtGu75nk6MMVDrdiMh hmd//U1rdGjjDoKRrPCRcVg2kPAtT5MJOZzfPvMVUbz4sO+FZQ4pWU0HqMH4iJrmmNHe Bv0p12sc/YHmDlysZAZsZ5N0nU9XrkyI66H2C1ytAmmf+x2choGm+5JbR2k5d9DDEO3g SGPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=lBoQCuwgP5MOOEKlL0UfHDOcKaVb4+ffEeRdFz4me8w=; b=FkGjTX9jZ2HaCnELNF35FsRSwRjwInwtLys6Y09sZOEz73y4H1woEj4Ca1MJnh1eCt s7zPHGJoGKlbF9jrp/hbq6n5uvldrQnx7dsbSnb/XQ9dyHawNFrSjuLBq3McLiuQvLjw 6F/oSQYasQk73+mSLzPqhMp2v9S9DMCkolLms1b++8XUq/LcWBwOnVZ2tjT5pJH/wt2m F0HuOPVkeQzJOGLKd0kiXSQpPtsodZNBO3D5oV1O0LTOY3WcNoPx4Jcu4tDhRcXC+gYe Gqg0ByjCBWArp7B6R462IWwLztuEtlOQqNIrT9NJBUenjrR5TyiA22NBh0xyPLnj/jqO kIgQ== X-Gm-Message-State: AOAM5327Mc8W6ZSTC/fuMZGMNPBPD9C6Jl6HwmooA6E0ptcMDnphSFZ5 P4K+/u0rhl7BpMWbm4nO9qZYkBil8JM= X-Google-Smtp-Source: ABdhPJxywJazf0ovPc1BRsCkF4HaeN0L2PC5XYMSWjqYBo7+uGaFNUj/hQcPJ3NZI3PFDsqbbFKqlA== X-Received: by 2002:a1c:c28a:: with SMTP id s132mr13451093wmf.67.1601851318122; Sun, 04 Oct 2020 15:41:58 -0700 (PDT) Received: from localhost.localdomain (84-114-45-16.cable.dynamic.surfer.at. [84.114.45.16]) by smtp.gmail.com with ESMTPSA id a7sm9309422wmh.6.2020.10.04.15.41.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Oct 2020 15:41:57 -0700 (PDT) From: Norbert Lange To: buildroot@buildroot.org Date: Mon, 5 Oct 2020 00:41:36 +0200 Message-Id: <20201004224137.193808-1-nolange79@gmail.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Subject: [Buildroot] [PATCH] skeleton + init: prepare /run/lock and adjust compat symlinks X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: joseph.kogut@gmail.com, Norbert Lange , =?utf-8?b?TWljaGHFgiDFgXlzemN6ZWs=?= , Adam Duskett Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Linux distros changed /var/run and /var/lock to reside on an tmpfs in /run a long time ago, and buildroot seems to agree by providing this tmpfs on all supported init systems. Packages on the other hand are currently free to either use /var/run or /run, and similarly using /var/lock should be identical to the replacement /run/lock. This series aims to ensure that *if* /var/lock is needed, then it will be a symlink to /run/lock. Allowing packages to continue working and allowing them to migrate to using /run/lock. If all relevant packages are fixed, the compatibility symlinks in /var can be dropped. Status before this patch: * Systemd /run will be mounted by PID1, /var/run will be recreated by /usr/lib/tmpfiles.d/var.conf. Creating /run/lock/subsys and the compatibility symlink is handled in /usr/lib/tmpfiles.d/legacy.conf. But this is *currently not installed* by Buildroot, see [1]. * OpenRC Seems to check for existence of a /run directory and does all necessary setup. * SysV /var/lock is currently a symlink to /tmp. * Busybox Same as sysv (Buildroot uses the sysv skeleton) Note that we create /run/lock/subsys, so sysv scrips could expect this directory to exist. Apart from simplifying scripts, creating the dir early as root adds some security. Signed-off-by: Norbert Lange --- package/busybox/inittab | 1 + package/skeleton-init-openrc/skeleton/var/lock | 2 +- package/skeleton-init-sysv/skeleton/var/lock | 2 +- package/sysvinit/inittab | 13 +++++++------ 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/package/busybox/inittab b/package/busybox/inittab index ff1725c775..f2b4df801b 100644 --- a/package/busybox/inittab +++ b/package/busybox/inittab @@ -18,6 +18,7 @@ ::sysinit:/bin/mount -o remount,rw / ::sysinit:/bin/mkdir -p /dev/pts /dev/shm ::sysinit:/bin/mount -a +::sysinit:/bin/mkdir -p /run/lock/subsys ::sysinit:/sbin/swapon -a null::sysinit:/bin/ln -sf /proc/self/fd /dev/fd null::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin diff --git a/package/skeleton-init-openrc/skeleton/var/lock b/package/skeleton-init-openrc/skeleton/var/lock index 1431b0e432..386c09e727 120000 --- a/package/skeleton-init-openrc/skeleton/var/lock +++ b/package/skeleton-init-openrc/skeleton/var/lock @@ -1 +1 @@ -../tmp \ No newline at end of file +../run/lock \ No newline at end of file diff --git a/package/skeleton-init-sysv/skeleton/var/lock b/package/skeleton-init-sysv/skeleton/var/lock index 1431b0e432..386c09e727 120000 --- a/package/skeleton-init-sysv/skeleton/var/lock +++ b/package/skeleton-init-sysv/skeleton/var/lock @@ -1 +1 @@ -../tmp \ No newline at end of file +../run/lock \ No newline at end of file diff --git a/package/sysvinit/inittab b/package/sysvinit/inittab index a31471031f..afc28e6c03 100644 --- a/package/sysvinit/inittab +++ b/package/sysvinit/inittab @@ -8,12 +8,13 @@ si0::sysinit:/bin/mount -t proc proc /proc si1::sysinit:/bin/mount -o remount,rw / si2::sysinit:/bin/mkdir -p /dev/pts /dev/shm si3::sysinit:/bin/mount -a -si4::sysinit:/sbin/swapon -a -si5::sysinit:/bin/ln -sf /proc/self/fd /dev/fd 2>/dev/null -si6::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin 2>/dev/null -si7::sysinit:/bin/ln -sf /proc/self/fd/1 /dev/stdout 2>/dev/null -si8::sysinit:/bin/ln -sf /proc/self/fd/2 /dev/stderr 2>/dev/null -si9::sysinit:/bin/hostname -F /etc/hostname +si4::sysinit:/bin/mkdir -p /run/lock/subsys +si5::sysinit:/sbin/swapon -a +si6::sysinit:/bin/ln -sf /proc/self/fd /dev/fd 2>/dev/null +si7::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin 2>/dev/null +si8::sysinit:/bin/ln -sf /proc/self/fd/1 /dev/stdout 2>/dev/null +si9::sysinit:/bin/ln -sf /proc/self/fd/2 /dev/stderr 2>/dev/null +si10::sysinit:/bin/hostname -F /etc/hostname rcS:12345:wait:/etc/init.d/rcS # S0:1:respawn:/sbin/getty -L ttyS0 115200 vt100 # GENERIC_SERIAL