From patchwork Thu Oct 24 10:10:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Mikanovich X-Patchwork-Id: 3884 Return-Path: Received: from shymkent.ilbers.de ([unix socket]) by shymkent (Cyrus 2.5.10-Debian-2.5.10-3+deb9u2) with LMTPA; Thu, 24 Oct 2024 12:10:26 +0200 X-Sieve: CMU Sieve 2.4 Received: from mail-wr1-f61.google.com (mail-wr1-f61.google.com [209.85.221.61]) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPS id 49OAAMHr017756 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 24 Oct 2024 12:10:22 +0200 Received: by mail-wr1-f61.google.com with SMTP id ffacd0b85a97d-37d3e8dccc9sf459792f8f.1 for ; Thu, 24 Oct 2024 03:10:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1729764617; cv=pass; d=google.com; s=arc-20240605; b=Cw582kL3fncT9I/O3rJPRNiPEzcc8ZPDeHoVKnly9+nR9+WUQWz2e6gua4BzAy7ozi SYJttpsBFu3HdT9eJAjcJrH1x3AC7HHtMMhXmexdbeeU7DXMCWoSkmgF+OljPMDZPzJL me3JeGo0r1vVlisNPRvPTHnmMwGB1rHxYt1ALGQHZMP6HoIpDuPl64S6tQfxyIwNl2NS tCGbvmVnsDe/79f0BCTsJL8vD3vrCcIpr8E4V2hXwHoFVSrxYiwv1LE8YbdGhgcAwa8y bDI89+0Ahv4ZLmQXoqIjnYxhcHbgAKC2U+aQlLU5QeG6FALAnfm8IiD6GwLybqz5MNiW pxIw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:mime-version:message-id:date :subject:cc:to:from:sender:dkim-signature; bh=x+kclH4MhW4NNLat0jLs+DRkVpdpZ5TpgUnfr3UizgM=; fh=HJb+5wNpIX/Syw1grLpWNqVtvK7XCkZ1ND5cFR+SPfw=; b=QxmcyGvDZcgqZjEUyHBqHgg3QXTaHFhH3iL8iyIf90PjD8ijMZuKo/e0IgsuYavgph 8mK3EYFh2528CKdeiNfAF2DNATzyeoQnFDIzS8MXS/q/t/jZgJ98KQwLbLxBvn4dZw9K dR2W0sQMl6rd97c7yWCIFfnlclIrw5a18SLqTd4FdCozaShkSjZ1DI9kpnh8IDuPSpsa qTL8rVvoyh5166kOLozKfXe3sVwfEZhHIwfcfpHj0eLsUX9MXdnEsFT0DFPXDZfGNSfV HKiXbPYSYQhUxXNL8Ch80hW+PFtja8357H/krSq+vHYgXIjfWWCAS+vy5pLJJ6vtUJtG hLIw==; darn=isar-build.org ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=amikan@ilbers.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1729764617; x=1730369417; darn=isar-build.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:message-id:date:subject:cc:to:from :sender:from:to:cc:subject:date:message-id:reply-to; bh=x+kclH4MhW4NNLat0jLs+DRkVpdpZ5TpgUnfr3UizgM=; b=B0ifSMJsTxTuTAexdzHbD8VaWLjupuO5tLDfo4zml12XIQvuSTXKKJD/wlJQOOfOAJ mDx4PVhE5DxGXeVrS+HeCKv2pBFOGCUEuKR0CI3H0TFNVi5eauUaYnJ20Qx3M232H41n 4ugm4Gm242/9LAqiEQ0vqj1pLYSxkS7WitKA6+kwghgC+eLtYsmcpBQKIWE9HARmbF8j xLp6oTL0yNFoaYuuJN/DB6YzaY2KGu/Swidf7sI2vvXXLJEdfBw/oC3gJxvX4YOpUmSo +VuDtoRmJAstnXMWcniwETPl4KkNGmNvGL16kniJzWERrWvZ2Q7Lz3+swcBZg5jo4gh8 K0Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729764617; x=1730369417; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :message-id:date:subject:cc:to:from:x-beenthere:x-gm-message-state :sender:from:to:cc:subject:date:message-id:reply-to; bh=x+kclH4MhW4NNLat0jLs+DRkVpdpZ5TpgUnfr3UizgM=; b=EIWMIEVbM2SvlwIsW86Je1ITq84w6jb08tKUwB6XZXFY16L8YSozm56FygFgmt0z6U lKGbmu3pzZww02Qsg5TtGXCxS9oowVpW9CgVNMBE1SfZoIFtCB9YFEouckzXMsXwBEJK UkPobD+iXXlaY4xP16bMKeD9UcJJxzCrDqTEiaXZY8gUMLTtiETJgl795e51R4rQQklY Jar2LNshHrdjSxgbo7lSNmKjtYGj4axB916UKFrUY32LngtFvV2ilXMxB2Mo0VVBPFdP BIRiYtI6Ea/kJC2UkvsgWg4kuZE8NAf4JQo6tPLwzDrrCtqEyCdVkm+hhgTa/U+G3FIy /0aA== Sender: isar-users@googlegroups.com X-Forwarded-Encrypted: i=2; AJvYcCWCOaANp1qQaq2rv4d9QKXp8B0IaJ5PsbG83MnTjQ+aUDwtjUanJs31GZrqmeZxhw5mKJPuBWs=@isar-build.org X-Gm-Message-State: AOJu0Yx5VuMyMs2bQ9OIiZvtV2HBucsbv2wN6yNXHHpOrF0hC5v4vyP9 YqCu0wR7AQPX/N9ADduTYs2jmEowKtx38BukkLjagDBF98BlBREC X-Google-Smtp-Source: AGHT+IEDuJQK964Wwqm0lPwGvl7AMq/RNYy9ZwGjLWd138M8/CxYF+Q+vr84ubJsul6LsPhbvnG0aQ== X-Received: by 2002:adf:fd8d:0:b0:37d:4125:5cba with SMTP id ffacd0b85a97d-37efcf2e89cmr3349357f8f.32.1729764616012; Thu, 24 Oct 2024 03:10:16 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a5d:4d0c:0:b0:37d:3ab7:5d68 with SMTP id ffacd0b85a97d-37f5990b6f4ls239766f8f.2.-pod-prod-02-eu; Thu, 24 Oct 2024 03:10:14 -0700 (PDT) X-Received: by 2002:adf:e302:0:b0:37d:47f9:be8a with SMTP id ffacd0b85a97d-37efcc62ba7mr3821886f8f.0.1729764613968; Thu, 24 Oct 2024 03:10:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729764613; cv=none; d=google.com; s=arc-20240605; b=HQNRNRmz6Q/tCWE9u4Z2ymidSnBJLA7KgbLlmJ3bEQwATRhFBo4BOOcYiMg54uIsFp MfKgRv/ajhatWSGQwBsXn9v863FoFVZRM5g9jkART01jGP0JxLpkJSQ8UQoChyM9xkag wDkCMH/nODTZln/7FrMnFK9mAt6rJtQj3QDh9nHnnCXF8nDgvVCJW6sIFQENgtevL9XG VfCfvNnVvCB0DsDPbJLxdP7/+R/qvxkSI+djCsjuVWU6Gm1vTg6NzXF1mMwge+JrS0p/ mq4+gmCMxLsUOq7p+dh6jSNDotDgA1f/pqUluQvFznX6JIVJrwG+Nb549sq3gsQgmaKD WXxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from; bh=f9pktiqyPJv9zLHJtVGioMZP3mzzn50blf7Y95ro0rc=; fh=/h9QQkzJ8EboVkWg45aWwpaUro6WMavIVd2OhN45RtE=; b=hDL5h6pZMGsbsaKXHzppyKDn+irhVDChcMi+m38VpATcYyObw2KvgQKQA9R/139PYz yuSe+kxk7gJQS6KEDoglgIdsvupefoZ5bh6oF4Zvc5fIWuGrr1kCbuFG370c3z9QQ7p7 1Ivm5qz9riy+RZ1mTojIbK7Kts6/AJzER1bskGJ3iK06rJtQ981dgpliys2UOFq8LXlD dJbIZEe3BDOLgnB8zAqPRvVjpH3oGZ6wtmwq0kL1mdEHhf8RERbpGWy9RI9abI7KRHBL DQCPkON+CuiOmnmHZeClOrWECEwxSlRF1/0PBJ9h7v2dSZ/ZqeYf61eCNDVcS5x+UWY6 LTIg==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=amikan@ilbers.de Received: from shymkent.ilbers.de (shymkent.ilbers.de. [85.214.156.166]) by gmr-mx.google.com with ESMTPS id 5b1f17b1804b1-4317d02bc69si3893355e9.0.2024.10.24.03.10.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Oct 2024 03:10:13 -0700 (PDT) Received-SPF: pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) client-ip=85.214.156.166; Received: from user-B660.promwad.corp ([159.148.83.114]) (authenticated bits=0) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPSA id 49OAAAxi017712 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 24 Oct 2024 12:10:11 +0200 From: Anton Mikanovich To: isar-users@googlegroups.com Cc: Anton Mikanovich Subject: [PATCH v2] initramfs: Avoid hanging mounts on failed update-initramfs Date: Thu, 24 Oct 2024 13:10:04 +0300 Message-Id: <20241024101004.214465-1-amikan@ilbers.de> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-4.6 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2, RCVD_IN_RP_CERTIFIED,RCVD_IN_RP_RNBL,RCVD_IN_RP_SAFE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shymkent.ilbers.de X-Original-Sender: amikan@ilbers.de X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=amikan@ilbers.de Precedence: list Mailing-list: list isar-users@googlegroups.com; contact isar-users+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: isar-users@googlegroups.com X-Google-Group-Id: 914930254986 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= If update-initramfs fails during do_generate_initramfs task execution there will be mounts left behind: | E: /usr/share/initramfs-tools/hooks/isar-example failed with return 1. | update-initramfs: failed for /boot/initrd.img-6.1.0-26-amd64 with 1. | WARNING: exit code 1 from a shell command. ERROR: Task (mc:qemuamd64-bookworm:isar/meta-isar/recipes-initramfs/images/isar-initramfs.bb:do_generate_initramfs) failed with exit code '1' NOTE: Tasks Summary: Attempted 38 tasks of which 27 didn't need to be rerun and 1 failed. WARNING: build/tmp/work/debian-bookworm-amd64/isar-initramfs-qemuamd64/1.0-r0/rootfs/isar-apt left mounted, unmounting... WARNING: build/tmp/work/debian-bookworm-amd64/isar-initramfs-qemuamd64/1.0-r0/rootfs/sys left mounted, unmounting... WARNING: build/tmp/work/debian-bookworm-amd64/isar-initramfs-qemuamd64/1.0-r0/rootfs/proc left mounted, unmounting... WARNING: build/tmp/work/debian-bookworm-amd64/isar-initramfs-qemuamd64/1.0-r0/rootfs/dev/pts left mounted, unmounting... WARNING: build/tmp/work/debian-bookworm-amd64/isar-initramfs-qemuamd64/1.0-r0/rootfs/dev/shm left mounted, unmounting... WARNING: build/tmp/work/debian-bookworm-amd64/isar-initramfs-qemuamd64/1.0-r0/rootfs/dev left mounted, unmounting... Protect mounting with a trap for cleanup in case of failure. Signed-off-by: Anton Mikanovich --- meta/classes/initramfs.bbclass | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/meta/classes/initramfs.bbclass b/meta/classes/initramfs.bbclass index 42013356..0197a60b 100644 --- a/meta/classes/initramfs.bbclass +++ b/meta/classes/initramfs.bbclass @@ -35,6 +35,10 @@ do_generate_initramfs[sstate-inputdirs] = "${DEPLOYDIR}" do_generate_initramfs[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}" do_generate_initramfs() { rootfs_do_mounts + + trap 'exit 1' INT HUP QUIT TERM ALRM USR1 + trap 'rootfs_do_umounts' EXIT + rootfs_do_qemu sudo -E chroot "${INITRAMFS_ROOTFS}" sh -c '\