看板 DFBSD_bugs 關於我們 聯絡資訊
--0023547c8b373d83da0498b74461 Content-Type: text/plain; charset=ISO-8859-1 I ran into a weird issue while building an encrypted root filesystem. I used the script below to build the encrypted root. Right after this runs, "ls /mnt/usr" and "ls /mnt/var" show the expected files and directories. However, if I unmount root and remount it, I find that the contents of /usr and /var have swapped. I can easily fix it by renaming /pfs/usr to /pfs/var and vice versa. The script works fine on a non-encrypted root, so I'm wondering if it is somehow related to the mapper. I'm running 2.9.1.176. kldload dm cryptsetup -y luksFormat /dev/da1s1d cryptsetup luksOpen /dev/da1s1d root || exit 1 newfs_hammer -L ROOT /dev/mapper/root mount_hammer /dev/mapper/root /mnt mkdir /mnt/boot mount /dev/da0s1a /mnt/boot mkdir /mnt/pfs hammer pfs-master /mnt/pfs/usr hammer pfs-master /mnt/pfs/usr.obj hammer pfs-master /mnt/pfs/var hammer pfs-master /mnt/pfs/var.crash hammer pfs-master /mnt/pfs/var.tmp hammer pfs-master /mnt/pfs/tmp hammer pfs-master /mnt/pfs/home mkdir /mnt/usr mkdir /mnt/var mkdir /mnt/tmp mkdir /mnt/home mount_null /mnt/pfs/usr /mnt/usr mount_null /mnt/pfs/var /mnt/var mount_null /mnt/pfs/tmp /mnt/tmp mount_null /mnt/pfs/home /mnt/home mkdir /mnt/usr/obj mkdir /mnt/var/tmp mkdir /mnt/var/crash mount_null /mnt/pfs/var.tmp /mnt/var/tmp mount_null /mnt/pfs/var.crash /mnt/var/crash mount_null /mnt/pfs/usr.obj /mnt/usr/obj chmod 1777 /mnt/tmp chmod 1777 /mnt/var/tmp cpdup -o / /mnt cpdup -o /boot /mnt/boot cpdup -o /usr /mnt/usr cpdup -o /var /mnt/var cpdup -i0 /etc /mnt/etc chflags -R nohistory /mnt/tmp chflags -R nohistory /mnt/var/tmp chflags -R nohistory /mnt/var/crash chflags -R nohistory /mnt/usr/obj --0023547c8b373d83da0498b74461 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <font class=3D"Apple-style-span" face=3D"tahoma, sans-serif">I ran into a w= eird issue while building an encrypted root filesystem. =A0I used the scrip= t below to build the encrypted root. =A0Right after this runs, &quot;ls /mn= t/usr&quot; and &quot;ls /mnt/var&quot; show the expected files and directo= ries. =A0However, if I unmount root and remount it, I find that the content= s of /usr and /var have swapped. =A0I can easily fix it by renaming /pfs/us= r to /pfs/var and vice versa. =A0The script works fine on a non-encrypted r= oot, so I&#39;m wondering if it is somehow related to the mapper. =A0I&#39;= m running 2.9.1.176.</font> <div><br></div><div><div>kldload dm</div><div>cryptsetup -y luksFormat /dev= /da1s1d</div><div>cryptsetup luksOpen /dev/da1s1d root || exit 1</div><div>= <br></div><div>newfs_hammer -L ROOT /dev/mapper/root</div><div><br></div> <div>mount_hammer /dev/mapper/root /mnt</div><div>mkdir /mnt/boot</div><div= >mount /dev/da0s1a /mnt/boot</div><div><br></div><div>mkdir /mnt/pfs</div><= div><br></div><div>hammer pfs-master /mnt/pfs/usr</div><div>hammer pfs-mast= er /mnt/pfs/usr.obj</div> <div>hammer pfs-master /mnt/pfs/var</div><div>hammer pfs-master /mnt/pfs/va= r.crash</div><div>hammer pfs-master /mnt/pfs/var.tmp</div><div>hammer pfs-m= aster /mnt/pfs/tmp</div><div>hammer pfs-master /mnt/pfs/home</div><div> <br></div><div>mkdir /mnt/usr</div><div>mkdir /mnt/var</div><div>mkdir /mnt= /tmp</div><div>mkdir /mnt/home</div><div><br></div><div>mount_null /mnt/pfs= /usr /mnt/usr</div><div>mount_null /mnt/pfs/var /mnt/var</div><div>mount_nu= ll /mnt/pfs/tmp /mnt/tmp</div> <div>mount_null /mnt/pfs/home /mnt/home</div><div><br></div><div>mkdir /mnt= /usr/obj</div><div>mkdir /mnt/var/tmp</div><div>mkdir /mnt/var/crash</div><= div><br></div><div>mount_null /mnt/pfs/var.tmp /mnt/var/tmp</div><div> mount_null /mnt/pfs/var.crash /mnt/var/crash</div> <div>mount_null /mnt/pfs/usr.obj /mnt/usr/obj</div><div><br></div><div>chmo= d 1777 /mnt/tmp</div><div>chmod 1777 /mnt/var/tmp</div><div><br></div><div>= cpdup -o / /mnt</div><div>cpdup -o /boot /mnt/boot</div><div>cpdup -o /usr = /mnt/usr</div> <div>cpdup -o /var /mnt/var</div><div>cpdup -i0 /etc /mnt/etc</div><div><br= ></div><div>chflags -R nohistory /mnt/tmp</div><div>chflags -R nohistory /m= nt/var/tmp</div><div>chflags -R nohistory /mnt/var/crash</div><div>chflags = -R nohistory /mnt/usr/obj</div> </div> --0023547c8b373d83da0498b74461--