Re: [pfSense] Restoring from XML prevents VM from booting [SOLVED]

2014-06-08 Thread Stefan Baur
Am 06.02.2014 18:43, schrieb Brian Candler:
>>> I find that the one restored
>>> >via web interface has:
>>> >
>>> >* an extra file /boot.config containing "-D"
>>> >* extra settings in /boot/loader.conf
>>> >
>>> >boot_multicons="YES"
>>> >boot_serial="YES"
>>> >comconsole_speed="115200"
>>> >console="comconsole,vidconsole"
>> So these parameters are added blindly regardless of whether they were
>> set before, is that what you're saying? If so, that sounds like a nasty
>> bug to me.
> Not exactly blindly: the boot config is overwritten based on what's in
> the XML. See setup_serial_port() in /etc/inc/pfsense-utils.inc
> 
> $fd = fopen($boot_config_file,"w");
> ...
> if(isset($config['system']['enableserial'])) {
> fwrite($fd, "-D");
> }
> ...
> if(isset($config['system']['enableserial'])) {
> $new_boot_config[] =
> 'boot_multicons="YES"';
> $new_boot_config[] = 'boot_serial="YES"';
> $new_boot_config[] =
> 'comconsole_speed="' . $serialspeed . '"';
> $new_boot_config[] =
> 'console="comconsole,vidconsole"';

I finally had some spare time to re-visit this issue.
Turns out my config file did contain the "enableserial" parameter -
$DEITY knows why, because I never ran the system via serial console, in
fact, it never had one to begin with (virtual machine).

So, for everyone that doesn't understand PHP well enough to figure out
what the code snippet quoted by Brian above does ... this is what you
need to do if you want to get rid of the issue:

1) Change to the directory where your config.xml resides

2) run one of the two following commands:

# "clean" way of handling XML, with backup copies of config files
# requires xmlstarlet present (not the case on default pfSense install)
xmlstarlet ed -d "/pfsense/system/enableserial" config.xml > config.new
&& cp config.xml config.old && cp config.new config.xml

# quick and dirty way operating in-place, works on default pfSense
sed -i -e '/https://lists.pfsense.org/mailman/listinfo/list


Re: [pfSense] Restoring from XML prevents VM from booting [SOLVED]

2014-02-06 Thread Brian Candler

On 06/02/2014 12:23, Stefan Baur wrote:

I find that the one restored
>via web interface has:
>
>* an extra file /boot.config containing "-D"
>* extra settings in /boot/loader.conf
>
>boot_multicons="YES"
>boot_serial="YES"
>comconsole_speed="115200"
>console="comconsole,vidconsole"

So these parameters are added blindly regardless of whether they were
set before, is that what you're saying? If so, that sounds like a nasty
bug to me.
Not exactly blindly: the boot config is overwritten based on what's in 
the XML. See setup_serial_port() in /etc/inc/pfsense-utils.inc


$fd = fopen($boot_config_file,"w");
...
if(isset($config['system']['enableserial'])) {
fwrite($fd, "-D");
}
...
if(isset($config['system']['enableserial'])) {
$new_boot_config[] = 
'boot_multicons="YES"';

$new_boot_config[] = 'boot_serial="YES"';
$new_boot_config[] = 
'comconsole_speed="' . $serialspeed . '"';
$new_boot_config[] = 
'console="comconsole,vidconsole"';


Regards,

Brian.

___
List mailing list
List@lists.pfsense.org
http://lists.pfsense.org/mailman/listinfo/list


Re: [pfSense] Restoring from XML prevents VM from booting [SOLVED]

2014-02-06 Thread Stefan Baur
Am 06.02.2014 13:10, schrieb Brian Candler:
> On 05/02/2014 17:47, Espen Johansen wrote:
>> Might be that serial redirection makes it show nothing.
> Yes, the serial port was the problem - thank you!

Interesting ...


> The production physical box (which this XML was pulled from) *was*
> configured to use a serial port, but the boot loader hangs if it can't
> find one inside the VM.

Mine wasn't configured to use a serial port, but still hung.


[...]

> When you restore XML via the web interface, I now see some boot loader
> settings are tweaked. Comparing a machine restored via the web interface
> versus one where I just copied config.xml, I find that the one restored
> via web interface has:
> 
> * an extra file /boot.config containing "-D"
> * extra settings in /boot/loader.conf
> 
> boot_multicons="YES"
> boot_serial="YES"
> comconsole_speed="115200"
> console="comconsole,vidconsole"

So these parameters are added blindly regardless of whether they were
set before, is that what you're saying? If so, that sounds like a nasty
bug to me.

-Stefan
___
List mailing list
List@lists.pfsense.org
http://lists.pfsense.org/mailman/listinfo/list


Re: [pfSense] Restoring from XML prevents VM from booting [SOLVED]

2014-02-06 Thread Brian Candler

On 05/02/2014 17:47, Espen Johansen wrote:

Might be that serial redirection makes it show nothing.

Yes, the serial port was the problem - thank you!

The production physical box (which this XML was pulled from) *was* 
configured to use a serial port, but the boot loader hangs if it can't 
find one inside the VM.


Solution: go into VirtualBox VM settings > Ports
  Serial Ports > Port 1
  [X] Enable Serial Port
  Port Number: (leave at COM1)
  Port Mode: Disconnected

Alternatively, you can set
  Port Mode: Raw File
  Port File/Path: /tmp/serial-pfsense1
and then it writes both to the VGA console and the serial port file.

When you restore XML via the web interface, I now see some boot loader 
settings are tweaked. Comparing a machine restored via the web interface 
versus one where I just copied config.xml, I find that the one restored 
via web interface has:


* an extra file /boot.config containing "-D"
* extra settings in /boot/loader.conf

boot_multicons="YES"
boot_serial="YES"
comconsole_speed="115200"
console="comconsole,vidconsole"

Thanks again for pointing me in the right direction.

Regards,

Brian.

___
List mailing list
List@lists.pfsense.org
http://lists.pfsense.org/mailman/listinfo/list