[BUG] /proc/net/route failure to find primary interface leads to unhelpful error about second DVD mount attempt
- Dominant language
- Python
- Stars
- 581
- Forks
- 397
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 9
Description
**Describe the bug**
Getting `None` for the primary interface of a Linux VM can lead to an unhandled error attempting to load `/etc/sysconfig/network-scripts/ifcfg-` (should trail with primary interface identifier, such as `eth0`). See [primary interface detection code](https://github.com/Azure/WALinuxAgent/blob/f3df4f33fb95583e8e1c34921f0ed82a15d18000/azurelinuxagent/common/osutil/default.py#L916) . Since that is the actual issue, should that be what throws the Provisioning Error and subsequent Provisioning Failure?
As a result of this error, the Daemon logs Warning `Daemon ended with exception -- Sleep 15 seconds and restart daemon`. This restart then leads to second attempt at provisioning. As noted in #1456 , the DVD parts are not idempotent, causing mount errors that lead to:
```shell
ERROR Provisioning failed: [ProtocolError] [CopyOfEnv] Error mounting dvd: [OSUtilError] Failed to mount dvd device Inner error: [mount -o ro -t udf,iso9660 /dev/sr0 /mnt/cdrom/secure] returned 32: mount: no medium found on /dev/sr0
```
This error is a bit confusing because the actual issue is networking, but the true failure source and issue reported to Azure front end is the mount error.
**Distro and WALinuxAgent details (please complete the following information):**
- CentOS 7.6
- WALinuxAgent version 2.2.6
**Additional context**
First let me say that this is an awesome repo! I think it is really easy to trace issues, and moving around this repo given my serial output has been a real breeze.
My use case is importing a securely-obtained CentOS 7.6 image and creating a clearly-defined image management pipeline for said image to deploy into various clouds for a special implementation of NIST 800-123 compliance. I use packer + Hyper-V builder plus Chef as a provisioning manager (and thus developed a cookbook to follow the [readying your image for Azure guidelines](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/create-upload-centos#centos-70) ). I'm currently engaging with support to determine what is actually wrong with my prepared image that I am importing to resolve the issue, but I stumbled across this bug and thought this info could help others using this workflow (Image Management Automation) and thus working intimately with the `WALinuxAgent`.
Contributor guide
Assessment
This issue has not been assessed yet.