Bug 2171863 - Relocate RPM to usr could not be completed - Upgrade from Fedora 36 to 37
Summary: Relocate RPM to usr could not be completed - Upgrade from Fedora 36 to 37
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: 37
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Neal Gompa
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-02-20 16:04 UTC by thiloteE
Modified: 2024-01-12 22:48 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2024-01-12 22:48:13 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description thiloteE 2023-02-20 16:04:30 UTC
Description of problem:

Failed "relocate RPM to usr" (https://fedoraproject.org/wiki/Changes/RelocateRPMToUsr)


Version-Release number of selected component (if applicable):

?

How reproducible:

upgrade from fedora 36 to 37

Steps to Reproduce:

1. Use fedora cockpit (https://cockpit-project.org/). This step might not be necessary, but this is how I personally manage my server.
2. Upgrade from fedora 36 to 37

Actual results:

See error in cockpit logs: rpmdb-migrate.service - RPM database migration to /usr was skipped because of a failed condition check (ConditionPathExists=/var/lib/rpm/.migratedb)
Expected results:

Expected results:

1. no error.
2. database migration was successful!

Additional info:

Discussion about this problem has been flourishing in

- https://bugzilla.redhat.com/show_bug.cgi?id=2042147
- https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/G6LFNGOXZXFWZM3IWT6MLZWGMNSIZCWM/#B37AFXH3TFGKO3H5IHKIYH6TA3YIJNGK

I am not posting there, because bug 2042147 was initially about a different problem, although the comments there were very helpful to track down the problem and for solution. I am not a developer and have (and also don't want to have) no access to the developers mailing list.

Comment 1 thiloteE 2023-02-20 16:06:42 UTC
More detailed description of problem and how i tried to solve it:

I upgraded today (2023-02-04) from Fedora 36 to Fedora 37 on my server via Fedora Cockpit and encountered a bug in relation to a failed RPM database migration:

During the upgrade it was apparently expected that the rpmdb-migrate process would start, but it did not. I found some error in my log.

Prior advise from the mailing list and bug 2042147 to manually

> # systemctl enable rpmdb-migrate
> # systemctl start rpmdb-migrate

Did **NOT** solve the issue.

Found this discussion and had a look via `ls -la /usr/lib/sysimage/rpm`.


Found a `.migratedb` in there. Also found following files:

.rpm.lock
rpmdb.sqlite
rpmdb.sqlite-shm
rpmdb.sqlite-wal


What I did to (hopefully) fix it:

1. Deleted the `.migratedb` via `sudo rm .migratedb`.
2. Ran the `RPM database migration to /usr` Systemservice via Fedora Cockpit (This should have been equivalent to `systemctl start rpmdb-migrate`).
3. Following error was triggered: rpmdb-migrate.service - RPM database migration to /usr was skipped because of a failed condition check (ConditionPathExists=/var/lib/rpm/.migratedb).
4. Remembered, the `RPM database migration to /usr` Systemservice was supposed to run at boot, so I rebooted my machine.
5. After restart, the `RPM database migration to /usr` Systemservice` did not trigger Fedora cockpit to give a warning anymore.

So, I checked both folders (i should have checked BOTH folders before deleting stuff btw.!):

$ ls -la /var/lib/rpm
lrwxrwxrwx. 1 root root 26 Jun 25  2022 /var/lib/rpm -> ../../usr/lib/sysimage/rpm

$  ls -la /usr/lib/sysimage/rpm
total 122940
drwxr-xr-x. 2 root root       123 Feb  4 19:21 .
drwxr-xr-x. 3 root root        17 Aug  9 15:27 ..
-rw-r--r--. 1 root root         0 Jul  1  2022 .rpm.lock
-rw-r--r--. 1 root root 125857792 Feb  4 18:34 rpmdb.sqlite
-rw-r--r--. 1 root root     32768 Feb  4 19:25 rpmdb.sqlite-shm
-rw-r--r--. 1 root root         0 Feb  4 18:34 rpmdb.sqlite-wal

which seemed pretty close to a migration.

I noticed `.rpmdbdirsymlink_created` was missing, so i manually created the file via `sudo touch .rpmdbdirsymlink_created`

`-rw-r--r--. 1 root root         0 Feb  4 19:21 .rpmdbdirsymlink_created`

I am thinking about manually creating all the other symlinks.

Hopefully this was correct.
Hopefully this will help anybody encountering the same issue.

Comment 2 thiloteE 2023-02-20 17:02:19 UTC
I think i did the wrong thing. Memo for myself: Use `ln -s` command to create symbolic links

https://linuxconfig.org/how-to-create-symlink-in-linux

Comment 3 thiloteE 2023-02-20 17:54:40 UTC
What I found in my folders today:


```
[Thilo@server rpm]$ cd /var/lib/rpm
[Thilo@server rpm]$ ls -la
total 122940
drwxr-xr-x. 2 root root       123 Feb  4 19:21 .
drwxr-xr-x. 3 root root        17 Aug  9  2022 ..
-rw-r--r--. 1 root root         0 Jul  1  2022 .rpm.lock
-rw-r--r--. 1 root root         0 Feb  4 19:21 .rpmdbdirsymlink_created
-rw-r--r--. 1 root root 125857792 Feb 20 16:09 rpmdb.sqlite
-rw-r--r--. 1 root root     32768 Feb 20 17:59 rpmdb.sqlite-shm
-rw-r--r--. 1 root root         0 Feb 20 16:09 rpmdb.sqlite-wal



[Thilo@server rpm]$ cd /
[Thilo@server /]$ cd /usr/lib/sysimage/rpm
[Thilo@server rpm]$ ls -la
total 122940
drwxr-xr-x. 2 root root       123 Feb  4 19:21 .
drwxr-xr-x. 3 root root        17 Aug  9  2022 ..
-rw-r--r--. 1 root root         0 Jul  1  2022 .rpm.lock
-rw-r--r--. 1 root root         0 Feb  4 19:21 .rpmdbdirsymlink_created
-rw-r--r--. 1 root root 125857792 Feb 20 16:09 rpmdb.sqlite
-rw-r--r--. 1 root root     32768 Feb 20 17:59 rpmdb.sqlite-shm
-rw-r--r--. 1 root root         0 Feb 20 16:09 rpmdb.sqlite-wal

[Thilo@server rpm]$ ln -s rpmdb.sqlite /var/lib/rpm/rpmdb.sqlite
ln: failed to create symbolic link '/var/lib/rpm/rpmdb.sqlite': File exists
```

So ... now I am having TWO rpm databases? what is going on?

Comment 4 Neal Gompa 2023-02-22 02:37:27 UTC
Pull requests opened for this.

Rawhide (and F38): https://src.fedoraproject.org/rpms/rpm/pull-request/37

This pull request, once merged, will also need to be merged back into the F38 branch.

F37: https://src.fedoraproject.org/rpms/rpm/pull-request/38
F36: https://src.fedoraproject.org/rpms/rpm/pull-request/39

These two can just be merged and built for their respective branches.

Comment 5 Aoife Moloney 2023-11-23 01:17:31 UTC
This message is a reminder that Fedora Linux 37 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 37 on 2023-12-05.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '37'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 37 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 6 Aoife Moloney 2024-01-12 22:48:13 UTC
Fedora Linux 37 entered end-of-life (EOL) status on 2023-12-05.

Fedora Linux 37 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of Fedora Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.