# bsdinstall fails



## tommiie (Nov 17, 2019)

After playing around with scripting *bsdinstall *I now tried to manually create a jail with *bsdintall*.


```
% sudo zfs create zroot/var/jails/_base
% sudo bsdinstall jail /var/jails/_base/
```

I then can select a mirror and I've tried several of them, but they all return the error message:


> Error while fetching base.txz: Invalid URL scheme.


What's going on? How can I fix this?


----------



## balanga (Nov 17, 2019)

Can you `ping -c3 8.8.8.8` ?


----------



## tommiie (Nov 17, 2019)

Yes, I can. Both the network and DNS work.

```
tom@bsd004:~ % ping -c3 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: icmp_seq=0 ttl=57 time=1.344 ms
64 bytes from 8.8.8.8: icmp_seq=1 ttl=57 time=0.467 ms
^C
--- 8.8.8.8 ping statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.467/0.906/1.344/0.439 ms
tom@bsd004:~ % ping www.slashdot.org
PING www.slashdot.org (216.105.38.15): 56 data bytes
64 bytes from 216.105.38.15: icmp_seq=0 ttl=48 time=138.802 ms
64 bytes from 216.105.38.15: icmp_seq=1 ttl=48 time=137.259 ms
^C
--- www.slashdot.org ping statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 137.259/138.030/138.802/0.771 ms
tom@bsd004:~ %
```


----------



## T-Daemon (Nov 17, 2019)

Try 
`mkdir 12.1-R`
`cd 12.1-R`
`fetch http://ftp.freebsd.org/pub/FreeBSD/releases/amd64/12.1-RELEASE/base.txz`
`fetch http://ftp.freebsd.org/pub/FreeBSD/releases/amd64/12.1-RELEASE/MANIFEST`
`setenv BSDINSTALL_DISTDIR /path/to/12.1-R`
`bsdinstall jail /var/jails/_base/`


----------



## T-Daemon (Nov 17, 2019)

Works also with a mdconfig(8) mounted installation image with distribution files: `setenv BSDINSTALL_DISTDIR /install-image_mount_point/usr/freebsd-dist`


----------



## sol289 (Nov 18, 2019)

here's my script for installing FreeBSD (no matter for jail template or for new system):

```
#!/bin/csh

set mount = "/usr/j/template"
#set disk = da0

set arch = "amd64"

if ($arch == "i386") then
    setenv DISTRIBUTIONS "base.txz kernel.txz"
endif

if ($arch == "amd64") then
    setenv DISTRIBUTIONS "base.txz kernel.txz lib32.txz"
endif

setenv BSDINSTALL_DISTDIR /usr/j
setenv BSDINSTALL_DISTSITE ftp://ftp.freebsd.org/pub/FreeBSD/releases/$arch/11.2-RELEASE
setenv BSDINSTALL_CHROOT $mount

if ($?disk) then
    echo "making all on $disk"
    echo "proceed? (type 'yes' to proceed)"
    set ans = $<
    if ($ans == yes ) then
        echo "gparting $disk"
        gpart create -s gpt $disk
        gpart add -t freebsd-boot -a4k -s512k $disk
        gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 da0
        gpart add -t freebsd-ufs -a4k -s10G -l rootfs $disk
        gpart add -t freebsd-ufs -a4k -s50G -l varfs $disk
        gpart add -t freebsd-ufs -a4k -l usrfs $disk
        newfs -L rootfs /dev/gpt/rootfs
        newfs -L varfs /dev/gpt/varfs
        newfs -L usrfs /dev/gpt/usrfs

        mount /dev/gpt/rootfs $mount
        mkdir $mount/etc $mount/usr $mount/var
        mount /dev/gpt/varfs $mount/var
        mount /dev/gpt/usrfs $mount/usr

        echo "/dev/gpt/rootfs     /       ufs     rw              1       1" >> $mount/etc/fstab
        echo "/dev/gpt/varfs     /var       ufs     rw              1       1" >> $mount/etc/fstab
        echo "/dev/gpt/usrfs     /usr       ufs     rw              1       1" >> $mount/etc/fstab
    endif
endif

chflags -R noschg $BSDINSTALL_CHROOT
bsdinstall distfetch
bsdinstall distextract
```


----------



## tommiie (Nov 18, 2019)

Thanks sol289. I will look into that when I'm back home and have some time to play around with it.


----------

