Page 1 of 1

Headless install issues

Posted: 18 Sep 2015 09:56
by hastdotwhat
I'm trying to install the current release from a LiveUSB image onto a headless system (no ability to add a graphics card, and with soldered-in SSD). I've read various other posts from people on trying to deal with this but the suggested solution of either dropping in a graphics card or installing on another system and moving the install media across aren't an option.

Is there any way to perform an embedded install from the WebGUI or SSH command prompt? Presumably the standard console config menu is driven from the command prompt, can that be triggered over SSH?

Re: Headless install issues

Posted: 18 Sep 2015 13:28
by raulfg3
hastdotwhat wrote:Is there any way to perform an embedded install from the WebGUI or SSH command prompt? Presumably the standard console config menu is driven from the command prompt, can that be triggered over SSH?
YES.

you need 2 USB Key, one clean and other with N4FXXX.USB.live version

put both USB keys on any machine ( your laptop or any machine with monitor and keyboard), boot from usb live.

use menu to install embeded version on clean USB ( Please be carefull DO NOT install embeded on any HD of your PC,because you lost data).

Once done, you have a new USB with embeded install on it, you can use this USB to boot your NAS.

PD: To upgrade this embeded version in the future, you can do it by WebGUI.

Re: Headless install issues

Posted: 18 Sep 2015 15:52
by hastdotwhat
Uhh, see my original message, I want to install to the SSD that's part of the headless system. While in theory it would be possible to run from an external USB key, it'd be pretty messy, and at some point someone will unplug it or bump into it and break it or something similar. So what I'm after is a way to get to the install menu via either SSH or the serial port, without needing to have a monitor and keyboard connected.

Re: Headless install issues

Posted: 18 Sep 2015 17:59
by crowi
use something like this and no one will bump into it and break it:
http://www.amazon.com/SanDisk-Cruzer-Lo ... B005FYNSZA

once you have installes it, you can enable the serial console through the webgui at System | Advanced
similar problem reported here:
https://forums.freenas.org/index.php?th ... -how.7487/

Re: Headless install issues

Posted: 18 Sep 2015 18:58
by armandh
two USB flash install is good practice for one and internal flash
write down each choice each step and give it a try blind.
it may or may not work

also there is the option of live USB option using internal FAT formatted flash for the config.

Re: Headless install issues

Posted: 19 Sep 2015 06:54
by hastdotwhat
crowi wrote:once you have installes it, you can enable the serial console through the webgui at System | Advanced
similar problem reported here:
https://forums.freenas.org/index.php?th ... -how.7487/
That was one of the threads I'd read, but he doesn't really describe a solution. He reports that the install option is missing from the console menu and that he'll post something to the Wiki, but that's all. I can't even enable the serial console, I get "Error: The changes could not be applied (error code 1)" when I try and enable it from the WebGUI. I'm guessing it's because it wants some writeable location for its config, this comment:
http://wiki.nas4free.org/doku.php?id=do ... ivecd_mode
indicates that you need to provide a second USB key for the LiveUSB image on the first USB key to save its config to, but providing an MSDOS-formatted (presumably meaning FAT32) key doesn't fix things, and the disk management page reports the FS as "Unknown or unformatted".

So I formatted the key FAT32 (which it was already formatted anyway) via the "Format" menu, but it hasn't resolved the problem, I still get the same "Error: The changes could not be applied (error code 1)". In any case rebooting resets the status to "Unknown or unformatted". Formatting to UFS instead of FAT32 doesn't change things either.

I tried to bypass the problem by adding 'console="comconsole"' to /boot/loader.conf, but predictably that failed with an error, "Warning: fopen(/cf/boot/loader.conf.local.4972): failed to open stream: No such file or directory in /etc/inc/util.inc on line 2735 Error: Failed to write configuration file '/cf/boot/loader.conf.local'".

Another option, will FreeBSD (via Nas4Free) recognise and work with a USB VGA adapter? If it really does need a physical console attached then that might be a way of providing one, assuming it'll also work through a USB hub (for the LiveUSB key, the config storage key, a USB keyboard, and a USB VGA adapter).

Re: Headless install issues

Posted: 19 Sep 2015 18:38
by ChriZathens
You could try the embedded install on a usb key.
Once up and running, and having access to the gui, perhaps you can then use dd to write the embedded install to the internal ssd, afterwards remove the usb and let it boot from the ssd...
Just an idea, perhaps it will work.

Re: Headless install issues

Posted: 20 Sep 2015 12:32
by hastdotwhat
Yeah, that was another option, use another machine to install from LiveUSB to another USB key, then create a third USB key to boot something like BusyBox and boot that so I can dd the installed image over to the SSD. The reason why I hadn't done that already is that I was a bit nervous about moving an installed image over to a completely different architecture (different CPU family, chipset, video, storage, everything is different), I know that FreeBSD reconfigures itself as required on boot but it felt like I'd be pushing things a bit. A second consideration was that I'll be throwing away most of the capacity of the SSD by dd'ing over the USB-installed image unless I hack around with partition resizing, which presumably means booting back into the LiveUSB and running gpart on the SSD image and sacrificing a goat or something to get it right.

I can't believe it's this hard to do a simple headless install. The underlying FreeBSD allows it with a bit of hackery (adding 'console="comconsole"' to loader.conf) but it seems to be almost impossible with Nas4Free. I'll post a wishlist for this in a separate message...

Re: Headless install issues

Posted: 20 Sep 2015 12:39
by hastdotwhat
So my wishlist for Nas4Free to allow headless installs:
  1. Enable the serial console by default. It's kinda painful to watch the full boot process nicely displayed on the serial console and then just before the FreeBSD prompt is about to come up it goes catatonic as the serial console is disabled. If this is seen for some reason to be a security issue then at least enable it for LiveUSB/LiveCD even if it's disabled when the final install is done.
  2. Document how the install is triggered so it can be initiated from the serial console or via SSH. Presumably there's some setup script somewhere that gets run, but I haven't been able to find it.
For the second point, it looks like /etc/rc.initial provides the menu variant without the install option that's referred to in the post referenced earlier:
https://forums.freenas.org/index.php?th ... post-29663
and then /etc/rc.initial.install chaining to /etc/rc.initial.install2 does the actual install, but before I potentially create a system that only half works I thought I'd see if anyone has any comments on running this manually from an SSH login.

Re: Headless install issues

Posted: 21 Sep 2015 07:51
by hastdotwhat
OK, I've figured out how to do it, I'll post details to a separate thread under the "SOLVED" tag.