1

I am trying to access a local apt mirror which is on a usb drive. The file tree on the drive is

/apt-mirror
    /mirror
        /archive.ubuntu.com
             /dists
             /pool
    /skel
    /var

The drive is /media/truecrypt1, so I added the following line to my sources list:

deb file:///media/truecrypt1/apt-mirror trusty main restricted universe multiverse

When I do sudo apt-get update I get lots of errors like:

Err file: trusty/main Sources
   File not found

Then it tries to reach http://us.archive.ubuntu.com which of course does not work because it is an offline machine, so I get a whole stream of errors while it fails to connect to that site.

If I try to install a package, for example:

sudo apt-get install astyle

It tries to do it, but then fails because it cannot connect to us.archive.unbuntu.com.

How can I make progress here?

Tyler Durden
  • 5,411
  • 16
  • 57
  • 96

2 Answers2

1

You should build a repository in a local directory and point a file: URI entry to your APT sources (see URI SPECIFICATION in man sources.list):

deb file:/home/user/repository

To make apt work, you need to create a list of packages (Packages.gz) for APT to consume. This is explained in detail here. For your case, it should be quite easy. I refer you to the "Trivial Repositories" section of the manual. It should be as easy as changing to, say, /home/user/repository and running

dpkg-scanpackages binary /dev/null | gzip -9c > binary/Packages.gz

Then after a apt-get update, the packages should become available. Perhaps if you want to make this source take precedence over others, you need to assign it a higher priority; for that see the APT manual pages.

0

You haven't specified the complete path to the mirror in your sources.list file.

Try:

deb file:///media/truecrypt1/apt-mirror/mirror/archive.ubuntu.com trusty main \
    restricted universe multiverse

(line-break added to avoid horizontal scrolling. should be all on one line, without the \).

cas
  • 1
  • 7
  • 119
  • 185
  • after making this change I still get the same errors (trusty/main Sources File not found) and the machine is still trying to contact us.archive.ubuntu.com when I try to install a package – Tyler Durden Mar 27 '16 at 20:00
  • 1. since it's a `deb` entry and not `deb-src`, it's hard to see how it has anything to do with an error message abouta Sources file not being found. 2. if it's trying to download from us.archive.ubuntu.com that would be because you have another sources.list entry telling it to do so....completely unrelated to this entry. try adding the actual output of `apt-get update` to your question. – cas Mar 27 '16 at 21:33