LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   install software via terminal (https://www.linuxquestions.org/questions/linux-newbie-8/install-software-via-terminal-4175448326/)

Piyush M 02-02-2013 06:48 AM

install software via terminal
 
I am having debian 6 (64bit) on my laptop.
Its installed from cd-1 so it is having very few softwares installed within.

I am trying to install supertux and system monitor via terminal but it gives me output as follows

apt-get install supertux
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

I am using it as root. pls help me. Also tell me if anything I need to do in sources.list file.

And also in future if I wanted to install any software then how can I get related things to paste in sources.list file?

Thanks a lot !!!

goumba 02-02-2013 06:51 AM

Do you have Synaptic Package Manager or anythign else open that interacts with the package system?

As a prompt type 'ps -A | grep apt' and if so kill any process that shows.

As a last resort if you are sure nothing else is using APT: 'sudo rm /var/lib/apt/lists/lock'

Piyush M 02-02-2013 07:30 AM

again and again terminal is giving message as,

E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

I tried your trick by typing
ps -A | grep apt
but it is giving output as,
bash: ps-A: command not found

And yes I am having synaptic but I like installing via terminal..!

pls help !

colucix 02-02-2013 07:40 AM

Quote:

Originally Posted by Piyush M (Post 4882969)
bash: ps-A: command not found

This indicates the command was typed wrong: it should be
Code:

ps -A
with a space between the command (ps) and the option (-A) whereas the error message reveal it was written as a single item (ps-A). Another way to check which process keep a file or a directory busy is by means of the lsof command. Try
Code:

sudo lsof /var/lib/dpkg
enter your user's password when prompted and post the results here, if in doubt.

An aside note: please use CODE tags when posting text copied/pasted from the terminal. They improve readability and preserve spacing. To use CODE tags either put [CODE] and [/CODE] around the text OR switch to Advanced Mode, select the text and click the # button. Thanks.

goumba 02-02-2013 07:55 AM

Quote:

Originally Posted by Piyush M (Post 4882969)
And yes I am having synaptic but I like installing via terminal..!


You can have synaptic installed and install using the terminal, just Synaptic cannot be running at the time you try to install a program at the terminal.

Piyush M 02-02-2013 09:00 AM

After re entering ps -A I got the result,

2345 pts/0 00:00:10 synaptic

what to do next ?

zrdc28 02-02-2013 09:03 AM

kill 2345

Shadow_7 02-02-2013 09:26 AM

Basically you can't be using the dpkg files in another term while trying to use them elsewhere. As in running apt-get update while apt-get update is already running. Using lsof lets you know which application is currently using the file(s) in question. And fuser might help too. You run into similar issues with mount if you're cd'd into one of the directories of a mounted device and are trying to unmount it.

You can kill the application as a quick release of the file, or you can find what terminal is accessing it and play nice with that application.

kill -9 2345
(to send SIGTERM to the application, as above)

or
killall synaptic
(to do basically the same thing, but multiple times if there happens to be more than one instance)

Basically kill requires the use of the pid of the application. And killall lets you use the applications name. If you can get to the term and application actually touching it directly that would probably work best. There are times when you don't want an application to fail by telling it to SIGTERM now. Or the power company does that for you by having an interruption in service. Since ending an update while performing the update can hose a few things. Particularly if libc is involved. I've had /var/lib/dpkg/available get corrupted once from a power failure. And that was no fun back in the early days. Especially if you're on dialup (or was at that time). Fortunately there was available.old at that time which I used to replace available and solved my issue.

goumba 02-02-2013 10:38 AM

BTW it might be nicer if you try to quit a program normally rather than just arbitrarily killing processes. Just lick the X on the titlebar. Never know what changes you may want to keep that will be lost by killing. Just my $0.02.

chrism01 02-03-2013 06:32 PM

Don't use '-9' unless you jhave to; it kills it stone dead without giving it a chance to cleanup eg clear the lock/pid file.
Just try the kill cmd without -9, or (better if you have a GUI) use the GUI.

http://linux.die.net/man/1/kill <-- read this


All times are GMT -5. The time now is 01:13 AM.