[elbe-devel] [PATCH 3/3] RFC: elbepack: only provide resolv.conf during download step
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Wed Apr 24 12:37:22 CEST 2024
Certain package expect to manage /etc/resolv.conf.
For example the resolvconf package contains a post-install script that
check if no /etc/resolv.conf exists and if it does, it gets created as a
symlink to ../run/resolvconf/resolv.conf.
However the way elbe downloads and installs packages requires it to have
a working /etc/resolv.conf in the target.
This /etc/resolv.conf is copied from the initvm through the excursion
mechanism.
To enable both, download with /etc/resolv.conf and installation without
/etc/resolv.conf, split the installation step into two phases, download
and installation.
Drawbacks:
* If a package installation script expects network connection this now
fails. Arguably this would be bad practice in any case.
* The current implementation also disables networking during finetuning.
This could be changed.
Closes: https://github.com/Linutronix/elbe/issues/274
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
elbepack/efilesystem.py | 1 -
elbepack/elbeproject.py | 9 ++++++++-
elbepack/rpcaptcache.py | 4 ++++
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/elbepack/efilesystem.py b/elbepack/efilesystem.py
index 18235568d3a5..fda963787d05 100644
--- a/elbepack/efilesystem.py
+++ b/elbepack/efilesystem.py
@@ -273,7 +273,6 @@ class ChRootFilesystem(ElbeFilesystem):
def __enter__(self):
self._excursions = [
- Excursion('/etc/resolv.conf'),
Excursion('/etc/apt/apt.conf'),
Excursion('/usr/sbin/policy-rc.d'),
]
diff --git a/elbepack/elbeproject.py b/elbepack/elbeproject.py
index a446907d3f61..53d95c479c3e 100644
--- a/elbepack/elbeproject.py
+++ b/elbepack/elbeproject.py
@@ -22,7 +22,7 @@ from elbepack.dump import (
dump_initvmpkgs,
elbe_report,
)
-from elbepack.efilesystem import TargetFs, extract_target
+from elbepack.efilesystem import TargetFs, extract_target, Excursion
from elbepack.elbexml import ElbeXML, NoInitvmNode, ValidationError, ValidationMode
from elbepack.filesystem import size_to_int
from elbepack.finetuning import do_prj_finetuning
@@ -1004,6 +1004,9 @@ class ElbeProject:
logging.info('Removed Release.gpg file!')
with target:
+ resolv_conf = Excursion('/etc/resolv.conf')
+ resolv_conf.do(target.rfs)
+
# First update the apt cache
try:
self.get_rpcaptcache(env=target).update()
@@ -1065,6 +1068,10 @@ class ElbeProject:
# the functions cleans up to much
# self.get_rpcaptcache().cleanup(debootstrap_pkgs + pkgs)
+ self.get_rpcaptcache(env=target).fetch_archives()
+
+ resolv_conf.end(target.rfs)
+
try:
self.get_rpcaptcache(env=target).commit()
except SystemError as e:
diff --git a/elbepack/rpcaptcache.py b/elbepack/rpcaptcache.py
index b9985414091f..a71a2e10b902 100644
--- a/elbepack/rpcaptcache.py
+++ b/elbepack/rpcaptcache.py
@@ -237,6 +237,10 @@ class RPCAPTCache(InChRootObject):
self.cache.update(fetch_progress=ElbeAcquireProgress())
self.cache.open(progress=ElbeOpProgress())
+ def fetch_archives(self):
+ print('Fetching packages...')
+ self.cache.fetch_archives(ElbeAcquireProgress())
+
def commit(self):
os.environ['DEBIAN_FRONTEND'] = 'noninteractive'
os.environ['DEBONF_NONINTERACTIVE_SEEN'] = 'true'
--
2.44.0
More information about the elbe-devel
mailing list