Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apt: reset only diverted files on deconfigure #1701

Merged
merged 1 commit into from
Jun 23, 2023

Conversation

ogayot
Copy link
Member

@ogayot ogayot commented Jun 22, 2023

Before starting the actual installation, we make changes to etc/apt directory in an overlay so that the packages are pulled from the media instead of the network.

At the end of installation, we need to revert these changes. We used to replace the etc/apt directory on the target by the etc/apt directory from the configured overlay.

This is a simple way to revert the temporary changes. Unfortunately, it also removes configuration files that extra packages may have installed in etc/apt. For instance, when installing an OEM meta-package, a etc/apt/sources.list.d/.list gets installed.

If we reset etc/apt to its content from the configured overlay, we lose this file.

Fixed by selectively discarding changes to the files that subiquity modified.

Before starting the actual installation, we make changes to etc/apt
directory in an overlay so that the packages are pulled from the media
instead of the network.

At the end of installation, we need to revert these changes. We used to
replace the etc/apt directory on the target by the etc/apt directory
from the configured overlay.

This is a simple way to revert the temporary changes. Unfortunately, it
also removes configuration files that extra packages may have installed
in etc/apt. For instance, when installing an OEM meta-package, a
etc/apt/sources.list.d/<oem-meta-package>.list gets installed.

If we reset etc/apt to its content from the configured overlay, we lose
this file.

Fixed by selectively discarding changes to the files that subiquity
modified.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Copy link
Collaborator

@mwhudson mwhudson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for splitting this out. I'm tempted to suggest (and knowing what you're like you probably thought of this too) the introduction of some kind of stateful object to track the customizations we make to the apt dir and that knows how to undo them but I think we should resist that until / unless this all gets a bit more involved!

@ogayot
Copy link
Member Author

ogayot commented Jun 23, 2023

I'm tempted to suggest (and knowing what you're like you probably thought of this too) the introduction of some kind of stateful object to track the customizations we make to the apt dir and that knows how to undo them but I think we should resist that until / unless this all gets a bit more involved!

I resisted the urge to go for this approach :) But yes, just like we do for mounts, I wanted to build a stack of AptDivert objects that get undone in reverse order.

@ogayot ogayot merged commit ef7668d into canonical:main Jun 23, 2023
@ogayot ogayot deleted the etc-apt-discard-selectively branch June 23, 2023 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants