GitLab “STDERR: chgrp: invalid group: ‘git’” 🤔

Today I ran into a bit of a pickle 🥒. I was upgrading GitLab on an Ubuntu server machine using Aptitude. I’ve done this hundreds of times and GitLab has never had the slightest issues updating for me in the past. Today was time for a new experience.

So to make a long story short… When GitLab is updated, it runs the command gitlab-ctl reconfigure. This command essentially performs some checks, makes sure that everything is upgraded and set up correctly. One of its internal features ensures that a folder exists and that it has the correct permissions.

This code failed to set the user group for the folder /var/opt/gitlab/.ssh because the required user group does not exist. Though this error seems fairly obvious, the problem I faced is that the user group actually does exist.

Luckily I remembered that after setting up this server, I also did some server hardening. One step in that process was to restrict access permissions to specific system files. So I went and checked which files I modified and one of the files happened to be /etc/group.

Coincidence? I think not.

What I had done was take away privileges for those system files so they could only be accessed by their owner, the root user. This is typically not an issue, but it turns out that even though Aptitude was being ran by the root user, the gitlab-ctl process must have been trying to set the permissions of that folder using a different user account, which had no permission to access /etc/group.

The solution: “sudo chmod og+r /etc/group” to permit other users to read the file. After having Aptitude retry the upgrade process, everything worked great!

After you have finished the upgrade, you can go ahead and revert the permission changes (sudo chmod og-r /etc/group). But keep in mind that it will probably happen again the next time you are upgrading GitLab.

Read More

IntelliJ IDEA 14.1 HiDPI issues

I’m a user and big fan of JetBrains’ IntelliJ IDEA IDE. Having tried and used several Java IDEs in the past, I personally think it’s the best out there. On top of that, every major update bring a couple of new amazing features.

Yesterday the 14.1 update of the IDE was released. As usual I rushed to download and install the new version, after a quick glance of the release notes. But as a first, I ran into a major issue.

I’m usually use my desktop or my laptop for programming, but a while ago I got myself a Microsoft Surface Pro 3, to carry around more easily. I also use this for programming. The Surface Pro 3 has a very high-resolution display, which makes whatever is displayed look nice and crisp. But if you use the native resolution, everything will also be very tiny. Microsoft has solved this issue by having Windows do DPI scaling of applications. This essentially simply scales them up to make everything readable to the user. Some applications support this and those that do provide a very nice upscaled crisp interface.

Up until now, IntelliJ has not supported high DPI displays, and as a result, the native OS would just scale it up, making text look slightly blurry, as well as other elements in the UI. To resolve this JetBrains has worked on adding support for these displays on all platforms into their IDE. This is where it got messy.

After installing the new version, and running it, I quickly noticed that there was something wrong. My code looked very crisp for sure, but it was incredibly tiny. Also icons on the toolbar had been shrunk down to a small size. To find the answer, I had to dig through some of JetBrains’ bugtracker issues and found a fix for the problem.

The problem is that (for some reason) the IDE does not detect that I’m running a high-DPI display. So solve this, you have to force it into the HiDPI mode. You can do this by editing the vmoptions files for the IDE, which are located in the same folder that holds the IDE’s binary files. For example “C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1\bin” on Windows 8.1 x64. Add the argument -Dhidpi=true to the end file. Be warned though, there are vmoptions files for both 32-bit and 64-bit, make sure you change the right one, or change both to be sure.

It’s clear that there’s still a few issues for JetBrains to work out, even in HiDPI mode, the text in the tip of the day window is pretty small, but they are well on their way towards properly supporting these displays.

Read More

Merge upstream changes with Git

Let’s say you want to work on some code in a git repository. To do this, generally you will “fork” this repository, by cloning it into your own repository. On GitHub there’s a simple “fork” feature that takes care of this. After a while, you might have made some changes, but the original repository that was forked might also have new commits pushed to it. A question many new git users then face is: “How do I pull the upstream changes from the original repository into my own?”

Read More

WinMerge as mergetool with Git(Hub) for Windows

WinMerge is a great free tool for merging conflicts when working with a version control system like Git or Subversion. To use it with Git(Hub) follow the following steps:

  1. Locate your .gitconfig file. If you’re using GitHub for Windows, you will certainly find it in your user folder.
  2. Add the following text at the bottom of the file:

    If you’re still using a 32-bit version of Windows, Replace “Program Files (x86)” with “Program Files”.
  3. To merge a conflict, open a shell and browse to your repository’s root folder.
  4. Use the command git mergetool to merge the conflicts with WinMerge.
    If WinMerge doesn’t open, Git might still be trying to use a different tool, try again with git mergetool --tool=winmerge.

Read More

Delphi: Absolute

You don’t often come across a piece of Delphi code that uses the keyword “absolute”. A lot of Delphi programmers consider it to fall in that “stay away” category, like “goto”. The keyword, when used correctly can however be very convenient and improve the readability of your code.

The absolute keyword allows you to define a variable that points to the memory location of another variable. This is something you can achieve with pointers as well, but the absolute keyword allows you to do it very cleanly in a single line of code.

Read More

Review: WeBuilder 2014 in retrospect

A while back I made a post about the PasteLock service I’ve developed and published. It took me quite a while to develop the service, mainly due to the fact that I am not a webdesigner, I’m a webdeveloper. As such, I usually open up Adobe Dreamweaver to develop anything that requires HTML and CSS work. Why Dreamwaver? You must be cringing if you think I need a WYSIWYG editor to create a website. This is not the case, but I like to see what I develop when I develop it.

Unlike before I decided not to go with Dreamweaver for once and try something new. I came across a web development suite that seemed to meet all of my requirements. WeBuilder 2014, still in beta at the time, had all of the tools I needed, like syntax highlighting, extensive code completion, a live browser preview and even support for PHP debugging. As I was immediately won over by the extensive feature list, I decided to give it a try.

Read More

Installing Imagemagick or GD (Ubuntu 12.04)

If you’re working with PHP software, you’ll often need image processing software to support complex processing of images in PHP. Most commonly, you will be using the GD or Imagemagick libraries.

To install Imagemagick on Ubuntu for PHP:

To install GD on Ubuntu for PHP:

Read More

Installing “pecl intl” (Ubuntu 12.04)

Some PHP software, such as MediaWiki, prefer for servers to have the “intl” PECL package to be installed. On Ubuntu you can insall it as a precompiled package from the official repositories:

If you start from a clean Ubuntu install and you want to build the package yourself, you might not have all of the dependencies installed. Run this command to make sure you have all of the prerequisites installed:

To build the package itself:

You might also have to restart your webserver if you manually build the package. For Apache, run:

Read More

PasteLock: Secure your data online.

For a while now I’ve been playing around with a couple of ideas for new projects in my head. I finally decided to go through with turning one of these ideas into reality. The result is PasteLock.

PasteLock is a pastebin style site where you can host pieces of text or code, so you can easily distribute it to your friend and colleagues. There are already many pastebin services out there, but I wanted to set out to create something special. This pastebin offers something different than most other pastebins, as it offers security.

When you create a paste, the title and paste content is encrypted in the database with a randomized encryption key which is never stored on the server. The encryption is powered by the AES-256 encryption algorithm. On top of the server-side encryption of the data, PasteLock also actively enforces a verified SSL connection to ensure that your connection to the site is secure and can’t be intercepted. In the event that the site were to switch to a stronger encryption algorithm, the data will also be automatically re-encrypted with the stronger algorithm when it is being accessed.

Syntax highlighting is of course available for about every programming language out there. The pastes that have been posted can easily be printed or downloaded from the site with the click of a button. For printing, the site provides a clean print-friendly format.

So go check it out at https://www.pastelock.com

Read More