During apt-get install -y python-catkin-tools on Ubuntu you have to enter timezone numbers 8 for the region and 7 for a city when "tzdata (2020f-0ubuntu0.18.04)" gets installed.
How can I run apt-get install -y python-catkin-tools so that the menu choices that pop up later will first get an 8 and then a 7 as soon as entering is possible? I have marked the numbers to be entered with ##
apt-get install -y python-catkin-tools
...
Setting up tzdata (2020f-0ubuntu0.18.04) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
Configuring tzdata
------------------
Please select the geographic area in which you live. Subsequent configuration questions will narrow this down by presenting a list of cities, representing the time zones in which they are located. 1. Africa 2. America 3. Antarctica 4. Australia 5. Arctic 6. Asia 7. Atlantic 8. Europe 9. Indian 10. Pacific 11. SystemV 12. US 13. Etc
Geographic area: ##8##
Please select the city or region corresponding to your time zone. 1. Amsterdam 6. Belgrade 11. Budapest [shortened...]
Time zone:
Time zone: ##7##
Current default time zone: 'Europe/Berlin'
Local time is now: Wed Jan 20 22:42:43 CET 2021.
Universal Time is now: Wed Jan 20 21:42:43 UTC 2021.
Run 'dpkg-reconfigure tzdata' if you wish to change it.I need this to automatically run from a Dockerfile, without asking the user to enter the timezone during installation. I would like to know the way how to put the right timezone here as a parameter of the install command, or as a mere workaround, how to force it to use the default timezone.
After a recent run, I have found out that entering the numbers during installation from Dockerfile does not seem to work either. The entries do not trigger anything.
[...]
Setting up tzdata (2021a-0ubuntu0.18.04) ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
Configuring tzdata
------------------
Please select the geographic area in which you live. Subsequent configuration
questions will narrow this down by presenting a list of cities, representing
the time zones in which they are located. 1. Africa 4. Australia 7. Atlantic 10. Pacific 13. Etc 2. America 5. Arctic 8. Europe 11. SystemV 3. Antarctica 6. Asia 9. Indian 12. US
Geographic area: 8
7
^CAs I assume that this problem is not specific to apt-get or to the OS, I do not tag it as such. Please change this if I am wrong here.
51 Answer
This does not work for me when building a Dockerfile:
(you may still try it, also with the external link)
If you want to go through a working menu and manually enter values of your choice in the menu, you need a "console-setup" (e.g. gnome-terminal with apt-get install -y gnome-terminal) in order to have the terminal dialog. But I could not get it to run with this, probably ssh to it is needed, seethis answer of "Unable to initialize frontend: dialog when using ssh", that would mean in this case activating the terminal (TERM) and using "dialog" as the frontend:
TERM=$TERM DEBIAN_FRONTEND=dialog apt-get install -y python-catkin-tools
This works for me when building a Dockerfile:
If you really wanted to enter the menu points, the following workaround would not help. If you are fine with the defaults, in this case zone/city = "etc./etc.", the solution is as follows, taken from Is it possible to answer dialog questions when installing under docker?:
Change
apt-get install -y python-catkin-toolstoDEBIAN_FRONTEND=noninteractive apt-get install -y python-catkin-tools
suppresses the menu of the command that comes directly after it.
You could also suppress any menu during the Dockerfile installation, then put at the beginning:
ARG DEBIAN_FRONTEND=noninteractiveDo not enter this since that will be kept as a setting even in the image:
ENV DEBIAN_FRONTEND=noninteractive
At best, use "1.", as you might not want to suppress every other menu point that comes up.