1

I have just configured a preseed file to include a local repository.

# Debian mirrors
d-i apt-setup/local0/comment string local mirror
d-i apt-setup/local0/repository string http://<repo_url>
d-i apt-setup/local0/key string http://<repo_key>

The main issue I am facing here is that the repo is not added to the sources.list, as the Releases file expired some days ago, so I am not able to grab some packages I need.

I know there is this option which can be added to the apt.conf file:

Acquire::Check-Valid-Until "false"

which will ignore the fact that the Releases file expired some time ago. However, I really need a way to include this same option in the preseed file. For such purpose, I have been looking for possible solutions:

  1. There is this german developer which seemed to be suffered from the same (https://lists.debian.org/debian-user-german/2012/04/msg00382.html). Basically, he is suggested to try adding:

    d-i apt-setup/check_valid_until boolean false
    

    but I have tried that option, and it was not successful.

  2. I thought about including something in the late_command stage to update the sources.list accordingly (i.e. executing

    in-target echo <my_mirror_information> >> /etc/apt/sources.list.d/custom.list
    in-target apt-get -o Acquire::Check-Valid-Until="false" update
    in-target apt-get upgrade
    

However, I do believe this is not the proper way of solving the issue, since there is an apt-setup section prepared to deal with these issues.

Is there any other solution which I can use in the preseed?

Thank you very much!

alvaroalo
  • 11
  • 1
  • 3
  • Did you find something that works? Did your #2 work for you? There is a ticket open at: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=771699 – Raymond Burkholder Mar 24 '16 at 20:43
  • If readers of my above comment go to the ticket, and reply to it, and ask for an agenda update, the ticket owner may see that the change would be useful, and may re-prioritize it. I am hoping. – Raymond Burkholder Mar 25 '16 at 15:09

3 Answers3

2

This works:

d-i partman/early_command string echo "echo 'Acquire::Check-Valid-Until \"false\";' > /target/etc/apt/apt.conf.d/02IgnoreValidUntil" > /usr/lib/apt-setup/generators/02IgnoreValidUntil ; chmod +x /usr/lib/apt-setup/generators/02IgnoreValidUntil
1

Having the same problem and not finding a solution either I finally got it working using preseed with:

d-i partman/early_command string echo "echo 'Acquire::Check-Valid-Until \"false\";' > /target/etc/apt/apt.conf.d/02IgnoreValidUntil" > /usr/lib/apt-setup/generators/02IgnoreValidUntil ; chmod +x /target/etc/apt/apt.conf.d/02IgnoreValidUntil

This is for Debian/Jessie

Hugo Walter
  • 3,048
  • 1
  • 16
  • 10
  • This won't work. When the `partman/early_command` is run `/target` doesn't even exist... – GnP Sep 10 '15 at 17:25
  • This answer has an error. The `chmod` command is targeting the wrong file. @Stefan Staedtler's answer is the same as this one but with the error fixed. – Vicente Olivert Riera Jul 09 '21 at 16:39
0

d-i preseed/run string script.sh

inside "script.sh":

fix_apt_repo_expire()
{
local APT_DIR="/target/etc/apt/apt.conf.d"
while [ ! -d "$APT_DIR" ]; do sleep 1; done
echo 'Acquire::Check-Valid-Until "false";' > "$APT_DIR"/90ignore-repo-expiry
}

fix_apt_repo_expire &
Tomek
  • 1