1

Via a script I am attempting to configure x11-common. Manually I have been able to run the command:

sudo dpkg-reconfigure x11-common

then selected Anybody which worked.

I would like to programmatically provide the Anybody answer to the command.

I have tried sudo dpkg-reconfigure -f noninteractive x11-common

How is this possible?

  • What does debconf-get-selections | grep x11-common say? – muru May 27 '15 at 17:43
  • One second rebooting and reprovisioning VM. I'm assuming it says "Console-only". Should be able to echo an answer to debconf/x11-common? – andrsnn May 27 '15 at 17:46
  • Also, from man dpkg-reconfigure: Note that if you normally have debconf set to use the noninteractive frontend, dpkg-reconfigure will use the dialog frontend instead, so you actually get to reconfigure the package. – muru May 27 '15 at 17:46
  • Yes it says: x11-common x11-common/xwrapper/allowed_users select Console Users Only x11-common x11-common/xwrapper/actual_allowed_users string console – andrsnn May 27 '15 at 17:48
  • I see so debconf-set-selections. – andrsnn May 27 '15 at 17:52
1

You can use debconf-set-selections to preseed settings for such configuration scenes. First, on a system on which the package has been installed and configured, run:

debconf-get-selections | grep x11-common

This will tell you the selection identifiers (the name of the package, which you know, and the name and type of the question) you need in case you want to manually set them. In this case, the output would be something like:

x11-common  x11-common/xwrapper/allowed_users         select  Anybody
x11-common  x11-common/xwrapper/actual_allowed_users  string  anybody

Then you can do, on a system on which x11-common is yet to be installed, you can:

ssh first-system 'debconf-get-selections | grep x11-common' |
  sudo debconf-set-selections

Or, manually:

sudo debconf-set-selections <<EOF
x11-common  x11-common/xwrapper/allowed_users         select  Anybody
x11-common  x11-common/xwrapper/actual_allowed_users  string  anybody
EOF

Then, you can install x11-common and expect it use this setting while configuration:

sudo DEBIAN_FRONTEND=noninteractive apt-get install x11-common

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.