# Manual installation question



## ldgc (Mar 9, 2018)

Hello 
I would like your guidance with the following situation:
I boot USB with FreeBSD-11.1-RELEASE-amd64-memstick.img in UEFI mode.
When *Welcome Menu* appears, I choose *[Shell]*.
Then I execute the following commands:

```
# kbdcontrol -l pt

# gpart create -s gpt ada0

# gpart add -t efi -s 800K ada0

# gpart add -t freebsd-ufs -s 2G    # / partition

# gpart add -t freebsd-swap -s 2G

# gpart add -t freebsd-ufs -s 1G ada0    # /var partition

# gpart add -t freebsd-ufs -s 1G ada0    # /tmp partition

# gpart add -t freebsd-ufs -s 50G ada0    # /usr partition

# gpart add -t freebsd-ufs ada0    # /home partition        

# dd if=boot/boot1.efifat of=dev/ada0p1

# newfs -U dev/ada0p2

# newfs -U dev/ada0p4

# newfs -U dev/ada0p5

# newfs -U dev/ada0p6

# newfs -U dev/ada0p7

# mount dev/ada0p2 mnt

# mkdir mnt/var

# mount dev/ada0p4 mnt/var

# mkdir mnt/tmp

# mount dev/ada0p5 mnt/tmp

# mkdir mnt/usr

# mount dev/ada0p6 mnt/usr

# mkdir mnt/home

# mount dev/ada0p7 mnt/home

# cd mnt

# tar xvJpf usr/freebsd-dist/base.txz

# tar xvJpf usr/freebsd-dist/kernel.txz

# chroot .
```
From this point forward, everything that I read, write and execute happens in the created root environment?


----------



## leebrown66 (Mar 9, 2018)

Yes.  You can replace:

```
# cd mnt
# chroot .
```
with

```
# chroot /mnt
```


----------



## ldgc (Mar 10, 2018)

Am I missing steps in order to have a successful chroot?


----------



## swegen (Mar 10, 2018)

pensador_13 said:


> Am I missing steps in order to have a successful chroot?


You should mount devfs(5) before chrooting:
`mount -t devfs devfs /mnt/dev`


----------



## k.jacker (Mar 10, 2018)

Hei pensador_13

If you don't return to the installer, remember there are important files missing that you have to create before you can reboot the machine:
/etc/rc.conf
/etc/fstab
/etc/resolv.conf
Depends on you needs, may or may not be neccessary before you reboot the machine for the first time...
/boot/loader.conf

Create a password for root...
`# passwd`

Only needed if you want to access the machine remotely after reboot and you have sshd_enable="YES" in /etc/rc.conf...
`# adduser`


----------



## ldgc (Mar 11, 2018)

k.jacker before I go to the created root environment to set root password and edit the files you mentioned, the commands that I posted + the one posted by swegen are sufficient to have a successful chroot?


----------



## k.jacker (Mar 11, 2018)

pensador_13 said:


> # tar xvJpf usr/freebsd-dist/base.txz
> # tar xvJpf usr/freebsd-dist/kernel.txz


This would require that you have already copied those files to /mnt/.
Say you have those files in /root/ (on your "old" filesystem then I would do
`# tar -xvpf /root/kernel.txz -C /mnt/` (-J is not needed, it will be ignored according to tar(1))
`# tar -xvpf /root/base.txz -C /mnt/`
Otherwise your steps look very solid, give it a shot.

Edit: I've never mounted devfs manually, just did the configuration and then rebooted the machine without problems.
devfs will be mounted after reboot, you don't have to configure anything. Though it's possible that devfs might be needed
under certain conditions before chroot. Can't say. Allways worked for me without it.


----------

