From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa.local.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794229649; x=1794834449; darn=lists.altlinux.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=xDqlLOAMP0tNyfy3iGLgscbeobEuDol04RlAkk4iZ8A=; b=JKsursX7F36avWYQMuawhl8pdzldwL5tu5Cg4EgThq/+W3HoYViuZ7+y9oda4Jl6qd gCLbtiiaHq5LCgszW1Ovt2q/QIUqP0kcBgSf2IIpAnf8P6pptJzmosen90wsmQaV61LS 9Of8A7iiZ7stXMtMmBAN4asx+lBD/eLVRKQldlzkP8pBG0jsxFZQ/zQ57E4Xk+ZY3J63 qeHDe8sODq5yVMCLGZiz/LAqa1XuiOCy1ubQZMHfWikloU5/D4fGqFE6xvPtKaD3XuCG tsn5UofKGpf5jJhFQmlx3q4sSbOa/Ow/shaVhiFck49H7sqxCuxMAZgkHGUWSC/HM3Rs h58w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794229649; x=1794834449; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=xDqlLOAMP0tNyfy3iGLgscbeobEuDol04RlAkk4iZ8A=; b=1HTsOtGt21rmVedZCIR3Al5mwaCJYRseXCgMugijX90EidfVZ2WY/gLCUmJ/Iu6N7R XSdSFlDds5qm8e+4l6aJORlxa3vyZq5TjQww7pJxCb0ejMbezkMdLVkY5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SMTP id 5b1f17b1804b1-4b943f76e67mr83824725e9.0.1794229648972; Mon, 09 Nov 2026 05:07:28 -0800 (PST) From: Alexey Gladkov To: make-initrd@lists.altlinux.org Date: Mon, 9 Nov 2026 14:06:57 +0100 Message-ID: X-Mailer: git-send-email 2.56.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [make-initrd] [PATCH v1 00/10] New shutdown feature X-BeenThere: make-initrd@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: make-initrd@lists.altlinux.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2026 13:07:33 -0000 Archived-At: List-Archive: Привет! Вот теперь я более менее уверен, что код работает. End-to-end тест проходит на всех дистрибутивах. Патчсет добавляет фичу shutdown, которая позволяет размонтировать систему перед перезагрузкой. Реализация механизма предложена разработчиками systemd [1]. Такое же поведение можно реализовать и в других реализациях init. В фиче есть guess, который проверяет предыдущий initrd и если он содержит shutdown, то в новый образ фича будет добавлена. Как сайд эффект были добавлены несколько улучшений. 1. initrd-find пытается искать initrd (и это часто получается), который был использован для загрузки. 2. Во все утилиты (initrd-ls, initrd-extract) добавлена поддержка нативная UKI. Это позволяет просматривать и извлекать initrd даже из UKI без objcopy. Я не хочу допихивать дополнительные хуки в тот же бранч [2]. Если эта фича работает в целом, я её смерджу в master и уже далее буду дорабатывать хуки для других фичей, что-то ещё. [1] https://systemd.io/INITRD_INTERFACE/ [2] https://github.com/osboot/make-initrd/tree/features-shutdown-v1 Alexey Gladkov (10): utils: Add PE header parsing to locate .initrd section shutdown: Add exitrd shutdown feature shutdown: Add make-initrd-shutdown-restore, initrd-find, and systemd service shutdown: Add basic unit test suite devmapper: shutdown: Teardown device-mapper targets on exit mdadm: shutdown: Stop MD arrays on exit btrfs: shutdown: Sync filesystem before umount on exit zfs: shutdown: Unmount filesystems and export zpools on exit testing: Add end-to-end test for shutdown feature docs: Add manpages and bash-completion for initrd-find and make-initrd-shutdown-restore .github/workflows/ci.yml | 2 +- .github/workflows/testcases.yml | 1 + Documentation/manpages/initrd-find.1.md | 94 ++++ .../make-initrd-shutdown-restore.1.md | 72 ++++ Makefile.in | 6 + contrib/bash-completion/initrd-find | 38 ++ .../lib/initrd/shutdown/umount.d/50-btrfs.sh | 13 + .../initrd/shutdown/post-umount.d/50-dm.sh | 21 + .../initrd/shutdown/post-umount.d/60-md.sh | 34 ++ features/shutdown/README.md | 81 ++++ features/shutdown/config.mk | 5 + features/shutdown/guess/common | 32 ++ features/shutdown/rules.mk | 7 + .../initrd/shutdown/post-umount.d/.gitignore | 1 + .../initrd/shutdown/post-umount.d/10-loop.sh | 21 + .../initrd/shutdown/pre-umount.d/.gitignore | 1 + .../lib/initrd/shutdown/shutdown.d/.gitignore | 2 + .../lib/initrd/shutdown/umount.d/.gitignore | 1 + features/shutdown/shutdown/shutdown | 196 +++++++++ .../system/make-initrd-shutdown.service | 20 + .../tests/ts0001-shutdown-basic/expect | 17 + .../shutdown/tests/ts0001-shutdown-basic/run | 145 +++++++ .../ts0002-guess-common-with-shutdown/expect | 3 + .../ts0002-guess-common-with-shutdown/run | 32 ++ .../expect | 1 + .../ts0003-guess-common-without-shutdown/run | 27 ++ .../ts0004-guess-common-no-initrd/expect | 1 + .../tests/ts0004-guess-common-no-initrd/run | 16 + .../lib/initrd/shutdown/shutdown.d/20-zfs.sh | 9 + .../lib/initrd/shutdown/umount.d/50-zfs.sh | 20 + testing/test-root-shutdown.cfg | 147 +++++++ utils/initrd-extract/tests/ts0005/expect | 3 + utils/initrd-extract/tests/ts0005/run | 62 +++ utils/initrd-find/Makefile.mk | 6 + utils/initrd-find/initrd-find.in | 401 ++++++++++++++++++ .../tests/ts0001-initrd-find-basic/expect | 10 + .../tests/ts0001-initrd-find-basic/run | 108 +++++ utils/initrd-ls/tests/ts0008/expect | 2 +- utils/initrd-ls/tests/ts0017/expect | 2 +- utils/initrd-ls/tests/ts0025/expect | 2 +- utils/initrd-ls/tests/ts0033/expect | 2 +- utils/initrd-ls/tests/ts0034/expect | 2 +- utils/initrd-ls/tests/ts0035/expect | 2 +- utils/initrd-ls/tests/ts0036/expect | 2 +- utils/initrd-ls/tests/ts0037/expect | 2 +- utils/initrd-ls/tests/ts0038/expect | 2 +- utils/initrd-ls/tests/ts0039/expect | 2 +- utils/initrd-ls/tests/ts0041/expect | 2 +- utils/initrd-ls/tests/ts0045/expect | 7 + utils/initrd-ls/tests/ts0045/run | 83 ++++ utils/initrd-parse.c | 81 +++- .../make-initrd-shutdown-restore/Makefile.mk | 6 + .../make-initrd-shutdown-restore.in | 147 +++++++ 53 files changed, 1980 insertions(+), 22 deletions(-) create mode 100644 Documentation/manpages/initrd-find.1.md create mode 100644 Documentation/manpages/make-initrd-shutdown-restore.1.md create mode 100644 contrib/bash-completion/initrd-find create mode 100755 features/btrfs/shutdown/lib/initrd/shutdown/umount.d/50-btrfs.sh create mode 100755 features/devmapper/shutdown/lib/initrd/shutdown/post-umount.d/50-dm.sh create mode 100755 features/mdadm/shutdown/lib/initrd/shutdown/post-umount.d/60-md.sh create mode 100644 features/shutdown/README.md create mode 100644 features/shutdown/config.mk create mode 100755 features/shutdown/guess/common create mode 100644 features/shutdown/rules.mk create mode 100644 features/shutdown/shutdown/lib/initrd/shutdown/post-umount.d/.gitignore create mode 100755 features/shutdown/shutdown/lib/initrd/shutdown/post-umount.d/10-loop.sh create mode 100644 features/shutdown/shutdown/lib/initrd/shutdown/pre-umount.d/.gitignore create mode 100644 features/shutdown/shutdown/lib/initrd/shutdown/shutdown.d/.gitignore create mode 100644 features/shutdown/shutdown/lib/initrd/shutdown/umount.d/.gitignore create mode 100755 features/shutdown/shutdown/shutdown create mode 100644 features/shutdown/system/make-initrd-shutdown.service create mode 100644 features/shutdown/tests/ts0001-shutdown-basic/expect create mode 100755 features/shutdown/tests/ts0001-shutdown-basic/run create mode 100644 features/shutdown/tests/ts0002-guess-common-with-shutdown/expect create mode 100755 features/shutdown/tests/ts0002-guess-common-with-shutdown/run create mode 100644 features/shutdown/tests/ts0003-guess-common-without-shutdown/expect create mode 100755 features/shutdown/tests/ts0003-guess-common-without-shutdown/run create mode 100644 features/shutdown/tests/ts0004-guess-common-no-initrd/expect create mode 100755 features/shutdown/tests/ts0004-guess-common-no-initrd/run create mode 100755 features/zfs/shutdown/lib/initrd/shutdown/shutdown.d/20-zfs.sh create mode 100755 features/zfs/shutdown/lib/initrd/shutdown/umount.d/50-zfs.sh create mode 100644 testing/test-root-shutdown.cfg create mode 100644 utils/initrd-extract/tests/ts0005/expect create mode 100755 utils/initrd-extract/tests/ts0005/run create mode 100644 utils/initrd-find/Makefile.mk create mode 100755 utils/initrd-find/initrd-find.in create mode 100644 utils/initrd-find/tests/ts0001-initrd-find-basic/expect create mode 100755 utils/initrd-find/tests/ts0001-initrd-find-basic/run create mode 100644 utils/initrd-ls/tests/ts0045/expect create mode 100755 utils/initrd-ls/tests/ts0045/run create mode 100644 utils/make-initrd-shutdown-restore/Makefile.mk create mode 100755 utils/make-initrd-shutdown-restore/make-initrd-shutdown-restore.in -- 2.56.0