4

If you are running apt-get commands on terminal and want to install stuff on the software center, the center says it waits until apt-get finishes. I wanted to know if it is possible to do the same but on the terminal, i.e., make apt-get on the terminal wait until the lock is released.

I found this link, that uses aptdcon to install stuff. I would like to know if:

  • Is it really not possible to do with apt-get?
  • Is aptdcon compatible with apt-get, i.e., can I use both to install stuff without borking the system?
  • does apt-get not notify you if you operate in the software center? – blissini Nov 12 '15 at 11:17
  • What do you mean notify? – Camandros Nov 12 '15 at 11:27
  • if you run apt-get <some command> in the terminal, it will tell you that a different process is locking the package database (e.g. the software center is operating). So the system should already behave like you want it. – blissini Nov 12 '15 at 12:32
  • apt-get has no built-in functionality for this purpose. – muru Nov 12 '15 at 13:50
3

Probably, not until Debian bug #754103 is resolved:

apt: support option to wait for lockfile

Reported by: Michael Prokop

Date: Mon, 7 Jul 2014 15:06:01 UTC

Severity: wishlist

Found in version apt/1.0.5

0

you can do this already:

create a new script called apt-get (wrapper for apt-get) in the

/usr/local/sbin

directory with the following bash code inside:

#!/bin/bash
#Make sure there is no space before the hashbang above!
i=0 
tput sc 
while fuser /var/lib/dpkg/lock >/dev/null 2>&1 ; do
     case $(($i % 4)) in
         0 ) j="-" ;;
         1 ) j="\\" ;;
         2 ) j="|" ;;
         3 ) j="/" ;;
     esac
     tput rc
     echo -en "\r[$j] Waiting for other software managers to finish..." 
     sleep 0.5
     ((i=i+1)) 
done
/usr/bin/apt-get "$@"

Don't forget to make it executable:

sudo chmod +x /usr/local/sbin/apt-get

run it. run it again with synaptic or another apt-get open. ;)

/usr/local/sbin comes earlier in the path...

I think it could cause chaos with scripts somewhere... maybe?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.