1

I upgraded my system to Debian bookworm and the process seemed to proceed normally but ended with some errors. When I try to use apt to address the problem, I end up with a screen full of the following error:

grep: symbol lookup error: grep: undefined symbol: pcre2_set_compile_extra_options_8

It seems that any attempt to use grep results in this error, no matter how basic the command. So I suppose that grep is somehow broken on this system now, which hampers any effort to repair it using apt or dpkg, eg:

$ sudo apt install -f
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up initramfs-tools (0.142+deb12u1) ...
update-initramfs: deferring update (trigger activated)
Setting up linux-image-6.1.0-31-amd64 (6.1.128-1) ...
/etc/kernel/postinst.d/dracut:
dracut: Generating /boot/initrd.img-6.1.0-31-amd64
grep: symbol lookup error: grep: undefined symbol: pcre2_set_compile_extra_options_8

[... 6 more times ...]

grep: symbol lookup error: grep: undefined symbol: pcre2_set_compile_extra_options_8
dracut: Disabling early microcode, because kernel does not support it. CONFIG_MICROCODE_[AMD|INTEL]!=y
grep: symbol lookup error: grep: undefined symbol: pcre2_set_compile_extra_options_8

[... 27 more times ...]

grep: symbol lookup error: grep: undefined symbol: pcre2_set_compile_extra_options_8
The default plymouth plugin () doesn't exist
grep: symbol lookup error: grep: undefined symbol: pcre2_set_compile_extra_options_8

[... 41 more times ...]

grep: symbol lookup error: grep: undefined symbol: pcre2_set_compile_extra_options_8
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-6.1.0-31-amd64
grep: symbol lookup error: grep: undefined symbol: pcre2_set_compile_extra_options_8
grep: symbol lookup error: grep: undefined symbol: pcre2_set_compile_extra_options_8
grep: symbol lookup error: grep: undefined symbol: pcre2_set_compile_extra_options_8
W: zstd compression (CONFIG_RD_ZSTD) not supported by kernel, using gzip
grep: symbol lookup error: grep: undefined symbol: pcre2_set_compile_extra_options_8
E: gzip compression (CONFIG_RD_GZIP) not supported by kernel
update-initramfs: failed for /boot/initrd.img-6.1.0-31-amd64 with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-6.1.0-31-amd64 (--configure):
 installed linux-image-6.1.0-31-amd64 package post-installation script subprocess returned error exit status 1
Processing triggers for initramfs-tools (0.142+deb12u1) ...
update-initramfs: Generating /boot/initrd.img-6.1.0-31-amd64
grep: symbol lookup error: grep: undefined symbol: pcre2_set_compile_extra_options_8
grep: symbol lookup error: grep: undefined symbol: pcre2_set_compile_extra_options_8
grep: symbol lookup error: grep: undefined symbol: pcre2_set_compile_extra_options_8
W: zstd compression (CONFIG_RD_ZSTD) not supported by kernel, using gzip
grep: symbol lookup error: grep: undefined symbol: pcre2_set_compile_extra_options_8
E: gzip compression (CONFIG_RD_GZIP) not supported by kernel
update-initramfs: failed for /boot/initrd.img-6.1.0-31-amd64 with 1.
dpkg: error processing package initramfs-tools (--configure):
 installed initramfs-tools package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 linux-image-6.1.0-31-amd64
 initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)
$ apt policy grep libpcre2-8-0
grep:
  Installed: 3.8-5
  Candidate: 3.8-5
  Version table:
 *** 3.8-5 500
        500 https://deb.debian.org/debian bookworm/main amd64 Packages
        100 /var/lib/dpkg/status
libpcre2-8-0:
  Installed: 10.42-1
  Candidate: 10.42-1
  Version table:
 *** 10.42-1 500
        500 https://deb.debian.org/debian bookworm/main amd64 Packages
        100 /var/lib/dpkg/status
$ ldd /bin/grep
        linux-vdso.so.1 (0x00007fff81ff6000)
        libpcre2-8.so.0 => /usr/local/lib/libpcre2-8.so.0 (0x00007fa6c7800000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa6c761f000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fa6c7c7e000)

$ LD_DEBUG=all grep 2>&1 | busybox grep pcre2_set_compile_extra_options_
    155549:     symbol=pcre2_set_compile_extra_options_8;  lookup in file=grep [0]
    155549:     symbol=pcre2_set_compile_extra_options_8;  lookup in file=/usr/local/lib/libpcre2-8.so.0 [0]
    155549:     symbol=pcre2_set_compile_extra_options_8;  lookup in file=/lib/x86_64-linux-gnu/libc.so.6 [0]
    155549:     symbol=pcre2_set_compile_extra_options_8;  lookup in file=/lib64/ld-linux-x86-64.so.2 [0]
    155549:     grep: error: symbol lookup error: undefined symbol: pcre2_set_compile_extra_options_8 (fatal)
grep: symbol lookup error: grep: undefined symbol: pcre2_set_compile_extra_options_8
$dpkg -S {/usr,}/lib/x86_64-linux-gnu/libpcre2-8*
libpcre2-dev:amd64: /usr/lib/x86_64-linux-gnu/libpcre2-8.a
libpcre2-dev:amd64: /usr/lib/x86_64-linux-gnu/libpcre2-8.so
libpcre2-8-0:amd64: /usr/lib/x86_64-linux-gnu/libpcre2-8.so.0
libpcre2-8-0:amd64: /usr/lib/x86_64-linux-gnu/libpcre2-8.so.0.11.2
dpkg-query: no path found matching pattern /lib/x86_64-linux-gnu/libpcre2-8.a
dpkg-query: no path found matching pattern /lib/x86_64-linux-gnu/libpcre2-8.so
dpkg-query: no path found matching pattern /lib/x86_64-linux-gnu/libpcre2-8.so.0
dpkg-query: no path found matching pattern /lib/x86_64-linux-gnu/libpcre2-8.so.0.11.2
$ (cd / && md5sum -c < /var/lib/dpkg/info/libpcre2-8-0:amd64.md5sums)
usr/lib/x86_64-linux-gnu/libpcre2-8.so.0.11.2: OK
usr/share/doc/libpcre2-8-0/README.Debian: OK
usr/share/doc/libpcre2-8-0/changelog.Debian.gz: OK
usr/share/doc/libpcre2-8-0/changelog.gz: OK
usr/share/doc/libpcre2-8-0/copyright: OK

The problem seems esoteric and my efforts to find a solution have been unproductive. Any help?

0

1 Answer 1

1

According to ldd, you have another (presumably older) version of libpcre2-8.so.0 in /usr/local/lib that takes precedence over the one in /usr/lib from the libpcre2-8-0 Debian package and the dynamic linker debug output confirms it doesn't have that pcre2_set_compile_extra_options_8 symbol which explains why grep (and presumably all the applications from bookworm that use PCRE2) fails.

You'd need to move those /usr/local/lib/libpcre2-8* out of the way (delete them, rename them or move them to a separate directory or run sudo make uninstall from the source directory where you compiled it from), then run sudo ldconfig and grep should work again.

Now, presumably you have installed PCRE2 in /usr/local in the past to be able to compile other applications that use PCRE2. Those applications will likely need to be recompiled (or installed from Debian packages if available there) as it seems the API for the two PCRE2 versions is different.

You may also want to check in /usr/local/lib for other libraries that may conflict with the new ones from bookworm or be now redundant.

Also having a non-working grep whilst some packages were installed and configured could have caused damage (misconfigured packages). I would review the logs of the Debian upgrade for what packages were affected and dpkg-reconfigure them or even possibly reinstall them.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.