Fix the “Cannot autolaunch D-Bus without X11 $DISPLAY” error

0Shares

It is annoying when some things just don’t work! Hopefully, this post will help you resolve this issue. This post assumes that you are trying to use a command similar to the ‘awsecrget-login-password‘ command with the ‘docker login‘ command. If this is correct, then let’s fix the “Cannot autolaunch D-Bus without X11 $DISPLAY” error.

The error you are getting will look something like this:

Error saving credentials: error storing credentials - err: exit status 1, out: Cannot autolaunch D-Bus without X11 $DISPLAY

What does these commands do?

awsecrget-login-password – The ‘get-login-password’ command fetches and displays a password that you can use to authenticate against an AWS ECR registry. Your IAM user must have permissions to use AWS ECR. The password is valid for 12 hours. You can then pass the password to the Docker CLI login. Also, note that the get-login-password is only supported by AWS CLI version 2 or in v1.17.10 or later.

Below is an example the the output:

root@ip-172-26-8-7:~# aws ecr get-login-password --region ap-southeast-2
eyJwYXlsb2FkIjoiNFlRQk1DTGNqNkhaNDF2YWVXTnZ4SndUd0NMS0VvQmE0QVNQQWUyQTVoUWJ
UUnRLK04zRjVHTnFuM1RDd3lleU5zMkZtcVBuMVlWdG1lQTNpa2hYL3IvbCtnci9ZQ0ovekZZYy
t3elhwTmd3N2VrVk5pNHZF

docker login – The ‘docker login’ command enables you to log in to the Docker registry and accepts the following options: –password, –password-stdin and –username. You use the ‘username’ option to specify the username. The ‘password’ option allows you to specify a password string. Be warned, though! Using the ‘password’ option is a bad idea, since the password will up in the shell’s history, or log-files. The ‘password-stdin’ option provides the password via STDIN and is thus more secure than the ‘password’ option.

Here is an example of the warning you will get if you use the insecure –password option:

WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error saving credentials: error storing credentials - err: exit status 1, out: Cannot autolaunch D-Bus without X11 $DISPLAY

How are these command used together?

The‘aws ecr get-login-password’ command retrieves a password from AWS and then pipes the output via STDIN to ‘docker login’.

The expected result is that Docker should say:

Login Succeeded.

And Docker should not say:

Error saving credentials: error storing credentials - err: exit status 1, out: Cannot autolaunch D-Bus without X11 $DISPLAY

What is the cause?

Docker supports a wide variety of credential helpers. These include the: D-Bus Secret Service, Apple macOS keychain, Microsoft Windows Credential Manager and pass.

As per Docker:

By default, Docker looks for the native binary on each of the platforms, i.e. “osxkeychain” on macOS, “wincred” on windows, and “pass” on Linux. A special case is that on Linux, Docker will fall back to the “secretservice” binary if it cannot find the “pass” binary.

Therefore, it seems the ‘secretservice’ executable has some sort of X11 dependency.

What is the solution

The simplest solution is to install pass – the standard UNIX password manager. You do not need to remove docker-compose! Pass does have a dependency on gpg, so you will need to install two applications.

You can install pass and gpg using the following command:

Ubuntu / Debian

sudo apt-get install pass gnupg2

Fedora / RHEL

sudo yum install pass gnupg2

Alternatively –

You can try to install the Amazon ECR Docker Credential Helper. What is this exactly? Well, it is a helper for the Docker daemon that makes it easier to use  Amazon ECR. Click here to read more about it.

As a last resort, use the ‘password’ option instead of ‘password-stdin’. Avoid this if possible!

Conclusion

Hopefully, this helped you solve the ‘Cannot autolaunch D-Bus without X11 $DISPLAY’ error! Share or like this post if your issue is now fixed. Otherwise, let us know in the comments, and we will update this post.

Hi, my name is Anto! I am a cloud computing hobbyist! Give me anything to do with the cloud, and I am interested. I work for a Cloud computing company by day and as a Cloud computing hobbyist by night! My projects use PHP, NodeJs, Ubuntu, MySQL and of course Amazon Web Services. Hopefully, my blog aids your cloud journey! Feel free to post a comment and share your thoughts.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.