cuteftp 2018-1-31 10:18
解決 AWS yum出現Errno 14 HTTP Error 401: Authorization Required 的問題
最近使用 snapshot 生成一台 EC2 後,發現yum 都會出現錯誤無法安裝套件,找了很多問件...才終於知道問題出在那~<br><br>問題說明:<br>[quote]<br>root@ip-**.**.**.** ~# yum install htop<br>Loaded plugins: amazon-id, fastestmirror, product-id, rhui-lb, security<br>Loading mirror speeds from cached hostfile<br>* epel: mirror.itc.virginia.edu<br>* rhui-us-east-1-client-config-server-5: rhui2-cds01.us-east-1.aws.ce.redhat.com<br>* rhui-us-east-1-rhel-server: rhui2-cds01.us-east-1.aws.ce.redhat.com<br>epel | 3.6 kB 00:00<br>https://rhui2-cds01.us-east-1.aws.ce.redhat.com/pulp/repos//rhui-client-config/rhel/server/5/x86_64/os/repodata/repomd.xml: Errno 14 HTTP Error 401: Authorization Required<br>Trying other mirror.<br>https://rhui2-cds02.us-east-1.aws.ce.redhat.com/pulp/repos//rhui-client-config/rhel/server/5/x86_64/os/repodata/repomd.xml: Errno 14 HTTP Error 401: Authorization Required<br>Trying other mirror.<br>Error: Cannot retrieve repository metadata (repomd.xml) for repository: rhui-us-east-1-client-config-server-5. Please verify its path and try again<br><br>root@ip-**.**.**.** ~# <font color="Red">curl http://169.254.169.254/latest/dynamic/instance-identity/document</font><br>{<br>"instanceId" : "i-ac64a0cf",<br>"billingProducts" : null,<br>"version" : "2010-08-31",<br>"region" : "us-east-1",<br>"accountId" : "****",<br>"imageId" : "ami-7cdba915",<br>"kernelId" : null,<br>"ramdiskId" : null,<br>"architecture" : "x86_64",<br>"pendingTime" : "2013-07-02T16:42:56Z",<br>"instanceType" : "m1.medium",<br>"availabilityZone" : "us-east-1b",<br>"devpayProductCodes" : null,<br>"privateIp" : "**.**.**.**" <br>[/quote]<br><br><font color="Red">如果 billingProducts 出現 null,就代表這個 EC2 Broken</font><br><br>This is a known issue when you create AMI from snapshot of a Redhat instance volume, the reason is that in this process the "billingProducts" is set to null.<br><br>兩種解法如下:<br>To workaround the issue please try one of these two options:<br><br>1- From the modified instance ( if you still have it ) create an AMI directly.<br><br>2- If the only source that you have is the snapshot then take these steps:<br><br>- Launch a new instance from a good RHEL AMI, stop and detach the root EBS volume.<br><br>- Stop the broken instance, detach all EBS volumes and attach to the new instance and restart ( remembering to associate the broken instance's EIP if applicable )<br><br>- Alternatively you could snap-shot the broken instance's EBS volumes, and attach volumes created from these snapshots to the new instance.<br><br><font color="Blue">最簡單的解法就是選第一種: 重新在 EC2 create AMI,再從新建一台EC2 就沒問題了~</font><br><br><br>參考官方說明:<br>https://forums.aws.amazon.com/thread.jspa?threadID=128658<br><br>