# Launching old version jail on newer version FreeBSD



## Engraf (Aug 1, 2014)

Hello,

I'm going to migrate our MTA (jailed Exim) to a new server. First off I've decided to perform all operations on a test machine. I inherited the old server and I'm still very much a newbie in _Free_BSD. So, that's what I was doing:

Old server: 
	
	



```
# uname -a
FreeBSD hostname.net 7.1-BETA FreeBSD 7.1-BETA #0: Sun Sep  7 13:49:18 UTC 2008     root@logan.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
# df -H
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/da0s1a     10G    3.6G    5.9G    38%    /
devfs          1.0k    1.0k      0B   100%    /dev
/dev/da1s1d    232G    122G     92G    57%    /storage
/dev/da0s1e     62G     34G     23G    60%    /jail
/dev/da0s1d     21G    4.1k     19G     0%    /database
/dev/da0s1f     21G    4.1k     19G     0%    /reserved
devfs          1.0k    1.0k      0B   100%    /var/named/dev
devfs          1.0k    1.0k      0B   100%    /jail/main/dev
# dump -0aLu -f /storage/jail.dmp /jail
```

New server: 
	
	



```
# uname -a
FreeBSD testBSD 10.0-RELEASE-p7 FreeBSD 10.0-RELEASE-p7 #0: Tue Jul  8 06:37:44 UTC 2014     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
# df -h
Filesystem            Size    Used   Avail Capacity  Mounted on
zroot/ROOT/default     25G    3,2G     21G    13%    /
devfs                 1,0K    1,0K      0B   100%    /dev
zroot/jails/mail       52G     31G     21G    59%    /jails/mail
tempdisk               59G     29G     30G    49%    /tempdisk
zroot/tmp              21G    224K     21G     0%    /tmp
zroot/usr/home         21G    184K     21G     0%    /usr/home
zroot/usr/ports        22G    890M     21G     4%    /usr/ports
zroot/usr/src          22G    545M     21G     2%    /usr/src
zroot/var              22G    278M     21G     1%    /var
zroot/var/crash        21G    148K     21G     0%    /var/crash
zroot/var/log          21G    356K     21G     0%    /var/log
zroot/var/mail         21G    144K     21G     0%    /var/mail
zroot/var/tmp          21G    152K     21G     0%    /var/tmp
devfs                 1,0K    1,0K      0B   100%    /jails/mail/main/dev
devfs                 1,0K    1,0K      0B   100%    /jails/mail/main/dev
# pkg install compat7x
# restore -rf /tempdisk/jail.dmp
```
rc.conf:
	
	



```
hostname="testBSD"
keymap="ru.koi8-r.win.kbd"
ifconfig_em0="DHCP"
cloned_interfaces="lo123"
ifconfig_lo123_alias0="inet 10.1.2.3 netmask 255.255.255.255"
ifconfig_lo123_alias1="inet 10.4.5.6 netmask 255.255.255.255"
gateway_enable="YES"
sshd_enable="YES"
sshd_flags="-4 -u0"
openntpd_enable="YES"
powerd_enable="YES"
syslogd_flags="-ss"
sendmail_enable="NO"
zfs_enable="YES"
pf_enable="YES"
jail_enable="YES"
jail_list="test mail"
devfs_load_rulesets="YES"
dumpdev="NO"
```
jail.conf:
	
	



```
interface = "lo123";
ip6 = "disable";
allow.mount;
enforce_statfs = 1;
mount.devfs;
devfs_ruleset = 4;
#allow.mount.nullfs;
#allow.mount.procfs;
allow.mount.zfs;
allow.noset_hostname;
allow.sysvipc;
allow.raw_sockets;
#allow.chflags;
exec.start = "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown";
mail {
	path = "/jails/mail/main";
	ip4.addr = 10.4.5.6;
	host.hostname = "mail";
}
```
pf.conf:
	
	



```
ext_if="em0"
jail_if="lo123"
IP_PUB="192.168.x.x"
IP_JAIL_TEST="10.1.2.3"
IP_JAIL_MAIL="10.4.5.6"
NET_JAIL_TEST="10.1.2.0/24"
NET_JAIL_MAIL="10.4.5.0/24"
PORTS_TEST="{2221}"
PORTS_MAIL="{2222,80,443,25,587,465,143,993,110,995}"
scrub in all
nat pass on $ext_if from $NET_JAIL_TEST to any -> $IP_PUB
nat pass on $ext_if from $NET_JAIL_MAIL to any -> $IP_PUB
rdr pass on $ext_if proto tcp from any to $IP_PUB port $PORTS_TEST -> $IP_JAIL_TEST
rdr pass on $ext_if proto tcp from any to $IP_PUB port $PORTS_MAIL -> $IP_JAIL_MAIL
pass out
pass in
```

Jail starts successfully. Problem is when I connect to the jail using SSH (PuTTY), after logon I receive the following message: 
	
	



```
Server refused to allocate pty
```
Some forums suggest to execute `/sbin/MAKEDEV tty && /sbin/MAKEDEV pty`, but it says 'command not found'. What am I doing wrong? Or what have I missed?

Thanks.


----------



## SirDice (Aug 1, 2014)

You probably need to install misc/compat7x, misc/compat8x and misc/compat9x on the host.


----------



## kpa (Aug 1, 2014)

The old pty(4) driver may be needed as well, it can be loaded on the fly with `kldload pty`. Put this in /boot/loader.conf to have to loaded on boot automatically


```
pty_load="YES"
```


----------



## Engraf (Aug 1, 2014)

kpa said:
			
		

> The old pty(4) driver may be needed as well


Such a simple solution! Thanks for your answer, that solved it.



			
				SirDice said:
			
		

> You probably need to install


Only compat7x is not enough?


----------



## SirDice (Aug 1, 2014)

Engraf said:
			
		

> Only compat7x is not enough?


No, that's for running 7.x binaries on an 8.x system. So to complete the circle up to 10.x you need to install them all.


----------



## Engraf (Aug 2, 2014)

What a good feeling when everything starts to work as planned )

Thanks to all who responded. Go preparing to repeat on a real server.


----------



## jimeha (Apr 22, 2016)

Apologies for resurrecting an old thread, but I wanted to express my profuse thanks to kpa for the above pty driver suggestion.  I had originally come looking for such a fix back in Nov 2014 after upgrading our FreeBSD 8.1 jail host running FreeBSD 6.1 & 8.1 jails to FreeBSD 10.1, whereupon, the FreeBSD 6.1 jails kept throwing the 'PTY allocation request failed on channel 0', but never found this post.  A simple 'kldload pty' fixed it.  FreeBSD 6.x /etc/defaults/devfs.rules doesn't have the "add path 'pts/*' unhide" lines, and adding them to it did nothing, but this above fix worked perfectly.  Thank you again.


----------

