You are not logged in.

#1 2024-03-16 14:54:09

qoneop
Member
Registered: 2024-03-16
Posts: 2

pacman 6.1.0-3 - segmentation fault with set XferCommand option

pacman 6.1.0-3 throws a segmentation fault error during "Synchronizing package databases" step right after it finishes downloading the first package database (e.g. core.db.part) when any XferCommand option is set.

Steps to recreate:
1. Set a custom XferCommand option or simply uncomment one of the predefined XferCommand options in /etc/pacman.conf.
2. Execute "pacman -Syu".

Workaround: Downgrade pacman to 6.0.2-9 or older.

Offline

#2 2024-03-16 15:18:04

seth
Member
Registered: 2012-09-03
Posts: 52,276

Re: pacman 6.1.0-3 - segmentation fault with set XferCommand option

https://bbs.archlinux.org/viewtopic.php … 2#p2144932

PSA'ing  a bug here won't help => https://gitlab.archlinux.org/pacman/pacman/-/issues
And include the actual segfault/backtrace.

Offline

#3 2024-03-17 02:27:11

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,410
Website

Re: pacman 6.1.0-3 - segmentation fault with set XferCommand option

qoneop wrote:

Steps to recreate:
1. Set a custom XferCommand option or simply uncomment one of the predefined XferCommand options in /etc/pacman.conf.
2. Execute "pacman -Syu".

Works for me...   I'll need more details.

Offline

#4 2024-03-17 10:39:31

qoneop
Member
Registered: 2024-03-16
Posts: 2

Re: pacman 6.1.0-3 - segmentation fault with set XferCommand option

Allan wrote:

Works for me...   I'll need more details.

Steps to reproduce:

  1. Confirm pacman 6.1.0 is installed on the system:

    $ pacman -V
    
     .--.                  Pacman v6.1.0 - libalpm v14.0.0
    / _.-' .-.  .-.  .-.   Copyright (C) 2006-2024 Pacman Development Team
    \  '-. '-'  '-'  '-'   Copyright (C) 2002-2006 Judd Vinet
     '--'
                           This program may be freely redistributed under
                           the terms of the GNU General Public License.
  2. (Optional) Temporarily replace contents of your /etc/pacman.conf with the default configuration from the GtiLab repo's main branch.

  3. Uncomment line #19:

    XferCommand = /usr/bin/curl -L -C - -f -o %o %u
  4. Run:

    sudo pacman -Syu --debug
  5. The segmentation fault error should occur:

    $ sudo pacman -Syu --debug
    debug: pacman v6.1.0 - libalpm v14.0.0
    debug: config: attempting to read file /etc/pacman.conf
    debug: config: new section 'options'
    debug: config: HoldPkg: pacman
    debug: config: HoldPkg: glibc
    debug: config: xfercommand: /usr/bin/curl -L -C - -f -o %o %u
    debug: config: Architecture: auto
    debug: config: arch: x86_64
    debug: config: SigLevel: Required
    debug: config: SigLevel: DatabaseOptional
    debug: config: LocalFileSigLevel: Optional
    debug: config: new section 'core'
    debug: config file /etc/pacman.conf, line 81: including /etc/pacman.d/mirrorlist
    debug: config: new section 'extra'
    debug: config file /etc/pacman.conf, line 87: including /etc/pacman.d/mirrorlist
    debug: config file /etc/pacman.conf, line 96: including /etc/pacman.d/mirrorlist
    debug: config: finished parsing S0a
    debug: setup_libalpm called
    debug: option 'logfile' = /var/log/pacman.log
    debug: option 'gpgdir' = /etc/pacman.d/gnupg/
    debug: option 'hookdir' = /etc/pacman.d/hooks/
    debug: option 'cachedir' = /var/cache/pacman/pkg/
    debug: registering sync database 'core'
    debug: database path for tree core set to /var/lib/pacman/sync/core.db
    debug: "/var/lib/pacman/sync/core.db.sig" is not readable: No such file or directory
    debug: sig path /var/lib/pacman/sync/core.db.sig could not be opened
    debug: got error 43 at _alpm_gpgme_checksig (../lib/libalpm/signing.c: 599) : missing PGP signature
    debug: missing optional signature
    debug: setting usage of 15 for core repository
    debug: adding new server URL to database 'core': https://geo.mirror.pkgbuild.com/core/os/x86_64
    debug: registering sync database 'extra'
    debug: database path for tree extra set to /var/lib/pacman/sync/extra.db
    debug: "/var/lib/pacman/sync/extra.db.sig" is not readable: No such file or directory
    debug: sig path /var/lib/pacman/sync/extra.db.sig could not be opened
    debug: got error 43 at _alpm_gpgme_checksig (../lib/libalpm/signing.c: 599) : missing PGP signature
    debug: missing optional signature
    debug: setting usage of 15 for extra repository
    debug: adding new server URL to database 'extra': https://geo.mirror.pkgbuild.com/extra/os/x86_64
    debug: adding new server URL to database 'extra': https://geo.mirror.pkgbuild.com/extra/os/x86_64
    :: Synchronizing package databases...
    debug: running command: /usr/bin/curl -L -C - -f -o /var/lib/pacman/sync/core.db.part https://geo.mirror.pkgbuild.com/core/os/x86_64/core.db
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  130k  100  130k    0     0  25588      0  0:00:05  0:00:05 --:--:-- 29936
    
    error: segmentation fault
    Please submit a full bug report with --debug if appropriate.
    Segmentation fault
  6. If the segmentation fault error did occur, the database will remain locked, thus preventing pacman from synchronizing package databases further. To fix it, run:

    $ sudo fuser /var/lib/pacman/db.lck # checks for any process that's still using the database
    $ sudo rm /var/lib/pacman/db.lck # removes the lock file
  7. Comment out line #19:

    #XferCommand = /usr/bin/curl -L -C - -f -o %o %u
  8. Run:

    sudo pacman -Syu --debug
  9. The process should finish successfully:

    $ sudo pacman -Syu --debug
    debug: pacman v6.1.0 - libalpm v14.0.0
    debug: config: attempting to read file /etc/pacman.conf
    debug: config: new section 'options'
    debug: config: HoldPkg: pacman
    debug: config: HoldPkg: glibc
    debug: config: Architecture: auto
    debug: config: arch: x86_64
    debug: config: SigLevel: Required
    debug: config: SigLevel: DatabaseOptional
    debug: config: LocalFileSigLevel: Optional
    debug: config: new section 'core'
    debug: config file /etc/pacman.conf, line 81: including /etc/pacman.d/mirrorlist
    debug: config: new section 'extra'
    debug: config file /etc/pacman.conf, line 87: including /etc/pacman.d/mirrorlist
    debug: config file /etc/pacman.conf, line 96: including /etc/pacman.d/mirrorlist
    debug: config: finished parsing bY\
    debug: setup_libalpm called
    debug: option 'logfile' = /var/log/pacman.log
    debug: option 'gpgdir' = /etc/pacman.d/gnupg/
    debug: option 'hookdir' = /etc/pacman.d/hooks/
    debug: option 'cachedir' = /var/cache/pacman/pkg/
    debug: registering sync database 'core'
    debug: database path for tree core set to /var/lib/pacman/sync/core.db
    debug: "/var/lib/pacman/sync/core.db.sig" is not readable: No such file or directory
    debug: sig path /var/lib/pacman/sync/core.db.sig could not be opened
    debug: got error 43 at _alpm_gpgme_checksig (../lib/libalpm/signing.c: 599) : missing PGP signature
    debug: missing optional signature
    debug: setting usage of 15 for core repository
    debug: adding new server URL to database 'core': https://geo.mirror.pkgbuild.com/core/os/x86_64
    debug: registering sync database 'extra'
    debug: database path for tree extra set to /var/lib/pacman/sync/extra.db
    debug: "/var/lib/pacman/sync/extra.db.sig" is not readable: No such file or directory
    debug: sig path /var/lib/pacman/sync/extra.db.sig could not be opened
    debug: got error 43 at _alpm_gpgme_checksig (../lib/libalpm/signing.c: 599) : missing PGP signature
    debug: missing optional signature
    debug: setting usage of 15 for extra repository
    debug: adding new server URL to database 'extra': https://geo.mirror.pkgbuild.com/extra/os/x86_64
    debug: adding new server URL to database 'extra': https://geo.mirror.pkgbuild.com/extra/os/x86_64
    :: Synchronizing package databases...
     core downloading...
     extra downloading...
    debug: core.db: url is https://geo.mirror.pkgbuild.com/core/os/x86_64/core.db
    debug: core.db: maxsize 134217728
    debug: core.db: using time condition 1710627592
    debug: core.db: opened tempfile for download: /var/lib/pacman/sync/core.db.part (wb)
    debug: core.db: curl returned result 0 from transfer
    debug: core.db: response code 304
    debug: core.db.sig: url is https://geo.mirror.pkgbuild.com/core/os/x86_64/core.db.sig
    debug: core.db.sig: maxsize 16384
    debug: core.db.sig: opened tempfile for download: /var/lib/pacman/sync/core.db.sig.part (wb)
    debug: core.db: file met time condition
    debug: core.db.sig: curl returned result 0 from transfer
    debug: core.db.sig: response code 404
    debug: core.db.sig: no more servers to retry
    debug: extra.db: url is https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db
    debug: extra.db: maxsize 134217728
    debug: extra.db: using time condition 1710668918
    debug: extra.db: opened tempfile for download: /var/lib/pacman/sync/extra.db.part (wb)
    debug: extra.db: curl returned result 0 from transfer
    debug: extra.db: response code 304
    debug: extra.db.sig: url is https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.sig
    debug: extra.db.sig: maxsize 16384
    debug: extra.db.sig: opened tempfile for download: /var/lib/pacman/sync/extra.db.sig.part (wb)
    debug: extra.db: file met time condition
    debug: extra.db.sig: curl returned result 0 from transfer
    debug: extra.db.sig: response code 404
    debug: extra.db.sig: no more servers to retry
    debug: curl_download_internal return code is 1
    debug: "/var/lib/pacman/sync/core.db.sig" is not readable: No such file or directory
    debug: sig path /var/lib/pacman/sync/core.db.sig could not be opened
    debug: got error 43 at _alpm_gpgme_checksig (../lib/libalpm/signing.c: 599) : missing PGP signature
    debug: missing optional signature
    debug: "/var/lib/pacman/sync/extra.db.sig" is not readable: No such file or directory
    debug: sig path /var/lib/pacman/sync/extra.db.sig could not be opened
    debug: got error 43 at _alpm_gpgme_checksig (../lib/libalpm/signing.c: 599) : missing PGP signature
    debug: missing optional signature
    :: Starting full system upgrade...
    <SKIPPED>
     there is nothing to do
    debug: unregistering database 'local'
    debug: freeing package cache for repository 'local'
    debug: unregistering database 'core'
    debug: freeing package cache for repository 'core'
    debug: unregistering database 'extra'
    debug: freeing package cache for repository 'extra'

Workaround:

  • Downgrade pacman to any of the previous versions (e.g. 6.0.2-9) and retry the process with uncommented line #19, i.e. a set XferCommand option. The segmentation fault should no longer occur.

    $ sudo pacman -U /var/cache/pacman/pkg/pacman-6.0.2-9-x86_64.pkg.tar.zst # downgrades pacman (assuming you still have it in your cache)
  • pacman 6.0.2-9 output with uncommented line #19:

    $ sudo pacman -Syu --debug
    debug: pacman v6.0.2 - libalpm v13.0.2
    debug: config: attempting to read file /etc/pacman.conf
    debug: config: new section 'options'
    debug: config: HoldPkg: pacman
    debug: config: HoldPkg: glibc
    debug: config: xfercommand: /usr/bin/curl -L -C - -f -o %o %u
    debug: config: Architecture: auto
    debug: config: arch: x86_64
    debug: config: SigLevel: Required
    debug: config: SigLevel: DatabaseOptional
    debug: config: LocalFileSigLevel: Optional
    debug: config: new section 'core'
    debug: config file /etc/pacman.conf, line 81: including /etc/pacman.d/mirrorlist
    debug: config: new section 'extra'
    debug: config file /etc/pacman.conf, line 87: including /etc/pacman.d/mirrorlist
    debug: config file /etc/pacman.conf, line 96: including /etc/pacman.d/mirrorlist
    debug: config: finished parsing /etc/pacman.conf
    debug: setup_libalpm called
    debug: option 'logfile' = /var/log/pacman.log
    debug: option 'gpgdir' = /etc/pacman.d/gnupg/
    debug: option 'hookdir' = /etc/pacman.d/hooks/
    debug: option 'cachedir' = /var/cache/pacman/pkg/
    debug: registering sync database 'core'
    debug: database path for tree core set to /var/lib/pacman/sync/core.db
    debug: "/var/lib/pacman/sync/core.db" is not readable: No such file or directory
    debug: setting usage of 15 for core repository
    debug: adding new server URL to database 'core': https://geo.mirror.pkgbuild.com/core/os/x86_64
    debug: registering sync database 'extra'
    debug: database path for tree extra set to /var/lib/pacman/sync/extra.db
    debug: "/var/lib/pacman/sync/extra.db.sig" is not readable: No such file or directory
    debug: sig path /var/lib/pacman/sync/extra.db.sig could not be opened
    debug: got error 43 at _alpm_gpgme_checksig (../lib/libalpm/signing.c: 603) : missing PGP signature
    debug: missing optional signature
    debug: setting usage of 15 for extra repository
    debug: adding new server URL to database 'extra': https://geo.mirror.pkgbuild.com/extra/os/x86_64
    debug: adding new server URL to database 'extra': https://geo.mirror.pkgbuild.com/extra/os/x86_64
    :: Synchronizing package databases...
    debug: running command: /usr/bin/curl -L -C - -f -o /var/lib/pacman/sync/core.db.part https://geo.mirror.pkgbuild.com/core/os/x86_64/core.db
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  130k  100  130k    0     0  26251      0  0:00:05  0:00:05 --:--:-- 32752
    debug: running command: /usr/bin/curl -L -C - -f -o /var/lib/pacman/sync/extra.db.part https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 8555k  100 8555k    0     0  33.7M      0 --:--:-- --:--:-- --:--:-- 33.8M
    debug: "/var/lib/pacman/sync/core.db.sig" is not readable: No such file or directory
    debug: sig path /var/lib/pacman/sync/core.db.sig could not be opened
    debug: got error 43 at _alpm_gpgme_checksig (../lib/libalpm/signing.c: 603) : missing PGP signature
    debug: missing optional signature
    debug: "/var/lib/pacman/sync/extra.db.sig" is not readable: No such file or directory
    debug: sig path /var/lib/pacman/sync/extra.db.sig could not be opened
    debug: got error 43 at _alpm_gpgme_checksig (../lib/libalpm/signing.c: 603) : missing PGP signature
    debug: missing optional signature
    :: Starting full system upgrade...
    <SKIPPING>
    resolving dependencies...
    debug: resolving target's dependencies
    debug: started resolving dependencies
    debug: checkdeps: package pacman-6.1.0-3
    debug: finished resolving dependencies
    looking for conflicting packages...
    debug: looking for conflicts
    debug: check targets vs targets
    debug: check targets vs targets
    debug: check targets vs db and db vs targets
    debug: check targets vs db
    debug: check db vs targets
    debug: checking dependencies
    debug: checkdeps: package pacman-6.1.0-3
    debug: found cached pkg: /var/cache/pacman/pkg/pacman-6.1.0-3-x86_64.pkg.tar.zst
    debug: setting download size 0 for pkg pacman
    debug: sorting by dependencies
    debug: started sorting dependencies
    debug: sorting dependencies finished
    
    Packages (1) pacman-6.1.0-3
    
    Total Installed Size:  4.78 MiB
    Net Upgrade Size:      0.06 MiB
    
    :: Proceed with installation? [Y/n]
    <SKIPPING>
    debug: unregistering database 'local'
    debug: freeing package cache for repository 'local'
    debug: unregistering database 'core'
    debug: freeing package cache for repository 'core'
    debug: unregistering database 'extra'
    debug: freeing package cache for repository 'extra'

Notes:

  1. It seems the "finished parsing" debug log line is broken in pacman 6.1.0-3:

    • pacman 6.1.0-3 with uncommented line #19:

      debug: config: finished parsing S0a
    • pacman 6.1.0-3 with commented line #19:

      debug: config: finished parsing bY\
    • pacman 6.0.2-9:

      debug: config: finished parsing /etc/pacman.conf

Offline

#5 2024-03-17 22:26:38

ayekat
Member
Registered: 2011-01-17
Posts: 1,599

Re: pacman 6.1.0-3 - segmentation fault with set XferCommand option

qoneop wrote:

Notes:

  1. It seems the "finished parsing" debug log line is broken in pacman 6.1.0-3:

    • pacman 6.1.0-3 with uncommented line #19:

      debug: config: finished parsing S0a
    • pacman 6.1.0-3 with commented line #19:

      debug: config: finished parsing bY\
    • pacman 6.0.2-9:

      debug: config: finished parsing /etc/pacman.conf

Sorry, got nerdsniped by this, but unless I'm missing something, is it possible there's a bug here? (based on current master, bae9594ac1806ce30f2af1de27c49bb101a00d44):

  • In pacman.c:1223, we call parseconfig() and pass it config->configfile (config is a global variable defined in conf.h:237/conf.c:43)

  • parseconfig() is defined in conf.c:1391, and passes the argument (named file) to parseconfigfile() on line 1394

  • parseconfigfile() is defined in conf.c:1374, and frees config->configfile on line 1382

  • file in parseconfigfile() and parseconfig() now point to freed memory (back in parseconfig(), on line 1400, we then finally see the effect of this in the output)

Not sure if this is directly related to the segfault described by qoneop above, but some memory corruption is happening here.

Interestingly, some cursory git-blaming shows that none of the lines here have been modified since 2020. But potentially some lines inbetween have been removed at some point (did not dig further, sorry)


pkgshackscfgblag

Offline

#6 2024-03-17 23:14:52

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,410
Website

Re: pacman 6.1.0-3 - segmentation fault with set XferCommand option

Segfault has been found - only occurs when there is a single Server for a repo and signature checking is enabled.
https://gitlab.archlinux.org/pacman/pacman/-/issues/108

Offline

#7 2024-03-17 23:29:12

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,410
Website

Re: pacman 6.1.0-3 - segmentation fault with set XferCommand option

ayekat wrote:

Sorry, got nerdsniped by this, but unless I'm missing something, is it possible there's a bug here? (based on current master, bae9594ac1806ce30f2af1de27c49bb101a00d44):

  • In pacman.c:1223, we call parseconfig() and pass it config->configfile (config is a global variable defined in conf.h:237/conf.c:43)

  • parseconfig() is defined in conf.c:1391, and passes the argument (named file) to parseconfigfile() on line 1394

  • parseconfigfile() is defined in conf.c:1374, and frees config->configfile on line 1382

  • file in parseconfigfile() and parseconfig() now point to freed memory (back in parseconfig(), on line 1400, we then finally see the effect of this in the output)

Not sure if this is directly related to the segfault described by qoneop above, but some memory corruption is happening here.

Interestingly, some cursory git-blaming shows that none of the lines here have been modified since 2020. But potentially some lines inbetween have been removed at some point (did not dig further, sorry)

It is not related to the segfault, and only happens when using --debug.   But I see what is happening and will fix.

Edit: https://gitlab.archlinux.org/pacman/pac … quests/153

Offline

Board footer

Powered by FluxBB