5

I have two Ubuntu system and they are exactly the same.

I execute several apt-get install XXX on one system and I can get the relative deb packages at /var/cache/apt/archives/. Then I copy these deb files to the other system at /home/me/archives/ and execute apt-get install ./*.deb.

I thought it should install the deb packages locally but to my surprise, it still redownload all deb files. I don't know why.

There are three things weird:

  1. When I execute apt-get install ./*.deb, lots of messages show up:

    Note, selecting 'python-rospkg' instead of './python-rospkg_1.1.4-100_all.deb'
    Note, selecting 'python-serial' instead of './python-serial_3.0.1-1_all.deb'
    Note, selecting 'python-service-identity' instead of './python-service-identity_16.0.0-2_all.deb'
    Note, selecting 'python-setuptools' instead of './python-setuptools_20.7.0-1_all.deb'
    Note, selecting 'python-sip-dev' instead of './python-sip-dev_4.17+dfsg-1build1_amd64.deb'
    Note, selecting 'python-sip' instead of './python-sip_4.17+dfsg-1build1_amd64.deb'
    Note, selecting 'python-six' instead of './python-six_1.10.0-3_all.deb'
    
  2. I try to install one of the deb packages, for example, apt-get install libwebp-dev_0.4.4-1_amd64.deb, but I always get the error:

    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    E: Unable to locate package libwebp-dev_0.4.4-1_amd64.deb
    E: Couldn't find any package by glob 'libwebp-dev_0.4.4-1_amd64.deb'
    E: Couldn't find any package by regex 'libwebp-dev_0.4.4-1_amd64.deb'
    
  3. I've also tried to use dpkg -i *.deb to install these local deb packages, but it produced the error about missing some packages, then I executed apt install -f to get the missing deb package from the Internet, but the missing packages coming from the Internet and the original local packages are exactly the same...

In a word, my system cannot install local deb packages as expected.

9
  • 3
    Possible duplicate of How do I install a .deb file via the command line?
    – Olorin
    Commented Apr 24, 2018 at 10:57
  • AFAIK only new versions of apt support installing a deb file directly. Which version is this?
    – Olorin
    Commented Apr 24, 2018 at 10:57
  • @Olorin check my re-edition.
    – Yves
    Commented Apr 24, 2018 at 11:02
  • What does it mean when you say you "have no right to use dpkg -i"? If you have the rights to use apt, it doesn't make sense to not have rights to use dpkg.
    – Olorin
    Commented Apr 24, 2018 at 11:03
  • 1
    You need to be very careful when copying packages out of your apt archives from one system to another. It's entirely possible the packages won't work on the other system because you don't have certain dependencies or certain library versions or because of a different architecture or a different OS version. You should only ever do what you did with copying the .deb files from your local apt archive as an absolute last resort.
    – Thomas Ward
    Commented Apr 24, 2018 at 19:30

2 Answers 2

3

"apt-get" command cannot be used like you want. You may install with it only from repositories. But the correct way is to use "dpkg" or "apt" commands:

sudo dpkg -i package_name.deb

or

sudo apt install package_name.deb

Using the dpkg may broke the package dependencies, which do not resolve it automatically so you can use apt-get to resolve the issue:

sudo apt-get install -f
4
  • As I said, sudo apt install package_name.deb doesn't work, it gives me the error.
    – Yves
    Commented Apr 24, 2018 at 12:48
  • sudo gdebi ./package_name.deb : gdebi is the local package installer (since 2006), which will also download and install dependencies. Commented Apr 24, 2018 at 12:50
  • Also, I've tried 'sudo dpkg -i * && sudo apt install -f', this will produce the same deb packages at /var/cache/apt/archives/, and if I execute apt install ./*.deb for the new deb packages again, it will f**king download again! GOD, I'm dying now...
    – Yves
    Commented Apr 24, 2018 at 12:59
  • 1st comment: nowhere mentions "sudo apt install package_name" in your question. "apt" and "apt-get" are two different commands. 3rd. comment: download again the package in separate folder. Navigate to it. And execute "sudo dpkg -i package_name.deb"
    – Stefan
    Commented Apr 24, 2018 at 13:36
1

This problem comes here:

I executed several apt install XXX, which are about python module, such as python-numpy etc. I thought it would depend on python2.7 so python2.7 would be downloaded and installed automatically but I was wrong (maybe it's because python3.5 has been installed by default? I don't know exactly the reason). Meaning that I should execute one more command: apt install python2.7. Otherwise, apt install ./*deb will redownload all of packages again. Also, I don't know why but dpkg -i *.deb && apt install -f didn't install python2.7.

Anyway, after installing python2.7 and put its deb package with other packages together, I can install all of them locally with the command apt install ./*.deb.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .