archinstall
archinstall copied to clipboard
Crashes if `additional-repositories` is omitted from config
When running the archinstall script from the command line, if additional-repositories
is omitted from the config, this causes a crash.
Config files:
user_configuration.json
{
"audio": "pulseaudio",
"config_version": "2.5.0",
"debug": false,
"gfx_driver": "VMware / VirtualBox (open-source)",
"harddrives": [
"/dev/sda"
],
"mount_point": null,
"nic": {
"dhcp": true,
"dns": null,
"gateway": null,
"iface": null,
"ip": null,
"type": "iso"
},
"plugin": null,
"profile": {
"path": "/usr/lib/python3.10/site-packages/archinstall/profiles/xorg.py"
},
"script": "guided",
"silent": true,
"version": "2.5.0"
}
user_disk_layout.json
{
"/dev/sda": {
"partitions": [
{
"boot": true,
"encrypted": false,
"filesystem": {
"format": "fat32"
},
"mountpoint": "/boot",
"size": "512MiB",
"start": "1MiB",
"type": "primary",
"wipe": true
},
{
"encrypted": false,
"filesystem": {
"format": "ext4",
"mount_options": []
},
"mountpoint": "/",
"size": "100%",
"start": "513MiB",
"type": "primary",
"wipe": true
}
],
"wipe": true
}
}
user_credentials.json
{
"!users": [
{
"!password": "examplefakepassword",
"sudo": true,
"username": "exampleusername"
}
]
}
Installation command:
archinstall --silent --config user_configuration.json --creds user_credentials.json --disk_layouts user_disk_layout.json
Error:
Traceback (most recent call last):
File "/usr/bin/archinstall", line 8, in <module>
sys.exit(run_as_a_module())
File "/usr/lib/python3.10/site-packages/archinstall/__init__.py", line 281, in run_as_a_module
script.execute()
File "/usr/lib/python3.10/site-packages/archinstall/lib/profiles.py", line 195, in execute
self.spec.loader.exec_module(sys.modules[self.namespace])
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/usr/lib/python3.10/site-packages/archinstall/examples/guided.py", line 307, in <module>
perform_installation(archinstall.storage.get('MOUNT_POINT', '/mnt'))
File "/usr/lib/python3.10/site-packages/archinstall/examples/guided.py", line 137, in perform_installation
with archinstall.Installer(mountpoint, kernels=archinstall.arguments.get('kernels', ['linux'])) as installation:
File "/usr/lib/python3.10/site-packages/archinstall/lib/installer.py", line 159, in __exit__
raise args[1]
File "/usr/lib/python3.10/site-packages/archinstall/examples/guided.py", line 184, in perform_installation
enable_testing = 'testing' in archinstall.arguments.get('additional-repositories', None)
TypeError: argument of type 'NoneType' is not iterable
It seems the error arises from the following lines expecting an iterable, so perhaps changing the default value from None
would fix it.
https://github.com/archlinux/archinstall/blob/5c3c1312a49e1c110d4c5825fbb8242868544900/examples/guided.py#L184-L185
However, I'm a bit confused because the config schema seems to suggest that this should be an enum
value, not an iterable (so an equality check would suffice). But this is further complicated by the fact that the TUI seems to suggest you can select both testing
and multilib
(although to make things more confusing, if you try to select both, only one will be inserted into the output string array value, e.g.
"additional-repositories": [
"multilib"
],
is the result I get when I tried to check both boxes).
It looks like the schema should be updated, or the code, or maybe both?
I'm also got this error, but i did't check additional-repo. if remove --silent flag, they can be install success , by manual operating, but I need this((
The feature in the guided installer that allows one to save a user_configuration.json
file does not populate defaults shown in the guided installer and other arguments that are needed for successful execution of archinstall. When using the --silent
argument to archinstall
it also does not populate these same arguments if they are missing from the user_configuration.json
file. Instead archinstall crashes when it arrives upon a missing argument.
One can capture these defaults in a user_configuration.json
file by running archinstall
using --dry-run
instead of --silent
. This will open the guided installer but will not proceed with installation when install is selected from the menu. Select install and this will create the file /var/log/archinstall/user_configuration.json
populated with the defaults shown in the guided installer. Using this configuration file with the --silent
argument provided to archinstall
will avoid any crashing that was previously caused by missing one of these arguments.
This particular crash happens because an argument of "additional-repositories": []
is expected when no additional repositories are selected. An attempt to access this array which should be empty gets NoneType because of the lack of an additiona-repositories
argument. Here is a diff of the user_configuration.json
file @wpaivine2 provided and one created using the steps given above.
{
+ "HSM": null,
+ "__separator__": null,
+ "additional-repositories": [],
+ "archinstall-language": "English",
"audio": "pulseaudio",
+ "bootloader": "systemd-bootctl",
"config_version": "2.5.0",
"debug": false,
"gfx_driver": "VMware / VirtualBox (open-source)",
"harddrives": [
"/dev/sda"
],
+ "hostname": "archlinux",
+ "kernels": [
+ "linux"
+ ],
+ "keyboard-layout": "us",
+ "mirror-region": {},
"mount_point": null,
"nic": {
"dhcp": true,
"dns": null,
"gateway": null,
"iface": null,
"ip": null,
"type": "iso"
},
+ "ntp": true,
+ "packages": [],
"plugin": null,
"profile": {
"path": "/usr/lib/python3.10/site-packages/archinstall/profiles/xorg.py"
},
+ "save_config": null,
"script": "guided",
- "silent": true,
+ "silent": false,
+ "swap": true,
+ "sys-encoding": "UTF-8",
+ "sys-language": "en_US",
+ "timezone": "UTC",
"version": "2.5.0"
}
I just confirmed that this should not longer happen