920201 - installing packages based on their dependencies
Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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.
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 .
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
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:
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:
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
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.
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?!
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?
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.
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
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.
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
you don't need to use dpkg -i. you may forget it forever.
when ubuntu finds a package already downloaded, it will never download it again.
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.
there's no need to create an apt-mirror or an offline repository out of /var/cache/apt/archives.
so the solution is:
install all required applications by apt-get install in an online server.
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.
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.
move (or copy) all files in /var/lib/apt/lists into the flash disk.
move (or copy) all files in the flash in the appropriate (corresponding) directories of the offline machine.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.