Skip to content

CTRL+C while yay is syncing while running as root exits but does not remove db.lck #2918

Description

@C0rn3j

Affected Version

 yay --version         
 yay v13.0.1 - libalpm v16.0.1

Describe the bug

If yay is ran from root and then immediately exited while syncing, it leaves a hanging db.lck.

Note this is on an SSH session (ssh root@hostname), running zsh, may or may not be relevant.

Reproduction Steps

  1. yay under root account - regular user works fine
  2. CTRL+C instantly
  3. yay -> won't run cause of locked database

Expected behavior

yay removes db.lck just like it does so when running under a regular user

Output

--debug does not log anything new at all after CTRL+C is pressed so I presume it's useless here

[130] # yay                                                                                                                                                                 
 -> Avoid running yay as root/sudo.                
:: Synchronising package databases...                                                                   
 core-testing is up to date                                                                             
 core is up to date                                                                                     
 extra-testing is up to date                                                                            
 extra                                                                                             15.8 KiB  0.00   B/s --:-- [Co  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  ]   0%
^Cultilib-testing                                                                                 697.0   B  7.16 KiB/s 00:00 [----------------------------------------------------------------------------] 100%
                                                                                                                                                                                                                 
[130] # yay                                                                                             
 -> Avoid running yay as root/sudo.                                                                     
 -> /var/lib/pacman/db.lck is present.                                                                  
 -> There may be another Pacman instance running. Waiting...^C    

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions