How can I create a config file that will automatically install packages
-
I have set up an instance of pfSense (NanoBSD) that his set up the way I want it. I created a script that will prompt for a few questions (LAN subnet, DynDNS hostname, etc), and it then generates a new config based on the generic one.
The generic one has packages installed. I know that if I were to use the restore function on a new install, it would reinstall the packages, but I'm not using that. Instead, I'm copying the config from a USB stick directly into the file system on the new install, and then rebooting.
Everything works fine that way except that the packages don't seem to get re-installed automatically, so it seems like there is something I'm missing; maybe something I have to set in the new XML. Can anyone tell me what I have to do to have the packages reinstalled automatically?
Thanks!
-
I would run a restore to a new target machine, then immediately after that run a backup of the xml.
Run a diff on the two files and perhaps there is some kind of 'check for pkg installation' routine that is set after a restore.
-
If a package's settings are in the config, but the package's files are not found on the system, then it will try to install them at boot time. As mhab12 suggested, if you backup a config that has the packages you want installed, copy the <installedpackages>section out of it into the other config file and it should do what you want.</installedpackages>
-
Yeah that's why this is confusing. I am literally taking a backup of a config file, and then changing some of the settings inside (none that are related to packages, just IP ranges and host names and such). Then I take the modified config, copy it over an existing config (not using the built-in restore feature), and reboot. WAN is set to DHCP and I made sure a cable was connected before rebooting, but for some reason it didn't install the packages correctly. I think one of them seemed okay (cron?) but others (NRPE I think) looked like it was installed but had missing files. Reinstalling the packages fixed it. If it sounds like what I'm doing should work, then I'll have to try it a few more times; I just thought that maybe there was something going on when an official restore was done that I wasn't replicating by just copying one config over another and rebooting. Thanks.
-
Thats why it is SO nice to run PFSense in a virtualized scenarioโฆ..MUCH easier.
-
After you copy that config file over, do this too:
# touch /conf/needs_package_sync
-
After you copy that config file over, do this too:
# touch /conf/needs_package_sync
Hi Jim,
I just tried this and it sorta looked like it was working after the reboot but it's still broken. The config I am starting out with came from a machine with these packages installed:
-
Cron
-
Notes
-
Shellcmd
-
NRPE
The only package that still works is Notes (and this is the only package shown under "installed packages"). The others still have their entries in the Services menu but going to them either gives a PHP error or a 404.
Any ideas? Thanks for your help!
-
-
rather odd that it isn't detecting the missing files. Are there any messages in the boot log about missing files?
-
It would also help to see the output of this when it is in the broken state:
var_dump($config['installedpackages']['package']);
Run that in the PHP Execute section of Diagnostics > Command.
-
It would also help to see the output of this when it is in the broken state:
var_dump($config['installedpackages']['package']);
Run that in the PHP Execute section of Diagnostics > Command.
Sorry for the long delay. It's been a little while since I've had to deploy another system and I haven't had the time to troubleshoot this on its own. I did another one today, and the output of the above command was NULL. Notes doesn't work this time either, none of the packages do. Installed packages in the GUI shows nothing, but I do still have entries in the services menu that don't work, so I will have to reinstall al packages manually again.
I appreciate your help on this, Jim. I should have another system to deploy soon so I'll be able to get back to you more quickly. Thanks.