Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Wednesday, July 20, 2016 11:32 AM
From Christian Haudum (@chaudum) via Twitter who tweets:
“cloud-init fails to install packages (Ubuntu 16.04) because apt is locked. Is there an intervening process from Azure?
Customer referenced the details on: https://gist.github.com/chaudum/6bfc9e5a681d1d6d98b992f5085afe8a
I could only find this article yet, but has no effect: https://msftstack.wordpress.com/2016/05/12/extension-sequencing-in-azure-vm-scale-sets/
Customer also adds: "I'm testing the Crate.IO VM image that is currently only on staging, so I start the VM from the web portal using Resource Manager as deployment model. On a side note: programmatic deployment for the staging resource is enabled, but the vm image is not listed when I run `azure vm image list --publisher crate-io --location westus`. I also disabled monitoring and boot diagnostics and use no extensions, just to make sure.”
Customer was sent the documentation on http://askubuntu.com/questions/15433/unable-to-lock-the-administration-directory-var-lib-dpkg-is-another-process , however this did not help the customer
The customer also added: “this however does not explain why another process is using apt during the cloud-init phase :(”
Tweet URL: https://twitter.com/chaudum/status/755696478870466560 and through DM
Appreciate if you may be able to assist the customer on this matter.
Thanks,
@AzureSupport
All replies (4)
Friday, September 2, 2016 11:50 AM ✅Answered
I'm not 100% sure, but it seems that Ubuntu's autoupdate caused the conflicting access to apt. It's a bit strange that autoupdate is running while cloud-init is executed, since cloud-init usually heavily relies on apt.
Anyway, rebuilding the VM image solved the problem.
Thursday, July 21, 2016 11:06 AM
Hello Christian,
Thank you for posting on Microsoft Azure Forums!
We are currently checking on this and will revert to you soon. Appreciate your patience in this regard.
Thanks,
Loydon
Thursday, July 21, 2016 11:36 AM
Hello Christian,
The apt or aptitude is locked because another program might be using it. You might have to find out which program is running either update or install and then kill the process. Once done you may try to run your command again.
Also, you will have to run the commands using sudo access because it might be that the login you are using to access the machine does not have permissions to execute the commands.
If nothing works then it might be that a program process might have got stuck during execution which has locked apt. You would have to delete the lock and the lock file from the system cache.
The ways to do the above are referenced in http://askubuntu.com/questions/15433/unable-to-lock-the-administration-directory-var-lib-dpkg-is-another-process.
Kindly check this link and try to do the steps in the order mentioned above. Also, a reboot of the Linux VM should also be tried before attempting to delete the lock.
Let me know if this helps.
Regards,
Loydon
Thursday, July 21, 2016 1:37 PM
Hello Christian,
In addition to Loydon’s response!
Kindly ensure that the cloud-init configuration file is less than 64KB.
You may try to use a different ‘Script file’ for the “Custom Script For Linux” tool configuration and then test again. Ensure that the script file is not locked locally.
Just for testing, kindly check to see if you can deploy to a different region.
Clear cache/cookies, logout/re-login to the Azure portal and then try to re-deploy to see if this makes any difference.
If you haven’t checked these links already, kindly look into this for a sample on how to provision and pass custom data to an Ubuntu Linux VM
https://azure.microsoft.com/en-in/blog/custom-data-and-cloud-init-on-windows-azure/
Also check the detailed Walkthrough on adding a cloud-init script to the VM creation with the Azure CLI
Regards,
Ajay