Disclaimer: Since you are modifying your kernel, things can go wrong and you might end up with a system that is not bootable. Make a backup of your important data. You have been warned.
So you got this great amp, you hooked it up to your Linux machine, and then… silence. Well, it’s about time to change that.
In this guide, I will walk you through the process of making your Katana and Linux like each other. In order to do that, you will have to tweak the included USB audio driver in your kernel. It sounds complicated, but it actually is not.
I won’t go into much detail of what we are changing and why, there is an ongoing discussion here, if you want to read more.
I’ve tested this workaround on a few different kernel versions, and it seems to be working. I am also assuming that you’re using an Ubuntu-derivative.
Here is the gist of what you will have to do
- Install the tools and dependencies required for building the kernel from source
- Download the kernel sources
- Prepare the kernel sources for building
- Patch the USB audio module
- Build the new USB audio module
- Install the new USB audio module
Installing the tools and dependencies
Open a terminal and run these commands:
sudo apt install build-essential -y
sudo apt build-dep linux -y
Getting the kernel sources
I created a folder called katana
in my home directory and downloaded the sources there.
mkdir ~/katana
cd ~/katana
apt source linux
After running the commands above, you should see several archive files and one folder that begins with linux
and ends with a version number. You don’t have to worry about the version number, the command above will always download the source code of the latest available kernel for your distribution, which you should be running if you do updates regularly.
Preparing the kernel sources
Navigate to the single directory created in your katana
folder:
cd linux-*
You want to use the same configuration as the currently running kernel, which you can do by copying these files over to the root of the source directory.
cp /lib/modules/`uname -r`/build/.config . -v
cp /lib/modules/`uname -r`/build/Module.symvers . -v
Then you need to update the Makefile
according to the currently running kernel.
For that, you need to find the version of the kernel you are currently using:
uname -r
On my system, this command gives the following output:
5.0.0-16-lowlatency
If I were to dissect the output, I would get the following parts:
Version: 5
Patch level: 0
Sub level: 0
Extra version: -16-lowlatency
You will find similar variables in your Makefile
. In my case the sub level was always different in the Makefile
than the output of uname -r
, and if the numbers don’t match, you will get errors.
Open your Makefile
in any text editor and you should see lines similar to these at the beginning of the file:
VERSION = 5
PATCHLEVEL = 0
SUBLEVEL = 18
EXTRAVERSION =
Make sure that the variables reflect the output of uname -r
My Makefile
looked like this after the changes:
VERSION = 5
PATCHLEVEL = 0
SUBLEVEL = 0
EXTRAVERSION = -16-lowlatency
Save the file and run the following command:
make modules_prepare
If nothing threw an error, you are ready for the next step.
Patching the USB audio module
For this, you will need to connect your Katana to your machine and find out the USB identifiers:
lsusb | grep Roland
This will list the connected USB devices, and filter the output to entries that contain the word Roland, which is the company behind Boss and therefore your amp.
You should get one line, something like this:
Bus 001 Device 004: ID 0582:01d8 Roland Corp.
You are interested in the 0582:01d8 part. That is the USB Vendor and Product identifier. You will have to use those numbers when patching the USB audio driver.
If you get no input, check your USB cable, or try a different USB port.
Now you are going to patch the USB audio driver.
This part will be different for each kernel version, but stick with me. Open the pcm.c
file in the sound/usb
folder with a text editor. The changes that you will have to make will be around line 355.
This is the part of the code that you are looking for:
case USB_ID(0x1397, 0x0002): /* Behringer UFX1204 */
ep = 0x81;
ifnum = 1;
goto add_sync_ep_from_ifnum;
}
if (attr == USB_ENDPOINT_SYNC_ASYNC &&
You will have to add some extra code right after goto add_sync_ep_from_ifnum;
. The affected part of the file should look something like this:
case USB_ID(0x1397, 0x0002): /* Behringer UFX1204 */
ep = 0x81;
ifnum = 1;
goto add_sync_ep_from_ifnum;
case USB_ID(0x0582, 0x01d8): /* Boss Katana 100 */
return 0;
}
if (attr == USB_ENDPOINT_SYNC_ASYNC &&
Save the file.
Building the USB audio module
make M=sound/usb
If everything goes executes without an error, you have successfully built a patched version of the USB audio module.
Installing the patched module
It’s a good idea to make a backup before you make any changes to your current kernel.
sudo cp /lib/modules/`uname -r`/kernel/sound/usb/snd-usb-audio.ko /lib/modules/`uname -r`/kernel/sound/usb/snd-usb-audio.ko.old -v
You have to make sure that the module is not in use before installing our own.
sudo rmmod snd-usb-audio
Then overwrite current module with the patched one:
sudo cp ./sound/usb/snd-usb-audio.ko /lib/modules/`uname -r`/kernel/sound/usb/snd-usb-audio.ko -v
Then you need to refresh the modules:
sudo depmod -a
And finally load the module
sudo modprobe snd-usb-audio
You should be able to record your Katana on Linux now.
Final thoughts
Since you are patching the currently running kernel, it means that every time there is a new kernel update, you will have to do the same on that new kernel or your Katana will stop working.
One day this workaround might make its way into the Linux kernel, in which case this guide will become obsolete.
Is this just to record on Linux? I’m trying to get the Tone Studio software to work. I’m also a programmer, but have little knowledge of Linux.
LikeLike
Correct. This is just for recording. Tone Studio will probably not work. I tried it a few times with Wine but I had no success.
You are better off using FX FloorBoard. It’s an alternative to Tone Studio with more features and it works natively on Linux.
You can get it from here: https://sourceforge.net/projects/fxfloorboard/files/KatanaFxFloorBoard/Katana%20FxFloorBoard%20for%20Desktop/
LikeLike
Boss Katana working on Ubuntu Studio 18.04 with kernel 5.3.0-24-lowlatency
Thanks…..!!!!!!
LikeLiked by 1 person
Soon the amp should work out of the box as this change was merged into to Linux kernel
LikeLike
Any idea, in which kernel version the changes will be included? Trying to build the module as described, but it’s constantly failing with WARNING: ”dev_warn” [sound/usb/snd-usb-audio.ko] undefined! error messages on 5.0.0-37-generic.
LikeLike
I think it should be in the 5.3 kernel.
LikeLike
Just updated to Ubuntu 19.10, running on 5.3.0-26-generic. Confirming that Boss Katana is automatically detected and can be used with e.g. QJackCTL. Thanks for your efforts!
LikeLiked by 1 person
No problem!
LikeLike
Do you get completely clean output with this fix? I was able to get sound working on my Boss GT-1 using this patch (by adding the GT-1 device ID). I get frequent audio dropouts, though, even at high buffer sizes, which leads me to believe that it is still not *quite* configured correctly.
LikeLike
Hey, I get quiet input. I’m using a low latency kernel. This is more of a workaround than an actual fix, so it might not work that well for your particular device.
LikeLike
Thanks for the quick response. The GT-1 USB implementation seems very similar to the Katana, but it must be different enough to cause issues.
LikeLike
Do you get completely clean output using this patch? I successfully got my Boss GT-1 to work using this method (by adding the GT-1 device ID). I get frequent audio dropouts, though, even using large buffer sizes, which leads me to believe that it is still not *quite* configured properly.
LikeLike
Is it possible that this approach might work for Fender Mustang amplifiers as well?
LikeLike
I have no way of telling or verifying that but I would not get my hopes up. The amp is most likely not class compliant which causes it to need a special driver. The manufacturer could have altered the USB implementation in any number of ways which would need either a quirk in the audio driver or a custom driver.
LikeLike
OK, thanks!
LikeLike
Just a heads-up that this is now properly fixed in the latest Linux kernel.
LikeLike
Thank you for the update! I received the email from the linux bug report too! I will post an update in a few days.
LikeLike
@Szabi Thanks a lot for this. I was wandering if the changes have been already integrated officially in the Linux kernel (see comment of Laadron). Since I am not an expect, can you please give me the Kernel release number which contains this patch. Again, thanks a lot for helping the Linux user community 😀
LikeLike
Hey!
These changes were not included, but something better was.
I don’t know the exact final release but you can read more here: https://bugzilla.kernel.org/show_bug.cgi?id=195223#c40
LikeLike
you are right. Thanks. With the kernel 5.12.0, everything works like a charm.
LikeLike
hi, im serching the way to control my boss katana mk2 with my midi pedalboard. i have no idea about programmig.
but im able to learn the necesary to make it work.
LikeLike
Hey!
The manual describes some MIDI messages that the amp can take.
The problem is that only the Artist and the Head models have a physical MIDI in.
The rest of the models can only take MIDI messages from the USB.
LikeLike
Thanks for this thread. Now it’s 2022 and I’m running Ubuntu Studio jammy (22.04). The kernel is 5.15.0-52-lowlatency. When I plug in the Katana USB, it is recognized (as USB3,0,0) with 4 audio ins/outs in Carla and can be routed to audio applications (I’m using Sooperlooper and Audacity). However the gain is really high and the sample rate is stuck at 44100. I wonder if things regressed since 2021?
LikeLike
They could have. I know that things changed a lot since I documented this hack here. The code looked a lot different last time I checked.
If you want to investigate this, I’d start with FX Floorboard and look at the USB levels configured for the amp.
I don’t have a Katana amp anymore so I haven’t been following the state of the Linux driver.
LikeLike