Is it practical to pre-configure servers in the Cubic chroot

Asked by MangoCats

I would like to install and pre-configure some "active" packages like virtualbox and rabbitmq-server, but when I apt install these in the chroot, their installers are blocked from executing their daemon related steps.

Is it practical to pre-install this kind of package to be "ready to use" straight away after the .iso is installed, or is this kind of thing better done after the live system has started running? If it is practical, what's an efficient approach?

Thanks,

Question information

Language:
English Edit question
Status:
Solved
For:
Cubic Edit question
Assignee:
No assignee Edit question
Solved by:
MangoCats
Solved:
Last query:
Last reply:
Revision history for this message
Cubic PPA (cubic-wizard) said :
#1

I don't know about rabbitmq-server. However, I was able to install VirtualBox...

First, add the universe repository:

$ nano /etc/apt/sources.list

Then install VirtualBox:

$ echo "deb http://download.virtualbox.org/virtualbox/debian `lsb_release -sc` contrib" | tee --append /etc/apt/sources.list.d/virtualbox.list
$ wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
$ apt update
$ apt install dkms build-essential libcurl3
$ apt install virtualbox-5.2

I received the following message:

  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  Running in chroot, ignoring request: daemon-reexec
  This system is currently not set up to build kernel modules.
  Please install the Linux kernel "header" files matching the current kernel
  for adding new hardware support to the system.
  The distribution packages containing the headers are probably:
      linux-headers-generic linux-headers-4.15.0-23-generic
  This system is currently not set up to build kernel modules.
  Please install the Linux kernel "header" files matching the current kernel
  for adding new hardware support to the system.
  The distribution packages containing the headers are probably:
      linux-headers-generic linux-headers-4.15.0-23-generic
  There were problems setting up VirtualBox. To re-start the set-up process, run
    /sbin/vboxconfig
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

So I manually installed the recommended package:

$ apt install linux-headers-generic linux-headers-4.15.0-23-generic

Then, I restarted the virtualbox configuration:

$ /sbin/vboxconfig

This produced the following messages:

  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  Running in chroot, ignoring request: daemon-reexec
  vboxdrv.sh: Stopping VirtualBox services.
  vboxdrv.sh: Starting VirtualBox services.
  vboxdrv.sh: Building VirtualBox kernel modules.
  Running in chroot, ignoring request: start
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Cubic was able to generate an ISO in which VirtualBox works.

Revision history for this message
MangoCats (mangocats) said :
#2

Thanks, I guess I'll take them one at a time and test to make sure they're installing o.k. The packages that have given me these kinds of "ignoring request" messages so far have been: virtualbox, rabbitmq-server, openssh-server and samba.

It will be much more convenient if the iso can not only have those services installed, but also pre-configured for our applications after the initial install. If worse comes to worse, I could include a post-install script that does the things that can't be done (or done easily) in the .iso - but it's really nice if the .iso can capture all the packages to install so the installation isn't dependent on internet access.

Revision history for this message
Cubic PPA (cubic-wizard) said :
#3

I regularly install openssh-server and samba in the chroot environment.

I have never had issues when running the customized live IOS or after installing it to hardware.

This is despite error messages like the following in the chroot environment:

     - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Setting up samba (2:4.7.6+dfsg~ubuntu-0ubuntu2) ...
    Adding group `sambashare' (GID 126) ...
    Done.
    Samba is not being run as an AD Domain Controller, masking samba-ad-dc.service.
    Please ignore the following error about deb-systemd-helper not finding samba-ad-dc.service.
    Running in chroot, ignoring request: daemon-reload
    Running in chroot, ignoring request: daemon-reload
    Running in chroot, ignoring request.
    Running in chroot, ignoring request: daemon-reload
    Running in chroot, ignoring request: is-active
    Running in chroot, ignoring request: start
    Running in chroot, ignoring request: daemon-reload
    Running in chroot, ignoring request.
    Running in chroot, ignoring request: daemon-reload
    Running in chroot, ignoring request: is-active
    Running in chroot, ignoring request: start
    Running in chroot, ignoring request: daemon-reload
    Running in chroot, ignoring request.
    Running in chroot, ignoring request: daemon-reload
    Running in chroot, ignoring request: is-active
    Running in chroot, ignoring request: start
    Created symlink /etc/systemd/system/multi-user.target.wants/nmbd.service → /lib/systemd/system/nmbd.service.
    Failed to preset unit, unit /etc/systemd/system/samba-ad-dc.service is masked.
    /usr/bin/deb-systemd-helper: error: systemctl preset failed on samba-ad-dc.service: No such file or directory
    Created symlink /etc/systemd/system/multi-user.target.wants/smbd.service → /lib/systemd/system/smbd.service.
     - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

However, I suspect you are trying to do do something a little more complex than the simple package installs that I have done.

If you come across a generic solution, I'd be interested in possibly including it in Cubic.

Revision history for this message
MangoCats (mangocats) said :
#4

For the moment, I'm going to consider myself answered with a "No, it's not terribly practical to pre-configure a rabbitmq-server instance in the chroot environment." The install seems to work, but the configuration steps (like setting up new username and passwords), require the server to be running, which it doesn't seem to want to in the chroot.

It will be easy enough to have a "first boot script" that can take care of all of that stuff after the .iso is installed, I'll be opening another question here in a minute about pre-configuring user accounts... It's already a big help that the .iso can install all the server code without internet access, pre-configuration would be icing on the cake, but my pre-cubic approach was a script that configured the system after a standard .iso install - of course requiring internet access to apt install all the required packages.