Troubles adding local repository for apt-get

Hi!
I want to use local packages repository with internet at the same time. So that packages that arleady exists in local repository will not be downloaded from internet.
Simply copying of packages to /etc/apt/cache/archives/ don't suit for me because of some reasons.
My problem is that apt-get downloads all packages from internet, in spite of greater priority of local repository.

What I do:

In /root/packages/debs/ I have packages for local repository.

Creating listing of local rep. packages:
cd /root/packages/
dpkg-scanpackages -a *_all.deb debs > Packages
gzip -9c Packages > debs/Packages.gz

Adding new source:
/etc/apt/sources.list:
deb file:/root/packages debs/
deb http://ftp.debian.org/debian sid main non-free contrib
deb-src http://ftp.debian.org/debian sid main non-free contrib

Setting packages from local rep. greater priority:
/etc/apt/preferences:
Package: *
Pin: origin
Pin-Priority: 999
(Note that syntax there differs from manual example, < Don't work! Or I mistaken?)

Checking:
bob:~# apt-cache policy
Package files:
100 /var/lib/dpkg/status
release a=now
500 http://ftp.debian.org sid/contrib Packages
release o=Debian,a=unstable,l=Debian,c=contrib
origin ftp.debian.org
500 http://ftp.debian.org sid/non-free Packages
release o=Debian,a=unstable,l=Debian,c=non-free
origin ftp.debian.org
500 http://ftp.debian.org sid/main Packages
release o=Debian,a=unstable,l=Debian,c=main
origin ftp.debian.org
999 file: debs/ Packages
Pinned packages:
bob:~#

bob:~# apt-cache policy sauerbraten-data
sauerbraten-data:
Installed: (none)
Candidate: 0.0.20070413-1
Version table:
0.0.20070413-1 0
999 file: debs/ Packages
500 http://ftp.debian.org sid/non-free Packages
bob:~#

That's it! Local repository have greater priority!
But
apt-get install sauerbraten-data
trying to download package from internet! :(

If I remove other sources from /etc/apt/sources.list and left only local repository, apt-get will install from local repository, so local rep. seems to be working.

Any ideas?

add:
Solution founded! See posts below.

Pay attention to pin priority comment!

No votes yet

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Troubles adding local

Check the docs again? I think '1000' is the lowest priority in the repositories, so '999' won't do anything. Maybe you meant to use '9999'?

Troubles adding local

Documentation says that priority 999 is great for my purposes.

Troubles adding local

Ah, OK, I haven't read the docs for about 2 years.

Well, according to the new docs (man apt_preferences), 990-1000 will install from the pinned repository only if the installed version is not more recent. You just need to think carefully about what you really want and then work it out. For example, I usually only have 'Pin' priorities set for certain software which I really don't want to change without reviewing the replacement. In your case you probably want to set a high enough priority to force a 'downgrade'. What you're trying to do is tricky because you're playing with 'sid' and that changes on a daily basis. Even in the case of 'Etch' it wouldn't be a very good solution because you could override security updates (unless you give them an even higher priority).

Troubles adding local

I understand that 999 is probably not good priority, but now I just want that apt-get used packages from local repository and internet at the same time.
I tried to set different priorities from -100 to 9999, but showed above package sauerbraten-data still downloads from internet!

Is this a bug? Or I dont understand meaning of repository priority?

Troubles adding local

According to the docs it should be:

Pin: origin ""

to pin to local files; otherwise you'd supply a "fully qualified domain name" such as "www.mymirror.org"

Troubles adding local

If i write:
/etc/apt/preferences:

Package: *
Pin: origin ""
Pin-Priority: 999

Then:

bob:~# apt-cache policy sauerbraten-data
sauerbraten-data:
Installed: (none)
Candidate: 0.0.20070413-1
Version table:
0.0.20070413-1 0
500 file: debs/ Packages
500 http://ftp.debian.org sid/non-free Packages

Priority dont sets!! (this probably bug...) And packages downloads from internet.

If i write:
/etc/apt/preferences:

Package: *
Pin: origin
Pin-Priority: 999

Then

bob:~# apt-cache policy sauerbraten-data
sauerbraten-data:
Installed: (none)
Candidate: 0.0.20070413-1
Version table:
0.0.20070413-1 0
999 file: debs/ Packages
500 http://ftp.debian.org sid/non-free Packages

Priorities became as I want, but packages still downloads from internet :(

Troubles adding local

I'm all out of ideas, aside from reading the source code for 'apt-get' to see exactly how the priority system works.

Troubles adding local

pinniped! Thanks for your replies anyway!
I'll try to dig deeper.
And may the source be with me...

Solution founded!

I found the solution!

In the sources of apt package (apt-0.7.2) I found: apt-pkg/acquire-item.cc:1252:

// check if we have one trusted source for the package. if so, switch
// to "TrustedOnly" mode

Packages from local repository are not signed, and as writed in source code if in list of packages sources is trusted source (with signed packages) then will be used only trusted sources, if it is not overrided.

To override usage only trusted source add to /etc/apt/apt.conf:

APT::Get::AllowUnauthenticated "true";

But! This will disable warnings about "not trusted source"!
apt-get will just write warning:
WARNING: The following packages cannot be authenticated!
And don't prompt are you sure want to install.
aptitude will not write any warning at all.

So this is not "true" solution, but it acceptable for me.

Also dont use pin priority 999, because it will tell apt-get to install any version of package from local repository, even if it is downgrading!
I'll recommend something like this in /etc/apt/preferences:

Package: *
Pin: origin
Pin-Priority: 510

Solution founded!

Wow - that didn't take you long. :)

I don't understand why your local packages are not signed - I would have expected them to have the signature from the original source. I guess you could always write a script to sign them all with your own key, and if you set up gpg to trust your own keys then that should get rid of the "untrusted" problem.

It sounds like that documentation needs updating...

Re: Troubles adding local repository for apt-get

I want to thank the post author for posting this problem and also thank everyone for finding a solution. You really saved me by solving this problem. Thanks again and keep up the good work!
---
Mary-Anne Davis, soft bucuresti affiliate.

Syndicate content