dpkg-reconfigure tzdata not working on Ubuntu 14.04 Trusty - timezone

I'm trying to change local timezone on Ubuntu 14.04 with the following commands.
$ echo Asia/Tokyo > /etc/timezone
$ dpkg-reconfigure --frontend noninteractive tzdata
Current default time zone: 'Asia/Tokyo'
Local time is now: Fri Apr 22 13:47:04 UTC 2016.
Universal Time is now: Fri Apr 22 13:47:04 UTC 2016.
However, localtime is still UTC not Asia/Tokyo.
I can change the timezone with timedatectl.
$ timedatectl set-timezone Asia/Tokyo
$ timedatectl
Local time: Fri 2016-04-22 23:07:29 JST
Universal time: Fri 2016-04-22 14:07:29 UTC
Timezone: Asia/Tokyo (JST, +0900)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a
Once I change timezone with timedatectl then I can also change with dpkg-reconfigure to any timezone.
Has anyone had the same issue?
Thanks!

sudo EDITOR='sed -Ei "
s|tzdata/Areas=.+|tzdata/Areas=\"Asia\"|;
s|tzdata/Zones/Asia=.+|tzdata/Zones/Asia=\"Shanghai\"|
"' dpkg-reconfigure -f editor tzdata
Related answer: How do you set a locale non-interactively on Debian/Ubuntu?

Related

Debian Docker on Mac M1Pro Monterey: cannot open shared object file: No such file or directory

I have a Docker container, that runs the redis:6 image, which builds FROM debian:bullseye-slim. When starting the redis server, I load a shared object file as a module, called redisearch.so. On my new Mac M1Pro Monterey this fails, telling me the file does not exist, even though it clearly does. I have checked that the file is there and made sure the permission is 777 and ownership is root.
On my old mac and another Linux device it runs fine.
Does anyone have a clue what could be the problem here?
Dockerfile
############ COMPILING OUR REDISSEARCH EXTENSION
FROM debian:buster-slim AS builder
RUN apt-get update
RUN apt-get install -y git
RUN apt-get install -y libatomic1
RUN apt-get install -y cmake
WORKDIR /home
RUN git clone https://github.com/RediSearch/RediSearch.git
WORKDIR /home/RediSearch
RUN rm ./tests/ctests/ext-example/*
COPY ./redisearch-ext/ ./tests/ctests/ext-example/
WORKDIR ./tests/ctests/ext-example/
RUN make jurata_extension.so
############ GETTING THE REDISEARCH SHARED OBJECT FILE AND PUTTING IT ON A REDIS SERVER
# Openshift compatible version of redissearch
FROM redislabs/redisearch:1.6.14 as redisearch
FROM redis:6
# ENV LD_LIBRARY_PATH /usr/lib/redis/modules
RUN apt-get update
RUN apt-get install -y sudo
COPY --from=redisearch /usr/lib/redis/modules/redisearch.so /usr/lib/redis/modules/
COPY --from=builder home/RediSearch/tests/ctests/ext-example/jurata_extension.so ./
COPY --from=builder home/RediSearch/tests/ctests/ext-example/jurata_extension.so /usr/lib/redis/modules/
ADD container-entrypoint.sh /
EXPOSE 6379
CMD ls -l /usr/lib/redis/modules/redisearch.so; sudo /usr/local/bin/redis-server --loadmodule /usr/lib/redis/modules/redisearch.so
Log Output
-rwxr-xr-x 1 root root 8531584 Sep 6 2020 /usr/lib/redis/modules/redisearch.so
10:C 04 Nov 2021 10:01:02.540 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
10:C 04 Nov 2021 10:01:02.540 # Redis version=6.2.6, bits=64, commit=00000000, modified=0, pid=10, just started
10:C 04 Nov 2021 10:01:02.540 # Configuration loaded
10:M 04 Nov 2021 10:01:02.540 * monotonic clock: POSIX clock_gettime
10:M 04 Nov 2021 10:01:02.540 * Running mode=standalone, port=6379.
10:M 04 Nov 2021 10:01:02.540 # Server initialized
10:M 04 Nov 2021 10:01:02.541 # Module /usr/lib/redis/modules/redisearch.so failed to load: /usr/lib/redis/modules/redisearch.so: cannot open shared object file: No such file or directory
10:M 04 Nov 2021 10:01:02.541 # Can't load module from /usr/lib/redis/modules/redisearch.so: server aborting

Docker logs - Synchronize Time from Host to Container

I tried synchronising the timezone from host to container at runtime using:
docker run -v $(pwd)/Data:/code/Data -v /etc/timezone:/etc/timezone:ro -v /etc/localtime:/etc/localtime:ro --restart unless-stopped intermediateservice
This does not appear to work as running the docker logs command:
docker logs -f -t zen_blackwell |tee output.log
Produces a timestamp (which is approximately 2 hours behind):
2021-01-13T10:43:22.372893697Z Ready...
This is incorrect as running the timedatectl command to check the current time on Host (Ubuntu 18.04 LTS - Bionic Beaver) produces:
timedatectl
Local time: Wed 2021-01-13 12:51:00 SAST
Universal time: Wed 2021-01-13 10:51:00 UTC
RTC time: Wed 2021-01-13 10:51:02
Time zone: Africa/Johannesburg (SAST, +0200)
System clock synchronized: yes
systemd-timesyncd.service active: yes
RTC in local TZ: no
What am I missing here?
you can look at this answer:
For the docker run -e TZ={timezone} workaround to work tzdata of course has to be installed in the container you’re trying to run.
What I was initially looking for (Docker container automatically having same timezone as host system) can be achieved through an ugly hack in the run script.
It can query geoip.ubuntu.com 172 (or any other geo IP database) once it is started on the new network and then set the server’s timezone based on the response:
https://askubuntu.com/a/565139
the askubuntu code snippet is given here:
echo "Setting TimeZone..."
export tz=`wget -qO - http://geoip.ubuntu.com/lookup | sed -n -e 's/.*<TimeZone>\(.*\)<\/TimeZone>.*/\1/p'` && timedatectl set-timezone $tz
export tz=`timedatectl status| grep Timezone | awk '{print $2}'`
echo "TimeZone set to $tz"

Issue starting Docker - Failed to start LSB: Create lightweight, portable, self-sufficient containers

Docker was working fine on Ubuntu box. Then, the Java version was updated for a different reason.
Now, all on a sudden docker is no longer running.
Tried different approach to recover, but it did not avail. Any pointers would help. Thanks.
$ sudo systemctl start docker
Job for docker.service failed because the control process exited with error code.
$ systemctl status docker.service
● docker.service - LSB: Create lightweight, portable, self-sufficient containers.
Loaded: loaded (/etc/init.d/docker; generated)
Drop-In: /etc/systemd/system/docker.service.d
└─10_docke_proxy.conf
Active: failed (Result: exit-code) since Thu 2020-04-23 17:06:05 EDT; 11s ago
Docs: man:systemd-sysv-generator(8)
Process: 8962 ExecStart=/etc/init.d/docker start (code=exited, status=1/FAILURE)
Main PID: 2746 (code=exited, status=0/SUCCESS)
Apr 23 17:06:05 ******** systemd[1]: Starting LSB: Create lightweight, portable, self-sufficient containers....
Apr 23 17:06:05 ******** docker[8962]: * /usr/bin/dockerd not present or not executable
Apr 23 17:06:05 ******** systemd[1]: docker.service: Control process exited, code=exited status=1
Apr 23 17:06:05 ******** systemd[1]: docker.service: Failed with result 'exit-code'.
Finally use this fixed.
wget -qO- https://get.docker.com/ | sh
This is the output
# Executing docker install script, commit: 26ff363bcf3b3f5a00498ac43694bf1c7d9ce16c
Warning: the "docker" command appears to already exist on this system.
If you already have Docker installed, this script can cause trouble, which is
why we're displaying this warning and provide the opportunity to cancel the
installation.
If you installed the current Docker package using this script and are using it
again to update Docker, you can safely ignore this message.
You may press Ctrl+C now to abort this script.
+ sleep 20
+ sh -c apt-get update -qq >/dev/null
+ sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq apt-transport-https ca-certificates curl >/dev/null
+ sh -c curl -fsSL "https://download.docker.com/linux/ubuntu/gpg" | apt-key add -qq - >/dev/null
Warning: apt-key output should not be parsed (stdout is not a terminal)
+ sh -c echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" > /etc/apt/sources.list.d/docker.list
+ sh -c apt-get update -qq >/dev/null
W: Target Packages (stable/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:56 and /etc/apt/sources.list.d/docker.list:1
W: Target Packages (stable/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:56 and /etc/apt/sources.list.d/docker.list:1
W: Target Translations (stable/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list:56 and /etc/apt/sources.list.d/docker.list:1
W: Target Translations (stable/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:56 and /etc/apt/sources.list.d/docker.list:1
W: Target CNF (stable/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list:56 and /etc/apt/sources.list.d/docker.list:1
W: Target CNF (stable/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list:56 and /etc/apt/sources.list.d/docker.list:1
W: Target Packages (stable/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:56 and /etc/apt/sources.list.d/docker.list:1
W: Target Packages (stable/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:56 and /etc/apt/sources.list.d/docker.list:1
W: Target Translations (stable/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list:56 and /etc/apt/sources.list.d/docker.list:1
W: Target Translations (stable/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:56 and /etc/apt/sources.list.d/docker.list:1
W: Target CNF (stable/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list:56 and /etc/apt/sources.list.d/docker.list:1
W: Target CNF (stable/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list:56 and /etc/apt/sources.list.d/docker.list:1
+ [ -n ]
+ sh -c apt-get install -y -qq --no-install-recommends docker-ce >/dev/null
+ sh -c docker version
Client: Docker Engine - Community
Version: 19.03.12
API version: 1.40
Go version: go1.13.10
Git commit: 48a66213fe
Built: Mon Jun 22 15:45:36 2020
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.12
API version: 1.40 (minimum version 1.12)
Go version: go1.13.10
Git commit: 48a66213fe
Built: Mon Jun 22 15:44:07 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.2.13
GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429
runc:
Version: 1.0.0-rc10
GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd
docker-init:
Version: 0.18.0
GitCommit: fec3683
If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:
sudo usermod -aG docker your-user
Remember that you will have to log out and back in for this to take effect!
WARNING: Adding a user to the "docker" group will grant the ability to run
containers which can be used to obtain root privileges on the
docker host.
Refer to https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface
for more information.
this worked for me:
$ sudo apt remove docker
$ sudo apt install docker docker-ce
I recommend to everyone to follow the official documentation. Which also starts with removing any old libraries then adding the GPG keys then installing the stable version of the library.
I used "Install from a package" method from Docker's official page. We have to install three deb packages. docker-ce, docker-ce-cli and containerd.io. I got this issue resolved by using all three debs released on the same date.
I fixed the issue by going back to the old jdk1.8.0_XXX the system had.
Updating to jdk-11.X.X was causing the issue in this case.

Docker (node:8.15-alpine) + Chromium + Karma unit tests not working

I'm trying to run my frontend tests on Docker (node:8.15-alpine) using Chromium and Karma, however I'm getting lots of ChromeHeadless related errors.
These tests used to work but recently they suddenly stopped, so I'm guessing it's either related to a third-party dependency (apk?), or the local Docker install.
I've created a branch on the repo with an easy to run command which reproduces the issue. README.md here:
https://github.com/olivercaine/react-redux-starter-kit-extended/tree/bug/cant-run-unit-tests-in-docker
Any help with this would be masively appreciated!
Thanks.
Expected Outcome:
[output of passed tests...]
Finished in 0.026 secs / 0.031 secs # 19:53:44 GMT+1100 (AEDT)
SUMMARY:
✔ 46 tests completed
Actual Outcome:
13 02 2020 09:10:45.314:ERROR [launcher]: Cannot start ChromeHeadless
13 02 2020 09:10:45.316:ERROR [launcher]: ChromeHeadless stdout:
13 02 2020 09:10:45.317:ERROR [launcher]: ChromeHeadless stderr:
13 02 2020 09:10:45.772:ERROR [launcher]: Cannot start ChromeHeadless
13 02 2020 09:10:45.772:ERROR [launcher]: ChromeHeadless stdout:
13 02 2020 09:10:45.773:ERROR [launcher]: ChromeHeadless stderr:
13 02 2020 09:10:45.939:ERROR [launcher]: Cannot start ChromeHeadless
13 02 2020 09:10:45.939:ERROR [launcher]: ChromeHeadless stdout:
13 02 2020 09:10:45.939:ERROR [launcher]: ChromeHeadless stderr:
13 02 2020 09:10:46.424:ERROR [launcher]: ChromeHeadless failed 2 times (cannot start). Giving up.
Finished in 0 secs / 0 secs # 09:10:46 GMT+0000 (UTC)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-redux-starter-kit#3.0.1 test: `cross-env NODE_ENV=test karma start build/karma.config`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-redux-starter-kit#3.0.1 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-02-13T09_10_46_935Z-debug.log
Update:
The above URL has been removed, however the full (now working) repo can be found here:
https://github.com/olivercaine/react-redux-starter-kit-extended/tree/modpack/latest
It seems there are some issues regarding the node:8-alpine image that you are using. See https://github.com/puppeteer/puppeteer/issues/379. I don't know if it's the same issue but I was able to run your tests using the node:8.15-slim as the base image of your base Dockerfile
You'll need to update your dev Dockerfile as well:
FROM olliecaine/base:master
WORKDIR /project
# Install Chrome
RUN apt update && apt install -y chromium
Ideally you would add ENV CHROME_BIN=/usr/bin/chromium to this Dockerfile, but for some reason this is not setting the variable properly.
To check that yourself, and insert console.log(process.env.CHROME_BIN) at the beginning of your build/karma.config.js file, you will see the value is still /usr/bin/chromium-browser when running the tests.
As a workaround, I had to insert this line at the beginning of the build/karma.config.js file:
process.env.CHROME_BIN = '/usr/bin/chromium'
Let me know if you understand why the ENV instruction is not working, I'm interested.
Thanks Baptiste, your answer helped me verify the fix was working.
Basically what I ended up doing was using a different URL for alpinelinux.org.
In the end I changed the Dockerfile to:
FROM node:8.15-alpine
WORKDIR /project
# Install Chrome
RUN echo http://dl-cdn.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories \
&& echo http://dl-cdn.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories \
&& echo http://dl-cdn.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories \
&& apk --no-cache update && apk --no-cache upgrade \
&& apk add --no-cache chromium \
&& rm -rf /var/cache/apk/* /tmp/*
ENV CHROME_BIN /usr/bin/chromium-browser
which seemed to set the CHROME_BIN env variable properly, allowing me to run my tests in the Alpine container. Also meant I didn't need to update the karma.config.js file either. Previously I was using nl.alpinelinux.org/alpine/v3.8/ instead of edge.
Cheers for your help!

Can't Unzip Files in Docker VM (Boot2Docker) / Windows 7 / CRC Error

Moin moin,
I'm unable to unzip files like eclipse.tar.gz with e.g gunzip.
Neither in DockerFiles with ADD url nore when I use wget on the File.
$ wget http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/neon/1a/eclipse-jee-neon-1a-linux-gtk.tar.gz&mirror_id=96
$ gunzip eclipse-jee-neon-1a-linux-gtk.tar.gz
I always get a CRC error. When I unzip the File with Windows there is no CRC error. They have the same CRC and the same MD5sum. I already changed the baseimage (debian/ubuntu), I used tar/gunzip and it happens when I build the images and when I unzip it in the bash from the Image.
This is my current system
Client:
Version: 1.12.0
API version: 1.24
Go version: go1.6.3
Git commit: 8eab29e
Built: Thu Jul 28 23:54:00 2016
OS/Arch: windows/amd64
Server:
Version: 1.12.2
API version: 1.24
Go version: go1.6.3
Git commit: bb80604
Built: Tue Oct 11 17:00:50 2016
OS/Arch: linux/amd64
Kernel Version: 4.4.24-boot2docker
Operating System: Boot2Docker 1.12.2 (TCL 7.2); HEAD : 9d8e41b - Tue Oct 11 23:40:08 UTC 2016
I think you are just not using the good url. Try with http://www.mirrorservice.org/sites/download.eclipse.org/eclipseMirror/technology/epp/downloads/release/neon/1a/eclipse-jee-neon-1a-linux-gtk.tar.gz
I tested the url you provided in a linux terminal and gives bad things so.
In fact, the url you provided is not a direct download link so I don't think add nor wget can acquire the files from it. It provide an html file instead so this is not something you can untar/unzip
if the url is correctly provided, try this :
FROM ubuntu
RUN apt-get update && apt-get install -y wget tar
WORKDIR /home/extract
VOLUME /home/extract
CMD wget -qO- http://www.mirrorservice.org/sites/download.eclipse.org/eclipseMirror/technology/epp/downloads/release/neon/1a/eclipse-jee-neon-1a-linux-gtk-x86_64.tar.gz | tar -xz
Or check https://github.com/titouanfreville/Docker/tree/master/unziper.
It worked well for me. If it's working well for you too, update your dockerfile ;)

Resources