You are not logged in.
Pages: 1
Create file with contents:
`/usr/bin/unlock-pacman`
#!/bin/sh
sudo rm /var/lib/pacman/db.lck
Set Permissions to Executable
sudo chmod 0755 /usr/bin/unlock-pacman
Now we can issue unlock-pacman instead of sudo rm [....] which helps deture accidental deletion from user input error.
I know it's simplistic but I thought I would share.
Offline
Could one not also use a Bash Alias for such a simple one-liner? In ~/.bashrc...
alias unlock-pacman='sudo rm var/lib/pacman/db.lck'
Also, this is really trivial to do and already covered in the wiki: https://wiki.archlinux.org/index.php/Pa … 9.22_error. Not sure what that means for this thread...
I am diagnosed with bipolar disorder. As it turns out, what I thought was my greatest weakness is now my greatest strength.
Everyday, I make a conscious choice to overcome my challenges and my problems. It's not easy, but its better than the alternative...
Offline
This also raises the question why are you having to run this command so often?
I've been running Arch on several machines for years and have never once seen the locked database error.
Offline
Good point. The easiest way to trigger the error is the following: In Terminal 1, run the following: sudo pacman -Syu. In a second terminal, run the following: sudo pacman -S <software>, in my case, I chose xterm at random. The error appears:
... With a pacman -Syu running in a second terminal ...
[jbs@dmb-gaming-laptop ~]$ sudo pacman -S xterm
error: failed to init transaction (unable to lock database)
error: could not lock database: File exists
if you're sure a package manager is not already
running, you can remove /var/lib/pacman/db.lck
[jbs@dmb-gaming-laptop ~]$
Granted, if you have a system update actively running, you should *never* remove the lock!
I am diagnosed with bipolar disorder. As it turns out, what I thought was my greatest weakness is now my greatest strength.
Everyday, I make a conscious choice to overcome my challenges and my problems. It's not easy, but its better than the alternative...
Offline
Good point. The easiest way to trigger the error is the following: In Terminal 1, run the following: sudo pacman -Syu. In a second terminal, run the following: sudo pacman -S <software>, in my case, I chose xterm at random. The error appears:
[...]
Granted, if you have a system update actively running, you should *never* remove the lock!
You're describing the exact reason why the lock exists: to prevent concurrent modification of the database.
So yes, there really is no reason why one would ever want to remove that lock.
... unless there is a crash of pacman or an underlying system. Which, under normal circumstances, shouldn't happen so often that it would require an automated workaround solution (→ slithery's question).
Offline
It can be useful with slower connections as pacman locks on starting downloads. Removing the lock when I know there's going to be enough time allows me to compile an AUR package (or 5) while waiting for downloads to complete.
I believe the lock should really be released during downloads, but it isn't.
Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.
Offline
The lock during download prevents multiple pacman instances trying to download the same file (which could be fixed by allowing more fine grained locking...)
Offline
The lock during download prevents multiple pacman instances trying to download the same file (which could be fixed by allowing more fine grained locking...)
Oh, I thought the *.part files should be useable for that. Then again there'd be a race condition I suppose.
Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.
Offline
Can't use .part fils for that. You could not tell a difference between a download that was interrupted and needs continued, or a download that is ongoing.
Offline
Pages: 1