u/TH3RM4L33

Zypper is absolutely broken

Edit: After a whole day, I found the solution. Fix is at the end.

I'm on Tumbleweed. I am not in a snapshot/read-only session:

❯ cat /proc/cmdline
initrd=\opensuse-tumbleweed\7.0.12-1-default\initrd-2e38adcb0ac85eb9e9babaf64f9cb9076532a1ef root=UUID=5ba06eba-4012-40c3-9dae-8cc8c645869d splash=silent mitigations=auto quiet security=selinux selinux=1 rootflags=subvol=@/.snapshots/259/snapshot
❯ mount | grep "on / type btrfs"
/dev/nvme0n1p1 on / type btrfs (rw,relatime,seclabel,ssd,discard=async,space_cache=v2,subvolid=511,subvol=/@/.snapshots/259/snapshot)

Zypper can install and remove packages from my system just fine. But, it forgets/never registers that it did. Anything I install or remove, it ends up thinking it never happened.

I can run sudo zypper in <package> 100 times in a row, and it will work, showing the exact same successful install output every time.

I can also sudo zypper rm packages that don't exist, and because it isn't aware of what exists and what doesn't, it ends up crashing when trying to remove something that doesn't exist:

Removal of (2816)opi-5.13.0-1.1.noarch(@System) failed:
Error: Subprocess failed. Error: RPM failed: Command exited with status 1.

It's simply completely unaware of my system. It doesn't know what's installed and what isn't.

rpm -qa returns absolutely nothing. It thinks that not even Zypper is installed:

❯ sudo rpm -q zypper
package zypper is not installed

OPI is also unable to install anything ever, I get a bunch of errors (you can find them in a reply below).

SOLUTION: PACKAGE DATABASE WAS DESTROYED. YOU HAVE 2 OPTIONS:

1) SAVE THE ZYPPER PACKAGE HISTORY TO A FILE VIA sudo awk -F'|' '$2 == "install" {print $3}' /var/log/zypp/history | tr -d ' ' | sort -u > /tmp/history_pkgs.txt, THEN RUN xargs -d '\n' -n 20 sudo zypper install --force -y < /tmp/history_pkgs.txt TO REINSTALL THEM.

2) IF YOUR HISTORY IS GONE, DO THIS: INSTALL OPENSUSE ON A VM AND SAVE THE OUTPUT OF rpm -qa > FILE.TXT, TRANSFER THE FILE TO YOUR COMPUTER, THEN RUN xargs -d '\n' -n 20 sudo zypper install --force -y < FILE.txt TO RE-REGISTER MOST OF THE IMPORTANT PACKAGES. MANUALLY REINSTALL THE REST.

reddit.com
u/TH3RM4L33 — 8 days ago

Deleted openSUSE boot entry from SystemD

EDIT: Fixed it. Below is what worked for me.

Boot in Rescue Mode via openSUSE USB.

&gt; lsblk
Grab the ID of your root and EFI. This is my output:

>nvme0n1 259:0 0 1,9T 0 disk
├─nvme0n1p1 259:1 0 1,9T 0 part /
├─nvme0n1p2 259:2 0 2G 0 part [SWAP]
└─nvme0n1p4 259:3 0 1,8G 0 part /boot/efi

In my case, root is nvme0n1p1 and EFI is nvme0n1p4.

&gt; mount /dev/nvme0n1p1 /mnt

&gt; btrfs subvolume list /mnt
Grab a working snapshot's ID. Here's my output:

>ID 398 gen 3476 top level 263 path @/.snapshots/143/snapshot
ID 399 gen 3493 top level 263 path @/.snapshots/144/snapshot
ID 400 gen 3496 top level 263 path @/.snapshots/145/snapshot
ID 401 gen 3510 top level 263 path @/.snapshots/146/snapshot
ID 402 gen 3736 top level 263 path @/.snapshots/147/snapshot

In my case, the preferred snapshot is ID 402.
&gt; btrfs subvolume set-default 402 /mnt

&gt; btrfs property set /mnt ro false

&gt; mount -o remount,rw /mnt

&gt; mount /dev/nvme0n1p4 /mnt/boot/efi

&gt; for i in dev dev/pts proc sys run; do mount --bind $i /mnt/$i; done

&gt; chroot /mnt /bin/bash

&gt; mount -t efivarfs efivarfs /sys/firmware/efi/efivars

&gt; zypper in shim systemd-boot

&gt; bootctl install

&gt; sdbootutil -v remove-all-kernels

&gt; sdbootutil -v add-all-kernels

&gt; update-bootloader --reinit

&gt; exit

cat /boot/efi/loader/entries/opensuse-tumbleweed*.conf | head -n 10

Grab the kernel version and linux/initrd hash IDs. Here is my output:

># Boot Loader Specification type#1 entry
title openSUSE Tumbleweed 20260623
version 113@7.0.12-1-default
sort-key opensuse-tumbleweed
options root=UUID=5ba06eba-4012-40c3-9dae-8cc8c645869d splash=silent mitigations=auto quiet security=selinux selinux=1 rootflags=subvol=@/.snapshots/113/snapshot
linux /opensuse-tumbleweed/7.0.12-1-default/linux-7d3cd59acace20f72f48f2ea72e96c1306f787d4
initrd /opensuse-tumbleweed/7.0.12-1-default/initrd-2e38adcb0ac85eb9e9babaf64f9cb9076532a1ef

cp -L /mnt/boot/vmlinuz-7.0.12-1-default /mnt/boot/efi/opensuse-tumbleweed/7.0.12-1-default/linux-7d3cd59acace20f72f48f2ea72e96c1306f787d4

cp -L /mnt/boot/initrd-7.0.12-1-default /mnt/boot/efi/opensuse-tumbleweed/7.0.12-1-default/initrd-2e38adcb0ac85eb9e9babaf64f9cb9076532a1ef

That's about it.

umount -R /mnt

reboot

reddit.com
u/TH3RM4L33 — 10 days ago