1

I get various and inconsistent errors with apt on the official Ubuntu images (ami-83e769fb). I'm using Packer to build my AMI and it fails about 40% of the time. Rerunning the script often succeeds.

My script runs:

sudo apt-get clean all
sudo apt-get update

before install any packages.

Some times I get this error:

amazon-ebs: W: GPG error: http://archive.ubuntu.com/ubuntu artful InRelease: Splitting up /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_artful_InRelease into data and signature failed
amazon-ebs: E: The repository 'http://archive.ubuntu.com/ubuntu artful InRelease' is not signed.

Some times apt-get update hits http://us-west-2.ec2.archive.ubuntu.com/ubuntu ... other times it doesn't.

Other times packages are missing (like apache2 or python3).

I don't understand why this behaviour is inconsistent.

How can I get apt-get update on the official Ubuntu AMI to work consistently?

4
  • cross posted here and serverfault.com/questions/904080/…
    – Mystic
    Mar 22, 2018 at 17:39
  • If you still hit this, can you please post complete logs of the error? Focus on just one type of error as well if you could. The W and E lines you have right now are symptoms, sometimes having to do with disks that are corrupt, etc. But we need more logs to check.
    – dpb
    Apr 6, 2018 at 3:36
  • @dpb, I'd love to post more logs, if you can tell me what you're most interested in (syslog?). One of the problems is that this is intermittent, without clear steps to reproduce (I hit it using Packer with AWS in us-west-2). I encountered this over a dozen times across multiple days with new EC2 instances each time, so I don't think it's a hardware issue on the VM).
    – Mystic
    Apr 12, 2018 at 22:00
  • next time you get it, the same place you see the W: and E: entries that you pasted in above, copy the entire context and put it in a pastebin. From the command that was executed. I guess the whole packer log file. Also, please paste in the packer commands that you are running please exactly.
    – dpb
    Apr 13, 2018 at 2:18

1 Answer 1

0

Put this line on top of your script to make it non-interactive:

export DEBIAN_FRONTEND=noninteractive

To fix the issue use following commands in terminal:

wget https://keybase.io/docs/server_security/code_signing_key.asc
sudo apt-key add code_signing_key.asc

Btw:

apt-get clean all     # The "all" doesn't add anything to the command here. 

Use these commands instead :

Clean, Update and Upgrade :

sudo apt-get update 
sudo apt-get -y upgrade 
sudo apt-get autoremove 
sudo apt-get autoclean

Reference for fixing and setting up the Ubuntu AWS AMI tools : docs.aws.amazon.com//Setting Up the AMI Tools-Managing Signing Certificates

7
  • What does this do? Why would it help?
    – Mystic
    Mar 22, 2018 at 18:04
  • The first line make's it non-interactive that means it just "hides" the messages and errors. The second fix should fix the problem.
    – An0n
    Mar 22, 2018 at 18:07
  • This doesn't address why the problem is intermittent. Why does the official AMI sometimes have this problem but not other times?
    – Mystic
    Mar 22, 2018 at 18:09
  • 1
    This doesn't fix the problem of intermittent apt failures. I appreciate your time and concern, but I keep hitting intermittent issues.
    – Mystic
    Mar 22, 2018 at 19:00
  • 1
    That is the correct place for official Ubuntu image AMIs, yes. That's where I got the AMI id in the first place (they update it regularly). Thanks again for your time and effort. Sadly, I still hit intermittent issues.
    – Mystic
    Mar 22, 2018 at 19:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .