FAIL: curtin command apt-config (KeyError: 'RELEASE')
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
curtin |
New
|
Undecided
|
Unassigned | ||
curtin (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
I'm getting the following error since I've updated the installer ISO image from the Ubuntu 20.04.3 LTS to Ubuntu 20.04.4 LTS:
Edit: Posted as attachment to avoid the formatting issues: https:/
```
finish: cmd-apt-config: FAIL: curtin command apt-config
Traceback (most recent call last):
File "/snap/
ret = args.func(args)
File "/snap/
handle_
File "/snap/
generate_
File "/snap/
entries = update_
File "/snap/
entry.uri = util.render_
File "/snap/
return basic_template_
File "/snap/
return BASIC_MATCHER.
File "/snap/
return str(selected_
KeyError: 'RELEASE'
'RELEASE'
```
I'm using Packer (https:/
The relevant part of my Ubuntu autoinstall configuration:
```
apt:
primary:
- arches: [default]
uri: "http://
sources_list: | # written by curtin custom template
deb $MIRROR/$RELEASE $RELEASE main restricted
deb $MIRROR/
deb $MIRROR/
deb $MIRROR/$RELEASE $RELEASE universe
deb $MIRROR/
deb $MIRROR/
```
I've based that on the following example configuration:
https:/
description: | updated |
The problem persists with Ubuntu 22.04 LTS (tested with one of the final RCs: https:/ /iso.qa. ubuntu. com/qatracker/ milestones/ 432/builds/ 247146/ downloads).
I did some analysis and the issue seems to be the "$MIRROR/$RELEASE" part of the custom template.
The relevant source code part (the generate_ sources_ list function in curtin/ commands/ apt_config. py): sources_ list(cfg, release, mirrors, target=None, arch=None): sources_ list sources. list" 'sources_ list', None) file(paths. target_ path(target, aptsrc)) (True)] default_ mirrors( entries, mirrors, target, arch) mirrors( entries, mirrors) dist(entries, release)
```
333 def generate_
334 """ generate_
335 create a source.list file based on a custom or default template
336 by replacing mirrors and release in the template
337 """
338 aptsrc = "/etc/apt/
339
340 tmpl = cfg.get(
341 from_file = False
342 if tmpl is None:
343 LOG.info("No custom template provided, fall back to modify"
344 "mirrors in %s on the target system", aptsrc)
345 tmpl = util.load_
346 from_file = True
347
348 entries = [SourceEntry(line) for line in tmpl.splitlines
349 if from_file:
350 # when loading from an existing file, we also replace default
351 # URIs with configured mirrors
352 entries = update_
353
354 entries = update_
355 entries = update_
```
After SourceEntry from python-apt ("from aptsources. sourceslist import SourceEntry") parses the custom template (s. apt.sources_list above), the data ("entries") looks as follows: sources. list', 'template': None, 'children': []} $RELEASE- updates' , 'dist': '$RELEASE-updates', 'comps': ['main', 'restricted'], 'comment': '', 'line': 'deb $MIRROR/ $RELEASE- updates $RELEASE-updates main restricted\n', 'file': '/etc/apt/ sources. list', 'template': None, 'children': []} $RELEASE- security' , 'dist': '$RELEASE- security' , 'comps': ['main', 'restricted'], 'comment': '', 'line': 'deb $MIRROR/ $RELEASE- security $RELEASE-security main restricted\n', 'file': '/etc/apt/ sources. list', 'template': None, 'children': []} sources. list', 'template': None, 'children': []} sources. list', 'template': None, 'children': []}
```
{'invalid': False, 'disabled': False, 'type': 'deb', 'architectures': [], 'trusted': None, 'uri': '$MIRROR/$RELEASE', 'dist': '$RELEASE', 'comps': ['main', 'restricted'], 'comment': '', 'line': 'deb $MIRROR/$RELEASE $RELEASE main restricted\n', 'file': '/etc/apt/
{'invalid': False, 'disabled': False, 'type': 'deb', 'architectures': [], 'trusted': None, 'uri': '$MIRROR/
{'invalid': False, 'disabled': False, 'type': 'deb', 'architectures': [], 'trusted': None, 'uri': '$MIRROR/
{'invalid': True, 'disabled': False, 'type': '', 'architectures': [], 'trusted': None, 'uri': '', 'dist': '', 'comps': [], 'comment': '', 'line': '\n', 'file': '/etc/apt/
{'invalid': False, 'disabled': False, 'type': 'deb', 'architectures': [], 'trusted': None, 'uri': '$MIRROR/$RELEASE', 'dist': '$RELEASE', 'comps': ['universe'], 'comment': '', 'line': 'deb $MIRROR/$RELEASE $RELEASE universe\n', 'file': '/etc/apt/
{'invalid'...