void-linux / xbps

The X Binary Package System (XBPS)
https://voidlinux.org/xbps/
Other
818 stars 124 forks source link

"switch_alt_group: Assertion `curpkgd' failed." when uninstalling a package #312

Open ackalker opened 4 years ago

ackalker commented 4 years ago

On Void Linux x86_64 (GLibc), xbps-0.59.1_2, today I hit this assertion when trying to uninstall some packages which are no longer in the repo.

Captured output of what I did:

# xbps-remove -fR ConsoleKit2 advancescan archivemount chirp-daily conkeror libprotobuf-lite18 libtk-img lunzip php-zmq pm-utils python-crypto python-websockify python3-PyQt4 statifier

Name               Action    Version           New version            Download size
ConsoleKit2        remove    1.2.1_2           -                      - 
cgmanager          remove    0.42_1            -                      - 
libcgmanager       remove    0.42_1            -                      - 
libnih             remove    1.0.3_5           -                      - 
advancescan        remove    1.18_1            -                      - 
archivemount       remove    0.8.7_1           -                      - 
chirp-daily        remove    20170714_1        -                      - 
pygtk              remove    2.24.0_14         -                      - 
python-gobject2    remove    2.28.7_2          -                      - 
python-pyserial    remove    3.4_3             -                      - 
libxml2-python     remove    2.9.10_2          -                      - 
conkeror           remove    1.0.3_1           -                      - 
libprotobuf-lite18 remove    3.7.1_1           -                      - 
libtk-img          remove    1.4.6_1           -                      - 
lunzip             remove    1.9_1             -                      - 
php-zmq            remove    1.1.3_1           -                      - 
zeromq             remove    4.3.2_1           -                      - 
pm-utils           remove    1.4.1_8           -                      - 
python-crypto      remove    2.6.1_9           -                      - 
python-websockify  remove    0.8.0_1           -                      - 
python3-PyQt4      remove    4.12.1_3          -                      - 
qt                 remove    4.8.7_29          -                      - 
python3-sip        remove    4.19.19_2         -                      - 
statifier          remove    1.7.4_1           -                      - 

Size freed on disk:             77MB
Space available on disk:        29GB

Do you want to continue? [Y/n] 
Removing `ConsoleKit2-1.2.1_2' ...
Removed `ConsoleKit2-1.2.1_2' successfully.
Removing `cgmanager-0.42_1' ...
Removed `cgmanager-0.42_1' successfully.
Removing `libcgmanager-0.42_1' ...
Removed `libcgmanager-0.42_1' successfully.
Removing `libnih-1.0.3_5' ...
Removed `libnih-1.0.3_5' successfully.
Removing `advancescan-1.18_1' ...
Removed `advancescan-1.18_1' successfully.
Removing `archivemount-0.8.7_1' ...
Removed `archivemount-0.8.7_1' successfully.
Removing `chirp-daily-20170714_1' ...
Updating MIME database...
Removed `chirp-daily-20170714_1' successfully.
Removing `pygtk-2.24.0_14' ...
Removing byte-compiled python2.7 code for module gtk-2.0/gtk...
Updating ldconfig(8) cache...
Removed `pygtk-2.24.0_14' successfully.
Removing `python-gobject2-2.28.7_2' ...
Removing byte-compiled python2.7 code for module glib...
Removing byte-compiled python2.7 code for module gobject...
Removing byte-compiled python2.7 code for module gtk-2.0...
Removing byte-compiled python2.7 code for module pygtk.py...
Updating ldconfig(8) cache...
Removed `python-gobject2-2.28.7_2' successfully.
Removing `python-pyserial-3.4_3' ...
Removing byte-compiled python2.7 code for module serial...
Updating ldconfig(8) cache...
python-pyserial-3.4_3: unregistered 'pyserial' alternatives group
Removed `python-pyserial-3.4_3' successfully.
Removing `libxml2-python-2.9.10_2' ...
Removing byte-compiled python2.7 code for module drv_libxml2.py...
Removing byte-compiled python2.7 code for module libxml2.py...
Updating ldconfig(8) cache...
Removed `libxml2-python-2.9.10_2' successfully.
Removing `conkeror-1.0.3_1' ...
Updating MIME database...
Removed `conkeror-1.0.3_1' successfully.
Removing `libprotobuf-lite18-3.7.1_1' ...
Removed `libprotobuf-lite18-3.7.1_1' successfully.
Removing `libtk-img-1.4.6_1' ...
Removed `libtk-img-1.4.6_1' successfully.
Removing `lunzip-1.9_1' ...
Removed `lunzip-1.9_1' successfully.
Removing `php-zmq-1.1.3_1' ...
Removed `php-zmq-1.1.3_1' successfully.
Removing `zeromq-4.3.2_1' ...
Removed `zeromq-4.3.2_1' successfully.
Removing `pm-utils-1.4.1_8' ...
Removed `pm-utils-1.4.1_8' successfully.
Removing `python-crypto-2.6.1_9' ...
Removing byte-compiled python2.7 code for module Crypto...
Updating ldconfig(8) cache...
Removed `python-crypto-2.6.1_9' successfully.
Removing `python-websockify-0.8.0_1' ...
Removed `python-websockify-0.8.0_1' successfully.
Removing `python3-PyQt4-4.12.1_3' ...
Removing 'pyqt4' alternatives group symlink: pyuic4
python3-PyQt4-4.12.1_3: unregistered 'pyqt4' alternatives group
xbps-remove: package_alternatives.c:319: switch_alt_group: Assertion `curpkgd' failed.
Aborted

Hopefully I'll be able to provide more info on request.

ackalker commented 4 years ago

Running xbps-alternatives -l after the above leads to another assertion:

$ xbps-alternatives -l
awk
 - gawk (current)
  - awk:/usr/bin/gawk
  - awk.1:/usr/share/man/man1/gawk.1
babel
 - python3-Babel (current)
  - pybabel:/usr/bin/pybabel3
bc
 - bc (current)
  - bc:/usr/bin/gnu-bc
  - bc.1:/usr/share/man/man1/gnu-bc.1
chardet
 - python-chardet (current)
  - chardetect:/usr/bin/chardetect2
 - python3-chardet
  - chardetect:/usr/bin/chardetect3
coverage
 - python-coverage (current)
  - coverage:/usr/bin/coverage2
crond
 - dcron (current)
  - crond:/etc/sv/dcron
  - crond:/usr/bin/dcrond
  - crontab:/usr/bin/dcrontab
  - crontab.1:/usr/share/man/man1/dcrontab.1
  - crond.8:/usr/share/man/man8/dcrond.8
cython
 - python3-Cython (current)
  - cygdb:/usr/bin/cygdb3
  - cython:/usr/bin/cython3
  - cythonize:/usr/bin/cythonize3
dc
 - bc (current)
  - dc:/usr/bin/gnu-dc
  - dc.1:/usr/share/man/man1/gnu-dc.1
docutils
 - python3-docutils (current)
  - rst2html:/usr/bin/rst2html.py3
  - rst2html4:/usr/bin/rst2html4.py3
  - rst2html5:/usr/bin/rst2html5.py3
  - rst2latex:/usr/bin/rst2latex.py3
  - rst2man:/usr/bin/rst2man.py3
  - rst2odt:/usr/bin/rst2odt.py3
  - rst2odt_prepstyles:/usr/bin/rst2odt_prepstyles.py3
  - rst2pseudoxml:/usr/bin/rst2pseudoxml.py3
  - rst2s5:/usr/bin/rst2s5.py3
  - rst2xetex:/usr/bin/rst2xetex.py3
  - rst2xml:/usr/bin/rst2xml.py3
  - rstpep2html:/usr/bin/rstpep2html.py3
find
 - findutils (current)
  - find:/usr/bin/gfind
  - find.1:/usr/share/man/man1/gfind.1
gntp
 - python-gntp (current)
  - gntp:/usr/bin/gntp2
hostname
 - coreutils (current)
  - hostname:/usr/bin/hostname-coreutils
  - hostname.1:/usr/share/man/man1/hostname-coreutils.1
 - net-tools
  - hostname:/usr/bin/net-tools-hostname
  - /usr/share/man/man1/hostname.1:/usr/share/man/man8/net-tools-hostname.1
ifconfig
 - net-tools (current)
  - ifconfig:/usr/bin/net-tools-ifconfig
  - /usr/share/man/man1/ifconfig.1:/usr/share/man/man8/net-tools-ifconfig.8
iptables
 - iptables (current)
  - ip6tables:/usr/bin/xtables-legacy-multi
  - ip6tables-restore:/usr/bin/xtables-legacy-multi
  - ip6tables-save:/usr/bin/xtables-legacy-multi
  - iptables:/usr/bin/xtables-legacy-multi
  - iptables-restore:/usr/bin/xtables-legacy-multi
  - iptables-save:/usr/bin/xtables-legacy-multi
java
 - openjdk8 (current)
  - /usr/bin/java:/usr/lib/jvm/java-1.8-openjdk/bin/java
  - /usr/bin/jjs:/usr/lib/jvm/java-1.8-openjdk/bin/jjs
  - /usr/bin/keytool:/usr/lib/jvm/java-1.8-openjdk/bin/keytool
  - /usr/bin/orbd:/usr/lib/jvm/java-1.8-openjdk/bin/orbd
  - /usr/bin/pack200:/usr/lib/jvm/java-1.8-openjdk/bin/pack200
  - /usr/bin/policytool:/usr/lib/jvm/java-1.8-openjdk/bin/policytool
  - /usr/bin/rmid:/usr/lib/jvm/java-1.8-openjdk/bin/rmid
  - /usr/bin/rmiregistry:/usr/lib/jvm/java-1.8-openjdk/bin/rmiregistry
  - /usr/bin/servertool:/usr/lib/jvm/java-1.8-openjdk/bin/servertool
  - /usr/bin/tnameserv:/usr/lib/jvm/java-1.8-openjdk/bin/tnameserv
  - /usr/bin/unpack200:/usr/lib/jvm/java-1.8-openjdk/bin/unpack200
 - openjdk8-jre
  - /usr/bin/java:/usr/lib/jvm/java-1.8-openjdk/jre/bin/java
  - /usr/bin/jjs:/usr/lib/jvm/java-1.8-openjdk/jre/bin/jjs
  - /usr/bin/keytool:/usr/lib/jvm/java-1.8-openjdk/jre/bin/keytool
  - /usr/bin/orbd:/usr/lib/jvm/java-1.8-openjdk/jre/bin/orbd
  - /usr/bin/pack200:/usr/lib/jvm/java-1.8-openjdk/jre/bin/pack200
  - /usr/bin/policytool:/usr/lib/jvm/java-1.8-openjdk/jre/bin/policytool
  - /usr/bin/rmid:/usr/lib/jvm/java-1.8-openjdk/jre/bin/rmid
  - /usr/bin/rmiregistry:/usr/lib/jvm/java-1.8-openjdk/jre/bin/rmiregistry
  - /usr/bin/servertool:/usr/lib/jvm/java-1.8-openjdk/jre/bin/servertool
  - /usr/bin/tnameserv:/usr/lib/jvm/java-1.8-openjdk/jre/bin/tnameserv
  - /usr/bin/unpack200:/usr/lib/jvm/java-1.8-openjdk/jre/bin/unpack200
jdk
 - openjdk8 (current)
  - /usr/bin/appletviewer:/usr/lib/jvm/java-1.8-openjdk/bin/appletviewer
  - /usr/bin/extcheck:/usr/lib/jvm/java-1.8-openjdk/bin/extcheck
  - /usr/bin/idlj:/usr/lib/jvm/java-1.8-openjdk/bin/idlj
  - /usr/bin/jar:/usr/lib/jvm/java-1.8-openjdk/bin/jar
  - /usr/bin/jarsigner:/usr/lib/jvm/java-1.8-openjdk/bin/jarsigner
  - /usr/bin/java:/usr/lib/jvm/java-1.8-openjdk/bin/java
  - /usr/bin/java-rmi.cgi:/usr/lib/jvm/java-1.8-openjdk/bin/java-rmi.cgi
  - /usr/bin/javac:/usr/lib/jvm/java-1.8-openjdk/bin/javac
  - /usr/bin/javadoc:/usr/lib/jvm/java-1.8-openjdk/bin/javadoc
  - /usr/bin/javah:/usr/lib/jvm/java-1.8-openjdk/bin/javah
  - /usr/bin/javap:/usr/lib/jvm/java-1.8-openjdk/bin/javap
  - /usr/bin/jcmd:/usr/lib/jvm/java-1.8-openjdk/bin/jcmd
  - /usr/bin/jconsole:/usr/lib/jvm/java-1.8-openjdk/bin/jconsole
  - /usr/bin/jdb:/usr/lib/jvm/java-1.8-openjdk/bin/jdb
  - /usr/bin/jdeps:/usr/lib/jvm/java-1.8-openjdk/bin/jdeps
  - /usr/bin/jhat:/usr/lib/jvm/java-1.8-openjdk/bin/jhat
  - /usr/bin/jinfo:/usr/lib/jvm/java-1.8-openjdk/bin/jinfo
  - /usr/bin/jjs:/usr/lib/jvm/java-1.8-openjdk/bin/jjs
  - /usr/bin/jmap:/usr/lib/jvm/java-1.8-openjdk/bin/jmap
  - /usr/bin/jps:/usr/lib/jvm/java-1.8-openjdk/bin/jps
  - /usr/bin/jrunscript:/usr/lib/jvm/java-1.8-openjdk/bin/jrunscript
  - /usr/bin/jsadebugd:/usr/lib/jvm/java-1.8-openjdk/bin/jsadebugd
  - /usr/bin/jstack:/usr/lib/jvm/java-1.8-openjdk/bin/jstack
  - /usr/bin/jstat:/usr/lib/jvm/java-1.8-openjdk/bin/jstat
  - /usr/bin/jstatd:/usr/lib/jvm/java-1.8-openjdk/bin/jstatd
  - /usr/bin/keytool:/usr/lib/jvm/java-1.8-openjdk/bin/keytool
  - /usr/bin/native2ascii:/usr/lib/jvm/java-1.8-openjdk/bin/native2ascii
  - /usr/bin/orbd:/usr/lib/jvm/java-1.8-openjdk/bin/orbd
  - /usr/bin/pack200:/usr/lib/jvm/java-1.8-openjdk/bin/pack200
  - /usr/bin/policytool:/usr/lib/jvm/java-1.8-openjdk/bin/policytool
  - /usr/bin/rmic:/usr/lib/jvm/java-1.8-openjdk/bin/rmic
  - /usr/bin/rmid:/usr/lib/jvm/java-1.8-openjdk/bin/rmid
  - /usr/bin/rmiregistry:/usr/lib/jvm/java-1.8-openjdk/bin/rmiregistry
  - /usr/bin/schemagen:/usr/lib/jvm/java-1.8-openjdk/bin/schemagen
  - /usr/bin/serialver:/usr/lib/jvm/java-1.8-openjdk/bin/serialver
  - /usr/bin/servertool:/usr/lib/jvm/java-1.8-openjdk/bin/servertool
  - /usr/bin/tnameserv:/usr/lib/jvm/java-1.8-openjdk/bin/tnameserv
  - /usr/bin/unpack200:/usr/lib/jvm/java-1.8-openjdk/bin/unpack200
  - /usr/bin/wsgen:/usr/lib/jvm/java-1.8-openjdk/bin/wsgen
  - /usr/bin/wsimport:/usr/lib/jvm/java-1.8-openjdk/bin/wsimport
  - /usr/bin/xjc:/usr/lib/jvm/java-1.8-openjdk/bin/xjc
locate
 - findutils (current)
logger
 - util-linux (current)
  - logger:/usr/bin/util-linux-logger
  - logger.1:/usr/share/man/man1/util-linux-logger.1
lua
 - lua52 (current)
  - lua:/usr/bin/lua5.2
  - luac:/usr/bin/luac5.2
  - lua.1:/usr/share/man/man1/lua5.2.1
  - luac.1:/usr/share/man/man1/luac5.2.1
  - lua:/usr/share/doc/lua5.2
 - lua51
  - lua:/usr/bin/lua5.1
  - luac:/usr/bin/luac5.1
  - lua.1:/usr/share/man/man1/lua5.1.1
  - luac.1:/usr/share/man/man1/luac5.1.1
  - lua:/usr/share/doc/lua5.1
 - lua53
  - lua:/usr/bin/lua5.3
  - luac:/usr/bin/luac5.3
  - lua.1:/usr/share/man/man1/lua5.3.1
  - luac.1:/usr/share/man/man1/luac5.3.1
  - lua:/usr/share/doc/lua5.3
mail
 - mailx (current)
  - mail.rc:/etc/mailx.rc
  - mail:/usr/bin/mailx
  - mail.1:/usr/share/man/man1/mailx.1
man
 - mdocml (current)
  - man:/usr/bin/mandoc
  - whatis:/usr/bin/mandoc
  - apropos:/usr/bin/mandoc
  - man.1:/usr/share/man/man1/mandoc-man.1
  - whatis.1:/usr/share/man/man1/mandoc-whatis.1
  - apropos.1:/usr/share/man/man1/mandoc-apropos.1
markdown
 - python-Markdown (current)
  - markdown_py:/usr/bin/markdown_py2
mkpasswd
 - expect (current)
  - mkpasswd:/usr/bin/expect-mkpasswd
  - mkpasswd.1:/usr/share/man/man1/expect-mkpasswd.1
nc
 - netcat (current)
  - nc:/usr/bin/gnetcat
  - nc.1:/usr/share/man/man1/gnetcat.1
 - openbsd-netcat
  - nc:/usr/bin/openbsd-nc
  - nc.1:/usr/share/man/man1/openbsd-nc.1
 - nmap
  - nc:/usr/bin/ncat
  - nc.1:/usr/share/man/man1/ncat.1
ntpd
 - chrony (current)
  - ntpd:/usr/bin/chronyd
  - ntpd.8:/usr/share/man/man8/chronyd.8
  - ntpd:/etc/sv/chronyd
numpy
 - python-numpy (current)
  - f2py:/usr/bin/f2py2
 - python3-numpy
  - f2py:/usr/bin/f2py3
pinentry
 - pinentry (current)
  - pinentry:/usr/bin/pinentry-curses
 - pinentry-gtk
  - pinentry:/usr/bin/pinentry-gtk-2
ping
 - iputils (current)
  - ping:/usr/bin/iputils-ping
  - ping.8:/usr/share/man/man8/iputils-ping.8
ping6
 - iputils (current)
  - ping6:/usr/bin/iputils-ping
  - ping6.8:/usr/share/man/man8/iputils-ping.8
pip
 - python3-pip (current)
  - pip:/usr/bin/pip3
 - python-pip
  - pip:/usr/bin/pip2
pkg-config
 - pkg-config (current)
  - pkg-config:/usr/bin/pkg-config.pkg-config
  - pkg-config.1:/usr/share/man/man1/pkg-config.1.pkg-config
  - pkg.m4:/usr/share/aclocal/pkg.m4.pkg-config
 - pkgconf
  - pkg-config:/usr/bin/pkgconf
  - pkg-config.1:/usr/share/man/man1/pkgconf.1
  - pkg.m4:/usr/share/aclocal/pkg.m4.pkgconf
pygments
 - python3-Pygments (current)
  - pygmentize:/usr/bin/pygmentize3
pyqt4
 - python3-PyQt4 (current)
  - pyuic4:/usr/bin/python3-pyuic4
 - python-PyQt4
xbps-alternatives: main.c:152: list_alternatives: Assertion `pkgd' failed.
Aborted

Running xbps-pkdb -a results in:

# xbps-pkgdb -a
ConsoleKit2: cannot read /var/db/xbps/.ConsoleKit2-files.plist, ignoring...
conkeror: cannot read /var/db/xbps/.conkeror-files.plist, ignoring...
cgmanager: cannot read /var/db/xbps/.cgmanager-files.plist, ignoring...
chirp-daily: cannot read /var/db/xbps/.chirp-daily-files.plist, ignoring...
advancescan: cannot read /var/db/xbps/.advancescan-files.plist, ignoring...
archivemount: cannot read /var/db/xbps/.archivemount-files.plist, ignoring...
libcgmanager: cannot read /var/db/xbps/.libcgmanager-files.plist, ignoring...
libnih: cannot read /var/db/xbps/.libnih-files.plist, ignoring...
libprotobuf-lite18: cannot read /var/db/xbps/.libprotobuf-lite18-files.plist, ignoring...
libtk-img: cannot read /var/db/xbps/.libtk-img-files.plist, ignoring...
libxml2-python: cannot read /var/db/xbps/.libxml2-python-files.plist, ignoring...
lunzip: cannot read /var/db/xbps/.lunzip-files.plist, ignoring...
php-zmq: cannot read /var/db/xbps/.php-zmq-files.plist, ignoring...
pm-utils: cannot read /var/db/xbps/.pm-utils-files.plist, ignoring...
python-gobject2: cannot read /var/db/xbps/.python-gobject2-files.plist, ignoring...
pygtk: cannot read /var/db/xbps/.pygtk-files.plist, ignoring...
python-websockify: cannot read /var/db/xbps/.python-websockify-files.plist, ignoring...
python-pyserial: cannot read /var/db/xbps/.python-pyserial-files.plist, ignoring...
python-crypto: cannot read /var/db/xbps/.python-crypto-files.plist, ignoring...
ERROR: python3-PyQt4: alternatives group pyqt4 symlink /usr/bin/pyuic4: No such file or directory
zeromq: cannot read /var/db/xbps/.zeromq-files.plist, ignoring...
ackalker commented 4 years ago

xbps-pkgdb -a doesn't appear to fix these problems; running it a second time results in identical output.

ericonr commented 4 years ago
Removing 'pyqt4' alternatives group symlink: pyuic4
python3-PyQt4-4.12.1_3: unregistered 'pyqt4' alternatives group
xbps-remove: package_alternatives.c:319: switch_alt_group: Assertion `curpkgd' failed.
Aborted

It either erroneously called switch_alt_group or that function should know how to deal with cases like this. I will try to reproduce this one.

I believe (but you're better off waiting for someone who understand XBPS better) you might be able to finish uninstalling these packages if you force reinstall them (assuming they are still in your cache), then remove them again. But perhaps leave the PyQt4 package alone. Also, you should probably make a copy of your database if you decide to mess with this stuff, it's in /var/db/xbps/pkgdb*.

ackalker commented 4 years ago

Thanks for your suggestions. I have forcibly reinstalled python3-PyQt4 from my cache using xdowngrade from the xtools package (without doing this I couldn't install anything anyway, as xbps-install would complain about python3-PyQt4 package being broken), and successfully uninstalled all other packages in my original list except for this one. Sadly the problem persists, trying to uninstall python3-PyQt4 produces the same error. At least xbps-pkgdb -a now no longer complains about files for the other packages.

ericonr commented 4 years ago

Could you share your pkgdb? I believe it would help with diagnosing your issue.

ackalker commented 3 years ago

@ericonr I'm sorry for the very long delay answering your question. I'm still experiencing problems with xbps-alternatives -l erroring out.

I have created a repository on Github with the contents of my /var/db/xbps directory as of today, I hope this can be of some use.

ackalker commented 3 years ago

From some digging in the XBPS source (sadly I've lost my notes about it), I have a hunch that the problem is somehow related to a situation where the _XBPS_ALTERNATIVES_ key/dict is left with references to non-existent packages. I think this can happen when:

Chocimier commented 3 years ago

As a kludge, any of following works:

Proper fix is unlikely to appear soon.

Vagabond commented 3 years ago

I can confirm the second approach worked. I removed both the key and dict for pyqt4 and xbps tools started working again.

Chocimier commented 2 years ago

Problem occurs in following way:

Draft of crash fix is sent in #457.