Make-initrd development discussion
 help / color / mirror / Atom feed
From: Alexey Gladkov <gladkov.alexey@gmail.com>
To: make-initrd@lists.altlinux.org
Subject: [make-initrd] [PATCH v1 00/10] New shutdown feature
Date: Mon,  9 Nov 2026 14:06:57 +0100
Message-ID: <cover.1794227900.git.gladkov.alexey@gmail.com> (raw)
In-Reply-To: <cover.1794063613.git.gladkov.alexey@gmail.com>

Привет!

Вот теперь я более менее уверен, что код работает. 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



  parent reply	other threads:[~2026-11-09 13:06 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-07 15:17 [make-initrd] [RFC PATCH 0/7] " Alexey Gladkov
2026-11-07 15:17 ` [make-initrd] [RFC PATCH 1/7] shutdown: Add exitrd " Alexey Gladkov
2026-11-07 15:17 ` [make-initrd] [RFC PATCH 2/7] shutdown: Add make-initrd-shutdown-restore utility and systemd service Alexey Gladkov
2026-11-07 15:17 ` [make-initrd] [RFC PATCH 3/7] shutdown: Add basic unit test suite Alexey Gladkov
2026-11-07 15:17 ` [make-initrd] [RFC PATCH 4/7] devmapper: shutdown: Teardown device-mapper targets on exit Alexey Gladkov
2026-11-07 15:17 ` [make-initrd] [RFC PATCH 5/7] mdadm: shutdown: Stop MD arrays " Alexey Gladkov
2026-11-07 15:18 ` [make-initrd] [RFC PATCH 6/7] btrfs: shutdown: Sync filesystem before umount " Alexey Gladkov
2026-11-07 15:18 ` [make-initrd] [RFC PATCH 7/7] zfs: shutdown: Unmount filesystems and export zpools " Alexey Gladkov
2026-11-08  5:51 ` [make-initrd] [RFC PATCH 0/7] New shutdown feature Anton Midyukov
2026-11-08 16:26   ` Alexey Gladkov
2026-11-09 13:06 ` Alexey Gladkov [this message]
2026-11-09 13:06   ` [make-initrd] [PATCH v1 01/10] utils: Add PE header parsing to locate .initrd section Alexey Gladkov
2026-11-09 13:06   ` [make-initrd] [PATCH v1 02/10] shutdown: Add exitrd shutdown feature Alexey Gladkov
2026-11-09 13:07   ` [make-initrd] [PATCH v1 03/10] shutdown: Add make-initrd-shutdown-restore, initrd-find, and systemd service Alexey Gladkov
2026-11-09 17:10     ` [make-initrd] [PATCH v2 " Alexey Gladkov
2026-11-09 18:45       ` Anton Midyukov
2026-11-09 18:52         ` Leonid Krivoshein
2026-11-10  9:31         ` Alexey Gladkov
2026-11-09 13:07   ` [make-initrd] [PATCH v1 04/10] shutdown: Add basic unit test suite Alexey Gladkov
2026-11-09 13:07   ` [make-initrd] [PATCH v1 05/10] devmapper: shutdown: Teardown device-mapper targets on exit Alexey Gladkov
2026-11-09 13:07   ` [make-initrd] [PATCH v1 06/10] mdadm: shutdown: Stop MD arrays " Alexey Gladkov
2026-11-09 13:07   ` [make-initrd] [PATCH v1 07/10] btrfs: shutdown: Sync filesystem before umount " Alexey Gladkov
2026-11-09 13:07   ` [make-initrd] [PATCH v1 08/10] zfs: shutdown: Unmount filesystems and export zpools " Alexey Gladkov
2026-11-09 13:07   ` [make-initrd] [PATCH v1 09/10] testing: Add end-to-end test for shutdown feature Alexey Gladkov
2026-11-09 13:07   ` [make-initrd] [PATCH v1 10/10] docs: Add manpages and bash-completion for initrd-find and make-initrd-shutdown-restore Alexey Gladkov
2026-11-09 15:23   ` [make-initrd] [PATCH v1 00/10] New shutdown feature Антон Мидюков
2026-11-09 15:25   ` Anton Midyukov
2026-11-09 15:47     ` Alexey Gladkov
2026-11-09 15:57       ` Anton Midyukov
2026-11-09 16:14         ` Alexey Gladkov
2026-11-09 16:16           ` Anton Midyukov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1794227900.git.gladkov.alexey@gmail.com \
    --to=gladkov.alexey@gmail.com \
    --cc=make-initrd@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Make-initrd development discussion

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/make-initrd/0 make-initrd/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 make-initrd make-initrd/ http://lore.altlinux.org/make-initrd \
		make-initrd@lists.altlinux.org make-initrd@lists.altlinux.ru make-initrd@lists.altlinux.com
	public-inbox-index make-initrd

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.make-initrd


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git