What should do in chrooted environment?

Glen Barber gjb at FreeBSD.org
Mon Apr 23 22:44:11 UTC 2018


On Tue, Apr 24, 2018 at 07:28:06AM +0900, KIRIYAMA Kazuhiko wrote:
> Hi, all
> 
> I've make buildworld in chrooted environment. But failed at
> 'stage 4.2: building libraries' [1]:
> 
> objcopy --only-keep-debug libproc.so.3.full libproc.so.3.debug
> objcopy --strip-debug --add-gnu-debuglink=libproc.so.3.debug  libproc.so.3.full libproc.so.3
> sh /usr/src/tools/install.sh  -C -o root -g wheel -m 444   libproc.a /usr/obj/usr/src/tmp/usr/lib/
> sh /usr/src/tools/install.sh  -s -o root -g wheel -m 444     libproc.so.3 /usr/obj/usr/src/tmp/usr/lib/
> sh /usr/src/tools/install.sh  -o root -g wheel -m 444    libproc.so.3.debug /usr/obj/usr/src/tmp/usr/lib/debug/usr/lib/
> sh /usr/src/tools/install.sh -l rs  libproc.so.3 /usr/obj/usr/src/tmp/usr/lib/libproc.so
> sh /usr/src/tools/install.sh  -C -o root -g wheel -m 444  /usr/src/lib/libproc/libproc.h /usr/obj/usr/src/tmp/usr/include/
> make[5]: "/dev/null" line 1: Need an operator
> make[5]: Fatal errors encountered -- cannot continuemake[4]: "/usr/src/Makefile.inc1" line 421: warning: "MK_AUTO_OBJ=no MAKEFLAGS= CPUTYPE=dummy make  -f /dev/null -m /usr/src/share/mk -V CPUTYPE" returned non-zero status
> make[4]: "/usr/src/Makefile.inc1" line 423: CPUTYPE global should be set with ?=.
> *** Error code 1
> 
> Stop.
> make[3]: stopped in /usr/src
> *** Error code 1
> 
> Stop.
> make[2]: stopped in /usr/src
> *** Error code 1
> 
> Stop.
> make[1]: stopped in /usr/src
> 
> My chrooted environment is a bhyve vm attach & mounted one
> like this(*1):
> 
> root at vms:~ # mdconfig  -a -t vnode -f /vm/tbedfs/disk0.img 
> md0
> root at vms:~ # gpart show md0
> =>      40  16777136  md0  GPT  (8.0G)
>         40        24       - free -  (12K)
>         64      1024    1  freebsd-boot  (512K)
>       1088  16776023    2  freebsd-ufs  (8.0G)
>   16777111        41       - free -  (21K)
>   16777152        23    3  freebsd-swap  (12K)
>   16777175         1       - free -  (512B)
> 
> root at vms:~ # mount /dev/md0p2 /mnt
> 
> 
> And src and obj are nullfs mounted to latest src
> repository(r332874) and OBJDIR respectively:
> 
> 
> root at vms:~ # uname -a
> FreeBSD vms.pis 12.0-CURRENT FreeBSD 12.0-CURRENT #0 r331153: Tue Mar 20 10:13:56 JST 2018     admin at t.pis:/ds/obj/current/12.0/r331153/ds/src/current/12.0/r331153/amd64.amd64/sys/GENERIC  amd64
> root at vms:~ # 
> admin at vms:~ % df
> Filesystem                    1K-blocks     Used       Avail Capacity  Mounted on
> /dev/aacd0p4                   10143484  4624840     4707168    50%    /
> devfs                                 1        1           0   100%    /dev
> /dev/aacd0p5                14560423728 79273144 13316316688     1%    /ds
> /ds/.dake                   14560423728 79273144 13316316688     1%    /.dake
> /ds/vm                      14560423728 79273144 13316316688     1%    /vm
> /dev/md0p2                      5061084  3053316     1602884    66%    /mnt
> /ds/src/stable/11.1/r332874 14560423728 79273144 13316316688     1%    /mnt/usr/src
> /ds/obj/stable/11.1/r332874 14560423728 79273144 13316316688     1%    /mnt/usr/obj
> admin at vms:~ % 
> 
> 
> Then chroot to /mnt and make buildworld:
> 
> 
> root at vms:~ # chroot /mnt "make buildworld"
> 
> 
> Of course 'make buildworld' in vm was successfully finished [2]:
> 
> 
> admin at tbedfs:~ % uname -a
> FreeBSD tbedfs 11.1-STABLE FreeBSD 11.1-STABLE #0 r332428: Thu Apr 12 16:37:51 UTC 2018     root at releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
> admin at tbedfs:~ % df
> Filesystem                            1K-blocks     Used       Avail Capacity  Mounted on
> /dev/vtbd0p2                            8106116   849980     6607648    11%    /
> devfs                                         1        1           0   100%    /dev
> vms.pis:/.dake                      14560423728 83720204 13311869628     1%    /.dake
> vms.pis:/ds/src/stable/11.1/r332874 14560423728 83720204 13311869628     1%    /usr/src
> vms.pis:/ds/obj/stable/11.1/r332874 14560423728 83720204 13311869628     1%    /usr/obj
> admin at tbedfs:~ % su
> Password:
> root at tbedfs:/usr/home/admin # cd /usr/src/
> root at tbedfs:/usr/src # make buildworld
> 
> 
> To make buildworld in chrooted environment, what should I do ?
> 

I think you might not have the devfs mount in the image.  With the paths
provided above, I think this should fix it:

 # mount -t devfs devfs /mnt/dev

Glen

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20180423/7fceedfc/attachment.sig>


More information about the freebsd-stable mailing list