kwilczynski/packer-templates

Permission Denied + ixgbevf build issues with Ubuntu 16.04 AMI

shanonvl opened this issue · 4 comments

Building from master does not complete when building AMIs for Ubuntu 16.04.

Issue 1:

Error when building ixgbevf:

cd src/; make BUILD_KERNEL=4.4.0-1022-aws....(bad exit status: 2)
ERROR (dkms apport): binary package for ixgbevf: 3.1.2 not found
Error! Bad return status for module build on kernel: 4.4.0-1022-aws (x86_64)
Consult /var/lib/dkms/ixgbevf/3.1.2/build/make.log for more information.

I found a fix in this SO answer.

Adding the following line to /scripts/ec2/networking.sh (I added to line 104) resolves the issue:

sed -i 's/#if UTS_UBUNTU_RELEASE_ABI > 255/#if UTS_UBUNTU_RELEASE_ABI > 99255/' /usr/src/ixgbevf-${SRIOV_DRIVER_VERSION}/src/kcompat.h

Issue 2:

With the above resolved, the AMI builds but when started, #1 is occurring again, this time for /etc/udev/70-persistent-rules.net. cloud-init now calls write_file on this file here which causes the same issue.

Applying the fix in #1 to /scripts/common/clean-up.sh resolves the issue:
-- line 277

if [[ $AMAZON_EC2 == 'yes' ]]; then
    # Get rid of this file, alas clout-init will probably
    # create it again automatically so that it can wreck
    # network configuration. These files, sadly cannot be
    # simply a symbolic links to /dev/null, as cloud-init
    # would change permission of the device node to 0644,
    # which is disastrous, every time during the system
    # startup.
    rm -f \
      /etc/network/interfaces.d/50-cloud-init.cfg \
      /etc/systemd/network/50-cloud-init-eth0.link \
      /etc/udev/rules.d/70-persistent-net.rules

    pushd /etc/network/interfaces.d &>/dev/null
    mknod .null c 1 3
    ln -sf .null 50-cloud-init.cfg
    popd &>/dev/null

    pushd /etc/udev/rules.d &>/dev/null
    mknod .null c 1 3
    ln -sf .null 70-persistent-net.rules
    popd &>/dev/null
fi

If these fixes are correct, I'm happy to submit a PR - just let me know.

And, thank you for all of your work here!

EDIT: Fixed in my fork via fbb0439

FYI, I also bumped ena to 1.2.0 and ixgbevf to 4.2.1 in 9b9302c and can PR that as well if helpful.

Hi @shanonvl,

(Sorry for a late reply, I am en route back to Europe from Asia at the moment)

Thank you for an amazing detective work!

I will be happy with all the proposed changes, most certainly.

Also, apologies for the issues in the first place. I used to build the images on a more frequent basis, but recently got busy with work more than usual and haven't had time to do it. I need to set up continuous build and add InSpec testes.

Again, apologies but we have had issues.

Great! PR sent. Thanks!

@shanonvl thank you!

I am also glad to see that you found this project useful.