Setting up Jekyll blog on Ubuntu subsystem for Windows 😵

Whether you are a fan or not, the Ubuntu subsystem for Windows is here to stay. Personally I am a fan as it puts an entire Ubuntu operating system at your fingertips without the need to set up a Virtual Machine. At the same time, it integrates pretty well with the Windows environment, allowing you to easily access the file system.

One thing that I have found, this is very useful for, is leveraging the power of Apititude. This package manager that comes preloaded with Ubuntu (and many other Debian based operating systems), makes it very easy to install open-source tools which on Windows typically require you to download and install them manually and often suffer from issues caused by the subtle differences between operating systems.

A while ago I decided to check out Jekyll. It is a Ruby-based platform which converts Markdown based files into static websites or even blogs. The big advantage of such websites is that they are very easy for a webserver to server up, as they require very little logic on the server to be executed. Essentially you are just reading a file from the filesystem and sending it through the HTTP socket to the requester. With a good caching system, these pages can even be served up directly from the memory of the server.

Setting up

The Ubuntu subsystem for Windows is fairly lightweight. So a lot of packages will not come pre-installed. This means that before you can follow the default instructions to start a new Jekyll project, you will have to set up some prerequisites.

These commands will install Ruby and the tools required to build Ruby gems. Next we will install the Bundler and Jekyll gems, which are needed to set up, build and serve your Jekyll based website.

Your Ubuntu subsystem should now be set up and ready for you to develop your website.

Your Jekyll project

As the prerequisites are now out of the way, it is time to follow the remaining setup instructions as they are given on the Jekyll website itself. The following commands will set up a basic project fro your website, build it and also serve it.

Your website should now be available at http://localhost:4000/ and update live when you modify it! All of the tools for editing on your Windows machine, you can now use to edit the website, even though it is being served by the Ubuntu subsystem.

Read More

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

CleanTalk anti-spam service

I have been running a large MediaWiki powered website for over three years now. In my opinion, the most important aspect about a wiki is that everyone can contribute with ease. That’s why when I set up the website, I wanted to make sure that anonymous users could contribute. This worked great for roughly a year, with an occasional spam message and some vandalism, but nothing that couldn’t be managed. I found that it was possible to keep the spam at bay with some basic tweaks ad plugins for MediaWiki. This system worked great until again roughly a year later. Suddenly a massive amount of SEO bots were flooding the website, posting an unmanageable amount of spam. It was very hard to find a good solution for this problem, even a commercial one, as MediaWiki isn’t that broadly supported, not like WordPress or Drupal for example. I ended up stumbling upon CleanTalk.

Read More

Microsoft Support

You often read about companies messing up with customer support, so I figured I’d write a short article to praise Microsoft for my great support experience.

Last year I purchased a Microsoft Surface Pro 3 tablet. Some minor performance issue aside, I have really enjoyed using the device. Unfortunately a while back I noticed that the tip of my Surface Pen started to bend a bit and I noticed it has a small crack, which fairly rapidly expanded as I used the pen. The pen included with the Surface Pro 3 does not have replaceable tips, so I got a bit worried. After searching online, I found a new tip for roughly 8.50 EUR (or let’s say about 10 USD) on AliExpress, which I personally thought was a bit too expensive for a tiny piece of plastic.

This did indicate to me that it should be possible to replace the tip. A lot of Q/A sites suggested taking the pen apart using tools and brute force to remove the tip, but not wanting to damage the expensive tool, I figured out that you can easily remove the tip by using some tweezers to just pull it out. It goes fairly deep into the pen to reach the pressure sensor.

Read More

Cannot open your terminal ‘/dev/pts/0’

I ran into the error Cannot open your terminal '/dev/pts/0'. Though I had not seen this before, it seems to occur when you use the “switch user (su)” command to access a user account and then try to open a screen.

The issue can be resolved by either logging in directly with the user account you want to use, or by running the command “script /dev/null” as demonstrated here on StackOverflow.

Read More

NoIP Dynamic Update Client on RaspberryPi (or Ubuntu)

Personally I like to use NoIP’s dynamic DNS services. This tutorial explains how to install the NoIP DUC on a RaspberryPi running a Raspbian based distribution, but it will work on Ubuntu or any other Debian based distribution as well. You should execute all of the commands below as superuser. As not to have to put sudo in front of all of them, it’s best to log in as root or switch to root with sudo su.

Step 1: Install prerequisites

You will need some software to install and run the DUC software. Execute the following commands:

apt-get update
apt-get install build-essential python-setuptools
easy_install killproc

Step 2: Download and install the DUC software

Next you will have to download and install the DUC software itself. The software has to be built from source code, which is why we installed build-essential. The following commands will download and install the software:

cd /usr/local/src/
rm -r noip-*
tar xf noip-duc-linux.tar.gz
rm noip-duc-linux.tar.gz
cd noip-*
make install

The commands above will first remove any previous source downloads for NoIP you might have had. Next it downloads the sources for the software and installs it. After installing it should immediately start the configuration wizard, which you can always restart using the command “/usr/local/bin/noip2 -C“. The configuration wizard will ask for your NoIP account details, as well as the host you want to be using. This should be mostly straight-forward. When it asks if you want to run anything on an update, you should probably just enter “No”.

Step 3: Running the DUC software on startup

By default, the DUC software will not start when you reboot your system. This is where killproc comes in, which we installed earlier. What we have to do now is set up an init script. We’re going to be using a simple script, as is described in the software’s readme file, with a slight alteration to make it work on our distribution. I have the script uploaded on my webserver, so you can just download it to your drive. Execute the following commands to install it and set it up:

cd /etc/init.d
chmod +x noip2
update-rc.d noip2 defaults

Step 4: Reboot

You’re all done now, so you can reboot the system now and when it boots up, the NoIP DUC software should be running.


Read More

Logitech MX Master scrolling issue

Since shortly after its initial release, I have used the Logitech Anywhere MX mouse for my desktop pc. I’m a huge fan of Logitech hardware, they have yet to disappoint me after years and years of products. If I couldn’t get Logitech input hardware, I would go with Microsoft, but that’s another story. So a week or two back, my Anywhere MX finally gave out, after years of loyal service. I’m not sure if it was just wear and tear from age, did I mash it too hard (after years of use tha bettery sometimes made bad contact inside, so I often gave it a tap on my desk with the back to lodge it back into place), … But the left button didn’t function quite as well anymore all of a sudden. I had to press it fairly hard or it would magically double-click or not click at all.

Time for a replacement! My philosophy when it comes to hardware, don’t cheap out. Good hardware will last years, it’s worth the price tag. So I go to the Logitech website and start hunting. Eventually I decide to get the MX Master. This is Logitech’s follow-up on the Anywhere MX’ bigger brother, the Performance MX. After I got it, I just fell completely in love. It took some getting used to the large desktop form factor, as I usually go with portable mice, but the functionality is simply amazing. After years of Anywhere Mx, I also couldn’t live without the hyper scroll system that allows you to scroll insanely fast and this has also been greatly improved.

Now this isn’t a product review, but actually a “quick fix” for an issue I bumped into. I play some FPS games every now and then and this is where I first noticed the issue. Sometimes when I scrolled to switch guns, the game would just keep swapping multiple times, as if I’d scrolled more than a single tick. Later when resizing my browser contents I noticed the same issue. Every time I tried to resize by using the Ctrl + Scroll combination, it resized twice, as if I had scrolled two ticks. This was extremely frustrating.

Today I decided to finally mess around with the settings of the device, to try and fix this. I found a solution. Simply open the Logitech Options software, hit the “Point and scroll” tab and then disable the “Smooth scrolling” feature. You will still get the hyper scrolling (freespin mode) functionality, but you will scroll with single scrolling ticks in “rachet mode” now.

Read More

Surface Pro 3, a headache and an addiction

So about one and a half year ago I wrote up my thoughts on tablet devices. This was the general idea:

Tablets are bulky smartphones with large screens to play low-end games on.

My point being that tablets are not devices for productivity. The market has changed a lot since I wrote up that post, but it has also changed very little. A lot, if not most tablets are still bulky smartphones. But they have improved in regards to productivity.

Read More