# Is this possible to do a fresh install through comconsole?



## boris_net (Oct 23, 2014)

Hi all,

I have a remote system running 8.1-STABLE. I was wondering if I could remotely install a fresh 10.1-RELEASE through remote console. I have boot.config set to -D and /etc/rc.conf configured with comconsole and I can access the system through a serial line.

I was thinking of creating a partition with the contents of the installation DVD and force the boot on this partition from the boot prompt but then I am not entirely sure if I could get the installation going on nicely.

Note: there is no KVMoIP and the hardware is super old but still useful for a few things here and there.

Has anybody gone through that? Any advice?

Thanks,

Boris


----------



## ShelLuser (Oct 23, 2014)

I have never tried something like this myself before, but alas...

There is one huge caveat with this approach, which is assuming that the 10.x kernel will fully support your hardware, especially the serial ports. Because if there's a problem there you'll pretty much lose access.

Also, given the specific nature of the upgrade, I personally wouldn't rely on the installer. As said before I haven't done this myself so I am assuming a few things here. But I can't help wonder how well the installer would perform using a serial console. On that subject; I'm not even sure how well it would behave on an upgrade. After all; the de-facto way to upgrade your system to a new release is using the freebsd-update command.

Personally I'd use a source upgrade. Don't bother with 10 just yet but get the 9.3 source code into /usr/src and build / tune your own setup. This way you'll remain in full control over the entire process, including the upgrade of all the binaries and configuration files as well as the new boot procedure.

Note; I'm not saying that using 10 is a bad idea. Its just that I'm always a little weary when it comes to skipping a major version in an upgrade. It may work flawlessly, but in my opinion it also introduces extra (unneeded) risks.

Hope this can give you some ideas.


----------



## boris_net (Oct 26, 2014)

Thanks ShelLuser, my serial ports are apparently well supported in FreeBSD 10!

I am happy to report I managed to do a fresh install of FreeBSD 10.x through serial.

Just in case anybody has to do this one day, here is the way I did it, nothing very difficult but the chance of losing the server puts some sort of pressure...

Prerequisite:
In my case, I have another HDD that I could free up on my server to put the CDROM installation contents on and boot from it.
I have /dev/idad0 for the current system FreeBSD 8.1-STABLE and /dev/idad1 for data which is going to be used as remote installation device.

Preparation:
I actually tried first on Virtualbox and spent most of my time getting the console working on Virtualbox as I had no real experience with it. I actually referred to the guidance given here: https://gist.github.com/snb/284940. I did not use socat as you can just `telnet` to the socket created in /tmp. Once it was enabled, I did two attempts to make sure I would not miss anything and prepare myself.

HOWTO:

The following can be done through SSH or Serial.

My system is super old and has 512MB of RAM only, so I just went with FreeBSD-10.0-RELEASE-i386-disc1.iso that I downloaded to the current system.
Once the download was complete, I copied the ISO to the HDD that I would use to boot the FreeBSD 10.xinstaller, just do this:
`dd if=/path/to/the/ISO/FreeBSD-10.0-RELEASE-i386-disc1.iso of=/dev/idad1`

_On my super old system copy took ages, 5500 seconds to copy the 550MBytes to the /dev/idad1. _

Make sure you have a backup of everything you need as the system is about to be wiped.​At this stage, go to the remote serial.

Reboot the server
Go in boot mode, it varies depending on the version you run, in my case I go from FreeBSD 8.1 where you select '6' to go into boot mode
Once in boot mode, you will have an 'OK' prompt
Verify your disks by running `lsdev`
It should look like the following:

```
OK lsdev
cd devices:
disk devices:
  disk0:  BIOS drive A:
  disk1:  BIOS drive C:
  disk1s1: Unknown fs: 0x12
  disk1s2a: FFS
  disk1s2b: swap
  disk1s2d: FFS
  disk1s2e: FFS
  disk1s2f: FFS
  disk2:  BIOS drive D:
pxe devices:
```
Yes, disk0 is a floppy disk ;-), disk1 is the current FreeBSD 8.1-STABLE, so the one I am interested in is disk2 where my installer should be thanks to the `dd` done earlier.
Let's see how it goes by changing the boot to disk2 using: `set currdev=disk2`
I then unload the current kernel then load the one from the installer:

```
OK unload
OK load kernel
/boot/kernel/kernel text=0xea8530 data=0xcf5f0+0xda970 syms=[0x4+0xd0bc0+0x4+0x1530e3]
```
The latter shows that the kernel was read and loaded which is a good sign
Now let's: `OK boot`

```
Installation has started for FreeBSD 10.x
[code]Copyright (c) 1992-2014 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
  The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 10.0-RELEASE #0 r260789: Fri Jan 17 01:46:25 UTC 2014
   root@snap.freebsd.org:/usr/obj/usr/src/sys/GENERIC i386
FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610
CPU: Intel Pentium III (930.41-MHz 686-class CPU)
  Origin = "GenuineIntel"  Id = 0x686  Family = 0x6  Model = 0x8  Stepping = 6
  Features=0x383fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR,SSE>
real memory  = 536870912 (512 MB)
avail memory = 502689792 (479 MB)
```
I told you the system was old 

After that point, the installation will happen the same way as any other installation with the exception that due to the hardware I have, I did not try the installation with ZFS and went with the Guided one.
Make sure to drop into a shell at the end and do the following crucial steps to keep access via console:

`echo 'console="comconsole"' >>/boot/loader.conf`
`echo '-D' >>/boot.config`
Edit /etc/ttys for the line you use, in my case:

```
ttyu0   "/usr/libexec/getty std.9600"   dialup  off secure
```
became

```
ttyu0   "/usr/libexec/getty std.9600"   vt100   on secure
```
Verify/modify/tune your /etc/rc.conf as per your needs, try to keep it as basic as possible to avoid any issue.
REBOOT
If all goes well, you will boot in FreeBSD 10.x which I then upgraded without any problem using `freebsd-update`


```
root@glouglou:~ # uname -a
FreeBSD glouglou.xxxxxx.xxx 10.0-RELEASE-p10 FreeBSD 10.0-RELEASE-p10 #0: Mon Oct 20 12:38:37 UTC 2014     [EMAIL]root@amd64-builder.daemonology.net[/EMAIL]:/usr/obj/usr/src/sys/GENERIC  i386
```

Glad to have done it as I am 5000 KMs away from this server which had a nice 1525-day uptime before the fresh install but I like the new pkg system so much I wanted to get a more recent installation and stick to a -RELEASE instead of going -STABLE!

Thanks to the FreeBSD team for making this kind of install possible, this is very convenient!


----------

