Is there any setting in the preseed file to ignore the Release 'Valid_Until' option?

3.1k Views Asked by At

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!

3

There are 3 best solutions below

0
On

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 &
0
On

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
2
On

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