Error: Failed to prepare transaction: invalid or corrupted database with pamac and the gui software manager

Edit: Never mind. I fixed it with pamac update --force-refresh. I searched similar topics and tried various commands, most involving gpg and pacman commands but it wasn’t until after I posted this that I found a similar problem with a pamac fix.

I have an issue that seems to be with pamac and the gui installer with the above error. Pacman works fine. I’m also confused as to which one I should be using. I gather is pamac because the gui seems to be based on it but most people on the forum use pacman. I also like to use the gui for searching for packages when I don’t know the name. Here is a typical situation.

[gnuorder@gnuorder-ds81d ~]$ sudo -E pacman -S blender
resolving dependencies...
looking for conflicting packages...

Packages (1) blender-17:4.2.1-2

Total Download Size:   133.08 MiB
Total Installed Size:  389.04 MiB

:: Proceed with installation? [Y/n] 
:: Retrieving packages...
 blender-17:4.2.1-2-x86_64                            133.1 MiB  10.4 MiB/s 00:13 [##############################################] 100%
(1/1) checking keys in keyring                                                    [##############################################] 100%
(1/1) checking package integrity                                                  [##############################################] 100%
(1/1) loading package files                                                       [##############################################] 100%
(1/1) checking for file conflicts                                                 [##############################################] 100%
(1/1) checking available disk space                                               [##############################################] 100%
:: Processing package changes...
(1/1) installing blender                                                          [##############################################] 100%
Optional dependencies for blender
    cuda: Cycles renderer CUDA support [installed]
    intel-compute-runtime: Cycles renderer Intel OneAPI support [installed]
    libdecor: wayland support [installed]
:: Running post-transaction hooks...
(1/3) Arming ConditionNeedsUpdate...
(2/3) Updating icon theme caches...
(3/3) Updating the desktop file MIME type cache...

[gnuorder@gnuorder-ds81d ~]$ sudo pamac install inkskape
Error: target not found: inkskape

[gnuorder@gnuorder-ds81d ~]$ sudo pamac install inkscape
Preparing...
Synchronizing package databases...
Error: Failed to prepare transaction: invalid or corrupted database

[gnuorder@gnuorder-ds81d ~]$ sudo -E pacman -S inkscape
resolving dependencies...
looking for conflicting packages...

Packages (1) inkscape-1.3.2-12

Total Download Size:    23.65 MiB
Total Installed Size:  169.93 MiB

:: Proceed with installation? [Y/n] 
:: Retrieving packages...
 inkscape-1.3.2-12-x86_64                              23.6 MiB  9.52 MiB/s 00:02 [##############################################] 100%
(1/1) checking keys in keyring                                                    [##############################################] 100%
(1/1) checking package integrity                                                  [##############################################] 100%
(1/1) loading package files                                                       [##############################################] 100%
(1/1) checking for file conflicts                                                 [##############################################] 100%
(1/1) checking available disk space                                               [##############################################] 100%
:: Processing package changes...
(1/1) installing inkscape                                                         [##############################################] 100%
Optional dependencies for inkscape
    fig2dev: xfig input [installed]
    gvfs: import clip art [installed]
    pstoedit: latex formulas [installed]
    texlive-pstricks: latex formulas [installed]
:: Running post-transaction hooks...
(1/3) Arming ConditionNeedsUpdate...
(2/3) Updating icon theme caches...
(3/3) Updating the desktop file MIME type cache...

Do not use sudo with pamac. It changes the database file permissions, eventually resulting in invalid or corrupted database error messages when users try to install or update apps via pamac.

The following command is then required to fix it:

sudo rm -rf /var/tmp/pamac

Then refresh your Pamac databases with:

pamac update --force-refresh

Pamac will prompt the user for their password if and when required.

1 Like

Ah thanks, I didn’t know that. That will be hard to remember because of muscle memory but at least I’ll remember the cause if this comes up again.

1 Like

Manjaro Wiki - Using the Pamac CLI

Warning

Using sudo with pamac can have undesirable effects, especially when building packages. if in doubt, don’t use sudo. Pamac will ask for escalated rights if needed.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.