0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Fedora Silverblue でアップグレード後リブート前に user id 不足をチェックする

Posted at

動機

rpm-ostree を使って update や install/remove を行った後、
リブートしてみるとものがまともに動かなくてロールバックすることがそこそこある。
理由の殆どは、必要なサービス用のIDがちゃんと作成されていないこと。
なーぜーか、そういうことが結構ある。

リブート前にこれをチェックしたいと思って簡単なスクリプトを作成した。

スクリプト

ostree-check-ids
#!/bin/bash
#
OSTREE=/usr/bin/ostree
HEAD=/usr/bin/head
CUT=/usr/bin/cut
SORT=/usr/bin/sort
UNIQ=/usr/bin/uniq
DIFF=/usr/bin/diff
#
NUM=$(${OSTREE} admin status|${HEAD} -1|${CUT} -c 10-75)
#
function extf ()
    {
    ${CUT} -d : -f 1 $1 | ${SORT} | ${UNIQ} > $2
    }
#
extf /usr/lib/passwd /tmp/usr_lib_passwd.$$
extf /ostree/deploy/fedora/deploy/${NUM}/usr/lib/passwd /tmp/ost_passwd.$$
${DIFF} -bwtBu /tmp/usr_lib_passwd.$$ /tmp/ost_passwd.$$
(( RET=$? ))
if (( ${RET} != 0 )); then
    exit ${RET};
fi
#
extf /usr/lib/group /tmp/usr_lib_group.$$
extf /ostree/deploy/fedora/deploy/${NUM}/usr/lib/group /tmp/ost_group.$$
${DIFF} -bwtBu /tmp/usr_lib_group.$$ /tmp/ost_group.$$
(( RET=$? ))
if (( ${RET} != 0 )); then
    exit ${RET};
fi

実行例

# /root/bin/ostree-check-ids 
--- /tmp/usr_lib_passwd.38204	2023-04-28 03:20:37.483279326 +0900
+++ /tmp/ost_passwd.38204	2023-04-28 03:20:37.486279392 +0900
@@ -11,7 +11,6 @@
 dhcpd
 dnsmasq
 dockerroot
-dovecot
 dovenull
 etcd
 flatpak
# 

うーん、これはダメだね。
次の update 待ち。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?