From: ebiederm@xmission.com (Eric W. Biederman)
To: Andy Johnson <johnsonzjo@gmail.com>
Cc: util-linux@vger.kernel.org
Subject: Re: Cannot allocate memory when calling unshare
Date: Thu, 09 May 2013 11:26:24 -0700 [thread overview]
Message-ID: <87ppx057sf.fsf@xmission.com> (raw)
In-Reply-To: <CAF0Lin2vFqLg3J_nhSkpdmzYuB56ZNn2TNqrZbSTynMB3x5Tew@mail.gmail.com> (Andy Johnson's message of "Tue, 7 May 2013 08:03:29 +0300")
Andy Johnson <johnsonzjo@gmail.com> writes:
> Hello,
> I use git last update of util-linux.
>
> ./unshare -n /bin/bash
> works ok.
>
> From a different terminal I run:
>
> ./unshare -p /bin/bash
> and get:
> bash: fork: Cannot allocate memory
>
> typing:
> shows 141 Mb free.
>
> the machine has x86_64 ubuntu, 13.04, Raring Ringtail
>
> any advice ?
Pid namespaces are funny. What you are seeing is expected and correct
behavior. The process that calls unshare is not put into the pid
namespace it's first child is. Which means that the first child of bash
becomes the init in the pid namespace and the next child of bash.
The following should do what you want.
unshare --pid -- /bin/sh -c /bin/bash
Eric
next prev parent reply other threads:[~2013-05-09 18:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-07 5:03 Cannot allocate memory when calling unshare Andy Johnson
2013-05-09 18:26 ` Eric W. Biederman [this message]
2013-05-10 6:07 ` Andy Johnson
2013-05-10 6:41 ` Eric W. Biederman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ppx057sf.fsf@xmission.com \
--to=ebiederm@xmission.com \
--cc=johnsonzjo@gmail.com \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox