Merge ~ahasenack/ubuntu/+source/base-files:groovy-handle-was-removed-1895302 into ubuntu/+source/base-files:ubuntu/devel
Status: | Merged |
---|---|
Approved by: | Andreas Hasenack |
Approved revision: | c7a8fc156ef1cf3a752e7ab383d7ffc2fbd2e60d |
Merged at revision: | c7a8fc156ef1cf3a752e7ab383d7ffc2fbd2e60d |
Proposed branch: | ~ahasenack/ubuntu/+source/base-files:groovy-handle-was-removed-1895302 |
Merge into: | ubuntu/+source/base-files:ubuntu/devel |
Diff against target: |
64 lines (+25/-7) 3 files modified
debian/changelog (+14/-0) debian/motd-news-config.postinst (+1/-1) debian/postinst.in (+10/-6) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Canonical Server | Pending | ||
Christian Ehrhardt | Pending | ||
Review via email: mp+390766@code.launchpad.net |
This proposal supersedes a proposal from 2020-09-15.
Description of the change
Handle the creation and removal of the /etc/default/
I have two choices here:
a) handle the creation and removal of that file (this MP)
b) give up trying to handle that file, and just cleanup: https:/
To recap, the idea behind /e/d/motd-
- user had base-files and ubuntu-server from before the split, meaning /e/d/motd-news is a config file part of base-files
- motd-news is enabled (ENABLED=1 in /e/d/motd-news)
- in an erroneous attempt to disable the service, the user removes the /e/d/motd-news file. ENABLED doesn't get set, and the motd-news script just exits
In the above scenario, without the .wasremoved feature, if the user upgraded to the updated packages with the spit, then /e/d/motd-news would be reinstated because it's now part of the motd-news-config package. This would re-enable the motd-news feature, something we want to be careful about.
The implementation suffers from some problems, though:
- a fresh install of base-files, like done via debootstrap, will create the .wasremoved file. If you then install motd-news-config (via apt install ubuntu-server, for example), the motd-news-config postinst fill find the .wasremoved file, see it's a fresh install of motd-news-config, and disable motd-news. This is the current situation in the groovy lxd images, for example
- if you just have base-files installed, no motd-news-config, and then reinstall or upgrade base-files, the .wasremoved will be created
To address those, this MP (choice (a)) does:
- motd-news-config postinst: always remove the .wasremoved file in configure if found, regardless if /etc/default/
- base-files postinst: guard the creation of .wasremoved with:
- Only during an upgrade
- Only if ubuntu-server is installed (via a dpkg -l check)
If a user again decides to erroneously disable motd-news by removing /e/d/motd-news, then an upgrade of base-files, motd-news-config and ubuntu-server will go through the creation and removal of the .wasremoved file, but no new /e/d/motd-news config file will be created or changed, and motd-news will at least remain disabled. But it's extra unnecessary churn, as the corner case it handles only happens when upgrading from before the motd-news-config split.
The dpkg -l check for ubuntu-server relies on ubuntu-server depending (and not just recommending) on motd-news-config. I'm a bit afraid of the dpkg -l call in base-files' postinst:
- Locking issues?
- I'm checking for ^i, should I be looking for other cases? Other flags?
- At least dpkg is already installed, as I see other calls to it in the same postinst
If we find other issues in these maintainer scripts regarding the motd-news-config split, or introduce new ones with these changes, it will get harder and harder to fix each time. That's why I also have to consider simply giving up and living with the corner case we tried to handle in the beginning, and that is this diff: https:/
I have PPAs for both scenarios, with groovy and focal packages (just not yet bionic or xenial):
Give up handling of .wasremoved: https:/
Try to fix handling of .wasremoved: https:/
May the best one win :)
I'm for handling it properly and like the approach.
There will always be one issue more with it, but at least the known ones are solved if we do it this way .. :-/
The former had two inline comments that would be useful to address.