Skip to content

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

Closed

Description

@remram44

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

Activity

  1. umiddelb commented on May 29, 2016

    @umiddelb
    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

  2. remram44 commented on May 29, 2016

    @remram44
    Author

    Thanks!

  3. jcoffland commented on May 29, 2016

    @jcoffland

    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.

  4. remram44 commented on May 29, 2016

    @remram44
    Author

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

  5. changed the title [-]uname -m is wrong[/-] [+]Linux personality (reported ex. via uname -m) is wrong[/+] on May 29, 2016
  6. ericcurtin commented on Nov 8, 2018

    @ericcurtin

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions