91-siduction-entry-key.install: line 43: 10000 - : arithmetic syntax error

Started by wolegis, 2026/10/23, 21:44:59

Previous topic - Next topic

wolegis

Just an ordinary upgrade after 4 weeks. Big crime, NOX, rootfs on btrfs.

QuoteProcessing triggers for initramfs-tools (0.151) ...
update-initramfs: Generating /boot/initrd.img-7.2.12-1-siduction-amd64
Updating kernel version 7.2.12-1-siduction-amd64 in systemd-boot...
/usr/lib/kernel/install.d/91-siduction-entry-key.install: line 43: 10000 - : arithmetic syntax error: operand expected (
error token is "- ")

In the script

91-siduction-entry-key.install
variable entry_path gets set to /boot/siduction-nox/7.2.12-1-siduction-amd64. The pipe

grep -o "shot-[0-9@]\+" <<< $entry_path | sed s'!shot-!!'
produces no output, thus variable sn_nr gets assigned the empty string. The following lines

if [ "X$sn_nr" = "X@" ]; then
        key="10000"
else
        key=$((10000 - "$sn_nr"))
fi

are not prepared for this, producing the above mentioned error message.

I have worked around this issue by adapting the script. But I keep asking myself if I did something wrong here or if the script is simply buggy.

scholle1

Thanks for pointing that out.
I'll take a look at the script.
It's probably a bug.
"Pax in terris" - Das ist mein großer, mein einzigster für diese Welt von Herzen kommender Wunsch.
"Friede auf Erden" und alles Weitere erscheint einfach.

scholle1

The cause is an incomplete entry in the /etc/kernel/entry-token file.
To help you, I need the following information.
Please show the output of:
ls /usr/lib/modulesand  if only one ESP is used,
tree /efior if an XBOOTLDR partition is also used
tree /bootand last
btrfs subvolume get-default /
"Pax in terris" - Das ist mein großer, mein einzigster für diese Welt von Herzen kommender Wunsch.
"Friede auf Erden" und alles Weitere erscheint einfach.

wolegis

# ls /usr/lib/modules
 7.2.12-1-siduction-amd64  7.2.8-1-siduction-amd64

# tree /boot
/boot
├── config-7.2.12-1-siduction-amd64
├── config-7.2.8-1-siduction-amd64
├── EFI
│   ├── BOOT
│   │   └── BOOTX64.EFI
│   ├── Linux
│   └── systemd
│      ├── systemd-boot-fallbackx64.efi
│      └── systemd-bootx64.efi
├── initrd.img-7.2.8-1-siduction-amd64
├── loader
│   ├── entries
│   │   ├── siduction-nox-7.2.12-1-siduction-amd64.conf
│   │   └── siduction-nox-7.2.8-1-siduction-amd64.conf
│   ├── entries.srel
│   ├── keys
│   ├── loader.conf
│   └── random-seed
├── siduction-nox
│   ├── 7.2.12-1-siduction-amd64
│   │   ├── initrd.img-7.2.12-1-siduction-amd64
│   │   └── linux
│   └── 7.2.8-1-siduction-amd64
│      ├── initrd.img-7.2.8-1-siduction-amd64
│      └── linux
├── System.map-7.2.12-1-siduction-amd64
├── System.map-7.2.8-1-siduction-amd64
├── vmlinuz-7.2.12-1-siduction-amd64
└── vmlinuz-7.2.8-1-siduction-amd64

# btrfs subvolume get-default /
ID 256 gen 441 top level 5 path @

Mind that /boot is NOT XBOOTLDR, but ESP. (Cannot recall why it is not as you expected. As far as I remember, this was a clean install with NOX ISO without any extra fiddling.)

scholle1

Thanks for the information.
You haven't performed a rollback yet. That makes the solution simple, even though there's a lot of text coming up.
Well, let's take it step by step.

1) Start siduction NOX with kernel 7.2.12 and become root.

2) View the contents of the /etc/kernel/entry-token file.
# cat /etc/kernel/entry-token
siduction-nox
If the output looks like this, append the file contents using the command
sed -i 's|\(.*\)|\1-snapshot-@|' /etc/kernel/entry-tokenJust to check. The file contents should now look like this.
siduction-nox-snapshot-@
3) Now create the new boot entries.
# dpkg-reconfigure linux-image-7.2.12-1-siduction-amd64
# dpkg-reconfigure linux-image-7.2.8-1-siduction-amd64

Check the /boot/ directory.
# tree /boot/
/boot/
├── config-7.2.12-1-siduction-amd64
├── config-7.2.8-1-siduction-amd64
├── EFI
│   ├── BOOT
│   │   └── BOOTX64.EFI
│   ├── Linux
│   └── systemd
│       └── systemd-bootx64.efi
├── initrd.img-7.2.12-1-siduction-amd64
├── initrd.img-7.2.8-1-siduction-amd64
├── loader
│   ├── entries
│   │   ├── siduction-nox-7.2.12-1-siduction-amd64.conf
│   │   ├── siduction-nox-7.2.8-1-siduction-amd64.conf
│   │   ├── siduction-nox-snapshot-@-7.2.12-1-siduction-amd64.conf
│   │   └── siduction-nox-snapshot-@-7.2.8-1-siduction-amd64.conf
│   ├── entries.srel
│   ├── keys
│   ├── loader.conf
│   └── random-seed
├── siduction-nox
│   ├── 7.2.12-1-siduction-amd64
│   │   ├── initrd.img-7.2.12-1-siduction-amd64
│   │   └── linux
│   └── 7.2.8-1-siduction-amd64
│       ├── initrd.img-7.2.8-1-siduction-amd64
│       └── linux
├── siduction-nox-snapshot-@
│   ├── 7.2.12-1-siduction-amd64
│   │   ├── initrd.img-7.2.12-1-siduction-amd64
│   │   └── linux
│   └── 7.2.8-1-siduction-amd64
│       ├── initrd.img-7.2.8-1-siduction-amd64
│       └── linux
├── System.map-7.2.12-1-siduction-amd64
├── System.map-7.2.8-1-siduction-amd64
├── vmlinuz-7.2.12-1-siduction-amd64
└── vmlinuz-7.2.8-1-siduction-amd64
A new directory named "siduction-nox-snapshot-@" has been created, and there are two new entries in /boot/loader/entries/

4) Shutdow and boot.
The boot menu now looks like this.
Important: Select the boot entry with "snapshot-@" and kernel 7.2.12

     siduction Big-crime NOX (7.2.12-1-siduction-amd64) (siduction-nox-7.2.12-1-siduction-amd64.conf)
      siduction Big-crime NOX (7.2.8-1-siduction-amd64) (siduction-nox-7.2.8-1-siduction-amd64.conf)
siduction Big-crime NOX (7.2.12-1-siduction-amd64) (siduction-nox-snapshot-@-7.2.12-1-siduction-amd64.conf)
 siduction Big-crime NOX (7.2.8-1-siduction-amd64) (siduction-nox-snapshot-@-7.2.8-1-siduction-amd64.conf)
                                    Reboot into Firmware Interface
Should an error occur, the old boot entries will still be available.

5) If everything looks good, delete the old boot entries. Again, with root privileges.
# rm /boot/loader/entries/siduction-nox-7*
# rm -r /boot/siduction-nox/

6) All done. After a reboot, the boot menu will return to the way it was before.

Additional Information.
The ".conf" files in /boot/loader/entries/ contain a subtle but important change.
# Boot Loader Specification type#1 entry
# File created by /usr/lib/kernel/install.d/90-loaderentry.install (systemd 262.1-1)
title      siduction Big-crime NOX
version    7.2.12-1-siduction-amd64
sort-key  nox-10000
options    root=UUID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ro quiet systemd.show_status=1
linux      /siduction-nox-snapshot-@/7.2.12-1-siduction-amd64/linux
initrd    /siduction-nox-snapshot-@/7.2.12-1-siduction-amd64/initrd.img-7.2.12-1-siduction-amd64

The "sort-key" was extended with the number 10,000. The lower the number, the higher the boot entry's priority. During a rollback, the snapper number of the new default subvolume is subtracted from 10,000. This ensures that the rollback target receives the highest boot priority.
And that fixes the "arithmetic syntax error."
"Pax in terris" - Das ist mein großer, mein einzigster für diese Welt von Herzen kommender Wunsch.
"Friede auf Erden" und alles Weitere erscheint einfach.