# Unable to boot new encrypted installation



## Dispater (Aug 24, 2012)

Attempting to install FreeBSDv9.0 amd64 onto a GELI encrypted partition. The installation seems to go perfectly, but on reboot I get the message:


```
loader: not a directory
gptboot: No /boot/loader on 0:ad(0p2)
kernel: not a directory
gptboot: No /boot/kernel/kernel on 0:ad(0p2)

FreeBSD/x86 boot
Default: 0:ad(0p2)/boot/kernel/kernel
boot:
```

If I boot to the live cd and mount ada0p2, /boot/kernel/kernel and /boot/loader exist. Doing some searching, I found this thread, but no solution was found.

If I go through the installation selecting the defaults (use entire disk, etc), FreeBSD works flawlessly. I think I'm just missing a simple command somewhere when I do the partitioning manually.

Relevant info:
Installing on a single 1.5TB hard drive (/dev/ada0)
Booting off a USB stick with the memstick image FreeBSDv9 amd64.
Installation and configuration based off of this guide.

I also threw the transcript of the installation on pastebin.

Thanks in advance!


----------



## Dispater (Aug 24, 2012)

Here's some highlights from the pastebin I posted above:

Partition layout:

```
ada0        HDD        (1.5T) GPT partition table
ada0p1      bootloader (64k)  freebsd-boot
ada0p2      /boot      (1G)   freebsd-ufs un-encrypted
ada0p3      -          (1.4T) encrypted partition
ada0p3.eli  /          (1.4T) freebsd-ufs
```

Output of *df* before rebooting:

```
Filesystem       Size  Used  Avail  Capacity  Mounted on
/dev/gpt/enc.eli 1.4T  1.7G  1.2T   0%        /mnt
/dev/gpt/boot    1G    303M  623M   33%       /mnt/boot
```

/boot/loader.conf:

```
geom_eli_load="YES"
vfs.root.mountfrom="ufs:/dev/ad0p3.eli"
```

I created the boot partitions by:

```
# gpart add -t freebsd-boot -s 64k ada0
      ada0p1 added
# gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ada0
      bootcode written to ada0
# gpart add -t freebsd-ufs -s 1g -l boot ada0
      ada0p2 added
```


----------



## Dispater (Aug 25, 2012)

*Solved*

Alright, I think I found the problem(s). Here's my work-around and reasoning:

My launcher.conf had a small typo:

```
geom_eli_load="YES"
vfs.root.mountfrom="ufs:/dev/ad[FILE][B]a[/B][/FILE]0p3.eli"
```

When booting, the boot manager loads the boot-flagged partition and tries to look in /boot of that partition for the kernel and boot loaders. It does not check to see if it is already in /boot.

To get around this, after installation finishes, cd into the boot partition (ada0p2 above) and type:

```
mkdir boot.tmp
mv * boot.tmp
mv boot.tmp boot
```

Here's a diagram of what the end result should be, Root partition mounted on /, boot partition mounted on /boot

```
/bin
   /mnt
   /etc
   ...
   /boot
      /boot/boot
          /boot/boot/boot
          /boot/boot/kernel
          ...
```

Also,





DAS BOOT


----------



## Dispater (Aug 25, 2012)

One other addendum:

FreeBSD can't update the kernels using the configuration above, so I told fstab to mount the boot partition on /mnt/preboot, then linked /mnt/preboot/boot to /boot.

Whew.


----------



## ignotus (Jan 16, 2013)

I also just installed freebsd9 FreeBSD 9 using the method above with the same result initially. To fix it I booted up into the live CD shell, mounted the encrypted and boot partitions, and copied the files from /boot2 to /boot. This worked, however, do you even need to create boot2? Can't you just mount the boot partition directly to /boot? I'm not sure what purpose it serves. 

Here arethe original instructions:

```
# mount /dev/gpt/enc.eli /mnt
# mkdir /mnt/boot2
# cd /mnt
# ln -s boot2/boot boot
# mount /dev/gpt/boot /mnt/boot2
```

Here's what I'm thinking:

```
# mount /dev/gpt/enc.eli /mnt
# mkdir /mnt/boot
# cd /mnt
# mount /dev/gpt/boot /mnt/boot
```

I'm thinking of getting rid of the whole boot2 thing. Just want to understand why it's there before I do.


----------



## ignotus (Jan 16, 2013)

Just realized I forgot to add

```
# mkdir /mnt/boot
```
to the above.

Sorry. Wish I could edit!


----------



## ignotus (Jan 16, 2013)

Wait. Nevermind. It's there. It's late. Again, would be nice to be able to edit.


----------

