Amazon EC2 AMI linux2 amazon-linux-extras basearch error

0

sudo amazon-linux-extras install
Traceback (most recent call last): 
  File "/usr/lib64/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/lib/python2.7/site-packages/amazon_linux_extras/__main__.py", line 35, in <module>
    sys.exit(cli_main([arg for arg in argv[1:] if arg != "-v"]))
  File "/usr/lib/python2.7/site-packages/amazon_linux_extras/cli.py", line 419, in main
    action(args)
  File "/usr/lib/python2.7/site-packages/amazon_linux_extras/cli.py", line 245, in cmd_install
    catalog = get_catalog(insist_stable_ordinal=any(re.match(r"^[0-9]+$", arg) for arg in args))
  File "/usr/lib/python2.7/site-packages/amazon_linux_extras/software_catalog.py", line 120, in get_catalog
    catalog = fetch_new_catalog()  
  File "/usr/lib/python2.7/site-packages/amazon_linux_extras/software_catalog.py", line 92, in fetch_new_catalog
    url = CATALOG_URL.format(**yumvars)
KeyError: u'basearch'

Getting this error saying Basesearch key error. Have to install nginx

Sijo James John

Posted 2019-06-19T15:38:14.633

Reputation: 1

Answers

0

Ok figured out the problem

First find the base arch with this code

python -c 'import yum, pprint; yb = yum.YumBase(); pprint.pprint(yb.conf.yumvar, width=1)'

{'arch': 'ia32e',

'awsdomain': 'amazonaws.com', 'awsregion': 'eu-*****', 'basearch': 'x86_64', 'product': 'core', 'releasever': '2', 'target': 'latest', 'uuid': '**************'}

Then edit

nano /usr/lib/python2.7/site-packages/amazon_linux_extras/software_catalog.py

to change the line

for name, default in (("awsdomain", "amazonaws.com"), ("awsregion", "default"), ("releasever", "2"), ("basearch", None)):

to

for name, default in (("awsdomain", "amazonaws.com"), ("awsregion", "default"), ("releasever", "2"), ("basearch", "x86_64")):

The problem is that the basearch default is set as None which causes the dict to not have a key value pair for basearch.

Sijo James John

Posted 2019-06-19T15:38:14.633

Reputation: 1