getpwnam: root: No such file or directory

Mikhail Goriachev mikhailg at
Sun Jul 20 08:20:32 UTC 2008

Евгений Шаповал wrote:
> Thanks!
>> You can't just add the root account. The jail/system should already come
>> with everything. It seems like you didn't populate the jail, that is why
>> there are many missing pieces.
>> What steps did you take to make your jail?
> 1. download freebsd sources
> 2. build jail, I use this script:
> ===================================================
> #!/bin/sh
> case "$2" in
>         create)
>                 jail_dir="$1"
>                 mkdir -p ${jail_dir}
>                 cd /usr/src
>                 mkdir -p ${jail_dir}
>                 make world DESTDIR=${jail_dir}
>                 cd /usr/src/etc
You should not change into /usr/src/etc. Remove that line from the script.

>                 make distribution DESTDIR=${jail_dir}

This is the line that populates most of your jail but it fails because 
it is executed from /usr/src/etc instead of /usr/src. That is why you 
get missing pieces.

So part of your script should look something like:

mkdir -p ${jail_dir}
cd /usr/src
make installworld DESTDIR=${jail_dir}
make distribution DESTDIR=${jail_dir}
mount_devfs devfs ${jail_dir}/dev

You should read the Jails section in the Handbook and also the man page 
for jail for further details.


Mikhail Goriachev

More information about the freebsd-jail mailing list