How to install Skype 8 on Linux (Ubuntu & Mint)

An installation of Skype in version 8.xx is a little bit different than it was with Skype 4.xx from what I found. As of writing this the current version of Skype is 8.11 and the procedure that I’ve checked on 2 computers was:

  1. Download DEB package with Skype from
  2. Check if GDebi is installed in your system. If not, install it from a repository. I used Synaptic package manager for this.
  3. Open downloaded DEB file (skypeforlinux-64.deb) with GDebi. To to this right-click on the file. On Linux Mint with Mate the context menu already contained “Open with GDebi” as the first menu-item. On Linux Ubuntu with Cinnamon one has to select “Open with…” menu-item and then select GDebi from the sub-menu.
  4. Click on “Install” button and provide your password


This worked for me under Linux Mint 17.3 and Linux Ubuntu 16.04 both being 64-bit.


Please note that Skype is not an open-source software and I don’t recommend it. This article is just providing an instruction how to get latest Skype version working on Linux in case you need it.

If you know the open-source alternative to Skype that is available on Linux and allows video-calls and it quite stable and somehow popular then please let me know.

Posted in Linux | 2 Comments

Gradle vs Maven

Short story

Don’t use gradle. Use maven.

A little longer story

Don’t use gradle until you really have to. Otherwise use maven.

Long story

Last time I was dropped into a project that was using gradle. And it was the first time during my professional career in Java (11 years!) I’ve encountered gradle in the wild. Moreover in the team there were 3 younger developers having different degree of experience. None of them knew gradle as well and preferred to use maven. Some 3 years before this in another company at the start of a new project we were discussing what build tool to use. Around 20 people and only one of them proposed to use gradle. I think I don’t have to say we’ve decided to use maven.

Conclusion 1: Maven is much more popular and gradle is just exotic. Maven is familiar to most Java developers so choosing gradle will make it harder to maintain the project.

Maven build files (pom.xml) are expressed in XML. XML is a kind of a document so maven build files are documents. It’s good. On the other hand gradle build files (build.gradle) are expressed in something similar to Groovy programming language. That’s make them programs! And as usual in a computer program you can do things in many different ways. And Groovy is even making things worse! There are many optional syntax elements – so they can appear or not (like semicolons – please refer to DZone: Groovy, Sometimes You Still Need a Semicolon.).

Conclusion 2: Gradle build files can be much more messy than Maven build files. Moreover Maven build files are documents you just read while Gradle build files are programs you’re wondering what they do.

Moreover my personal impression was that building a project with gradle is slower than building with maven. It seems others experienced this as well: How to speed up your slow Gradle builds. It’s crazy to use this tool until you really have to!

Posted in Java | Tagged , | 2 Comments

Network problem inside a Docker container

Last weeks me and couple of folks from my team have started using Docker. So every one of us was a Docker-newbie. And I have noticed all of us had the same common problem:

Network connections were not working inside a Docker while they were fine on a host running the Docker container.

Example: I wanted to build a Docker image based on the following Dockerfile:

FROM debian:9.2
RUN apt-get update
RUN apt-get install -y openjdk-8-jdk
RUN apt-get install -y maven
RUN apt-get install -y gradle

My command to build an image:
docker build -t java8_maven_gradle .

It failed as soon as it started executing the apt-get update command. None of other commands making network requests was running as well.

After some surprisingly long search in the Internet I found out that a Docker container by default has networking turned off. That explained our problems. The solution was to add
parameter to commands invoking Docker. So my command became:
docker build --network=host -t java8_maven_gradle .

I used version 17.xx of Docker. Some older versions of Docker do not recognize --network parameter. Instead they need -net.


I suppose this is something obvious for people knowing Docker well. However it looks like people that need to just quickly start using Docker without devoting a longer time for studying are facing this problem often. I guess this is something Docker tutorial/beginners guides don’t cover good enough.

Posted in Docker | Tagged | 1 Comment

Spring Boot configuration for Tomcat’s pooling data source

In one of projects I was just working on in my professional career I’ve faced the problem of a Spring Boot configuration for a Tomcat’s database connection pool. The main issue was that after some time the pool was giving database connections that were not valid so we were trying different pool configuration parameters – but this is not relevant here. What is relevant is that all re-configuring approaches had no effect.

Is Spring Boot properly configuring the data source?

At some point I stopped believing that the Spring Boot is applying data source parameters from configuration file which was application.yml having following part related to the data source:

    url: jdbc:mysql://localhost:3306/some_db
    username: root
    password: root
    driver-class-name: "com.mysql.jdbc.Driver"
      removeAbandoned: true
      removeAbandonedTimeout: 120
      logAbandoned: true
      maxActive: 50
      maxIdle: 5
      maxWait: 1000
      validationQuery: "select 1"
      testOnBorrow: true
      testOnConnect: true
      testWhileIdle: true

I’ve realized that I cannot easily verify what are actual data source parameters being applied by the Spring Boot. At last I’ve added a diagnostic REST endpoint showing what are actual parameters of the data source configured by Spring Boot. It was looking like this:

import org.apache.commons.beanutils.BeanUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.sql.DataSource;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

public class InfoController {
    private static final Logger LOGGER = LoggerFactory.getLogger(InfoController.class);
    private static final List<String> TOMCAT_DB_CONN_POOL_PROPERTIES = Arrays.asList(
            "driverClassName", "maxActive", "maxAge", "maxIdle", "maxWait", "minEvictableIdleTimeMillis",
            "minIdle", "name", "removeAbandonedTimeout", "timeBetweenEvictionRunsMillis", "validationInterval",
            "validationQuery", "validationQueryTimeout", "removeAbandoned", "testOnBorrow", "testWhileIdle",
            "testOnConnect", "poolSweeperEnabled", "logAbandoned", "jmxEnabled", "url", "dataSourceJNDI",
            "initialSize", "suspectTimeout", "username", "useDisposableConnectionFacade");

    private DataSource dataSource;

    @RequestMapping(path = "/data-source-info", method = RequestMethod.GET, produces = "application/json")
    public Object getInfo() {
        Map<String, Object> dataSourceDetails = new TreeMap<>();
        dataSourceDetails.put("data-source-class", dataSource.getClass().getName());
        addObjPropertiesUnderKey(dataSource, "data-source-config", dataSourceDetails);
        return dataSourceDetails;

    static void addObjPropertiesUnderKey(Object obj, String key, Map<String, Object> map) {
        try {
            Map<String, Object> properties = new TreeMap<>();
   -> addPropertyIfNotNull(obj, property, properties));
            if (!properties.isEmpty()) {
                map.put(key, properties);
        } catch (Exception e) {
            LOGGER.warn("Cannot fetch properties of object: {}.", obj, e);

    static void addPropertyIfNotNull(Object obj, String property, Map<String, Object> map) {
        try {
            String value = BeanUtils.getProperty(obj, property);
            if (value != null) {
                map.put(property, value);
        } catch (Exception e) {
            LOGGER.warn("Cannot get property '{}' from  object of class {}. {}", property, obj.getClass(), e.getMessage());

The above solution uses dynamic property access with BeanUtils to not bind the application code to the actual data source implementation class (org.apache.tomcat.jdbc.pool.DataSource in case of Tomcat db-connection pool). And of course the set of property names is specific for this data source class.

The first look at the output produced by this REST controller confirmed my suspicion. Only first 4 parameters were properly applied (url, user, password and driver class). The remaining parameters (all with prefix spring.datasource.tomcat.) were ignored by the Spring Boot!

Spring Boot versions and the parameters naming

It turned out the data source parameters definition given in project’s application.yml file was conforming to the current version of the Spring Boot – which was 1.5.8 at the time of writing this article. But the Spring Boot version used in the project was much older: 1.3.8.

Please note the difference between the section “Connection to a production database” for Spring Boot 1.5.8 and the same section for Spring Boot 1.3.8!

For Spring Boot 1.3.8 we have:

And for Spring Boot 1.5.8 we have:

Now it got clear that parameters naming with “tomcat” was not valid for the Spring Boot version used in the project. The naming scheme was changed in Spring Boot somewhere between versions 1.3.x and 1.5.x! The correct form of this part of application.yml for Spring Boot 1.3.8 is:

    url: jdbc:mysql://localhost:3306/some_db
    username: root
    password: root
    driver-class-name: "com.mysql.jdbc.Driver"
    removeAbandoned: true
    removeAbandonedTimeout: 120
    logAbandoned: true
    maxActive: 50
    maxIdle: 5
    maxWait: 1000
    validationQuery: "select 1"
    testOnBorrow: true
    testOnConnect: true
    testWhileIdle: true

After this change the actual data source parameters dump provided by my diagnostic endpoint confirmed that now values from the configuration file are used.

Very tricky!


  1. One should always refer to the documentation in version corresponding to the version of a framework being used.
  2. It’s really hard to solve a problem without a diagnostic tool (like the InfoController class presented above) so don’t hesitate to invest time into preparing one. In a result it will save your time.
Posted in database, Java, Spring, Tomcat | Tagged , | 3 Comments

RestTemplate and <mvc:message-converters> in Spring Framework 4.3

The Spring Framework’s documentation says that RestTemplate instance created by the default constructor gets the default set of HttpMessageConverters.

But what is the default set of HttpMessageConverters? Well, this is defined in the Spring Framework Reference. Unfortunately I’ve missed it somehow and I was believing that the default set of HttpMessageConverters is affected by <mvc:message-converters> Spring XML configuration element, like in the sample below:

    <bean id="customGsonHttpMsgConverter" class="org.springframework.http.converter.json.GsonHttpMessageConverter">
        <property name="gson">
            <bean class="CustomGsonFactoryBean"/>
            <ref bean="customGsonHttpMsgConverter"/>

    <bean id="restTemplate" class="org.springframework.web.client.RestTemplate"/>

Actually it’s not true. In the above example the RestTemplate bean will not be using this “customGsonHttpMsgConverter” bean. The default set of HttpMessageConverters for RestTemplate is… hardcoded in RestTemplate class. However one can customize it easily. This is the correct way of configuring HttpMessageConverters to be used by RestTemplate:

    <bean id="customGsonHttpMsgConverter" class="org.springframework.http.converter.json.GsonHttpMessageConverter">
        <property name="gson">
            <bean class="CustomGsonFactoryBean"/>
    <bean id="restTemplate" class="org.springframework.web.client.RestTemplate">
                <ref bean="customGsonHttpMsgConverter"/>

Lesson learned! RestTemplate has nothing to do with <mvc:message-converters> configuration.

Posted in Java, Spring | Tagged | Leave a comment

How to add a key binding to toggle a touchpad under Linux

A laptop's key toggling the touchpad My previous laptop (Asus) had a special key on its keyboard to toggle the touchpad. It was working out of the box with Linux Mint & the Mate desktop environment – there was a special support for it. My new laptop (HP) doesn’t have this special key and I was really missing it. This article is about how to add a key binding under Linux that will be behaving exactly as having such a special key (tested on Ubuntu 16.04 LTS and Cinnamon 3.4.6).

Let’s identify what is a keycode that is recognized by a desktop environment as a signal to toggle the touchpad. To discover this run the command: xmodmap -pke|grep -i touchpad
On my computer results look as follows:

$ xmodmap -pke|grep -i touchpad
keycode 199 = XF86TouchpadToggle NoSymbol XF86TouchpadToggle
keycode 200 = XF86TouchpadOn NoSymbol XF86TouchpadOn
keycode 201 = XF86TouchpadOff NoSymbol XF86TouchpadOff

So now we know keycode 199 is the one recognized as toggling the touchpad.

Now we need a program that can simulate pressing a key with such a keycode. I found this can be done by xdotool. I needed to install it with the following command:

sudo apt install xdotool

Now you can test the program with the command:

xdotool key 199

For me it worked like a charm.

Finally we need to setup a key binding that will run the above command actually toggling the touchpad. In the Cinnamon desktop environment one does this as follows (optionally you can refer the section 15. Custom Keyboard Shortcuts of How To Change The Linux Mint Cinnamon Keyboard Shortcuts):

  1. Open system settings window
  2. Click on “Keyboard” item
  3. Go to “Shortcuts”
  4. Click on “Add custom shortcut” button
  5. Enter a name for a key binding (something like “touchpad toggling”)
  6. Enter a command: xdotool key 199
  7. Click on “Add” button
  8. Now select the first “unassigned” item in “Keyboard bindings” section and click it again to activate key capturing
  9. Press a key or a key combination of your choice

I used just F5 key for this and it’s working great. I have to admit that initially I wanted a key combination of windows-key+F5 but it was not working, but this is some issue with windows-key (it’s named SUPER key under Linux) and Cinnamon.
In my opinion this case is another example of how elastic Linux and open source software are. And it’s great!

Posted in Linux | Leave a comment

Problems with Linux on a HP Notebook

This is a documentation of my tries to get a properly working Linux desktop environment on a brand new laptop: HP Notebook 15-ba006nm (P/N: 1BV18EA). This hardware contains:

This is what Linux Ubuntu 16.04.3 sees – output of lspci -Q|grep ‘VGA\|Wireless\|Display’ command:

00:01.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Carrizo (rev ca)
02:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8723BE PCIe Wireless Network Adapter
05:00.0 Display controller: Advanced Micro Devices, Inc. [AMD/ATI] Topaz XT [Radeon R7 M260/M265 / M340/M360 / M440/M445] (rev ff)

With this hardware I wanted to achieve following goals:

  1. Linux to boot successfully, including desktop environment
  2. Wifi network card to work properly – this hardware causes some problems, see the ant_sel fix
  3. Cooling to work as quiet as possible – in case of this laptop is seems that one should use the GPU from the APU (Radeon R5) while keeping discrete GPU (Radeon R7) turned off
  4. Hibernation (suspend to disk) to work


Note 1: “No” in the “Wifi” column means that the Wifi adapter was working but the driver selected wrong antenna (as explained here) thus the Wifi signal reception was really poor, almost unusable.

Note 2: With 3.xx kernels one has to use radeon or fglrx graphic card driver and with 4.xx kernels one has to use amdgpu driver on this laptop. I don’t know the reason for this.

Linux version Does it boot? Wifi Graphics Hibernation How loud?
1. Linux Mint 17.3 “Rosa” – Cinnamon (64-bit)
kernel 3.19
Yes No radeon – yes, no GPU selection
fglrx – only discrete GPU
Yes radeon – too loud
fglrx – very loud
2. Linux Mint 18.1 “Serena” – Cinnamon (64-bit)
kernel 4.4
Yes Yes (ant_sel fix) Yes No a bit too loud
3. Linux Mint 18.2 “Sonya” – Cinnamon (64-bit)
kernel 4.8
No not verified not verified not verified not verified
4. OpenMadriva Lx 3.02
kernel 4.12
No not verified not verified not verified not verified
5. openSUSE Leap 42.3
kernel 4.4
Yes not verified Yes – but which GPU? No too loud
6. Fedora 26 MATE-Compiz Desktop, 64-bit
kernel 4.11
Yes, with kernel param not verified Yes – but which GPU? No too loud
7. Ubuntu 16.04.3 LTS (Desktop, 64-bit)
kernel 4.10
Yes, with kernel param Yes (ant_sel fix) Yes No almost ok
8. Ubuntu 18.04 LTS (Desktop, 64-bit)
kernel 4.15
Yes Yes (ant_sel fix) Yes No not compared, most likely the same as above


Linux Mint 17.3 “Rosa” – Cinnamon (64-bit) is LTS version. The default kernel is 3.13 and can be easily updated to 3.19. Definitely this kernel doesn’t have updated module for a Wifi adapter so it doesn’t support ant_sel fix. By default radeon driver is used for graphic card but it was hard to guess which GPU was used. Cooling was a little bit too load so I wanted to check if the AMD-provided driver will give me better results. After switching (easy, by “Drivers” window in “Settings”) to fglrx this could be established by using Catalyst Control Center window. Unfortunately this driver selected discrete GPU on board and it was causing definitely more loud cooling. Catalist Control Center allows to switch between GPUs but after selecting integrated GPU and restarting (needed after this change) the X-server could not start (I was too tired to investigate why). This is the only Linux distribution being able to hibernate the system and resume. The second advantage: no problems with booting. However lack of Wifi was not acceptable.

Possible actions

– investigate if a custom kernel module for wireless adapter for 3.xx kernel can be built and installed so ant_sel fix can be used
– investigate how to control which GPU is ued by radeon driver and if one can make sure on-board GPU is turned off


With Linux Mint 18.1 “Serena” – Cinnamon (64-bit) most things were ok. The biggest disadvantage was that hibernation was not working at all. If I recall correctly hibernation was hanging the computer with a default kernel and after upgrade of kernel to newest version of 4.4.0 line it was hanging when resuming from hibernation. Moreover I was not sure if discrete GPU (on board) was completely turned off as vgaswitcheroo presented something like “dyn-off” for its status. Cooling system seemed a little too loud for me so it pushed me to try other Linux distributions…

Possible actions

– investigate more how to fix the hibernation issue (I gave up…)
– study more details of vgaswitcheroo and if the laptop has muxed or muxless hybrid graphics (something for people with too much free time – not me)

Ad.3 and 4

Not booting! WTF?!? I was too disappointed to dig in. I haven’t seen official Linux distribution not booting for a really long time so gave them up quickly.

Possible actions

– try adding amd_iommu=off to kernel boot parameters to see if it boots


openSUSE Leap 42.3 has 2 installation variants. The first one has a size of 4.7 GB so is large and it didn’t fit on my USB stick. The second one is a network installer. It has a size around 100 MB but then… it downloads something like 3.5 GB during the installation. And all those downloaded things are not necessarily needed – annoying! Then I was hit by KDE Plasma and Yast package manager. KDE Plasma is a monster! What happened to the KDE I was using in 2001?!? And with Yast I was unable to switch to other desktop environment (maybe I got used to Synaptic too much?). If I recall correctly I checked only if hibernation works out of the box and gave up this distribution when it failed to hibernate.


Fedora 26 MATE-Compiz Desktop, 64-bit didn’t boot at the first approach. After some googling I’ve found some information about a kernel parameters to add. Unfortunately I don’t remember which one worked. Most likely this was something with acpi or something like nomodeset. Strange! After Fedora finally booted the graphics looked really poor. And hibernation was not working so I gave it up.


Ubuntu 16.04.3 LTS (Desktop, 64-bit) didn’t boot at the first time as well. This time according to error messages from booting (AMD-Vi: Completion-Wait loop timed out) I’ve found that one needs to add amd_iommu=off to kernel boot parameters. Then Ubuntu started. Of course ant_sel fix was needed to get Wifi working correctly. The graphic card driver (kernel module) used is amdgpu (as given by lspci -k command). Ubuntu shows graphics subsystem details as: Gallium 0.4 on AMD CARRIZO (DRM 3.9.0 / 4.10.0-28-generic, LLVM 4.0.0). This suggests GPU integrated with APU is used. The cooling is not so loud (comparing to other distros I’ve tested) but still it’s not silent. The worst thing is of course hibernation not working. A little bonus with Ubuntu is that the hibernation functionality is hidden from the user so you can’t hang your system by selecting “Hibernate” from a menu. Hibernation is still available for more advanced users by a command line. The additional disadvantage is Unity desktop environment (I know some people do like it) but it should be easy to replace by something else like MATE.

Possible actions

– check if AMDGPU-PRO Driver for Linux can be used with this Ubuntu version & this kernel. The hope is this driver will be more powerful to control this hybrid graphic system (however it may be not – as it was with fglrx and its Catalyst Control Center).
– dig more how to make hibernation working…


It looks the best option is 7 (Ubuntu 16.04.3), however option no 2 was close and now I probably would know how to fix booting problem with Linux Mint 18.2 (probably I’m Ubuntu/Mint biased…). It’s a total nonsense that hibernation is not working with 4.x kernels like it worked with 3.x kernels! But Wifi is a must-have.

The output of command sudo cat /sys/kernel/debug/vgaswitcheroo/switch under tested distros 2 and 7 (kernels 4.4 and 4.10) was:

1:DIS: :DynOff:0000:05:00.0

This shows that GPU integrated with APU is used what causes more silent cooling.

The HP laptop cooling is too loud most likely because of the laptop poor design, not because of Linux. However my adventure shows one can have different results with different Linux kernel/graphic drivers and it looks there is a little mess with these radeon/fglrx/amdgpu things. I’m not an expert on this so any help and advices on this appreciated!


Similar laptop and similar problem: HP Laptop AMD APU – Fail to Boot – Live linux cd

UPDATE: Battery time

According to the laptop’s specification given by HP this laptop (HP Notebook 15-ba006nm) should be able to work up to 8 hours on battery (Estimated Windows 10 battery life based on Windows 10 / MobileMark® 2014 benchmarking). Well, according to my experience (2 months) on Linux Ubuntu 16.04 with kernel 4.10, the laptop works up to only 2,5 hours on battery. How disappointing! I guess this is mainly caused by HP not providing Linux device drivers for hardware present in the laptop.

UPDATE 2: (16.06.2018)


The Ubuntu 18.04 LTS (kernel 4.15) started without any extra kernel parameters! This is the first version of kernel after 4.4 that is able to boot normally on this laptop – 1st good news! 🙂 And this is very good news as I noticed that now the Linux is using IOMMU and that IOMMU is important.

The “ant_sel fix” was needed to get Wifi working correctly. Let’s say 2nd good news.

The bad news is that hibernation doesn’t work. 😦

The output of command sudo cat /sys/kernel/debug/vgaswitcheroo/switch is the same as for kernels 4.4 and 4.10. The graphic card driver (kernel module) used is amdgpu (as given by lspci -k command). So my guess is no relevant change here compared to Ubuntu 16.04.3 LTS.

In case of loudness of laptop’s cooling subsystem – I cannot compare to earlier distros I’ve tested as it was months ago and at the time of installing Ubuntu 18.04 LTS it was June and it was quite hot June here (Warsaw, Poland). My impression is that the cooling loudness level is similar to that one experienced with Ubuntu 16.04.3 LTS.


Right now I’m recommending Ubuntu 18.04 LTS with this laptop.

Posted in hardware, Linux | 1 Comment