Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux personality (reported ex. via uname -m) is wrong #1

Closed
remram44 opened this issue May 25, 2016 · 5 comments
Closed

Linux personality (reported ex. via uname -m) is wrong #1

remram44 opened this issue May 25, 2016 · 5 comments

Comments

@remram44
Copy link

remram44 commented May 25, 2016

Cf docker-32bit/ubuntu#12

You only have to set ENTRYPOINT ["linux32", "--"] to fix this.

Right now I use my own Dockerfile on top of yours:

FROM ioft/i386-ubuntu:14.04.3
ENTRYPOINT ["linux32", "--"]

Test:

$ docker run -ti --rm ioft/i386-ubuntu:14.04.3 uname -m
x86_64
$ docker build -t ubuntu32 - <Dockerfile
$ docker run -ti --rm ubuntu32 uname -m
i686
@umiddelb
Copy link
Contributor

Hi Remi,

thank you for pointing out this issue, I've updated the Dockerfiles accordingly (and built the Ubuntu i386 image for 16.04/xenial as well).

Cheers
Uli

@remram44
Copy link
Author

Thanks!

@jcoffland
Copy link

Note, that this solution does not work for Dockerfile RUN commands. A better solution is to also replace /bin/uname like this:

RUN mv /bin/uname /bin/uname.orig && \
  echo '#!/bin/sh\n/usr/bin/linux32 /bin/uname.orig "$@"' > /bin/uname && \
  chmod +x /bin/uname

I think @remram44 prefers this solution anyway.

@remram44
Copy link
Author

This will only make the Dockerfile's commands work if these commands are uname or calling uname.

@remram44 remram44 changed the title uname -m is wrong Linux personality (reported ex. via uname -m) is wrong May 29, 2016
@ericcurtin
Copy link

I normally put something like this in my x86 32 bit dockers:

RUN echo $'#!/usr/bin/perl\n\
\n\
use strict;\n\
use warnings;\n\
\n\
use Getopt::Long qw(GetOptions);\n\
\n\
my $opts = {};\n\
GetOptions($opts, "kernel-name|s", "nodename|n", "machine|m", "processor|p",\n\
           "hardware-platform|i", "operating-system|o");\n\
\n\
if ($opts->{"kernel-name"}) {\n\
  print("Linux\n");\n\
} elsif ($opts->{"nodename"}) {\n\
  exec("hostname");\n\
} elsif ($opts->{"machine"} || $opts->{"processor"}) {\n\
  print("i686\n");\n\
} elsif ($opts->{"hardware-platform"}) {\n\
  print("i386\n");\n\
} elsif ($opts->{"operating-system"}) {\n\
  print("GNU/Linux\n");\n\
}\n' > /bin/uname

Hacky, but it's hard to avoid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants