Linux Software

Fix Music on Console (moc) on Arch Linux

The Problem

In this quick article I’ll go over the process to fix moc (Music on Console) not starting properly on Arch Linux.

Firstly, at the time of writing this article the current <a href="" target="_blank" rel="noreferrer noopener">moc</a> version is moc-1:2.5.2-5. Future releases may fix the issue described below.

Usually, installing moc on Arch Linux should be a simple case of running the following command:

sudo pacman -S moc

And, in fact, installing moc with pacman will appear to succeed without any issues:

Installing moc using Pacman … looks good, right?

Unfortunately, when you now try to run mocp, the following exception is immediately thrown:

Immediate exception when running mocp for the first time

… what the hell?

The Fix

Due to a bug in glibc 2.35, a patch needs to be applied to the moc package build files, after which the package can be rebuilt and the resulting binaries + docs + libs copied over those installed by pacman.

Because this is an Arch Linux article, I’ll assume you already have git installed. Let’s go.

  • Firstly, grab the moc package build files
git clone -b packages/moc --single-branch
  • Enter the main source directory and open the PKGBUILD file for editing (use any editor that suits you)
  • Modify the source array as follows, making sure to keep the quotes intact:
  • Modify the prepare() function as follows:
prepare() {
  cd $pkgname-$pkgver
  patch -p0 -i ../moc-ffmpeg4.patch # Fix build with ffmpeg 4
  patch -p0 -i ../moc-https.patch  # Allow https for urls
  patch -p0 -i ../glibc-2.35.patch # FS74041
  • Save the PKGBUILD file and close the editor
  • Build the package, making sure to tell the process to skip integrity checks.
makepkg --skipinteg

The man page for the makepkg --skipinteg parameter is as follows:

Do not perform any integrity checks (checksum and PGP) on source files.

makepkg man page, –skipinteg parameter info

When an error occurs indicating the current file being patched can’t be found, it’s a simple case of entering utf8.c and pressing enter:

patching file files.c
can't find file to patch at input line 32
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
File to patch: utf8.c

If the build process is successful, the output will end something like this:

makepkg --skipinteg completed, including entering utf8.c when prompted

Updating moc Installation

A successful build will result in a new moc package in the pkg directory. The contents of the package’s root directory are nothing more than a usr directory, as follows:

Contents of new moc package

The last step is to copy those files into place, overwriting existing files. This assumes you’ve already changed to the pkg/moc directory.

cd usr
sudo cp -R * /usr

By default there’s no output after copying these files:

Copying newly built moc files into place

Test moc

So now there’s only one thing left to do … run mocp!

mocp running after being patched and rebuilt


Thanks to the participants in the Arch Linux bug tracker for this info. Given the time I spent finding a process that actually worked (poor Google fu, maybe), I’m keeping a record of it here so I can refer back later, if required.

Hope it helps someone.

Archived Software Uncategorized

Set network interface IP address with Powershell

The Problem

While setting up our partner technology centre recently, I found myself switching back and forth between networks so often that I was constantly having to change my laptop’s IP address. For reasons that are outside the scope of this article I’m unable to use the option for an alternate network configuration.

Powershell to the rescue

The solution? Two small Powershell scripts – one to setup my network connection for our corporate LAN, the other to setup my network connection for the PTC. The scripts are shown below – feel free to use them in any way you like.

PTC configuration script {#ptcconfigurationscript}

 $index = (gwmi Win32_NetworkAdapter | where {$_.netconnectionid -eq “Local Area Connection”}).InterfaceIndex $NetInterface = Get-WmiObject Win32_NetworkAdapterConfiguration | where {$_.InterfaceIndex -eq $index} $NetInterface.EnableStatic(“”, “”) $NetInterface.SetDynamicDNSRegistration(“FALSE”) 

Corporate LAN configuration script

This script just resets the network adapter back to DHCP

 $index = (gwmi Win32_NetworkAdapter | where {$_.netconnectionid -eq “Local Area Connection”}).InterfaceIndex $NetInterface = Get-WmiObject Win32_NetworkAdapterConfiguration | where {$_.InterfaceIndex -eq $index} $NetInterface.EnableDHCP() $NetInterface.SetDynamicDNSRegistration(“TRUE”) 

Extra stuff

Although I don’t need them in my PTC environment (it’s internal only, with no internet access), you can also use the snippets below to add some extra functionality. Set gateway:


Set DNS server search order:

 $NetInterface.SetDNSServerSearchOrder($dns) # (e.g. “” for single server or “,” for multiple servers) 

Enable dynamic DNS registration (e.g. in AD environment):