Skip to content
This repository has been archived by the owner on Sep 22, 2024. It is now read-only.

error: failed to initialize alpm library #77

Closed
bordermick opened this issue Mar 17, 2016 · 8 comments
Closed

error: failed to initialize alpm library #77

bordermick opened this issue Mar 17, 2016 · 8 comments

Comments

@bordermick
Copy link

Hello, I have been trying to get yaourt working in fedora but I continue to run into this issue when trying to run

pacman -Sy
error: failed to initialize alpm library
(could not find or read directory: /opt/arch/var/lib/pacman/)

I have tried following the fixes given in this issue report but there has still been no luck. Does anyone know how I would go about getting this working successfully? Any help would be great, thanks in advance.

@1dot75cm
Copy link
Contributor

Hi @bordermick
I'm so sorry. These days, I'm not online.
You may need to check the alsm library exists.

$ pacman -V
Pacman v5.0.1 - libalpm v10.0.1
$ ldd /usr/bin/pacman
libalpm.so.10 => /lib64/libalpm.so.10 (0x00007f71cf847000)
$ ll /usr/lib64/libalpm.so.10.0.1
-rwxr-xr-x. 1 root root ...

@bordermick
Copy link
Author

No problem, I ran those same commands and got the same outputs as you so I assume that means that the alsm library exists.

@1dot75cm
Copy link
Contributor

Please use --debug option to see more information.

-> $ pacman -V
Pacman v5.0.1 - libalpm v10.0.1
-> $ pacman -v
Root      : /opt/arch1/
Conf File : /etc/pacman.conf
DB Path   : /opt/arch1/var/lib/pacman/
Cache Dirs: /var/cache/pacman/pkg/  
Hook Dirs : /opt/arch1/usr/share/libalpm/hooks/  /etc/pacman.d/hooks/  
Lock File : /opt/arch1/var/lib/pacman/db.lck
Log File  : /var/log/pacman.log
GPG Dir   : /etc/pacman.d/gnupg/
-> $ pacman -Sy --debug
[04:03:54] debug: pacman v5.0.1 - libalpm v10.0.1
......

@bordermick
Copy link
Author

Sorry for the late response, I have been rather busy over the past 3 days.

When I run pacman -v I get the same error:

$ pacman -v
error: failed to initialize alpm library
(could not find or read directory: /opt/arch/var/lib/pacman/)

This is my pacman -Sy --debug output:

$ pacman -Sy --debug
[18:32:47] debug: pacman v5.0.1 - libalpm v10.0.1
[18:32:47] debug: config: attempting to read file /etc/pacman.conf
[18:32:47] debug: config: new section 'options'
[18:32:47] debug: config: rootdir: /opt/arch/
[18:32:47] debug: config: dbpath: /opt/arch/var/lib/pacman/
[18:32:47] debug: config: logfile: /var/log/pacman.log
[18:32:47] debug: config: arch: x86_64
[18:32:47] debug: config: new section 'core'
[18:32:47] debug: config: SigLevel: Optional
[18:32:47] debug: config: SigLevel: TrustedOnly
[18:32:47] debug: config file /etc/pacman.conf, line 10: including /etc/pacman.d/mirrorlist
[18:32:47] debug: config: new section 'community'
[18:32:47] debug: config: SigLevel: Never
[18:32:47] debug: config file /etc/pacman.conf, line 14: including /etc/pacman.d/mirrorlist
[18:32:47] debug: config: new section 'multilib'
[18:32:47] debug: config: SigLevel: Never
[18:32:47] debug: config file /etc/pacman.conf, line 18: including /etc/pacman.d/mirrorlist
[18:32:47] debug: config: new section 'extra'
[18:32:47] debug: config: SigLevel: Never
[18:32:47] debug: config file /etc/pacman.conf, line 22: including /etc/pacman.d/mirrorlist
[18:32:47] debug: config: new section 'archlinuxfr'
[18:32:47] debug: config: SigLevel: Optional
[18:32:47] debug: config: SigLevel: TrustedOnly
[18:32:47] debug: config: new section 'archlinuxcn'
[18:32:47] debug: config: SigLevel: Optional
[18:32:47] debug: config: SigLevel: TrustedOnly
[18:32:47] debug: config: finished parsing /etc/pacman.conf
[18:32:47] debug: setup_libalpm called
[18:32:47] error: failed to initialize alpm library
(could not find or read directory: /opt/arch/var/lib/pacman/)

@1dot75cm
Copy link
Contributor

I saw some similar problems https://bbs.archlinux.org/viewtopic.php?id=191861 . In fact, you need to run pacman as root permissions. @bordermick

$ pacman -Sy
error: failed to initialize alpm library
(database is incorrect version: /opt/arch1/var/lib/pacman/)
try running pacman-db-upgrade
$ sudo pacman -Sy
:: Synchronizing package databases...
Initializing download: http://mirrors.ustc.edu.cn/archlinux/core/os/x86_64/core.db
-OR-
$ su -
# pacman -Sy

I will update wiki, thanks.

@bordermick
Copy link
Author

Still getting the same error, even when I run it as root.

# pacman -Sy
error: failed to initialize alpm library
(could not find or read directory: /opt/arch/var/lib/pacman/)

@markzz
Copy link

markzz commented Aug 8, 2016

So create that directory. ALPM cannot initialize if the root or dbpath don't exist on the filesystem.

# mkdir -p /opt/arch/var/lib/pacman

@alick
Copy link
Member

alick commented May 20, 2018

Closing as fixed

@alick alick closed this as completed May 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants