dockerubuntuazure-pipelinescontainerssudo

dpkg-checkbuilddeps: error: Unmet build dependencies


I'm building a Debian package using a Ubuntu container on azure pipeline.

Here is the yaml file:

trigger:
- master

pool: 'AWSLinux'

container: 
  image: ubuntu:20.04
  options: "--name sample -v /usr/bin/docker:/tmp/docker:ro"
  
steps:
- checkout: self
  lfs: true
  path: HVD
  clean: true

- script: |  #scipt 1 for install SUDO SVN dpkg-dev
    /tmp/docker exec -t -u root sample mv /etc/sudoers /etc/sudoers.bak
    /tmp/docker exec -t -u root sample apt-get -qq update
    /tmp/docker exec -t -u root sample apt-get -qq install sudo
    /tmp/docker exec -t -u root sample apt-get -qq install subversion
    /tmp/docker exec -t -u root sample apt-get -qq install dpkg-dev
    /tmp/docker exec -t -u root sample mv /etc/sudoers.bak /etc/sudoers

- script: |  # Script2

    cd HVD/Sources/Proprietary/hvd-client/
  
    echo ------Update and install packages------
    sudo apt update -y
    sudo apt upgrade -y
    sudo DEBIAN_FRONTEND=noninteractive apt install -y build-essential devscripts equivs git git-lfs

    echo ------Initialize build environment------
    sudo ./init-dev-hvd

    echo ------Build HVD------
    ./build.tp

    echo ------Build finshed------

I have following error when running step "./build.tp" in script 2.

dpkg-checkbuilddeps: error: Unmet build dependencies: lbzip2 cmake qt5-default libssl-dev libpcsclite-dev libpng-dev libpulse-dev libxrandr-dev libxkbfile-dev libxcursor-dev libxt-dev chrpath python3-pip python3-venv libpython3-dev libxcb-xinerama0 libfreetype6-dev libxft-dev libqt5x11extras5-dev libxinerama-dev libudev-dev upx wmctrl libxmu-headers libxmu-dev libglib2.0-dev freerdp2-dev liblz4-tool cython3 clang-tidy-11 libuvc-dev libcups2-dev qtmultimedia5-dev qtpositioning5-dev libxext-dev libxcomposite-dev libxdamage-dev libxfixes-dev libxtst-dev libavcodec-dev libavutil-dev libicu-dev libgbm-dev libdrm-dev libjson-c-dev libopencv-dev libcurl4-openssl-dev

And i find this command in step "sudo ./init-dev-hvd"

sudo mk-build-deps --install src/debian/control

And here is the control file under src/debian/control:

Source: hvd-client
Section: non-free/misc
Priority: optional
Maintainer: 
Build-Depends: g++-9, debhelper (>= 10), lbzip2, debhelper, cmake, qt5-default, libssl-dev, libpcsclite-dev, libpng-dev, libpulse-dev, libxrandr-dev, libxkbfile-dev, libxcursor-dev, libxt-dev, chrpath, python3-pip, python3-venv, libpython3-dev, libxcb-xinerama0, libfreetype6-dev, libxft-dev, libqt5x11extras5-dev,libxinerama-dev, libudev-dev, subversion, upx, wmctrl, libxmu-headers, libxmu-dev, libglib2.0-dev, freerdp2-dev, liblz4-tool, cython3, clang-tidy-11, libuvc-dev, libcups2-dev, qtmultimedia5-dev, qtpositioning5-dev, libxext-dev, libxcomposite-dev, libxdamage-dev, libxfixes-dev, libxtst-dev, libavcodec-dev, libavutil-dev, libicu-dev, libgbm-dev, libdrm-dev, libjson-c-dev, libopencv-dev, libcurl4-openssl-dev
Standards-Version: 4.1.2

Package: hvd-client
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, liblz4-tool, python3-pip, libuvc0, libcups2, libavcodec58, libavutil56
Breaks: hvd-client
Conflicts: hvd-client
Replaces: hvd-client
Description: 

Also i find this in log of step "sudo ./init-dev-avd"

root is not in the sudoers file.  This incident will be reported.

So I guess this "Unmet build dependencies" error is caused by unsuccessful run of "sudo mk-build-deps --install src/debian/control". Any solution to make this command work?


init-dev-hvd:

sudo mk-build-deps --install src/debian/control

echo "Setup complete!"

error log:

root is not in the sudoers file.  This incident will be reported.
Setup complete!

updated init-dev-hvd:

mk-build-deps --install src/debian/control

echo "Setup complete!"

error log:

0 upgraded, 505 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 275 MB of archives.
After this operation, 1625 MB of additional disk space will be used.
Do you want to continue? [Y/n]  //stuck here

Solution

  • Your original issue, as I mentioned above, was caused by the unnecessary sudo call. root user has the privileges to install packages and sudo is not required.

    Your current problem, is not an actual problem but the expected behaviour. If you check the mk-build-deps manual (man mk-build-deps), it says very clearly that the tool used to install the generated package by default is apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends. And the default behavior of apt-get and apt is that it will ask for confirmation before installing packages, unless specified otherwise via configuration or command line flags like --assume-yes (-y).

    So if you need a solution that will work for you non-interactively, you can combine all this and try something like mk-build-deps --install src/debian/control --tool "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y".

    Edit: I missed the comments before but user tripleee has mentioned basically the same solution.