LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-21-2013, 04:56 AM   #1
hamidi2
Member
 
Registered: Aug 2012
Posts: 63

Rep: Reputation: Disabled
920201 - installing packages based on their dependencies


hi
there's a folder containing all packages i'm going to install on my ubuntu server 12.04. if i use the following command:
Code:
dpkg -i *.deb
i get dependency errors like:
Quote:
dpkg: dependency problems prevent configuration of accountsservice:
accountsservice depends on libdbus-1-3 (>= 1.0.2); however:
Package libdbus-1-3 is not configured yet.
dpkg: error processing accountsservice (--install):
dependency problems - leaving unconfigured
while eg. apt-get knows the prerequisites packages and installs them automatically when i want to install accountsservice or anything else.
now my question is:
is there any automated method when using dpkg -i to install prerequired packages automatically? -- OR ---
is there any method to sort packages to be installed so that i won't get such a dependency error?
thx
 
Old 04-21-2013, 05:38 AM   #2
ali.abry
Member
 
Registered: Feb 2013
Posts: 74

Rep: Reputation: Disabled
i use this to install dependencies when i going to install programs from source . maybe it helped in your situation :
Code:
apt-get build-dep
Code:
build-dep
           build-dep causes apt-get to install/remove packages in an attempt to satisfy
           the build dependencies for a source package. By default the dependencies are
           satisfied to build the package natively. If desired a host-architecture can
           be specified with the --host-architecture option instead.
 
Old 04-21-2013, 09:37 AM   #3
hamidi2
Member
 
Registered: Aug 2012
Posts: 63

Original Poster
Rep: Reputation: Disabled
thx, but the server is not connected to the internet
 
Old 04-21-2013, 10:16 AM   #4
r.stiltskin
Member
 
Registered: Oct 2003
Location: USA
Distribution: Xubuntu, Arch
Posts: 231

Rep: Reputation: 31
Try
Code:
dpkg --configure -a
I'm not sure, but it might be necessary to run that more than once until all the packages have been configured.
 
Old 04-22-2013, 02:27 PM   #5
ali.abry
Member
 
Registered: Feb 2013
Posts: 74

Rep: Reputation: Disabled
i'm not sure if this is the best way but its only way i know for now :
you can have another ubuntu server on a virtual machin in another system and use a command like this to get URL of all the dependencies of the package you want to install & download them and move them to your main Ubuntu server .

this command is for vlc dependencies :
Code:
$ sudo apt-get build-dep vlc --yes --print-uris | grep http | cut -d " " -f 1 | tr -d \'
 
Old 04-22-2013, 03:55 PM   #6
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,279

Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
Resolving dependencies is bit complicated thing, it depends on what and which version of some packages is already installed on system and what is available. But if you already have all depended files in one directory, you can generate a special "Package.gz" file to read by apt-get or other more advanced than "dpkg" tools. For example: put all *.deb files into "/srv/apt/packages" directory, then invoke commands
Code:
cd /srv/apt
dpkg-scanpackages -m packages | gzip > /srv/apt/Packages.gz
echo 'deb [trusted=yes] file:/srv/apt /' > /etc/apt/sources.list.d/local.list
apt-get update
Then you can use regular package manager to install these packages.
 
Old 04-22-2013, 04:31 PM   #7
r.stiltskin
Member
 
Registered: Oct 2003
Location: USA
Distribution: Xubuntu, Arch
Posts: 231

Rep: Reputation: 31
After dpkg gives dependency errors like
Quote:
dpkg: error processing accountsservice (--install):
dependency problems - leaving unconfigured
can't you run
Code:
apt-get install -fy
to bring in the dependencies and complete the installation?

(Assuming you want it to run completely on its own. Otherwise just
apt-get install -f
to run it interactively.)

Last edited by r.stiltskin; 04-22-2013 at 04:33 PM.
 
Old 04-23-2013, 12:29 AM   #8
hamidi2
Member
 
Registered: Aug 2012
Posts: 63

Original Poster
Rep: Reputation: Disabled
hi
thanx 4 replying
when i run:
Code:
apt-get build-dep
i get:
Quote:
E: Must specify at least one package to check builddeps for
when i run:
Code:
apt-get build-dep *.deb
i get:
Quote:
E: Unable to find a source package for accountsservice_0.6.15-2ubuntu9.4_amd64.deb
when i run:
Code:
apt-get build-dep accountsservice
i get:
Quote:
The following packages have unmet dependencies:
intltool : Depends: libxml-parser-perl but it is not going to be installed
E: Build-dependencies for accountsservice could not be satisfied.
when i run:
Code:
dpkg --configure -a
i get:
Quote:
dpkg: dependency problems prevent configuration of libbonoboui2-0:
libbonoboui2-0 depends on libatk1.0-0 (>= 1.12.4); however:
Package libatk1.0-0 is not installed.
libbonoboui2-0 depends on libgconf-2-4 (>= 2.31.1); however:
Package libgconf-2-4 is not installed.
dpkg: error processing libbonoboui2-0 (--configure):
dependency problems - leaving unconfigured
Setting up openmpi-common (1.4.3-2.1ubuntu3) ...
dpkg: dependency problems prevent configuration of libmng-dev:
libmng-dev depends on libmng1 (= 1.0.10-1ubuntu1); however:
Package libmng1 is not installed.
dpkg: error processing libmng-dev (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of gtk2-engines-murrine:i386:
gtk2-engines-murrine:i386 depends on libc6 (>= 2.4).
...
Processing was halted because there were too many errors.
and running it again gives the same result.
when i run:
Code:
apt-get build-dep <any package> --yes --print-uris
i get:
Quote:
E: Unable to find a source package for <the package>
then i did what eSelix suggested. my packages are located in /hamidi/prerequisites, so i created the file /etc/apt/sources.list.d/local.list with the following content:
Code:
deb [trusted=yes] file:/hamidi/prerequisites /
i created Packages.gz in /hamidi/prerequisites directory by the following command:
Code:
dpkg-scanpackages . |gzip >Packages.gz
because i want just new packages to come into account. before sending output of dpkg-scanpackages to gzip i ran it solely and found that no error exists. after running this command i made sure that the file is properly generated and has a reasonable size and content.
then i ran this command:
Code:
apt-get update
and i got the following result:
Quote:
Ign file: InRelease
Ign file: Release.gpg
Ign file: Release
Ign file: Translation-en_US
Ign file: Translation-en
58% [Connecting to us.archive.ubuntu.com] [Connecting to security.ubuntu.com]
u see that it still tries to connect to the internet in an offline system. why? i don't know!
this seems to be a good suggestion. i prefer to use apt-get instead of dpkg. there must be a way to say it work offline, but it seems that there's still something wrong.
when i run apt-get install -f it also tries to connect to the internet.
it seems that ubuntu designers could never think about an offline environment!
now what can i do?
thx
 
Old 04-23-2013, 12:45 AM   #9
hamidi2
Member
 
Registered: Aug 2012
Posts: 63

Original Poster
Rep: Reputation: Disabled
let me give a more detailed output of a command:
as i said before, the following command:
Code:
apt-get build-dep accountsservice
gives the following result:
Quote:
The following packages have unmet dependencies:
intltool : Depends: libxml-parser-perl but it is not going to be installed
E: Build-dependencies for accountsservice could not be satisfied.
so i decided to run the following command:
Code:
apt-get build-dep libxml-parser-perl --yes --print-uris
and it results in:
Quote:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
...
The following NEW packages will be installed:
...
The following packages will be upgraded:
...
4 upgraded, 15 newly installed, 355 to remove and 28 not upgraded.
1230 not fully installed or removed.
Need to get 4,677 kB of archives.
After this operation, 569 MB disk space will be freed.
'http://us.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.0.0_1.0.1-4ubuntu5.7_amd64.deb' libssl1.0.0_1.0.1-4ubuntu5.7_amd64.deb 1010238 MD5Sum:b8b253c9e790f1b432fab476c6700774
... (more uri's)
when i check for existance of libssl1.0.0_1.0.1-4ubuntu5.7_amd64.deb, i see that it exists! so, why it says that it needs to get 4,677 kB of archives?!

Last edited by hamidi2; 04-23-2013 at 12:46 AM.
 
Old 04-23-2013, 08:00 AM   #10
r.stiltskin
Member
 
Registered: Oct 2003
Location: USA
Distribution: Xubuntu, Arch
Posts: 231

Rep: Reputation: 31
Please clarify this. You said:
Quote:
Originally Posted by hamidi2 View Post
hi
there's a folder containing all packages i'm going to install on my ubuntu server 12.04....
Does that folder contain all the dependencies of all of the packages, in which case the problem is simply getting them to install in the correct sequence?

Or are you looking for a way to identify, download, and install unmet dependencies when they are discovered?
 
Old 04-23-2013, 01:03 PM   #11
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,279

Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
Quote:
u see that it still tries to connect to the internet in an offline system. why?
It should ignore missing sources and go on. You need to tell your system not trying to connect by Internet. Look into "/etc/apt/sources.list" file and into "/etc/apt/sources.list.d", you should see that there are defined servers which apt connect to get packages. Just backup and remove all from directory (but "local.list") and empty file "/etc/apt/sources.list", do not delete it, because some tools need it presence. Then "apt-get update" and your system will use only local.
 
Old 04-23-2013, 09:42 PM   #12
hamidi2
Member
 
Registered: Aug 2012
Posts: 63

Original Poster
Rep: Reputation: Disabled
r.stiltskin:
i hope so. indeed, after installing all necessary applications on the first server which is connected to the internet these are the packages located in its /var/cache/apt/archives. so it's reasonable to think that all dependencies are included.

eSelix:
thank you for informing me how to tell ubuntu not to connect. but forcing ubuntu not to connect to the internet in this case is not my aim and can't be a good solution. my problem is that why it essentially tries to, while all packages are at hand and already downloaded?! i worry about that this be a mistake that i think that all dependencies are available, but as i said above, it's a reasonable proof to think that are all downloaded.

then, i thought about:
1. finding packages order in which dpkg -i may work without dependency problems. first let me know whether it's important? in another words, does it differ how to order package names when giving them to dpkg -i? if so, a proper order may solve the problem.
2. using 'apt-get install <package> -s' to just list NEW packages to be installed. it seems that this order is important and if i give packages to dpkg -i with this order the problem will be solved.
3. finally, when all packages are ordered by accumulating results of the above apt-get commands running for all packages i will give the result to dpkg -i. good idea?
4. may i be sure that dependent packages orders for different packages listed by apt-get don't conflict?

i know that my English is not so good. so please let me know which part(s) need more clearance.
thx
 
Old 04-23-2013, 11:21 PM   #13
r.stiltskin
Member
 
Registered: Oct 2003
Location: USA
Distribution: Xubuntu, Arch
Posts: 231

Rep: Reputation: 31
It's an interesting problem that I've never had but I'd like to help you figure out. It would be great if we could sort the file into the correct order, but I'm not sure that a correct order always exists because it's conceivable that some packages could have circular dependencies, i.e. A depends on B, B depends on C, and C depends on A. It must be possible to install them all, but in what order? There must be a way that ignores order.

I have two ideas, if you're willing to try.

One is simply to force dpkg to ignore dependencies (which means treat missing dependencies as warnings instead of errors), unpack and try to configure the packages. I imagine some might remain unconfigured at the end, and some might be configured incorrectly due to the forcing, but it should be possible to fix that by reconfiguring everything.
That would look like:
Code:
dpkg -i --force-depends *.deb
dpkg --reconfigure -a

Another way might be to use dpkg the option to unpack all the packages without configuring them, and then in a second pass try to configure all the packages. It will still be necessary to "force-depends" because the package control file is the first thing that is extracted for each package, and that is what contains the dependency information. So I think that would be
Code:
dpkg --unpack --force-depends *.deb
dpkg --configure -a
I wish I could be more certain, but they both seem logical. The second way might save time by doing all the configuring at the end and hopefully not having to reconfigure anything.

At least this approach does it all with dpkg. No apt-get or aptitude, and no messing around with your sources.list and internet connection. Good luck.
 
Old 04-27-2013, 11:24 PM   #14
hamidi2
Member
 
Registered: Aug 2012
Posts: 63

Original Poster
Rep: Reputation: Disabled
sorry 4 late.
you're right. in your example, there're three packages in the circle, while i've found even two:
Quote:
openjdk-6-jre-headless depends on openjdk-6-jre-lib
openjdk-6-jre-lib depends on openjdk-6-jre-headless
in such a condition, you can install neither, but there's a way for this purpose: installing both with the same command:
Code:
dpkg -i openjdk-6-jre-headless openjdk-6-jre-lib
but, which one must locate after the other one? this is what may be educed from apt-get output. when installing an application which requires them, we may see which one it shows after the other one.
however, this has been my idea. is it right?
---
about ur idea, it looks great did you personally, try it yourself? did it work?
now, my boss has said to do it by apt-get for now, and find the required applications to be installed in order, until in the soon future, i'll get solution with dpkg. in another words, using dpkg is suspended for now. i will try this idea as soon as i get done with apt-get.
thank you very much

Last edited by hamidi2; 04-27-2013 at 11:33 PM.
 
Old 05-07-2013, 12:18 AM   #15
hamidi2
Member
 
Registered: Aug 2012
Posts: 63

Original Poster
Rep: Reputation: Disabled
hi,
now, i come again with precious conclusions:
  1. you don't need to use dpkg -i. you may forget it forever.
  2. when ubuntu finds a package already downloaded, it will never download it again.
  3. existence of a package is found by not only existence of the deb file in /var/cache/apt/archives, but also with the changes made to /var/lib/apt/lists by apt-get after downloading it.
  4. there's no need to create an apt-mirror or an offline repository out of /var/cache/apt/archives.
so the solution is:
  1. install all required applications by apt-get install in an online server.
  2. it's better to run apt-get update and then apt-get upgrade * to keep installed applications up-to-date, but it seems not to be necessary.
  3. move (or copy) all packages in /var/cache/apt/archives into a flash disk. check that the 'partial' directory be empty. otherwise, it indicates that a required package is not completely downloaded and installation on the offline machine may fail.
  4. move (or copy) all files in /var/lib/apt/lists into the flash disk.
  5. move (or copy) all files in the flash in the appropriate (corresponding) directories of the offline machine.
  6. if you've used apt-get upgrade * on the online machine do the same on the offline machine. this must not try to download anything from the internet.
  7. install all required applications that you've installed on the online machine on the offline machine by using apt-get install. this must not try to download anything from the internet.
that's it!
good luck!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
python-apt : unresolved dependencies installing packages on Debian squeeze 6.04 marmirelo Linux - Newbie 1 04-27-2012 07:19 PM
Problems installing vlc and its dependencies (DEB packages) Pr@veen Linux - Newbie 8 03-30-2012 06:54 AM
installing multiple packages and dependencies offline quidoloremipsum Debian 3 02-01-2009 09:21 AM
X wont run after installing some packages with dependencies MrVahn Linux - Software 1 06-03-2006 10:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration