You are not logged in.

#1 2024-10-14 12:15:50

delicious_taco
Member
Registered: 2024-10-14
Posts: 7

[Solved] Pacman tells me "Current root is not booted"

Ever since I switched from GRUB to systemd-boot, I've been getting those weird pacman messages related to root not being booted:

:: Running post-transaction hooks...
( 1/10) Reloading system manager configuration...
  Skipped: Current root is not booted.
( 2/10) Reloading user manager configuration...
  Skipped: Current root is not booted.
( 3/10) Updating udev hardware database...
( 4/10) Reloading device manager configuration...
( 5/10) Arming ConditionNeedsUpdate...
( 6/10) Reloading system bus configuration...
  Skipped: Current root is not booted.

But I am booting as normal into the system, not chrooting into it. I have also confirmed that I am booting with systemd-boot.

Just for testing, I deleted everything from /boot, repopulated the kernel and initramfs files in /boot with `sudo pacman -Syu linux` and re-installed systemd-boot with `sudo bootctl install`. No change it seems.

Some info about my setup:

~ $ lsblk -f 
NAME  FSTYPE FSVER LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
sda 
├─sda1 
│     vfat   FAT32       2052-EE63                             361.9M    29% /boot 
└─sda2 
      ext4   1.0         465d723a-95cc-43d8-9b4e-35189306417c  841.9G     3% / 
sr0

My `arch.conf`:

~ $ cat /boot/loader/entries/arch.conf
title    Arch Linux
linux    /vmlinuz-linux
initrd   /initramfs-linux.img
options  root=/dev/sda2 rw quiet loglevel=3 udev.log_level=3 nowatchdog mitigations=off modprobe.blacklist=iTCO_wdt transparent_hugepage=madvise

Fstab:

~ $ cat /etc/fstab
/dev/sda2       /               ext4            rw,relatime,commit=60 0 1

/dev/sda1       /boot           vfat            rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro   0 2

Everything seems to work fine except for getting those pacman messages. Does anybody know what causes this?

Last edited by delicious_taco (2024-10-15 13:57:49)

Offline

#2 2024-10-14 14:24:01

seth
Member
Registered: 2012-09-03
Posts: 57,492

Re: [Solved] Pacman tells me "Current root is not booted"

https://www.reddit.com/r/archlinux/comm … ot_booted/

https://gitlab.archlinux.org/archlinux/ … =heads#L13

systemd-notify --booted || echo foo

This used to be

systemd_live() {
  is_chrooted
  if [ ! -d /run/systemd/system ]; then
    echo >&2 "  Skipped: Current root is not booted."
    exit 0
  fi
}
stat /run/systemd/system

is ok?

Online

#3 2024-10-14 14:40:45

delicious_taco
Member
Registered: 2024-10-14
Posts: 7

Re: [Solved] Pacman tells me "Current root is not booted"

seth wrote:
stat /run/systemd/system

is ok?

Running this:

systemd-notify --booted || echo foo

gives no output.

The directory `/run/systemd/system` exists, but is empty:

~ $ stat /run/systemd/system 
  File: /run/systemd/system 
  Size: 40              Blocks: 0          IO Block: 4096   directory 
Device: 0,24    Inode: 577         Links: 2 
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root) 
Access: 2024-10-14 14:59:17.080384935 +0300 
Modify: 2024-10-14 14:59:15.587051609 +0300 
Change: 2024-10-14 14:59:15.587051609 +0300 
 Birth: 2024-10-14 14:59:15.587051609 +0300 

Offline

#4 2024-10-14 14:50:50

seth
Member
Registered: 2012-09-03
Posts: 57,492

Re: [Solved] Pacman tells me "Current root is not booted"

gives no output

Means systemd should™ consider the current root booted, no idea why that would not work from the hook

pacman -Qikk systemd

Do you get this on all updates or only when updating systemd or the kernel?

Online

#5 2024-10-14 15:20:36

delicious_taco
Member
Registered: 2024-10-14
Posts: 7

Re: [Solved] Pacman tells me "Current root is not booted"

seth wrote:
pacman -Qikk systemd
~ $ pacman -Qikk systemd 
Name            : systemd 
Version         : 256.7-1 
Description     : system and service manager 
Architecture    : x86_64 
URL             : https://www.github.com/systemd/systemd 

[...]

Build Date      : Tue 08 Oct 2024 06:47:49 PM EEST 
Install Date    : Sun 13 Oct 2024 12:11:10 PM EEST 
Install Reason  : Installed as a dependency for another package 
Install Script  : Yes 
Validated By    : Signature 
backup file: systemd: /etc/systemd/journald.conf (Modification time mismatch) 
backup file: systemd: /etc/systemd/journald.conf (Size mismatch) 
backup file: systemd: /etc/systemd/journald.conf (SHA256 checksum mismatch) 
warning: systemd: /var/log/journal (GID mismatch) 
systemd: 1547 total files, 1 altered file
seth wrote:

Do you get this on all updates or only when updating systemd or the kernel?

I'm not quite sure what the pattern is, but it happens on many packages I tested. For example, on installing emacs:

:: Running post-transaction hooks...
(1/5) Reloading user manager configuration...
  Skipped: Current root is not booted.

Another example is okular:

:: Running post-transaction hooks...
( 1/11) Reloading system manager configuration...
  Skipped: Current root is not booted.
( 2/11) Updating udev hardware database...
( 3/11) Creating temporary files...
( 4/11) Reloading device manager configuration...
( 5/11) Arming ConditionNeedsUpdate...
( 6/11) Updating the MIME type database...
( 7/11) Reloading system bus configuration...
  Skipped: Current root is not booted.

Offline

#6 2024-10-14 15:28:23

seth
Member
Registered: 2012-09-03
Posts: 57,492

Re: [Solved] Pacman tells me "Current root is not booted"

Edit /usr/share/libalpm/scripts/systemd-hook and add

strace -tt -f -o /tmp/wtf_$$.strace systemd-notify --booted

Install vim tongue and check the generated straces, it seems to be only a convoluted way to check for /run/systemd/system - maybe the strace reveals what's wrong.

Online

#7 2024-10-14 15:47:46

ua4000
Member
Registered: 2015-10-14
Posts: 479

Re: [Solved] Pacman tells me "Current root is not booted"

A hunch,
please post the full output, including your complete used command line from an example with this strange message.
Please include everything, including your terminal prompt.

Offline

#8 2024-10-14 15:49:36

delicious_taco
Member
Registered: 2024-10-14
Posts: 7

Re: [Solved] Pacman tells me "Current root is not booted"

seth wrote:

Edit /usr/share/libalpm/scripts/systemd-hook and add

strace -tt -f -o /tmp/wtf_$$.strace systemd-notify --booted

Install vim tongue and check the generated straces, it seems to be only a convoluted way to check for /run/systemd/system - maybe the strace reveals what's wrong.

I did this, then installed and uninstalled some stuff. Every generated log has only one mention of /run/systemd/system, which looks like this:

25005 18:41:26.087534 faccessat2(AT_FDCWD, "/run/systemd/system/", F_OK, AT_SYMLINK_NOFOLLOW) = 0
ua4000 wrote:

A hunch,
please post the full output, including your complete used command line from an example with this strange message.
Please include everything, including your terminal prompt.

Here it is:

~ $ pacman -S emacs 
resolving dependencies... 
looking for conflicting packages... 
Packages (5) libotf-0.9.16-5  libxaw-1.0.16-1  m17n-db-1.8.5-1  m17n-lib-1.8.4-3  emacs-29.4-3 
Total Download Size:    46.50 MiB 
Total Installed Size:  130.46 MiB 
:: Proceed with installation? [Y/n] 
:: Retrieving packages... 
 libotf-0.9.16-5-x86_64                                                     84.4 KiB   294 KiB/s 00:00 [------------------------------------------------------------] 100%
 m17n-lib-1.8.4-3-x86_64                                                   322.0 KiB   623 KiB/s 00:01 [------------------------------------------------------------] 100%
 libxaw-1.0.16-1-x86_64                                                    354.5 KiB   636 KiB/s 00:01 [------------------------------------------------------------] 100%
 m17n-db-1.8.5-1-any                                                      1640.1 KiB  1206 KiB/s 00:01 [------------------------------------------------------------] 100%
 emacs-29.4-3-x86_64                                                        44.2 MiB  3.89 MiB/s 00:11 [------------------------------------------------------------] 100%
 Total (5/5)                                                                46.5 MiB  4.08 MiB/s 00:11 [------------------------------------------------------------] 100%
(5/5) checking keys in keyring                                                                         [------------------------------------------------------------] 100%
(5/5) checking package integrity                                                                       [------------------------------------------------------------] 100%
(5/5) loading package files                                                                            [------------------------------------------------------------] 100%
(5/5) checking for file conflicts                                                                      [------------------------------------------------------------] 100%
(5/5) checking available disk space                                                                    [------------------------------------------------------------] 100%
:: Processing package changes... 
(1/5) installing libxaw                                                                                [------------------------------------------------------------] 100%
(2/5) installing libotf                                                                                [------------------------------------------------------------] 100%
(3/5) installing m17n-db                                                                               [------------------------------------------------------------] 100%
(4/5) installing m17n-lib                                                                              [------------------------------------------------------------] 100%
Optional dependencies for m17n-lib 
    anthy: to use the anthy input method 
    ispell: to use the ispell input method 
(5/5) installing emacs                                                                                 [------------------------------------------------------------] 100%
:: Running post-transaction hooks... 
(1/5) Reloading user manager configuration... 
  Skipped: Current root is not booted. 
(2/5) Arming ConditionNeedsUpdate... 
(3/5) Updating icon theme caches... 
(4/5) Updating the info directory file... 
(5/5) Updating the desktop file MIME type cache... 

Last edited by delicious_taco (2024-10-14 15:52:41)

Offline

#9 2024-10-14 15:52:36

seth
Member
Registered: 2012-09-03
Posts: 57,492

Re: [Solved] Pacman tells me "Current root is not booted"

Yeah, but the overall strace (notably why it exits non-0) would be more interesting.

Online

#10 2024-10-14 15:58:41

ua4000
Member
Registered: 2015-10-14
Posts: 479

Re: [Solved] Pacman tells me "Current root is not booted"

delicious_taco wrote:

~ $ pacman -S emacs

You are root in this terminal ? No sudo/su/doas/run0/pkexc ? And not inside arch-chroot, or container as well ?

Offline

#11 2024-10-14 16:06:22

delicious_taco
Member
Registered: 2024-10-14
Posts: 7

Re: [Solved] Pacman tells me "Current root is not booted"

seth wrote:

Yeah, but the overall strace (notably why it exits non-0) would be more interesting.

Here is the entire strace: https://pastebin.com/raw/3G71e7Lr

ua4000 wrote:

You are root in this terminal ? No sudo/su/doas/run0/pkexc ? And not inside arch-chroot, or container as well ?

On my system pacman is an alias for "sudo pacman". Also, the system is booted normally; no arch-chroot or container...

Offline

#12 2024-10-14 20:17:35

seth
Member
Registered: 2012-09-03
Posts: 57,492

Re: [Solved] Pacman tells me "Current root is not booted"

Ok, but

27340 18:58:39.992135 +++ exited with 0 +++

that didn't fail at all - the hook should™ not complain

stat /bin/sh # is this /bin/bash?
…
systemd_live() {
  skip_chrooted
set -x # add this line
  if ! systemd-notify --booted &>/dev/null; then
echo >&2 $? # and this line
    echo >&2 "  Skipped: Current root is not booted."
    exit 0
set +x # and this line
  fi
set +x # and also this line
}

Online

#13 2024-10-15 11:50:43

delicious_taco
Member
Registered: 2024-10-14
Posts: 7

Re: [Solved] Pacman tells me "Current root is not booted"

seth wrote:
stat /bin/sh # is this /bin/bash?

My /bin/sh symlink is dash, not bash.

seth wrote:
systemd_live() {
  skip_chrooted
set -x # add this line
  if ! systemd-notify --booted &>/dev/null; then
echo >&2 $? # and this line
    echo >&2 "  Skipped: Current root is not booted."
    exit 0
set +x # and this line
  fi
set +x # and also this line
}

After making those modifications:

~ $ pacman -S emacs 
resolving dependencies... 
looking for conflicting packages... 
 [...]
:: Running post-transaction hooks... 
(1/5) Reloading user manager configuration... 
+ 
+ echo 0 
0 
+ echo   Skipped: Current root is not booted. 
  Skipped: Current root is not booted. 
+ exit 0 
+ systemd-notify --booted 
(2/5) Arming ConditionNeedsUpdate... 
(3/5) Updating icon theme caches... 
(4/5) Updating the info directory file... 
(5/5) Updating the desktop file MIME type cache... 

EDIT:
For testing, I switched to bash and reinstalled emacs. Seems like this fixed it:

~ $ pacman -S emacs 
resolving dependencies... 
looking for conflicting packages... 
[...]
:: Running post-transaction hooks... 
(1/5) Reloading user manager configuration... 
+ systemd-notify --booted 
+ set +x 
(2/5) Arming ConditionNeedsUpdate... 
(3/5) Updating icon theme caches... 
(4/5) Updating the info directory file... 
(5/5) Updating the desktop file MIME type cache... 

My fix for now is to replace the shebang line in /usr/share/libalpm/scripts/systemd-hook with

#!/bin/bash

This seems to be a systemd-boot thing though, because I don't recall GRUB having this problem.

Thank you very much for the help, seth!

Last edited by delicious_taco (2024-10-15 12:27:45)

Offline

#14 2024-10-15 13:41:16

seth
Member
Registered: 2012-09-03
Posts: 57,492

Re: [Solved] Pacman tells me "Current root is not booted"

Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

You probably also want to file a bug at https://gitlab.archlinux.org/archlinux/ … d/-/issues for the bashism (it's a package bug, the hook is a downstream addition)

Edit:

This seems to be a systemd-boot thing though, because I don't recall GRUB having this problem.

As mentioned, the test was recently changed - maybe coincidentally w/ your bootloader switch.

Last edited by seth (2024-10-15 13:42:10)

Online

#15 2024-10-15 15:02:26

delicious_taco
Member
Registered: 2024-10-14
Posts: 7

Re: [Solved] Pacman tells me "Current root is not booted"

seth wrote:

You probably also want to file a bug at https://gitlab.archlinux.org/archlinux/ … d/-/issues for the bashism (it's a package bug, the hook is a downstream addition)

Got it, thanks.
https://gitlab.archlinux.org/archlinux/ … /issues/34

Offline

#16 2024-10-15 18:35:52

ua4000
Member
Registered: 2015-10-14
Posts: 479

Re: [Solved] Pacman tells me "Current root is not booted"

fix redirection for dash
Christian Hesse closed with commit b5c20dc6 2 hours ago

Thanks for the bug report, delicious_taco !

Offline

#17 2024-10-17 20:04:21

gerald5
Member
Registered: 2024-10-17
Posts: 1

Re: [Solved] Pacman tells me "Current root is not booted"

for the record, this also happens with an out-of-date version of apparmor.d-git (AUR) in enforce mode, solved by rebuilding it

Last edited by gerald5 (2024-10-17 20:05:56)

Offline

Board footer

Powered by FluxBB