[SOLVED]Preconfiguring a package for numerous installations

Kernels & Hardware, configuring network, installing services

Re: Preconfiguring a package for numerous installations

Postby cuckooflew » 2020-08-21 17:03

I am looking at the files in the package download, and
this really seems odd to me, now:
fdelente wrote:
I've asked the developers, but they didn't seem much at ease with debconf and couldn't really give me any hint on how to do!

Yet they are using a "debconf" directory, and module, in their post install scripts, .... :?: :?:

Code: Select all
#!/bin/bash
# postinst script for sambaedu-boot-server
#
# see: dh_installdeb(1)

set -e
. /usr/share/debconf/confmodule

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <postinst> `abort-remove'
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see https://www.debian.org/doc/debian-policy/ or
# the debian-policy package ---snip---
-------

Maybe , if you take a closer look at these scripts, you will see that they could be modified to do what you want,..... but you need to use debconf, I fail to understand why you don't want to:
The manpage of dpkg-preconfigure says that all answers can be given in advance, and stored in a LDAP database, but I don't want (don't know and am not interested in that solution), but can a file be used instead?

Of course a file can be used, the file would be a script, written to post/submit the responses needed,... If the developers of this software are unable, or unwilling to help provide you with a file or template, maybe consider looking into other software,... They might need some details , EG: a list of the responses you want to use, ... I don't know, or are you hoping someone here will download the package, and then write your script for you ? (That is ok, please don't get me wrong), but if this is some kind of home work assignment,
Post by fdelente » 2020-08-21 11:40
Thanks for your answer, unfortunately it's my « job » to do it (not really but I have been assigned the task) ---snip---

Why would some one assign a task to someone that is not qualified, ? There are some details here that seem to be missing,
fdelente wrote:Sorry if it's a FAQ or a vague question, but I'm not very knowledgeable about Debian, and I have a hard time understanding the info I find on the web.

Well , it isn't really FAQ, but to some extent vaque, Yes , I understand you are not very knowledgeable about Debian,... we might be able to help if you can specify , the info you found, and exactly what parts you do not understand,..
Some one might be able to clarify on those parts, Eg: I can't really explain to you what, those instructions mean, when I don't even know what the instructions/info is, can I ? Probably I couldn't anyway., I am not all that advanced myself, ...I also found quite a bit of info on "the web", but if it is info you have all ready seen and don't want to use, like this: " The manpage of dpkg-preconfigure says that all answers can be given in advance, and stored in a LDAP database, but I don't want (don't know and am not interested in that solution),".... Below is another part of the postinstall script, (file)
'
Code: Select all
  ---snip---
      # mise au domaine
# domain update
       net ads join -U "${config_ldap_admin_name}%${config_ldap_admin_passwd}" $ou
       
       # nettoyage eventuel d'un preseed
# possible cleaning of a preseed
       
       if [ -f "/var/www/sambaedu/ipxe/diconf/se4ad.preseed" ]; then
          rm -f "/var/www/sambaedu/ipxe/diconf/se4ad.preseed"

Head_on_a_Stick wrote:
fdelente wrote:if I do a dpkg-preconfigure, is there somewhere a file that is created with the answers to the questions, so that I can then copy this file on another machine and have the package install non-interactively?

See debconf.conf(5).

I think it would be to your advantage to get interested in "that solution", and if you don't know or understand it, start learning what you will need to know,..then again, it might be faster and easier to copy/paste from a file some 400 times,... there will be a learning curve to learn how to use the above solution, depending on how fast you learn, etc,.. interesting situation,..good luck
H_O_A_S posted while I was typing, I don't know if these script snippets will be of any use, but any way, I am still going to post them.
==== edit ===
Both neuraleskimo and H_O_A_S are very knowledgeable , Steve as well, I think there is a good chance they can help use the debconf, LDAP database,etc solution, if you show your interest , instead of rejecting it.
Please Read What we expect you have already Done
Search Engines know a lot, and
"If God had wanted computers to work all the time, He wouldn't have invented RESET buttons"
and
Just say NO to help vampires!
cuckooflew
 
Posts: 683
Joined: 2018-05-10 19:34
Location: Some where out west

Re: Preconfiguring a package for numerous installations

Postby cuckooflew » 2020-08-21 22:57

Head_on_a_Stick wrote:
fdelente wrote:if I do a dpkg-preconfigure, is there somewhere a file that is created with the answers to the questions, so that I can then copy this file on another machine and have the package install non-interactively?

See debconf.conf(5).

There is some more documentation, here:
https://manpages.debian.org/unstable/debconf-doc/debconf.7.en.html
I will quote some parts, but really the entire page needs close study,
DESCRIPTION
Debconf is a configuration system for Debian packages. There is a rarely-used command named debconf, documented in debconf(1)

Debconf provides a consistent interface for configuring packages, allowing you to choose from several user interface frontends. It supports preconfiguring packages before they are installed, which allows large installs and upgrades to ask you for all the necessary information up front, and then go do the work while you do something else. It lets you, if you're in a hurry, skip over less important questions and information while installing a package (and revisit it later).
Preconfiguring packages
Debconf can configure packages before they are even installed onto your system. This is useful because it lets all the questions the packages are going to ask be asked at the beginning of an install, so the rest of the install can proceed while you are away getting a cup of coffee.

==============
Unattended Package Installation
If you have many machines to manage you will sometimes find yourself in the position of needing to perform an unattended installation or upgrade of packages on many systems, when the default answers to some configuration questions are not acceptable. There are many ways to approach this; all involve setting up a database and making debconf use it to get the answers you want.

You should really read debconf.conf(5) before this section, as you need to understand how debconf's databases work.

Sounds like exactly what you want, and need to learn, based on your description . Yet,
fdelente »The manpage of dpkg-preconfigure says that all answers can be given in advance, and stored in a LDAP database, but I don't want (don't know and am not interested in that solution), but can a file be used instead?

And the developers as well ?
Postby fdelente » 2020-08-21 04:54
I've asked the developers, but they didn't seem much at ease with debconf and couldn't really give me any hint on how to do!

I can give a hint, and I am not even a developer,... Spend some time reading carefully, and study what is said, also follow the "see also" links, then try to put what you learn into practice.
fdelente » I have read the manpages about debconf but I find them vague: if I do a dpkg-preconfigure, is there somewhere a file that is created with the answers to the questions, so that I can then copy this file on another machine and have the package install non-interactively?

https://manpages.debian.org/unstable/debconf-doc/debconf.7.en.html
I guess you must be talking about a different manual page, this one^ (above)
is not vague at all, and it includes some examples,
But perhaps you're using something a little bit easier to set up like, say, the default debconf database configuration, or you just don't want your remote systems to use LDAP all the time. In this case the best approach is to temporarily configure the remote systems to stack your database underneath their own existing databases, so they pull default values out of it. Debconf offers two environment variables, DEBCONF_DB_FALLBACK and DEBCONF_DB_OVERRIDE, to make it easy to do this on the fly. Here is a sample use:

Ok, well no need to copy paste the entire page to here, it is there, and your choice , study it or not. I don't think it is something that can be learned just "over night" or in one day, but it will be worth it, once your done you will be able to use what you learn for upgrades, updates, and possible future situations,... Be sure to also follow the "see also" links, they are a important part of it.
SEE ALSO
debconf.conf(5), debconf-devel(7), dpkg-preconfigure(8), dpkg-reconfigure(8), debconf(1),

I will let you know in a week or 2, if I learn how to do this myself, and you still have not grasped it. :mrgreen: Good luck
Please Read What we expect you have already Done
Search Engines know a lot, and
"If God had wanted computers to work all the time, He wouldn't have invented RESET buttons"
and
Just say NO to help vampires!
cuckooflew
 
Posts: 683
Joined: 2018-05-10 19:34
Location: Some where out west

Re: Preconfiguring a package for numerous installations

Postby cuckooflew » 2020-08-22 02:03

More questions, from this end:
by fdelente » The package that asks for parameters is https://deb.sambaedu.org/debian/pool/st ... 96_all.deb ----snip----
However, when I install it on a machine, I have several questions about the Kerberos realm, the admin password, etc. I'd like to not have to type these (they are to be the same) on every machine I have to install.

Did you really install it on a machine ? If you did, what did you do about the dependencies, ? The package you link to is not installable like it is. I really think you need to be communicating with the developers on this. It is not a Debian package, in that it is not in the Debian repositories, normally we recommend not using packages from random websites: RE:
https://wiki.debian.org/DontBreakDebian
I decided to try it, in order to get a first hand look, but it is not installable..can you explain that ?
Please Read What we expect you have already Done
Search Engines know a lot, and
"If God had wanted computers to work all the time, He wouldn't have invented RESET buttons"
and
Just say NO to help vampires!
cuckooflew
 
Posts: 683
Joined: 2018-05-10 19:34
Location: Some where out west

Re: Preconfiguring a package for numerous installations

Postby fdelente » 2020-08-22 05:40

Thanks for all this info, that'll take some time to digest! :^)

I really installed the package on a machine and everything workd as intented by the developer (their project is to create a Windows AD server based on samba, and the package I install on a machine makes authentication on this server possible).

I have been able to authenticate from a Debian Buster to this AD server, and from an Xubuntu 16 (our old machines) too.

The only problem I have is having to install with

apt-get install sambaedu-ad-client
apt-get install sambaedu-winbind

and one of these packages (or a dependency) asks me all these questions and I don't want to have to enter by hand the answers.

Anyway I'll look again in the manpages and spend more time on them to try to get info from them.

Thanks!
fdelente
 
Posts: 11
Joined: 2012-12-02 14:32

Re: Preconfiguring a package for numerous installations

Postby fdelente » 2020-08-22 09:04

Super great, it works perfectly with debconf-get-selections and debconf-set-selections! I could write a script that does the whole installation unattended!

Thanks very much to all of you for your input!
fdelente
 
Posts: 11
Joined: 2012-12-02 14:32

Re: Preconfiguring a package for numerous installations

Postby Head_on_a_Stick » 2020-08-22 13:01

fdelente wrote:it works perfectly with debconf-get-selections and debconf-set-selections!

Fantastic, please add [SOLVED] to the thread title to help others who encounter this problem.
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 12640
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: [SOLVED]Preconfiguring a package for numerous installati

Postby Head_on_a_Stick » 2020-08-30 21:29

Bump!

The location of the configuration file is /var/cache/debconf/config.dat

EDIT: and here's an example of the contents for preseed.cfg setting permission for the licences of the firmware-ipw2x00 & firmware-ivtv packages:
Code: Select all
firmware-ipw2x00 firmware-ipw2x00/license/accepted boolean true
firmware-ivtv firmware-ivtv/license/accepted boolean true

^ They are derived from the pure output of debconf-get-selections(1).
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 12640
Joined: 2014-06-01 17:46
Location: /dev/chair

Previous

Return to System configuration

Who is online

Users browsing this forum: No registered users and 15 guests

fashionable