img icon indicating copy to clipboard operation
img copied to clipboard

Getting "nsenter: USER is unset: Inappropriate ioctl for device" error trying to run img on Ubuntu 16.04

Open othomann opened this issue 5 years ago • 5 comments

Hi, I installed img 0.5.7 on top of Ubuntu with the required packages as root. uname -a returns:

Linux 82b577ed1adb 4.4.0-154-generic #181-Ubuntu SMP Tue Jun 25 05:29:03 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

here is my script:

#!/bin/bash
export IMG_DISABLE_EMBEDDED_RUNC=1
apt-get update
apt-get install uidmap libseccomp-dev
chmod 4755 /usr/bin/newuidmap

echo "root:100000:65536" > /etc/subgid
echo "root:100000:65536" > /etc/subuid

echo "Downloading img"
curl -fSL -o /usr/local/bin/img https://github.com/genuinetools/img/releases/download/v0.5.7/img-linux-amd64
curl -fSL https://github.com/genuinetools/img/releases/download/v0.5.7/img-linux-amd64.sha256 -o /usr/local/bin/img-linux-amd64.sha256
echo "Checking download hash"
echo "`cat /usr/local/bin/img-linux-amd64.sha256 | awk '{print $1}'` /usr/local/bin/img" | sha256sum -c -
echo "Installing img"
chmod a+x /usr/local/bin/img
img build -t test:latest -f Dockerfile .

Unfortunately I always get this error nsenter: USER is unset: Inappropriate ioctl for device. I tried to search for a solution, but I didn't find anything useful. Any idea what could be wrong?

Thanks for any pointers you might have.

othomann avatar Jul 25 '19 15:07 othomann

Issue Label Bot is not confident enough to auto-label this issue. See dashboard for more details.

issue-label-bot[bot] avatar Jul 25 '19 15:07 issue-label-bot[bot]

note that if I do: img version, it works.

othomann avatar Jul 25 '19 15:07 othomann

Were you ever able to solve this? I'm running into the same issue, with the same error, only difference is I've stepped up to 0.5.11

Justin-DynamicD avatar Feb 07 '21 22:02 Justin-DynamicD

  sh '''
                           sudo apt-get update -y \\
                        && sudo apt-get install -y uidmap \\
                        && echo "Downloading img" \\
                        && curl -fSL "https://github.com/genuinetools/img/releases/download/v0.5.11/img-linux-amd64" -o "/usr/local/bin/img" \\
                     	&& echo "cc9bf08794353ef57b400d32cd1065765253166b0a09fba360d927cfbd158088  /usr/local/bin/img" | sha256sum -c - \\
                    	&& chmod a+x "/usr/local/bin/img"
                        '''
                        sh 'img -v'
                        echo "img installed!"

I can install the img, but on building image throwing same error, any update on this?

jijeshvu07 avatar Jan 12 '23 10:01 jijeshvu07

got the fix

  sudo apt-get update -y \\
                            && sudo apt-get install -y uidmap \\
                            && sudo apt-get install -y qemu-user-static \\
                            && echo "Downloading img" \\
                            && curl -fSL "https://github.com/genuinetools/img/releases/download/v0.5.11/img-linux-amd64" -o "/usr/local/bin/img" \\
                         	&& echo "cc9bf08794353ef57b400d32cd1065765253166b0a09fba360d927cfbd158088  /usr/local/bin/img" | sha256sum -c - \\
                        	&& chmod a+x "/usr/local/bin/img"

Also configured the environment for Jenkins pipeline.

 environment {
                USER = "jenkins"
            }

jijeshvu07 avatar Jan 16 '23 11:01 jijeshvu07