Fix for – W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial/InRelease Temporary failure resolving ‘archive.ubuntu.com’

Problem: apt-get update gives an error :


W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial/InRelease Temporary failure resolving 'archive.ubuntu.com'

Reason: Name server is not configured correctly.

Solution : Use Google’s nameservers as below-


echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null

 

Apt get should work now.

 

View logs and debug a docker service

 

To debug why a container within a docker stack didn’t start, these commands will help


#list all processes

docker service ls

#note the id of your problematic service

docker service ps <problematic-service-id-from-above>

#lists all containers of this service. note the id of the most recent container

docker inspect <container-id-from-above-step>

How to install Docker Compose on Ubuntu 18.04 LTS

Here’s how to install docker-compose on Ubuntu LTS :

Open terminal and run these commands


sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

sudo chmod +x /usr/local/bin/docker-compose

Now verify installation


docker-compose --version

This should show the version of docker compose that was installed.

GCloud gives warning : `docker-credential-gcloud` not in system PATH

Problem :

On an Ubuntu VM, the Docker pulls from Gcloud private repository give the error


Error response from daemon: unauthorized: You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your r
equest, follow the steps in: https://cloud.google.com/container-registry/docs/advanced-authentication

After this to reconfigure auth, the following command is issued :


gcloud auth configure-docker

This gives the error:

WARNING: `docker-credential-gcloud` not in system PATH.
gcloud's Docker credential helper can be configured but it will not work until this is corrected.
gcloud credential helpers already registered correctly.

Solution:

Issue these commands on terminal


sudo su

curl -fsSL "https://github.com/GoogleCloudPlatform/docker-credential-gcr/releases/download/v1.5.0/docker-credential-gcr_linux_amd64-1.5.0.tar.gz" | tar xz --to-stdout ./docker-credential-gcr > /usr/bin/docker-credential-gcr && chmod +x /usr/bin/docker-credential-gcr

docker-credential-gcr configure-docker

docker pull <your-image>

The docker pulls should work now.

 

Spring boot and Hibernate Second Level cache giving NoCacheRegionFactoryAvailableException

Problem:

Setting below in application.properties,

hibernate.cache.use_second_level_cache=true
hibernate.cache.hazelcast.use_native_client=true
hibernate.cache.region.factory_class=com.hazelcast.hibernate.HazelcastCacheRegionFactory

Gives the error:


org.hibernate.cache.NoCacheRegionFactoryAvailableException: Second-level cache is used in the
application, but property hibernate.cache.region.factory_class is not given, please either
disable second level cache or set correct region factory class name to property
hibernate.cache.region.factory_class (and make sure the second level cache provider,
hibernate-infinispan, for example, is available in the classpath).

Solution

Move the above settings from application.properties to hibernate.properties.

🙂

Openfire with Smack disconnects with error : You acknowledged stanzas that we didn’t send

 

Problem: After connecting, openfire servers disconnects from Smack client giving an exception as below –

Connection XMPPTCPConnection[dhee@dheeyantra.com/bot] (0) closed w
ith error

org.jivesoftware.smack.XMPPException$StreamErrorException: undefined-condition You can read more about the meaning of this stream error at http://xmpp.org/rfcs/rfc6120
.html#streams-error-conditions
<stream:error><undefined-condition xmlns='urn:ietf:params:xml:ns:xmpp-streams'/><text>You acknowledged stanzas that we didn&apos;t send. Your Ack h: 11, our last stanz
a: 10</text></stream:error>
 at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1057) [smack-tcp-4.3.0.jar:4.3.0]

 

Fix:

  1. In Openfire admin too, go to Server Manager => Server Properties
  2. Set stream.management.active = false

 

Fix : /boot disk has no space ( on Ubuntu)

Problem : /boot disk has no space, thus blocking installation or removal of any package using apt-get

Fix :

In terminal –

cd /boot

ls

sudo rm -r abi-4.4.0-89-generic abi-4.4.0-92-generic config-4.4.0-89-generic config-4.4.0-92-generic initrd.img-4.4.0-89-generic initrd.img-4.4.0-92-generic System.map-4.4.0-89-generic System.map-4.4.0-92-generic vmlinuz-4.4.0-89-generic vmlinuz-4.4.0-92-generic

(From the listed files, remove least two versions of every file)

 

This command searches of kernel files not in use and removes them to make space.