<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Ben Leskey's Blog: debugging</title>
		<description>debugging posts from Ben Leskey</description>
		<link>https://benleskey.com/blog/tags/debugging</link>
		<language>en-us</language>
		<copyright>2025 Ben Leskey</copyright>
		<lastBuildDate>Sun, 14 Sep 2025 18:47:01 +0000</lastBuildDate>
		<pubDate>Sun, 14 Sep 2025 18:47:01 +0000</pubDate>
		<atom:link href="https://benleskey.com/blog/tags/debugging.feed.xml" rel="self" type="application/rss+xml" />

		<item>
	<title>Fixing Intellj IDEA lag spikes on OpenSUSE KDE Plasma 6</title>
	<description>&lt;div&gt;&lt;p&gt;
    I ran into &lt;a href=&quot;https://youtrack.jetbrains.com/issue/JBR-6830&quot;&gt;JBR-6830&lt;/a&gt;. When using Intellij IDEA on KDE Plasma 6 (OpenSUSE Tumbleweed), I was getting random very noticeable lag spikes.
    The solution was to add &lt;/p&gt;&lt;pre&gt;&lt;code&gt;-Dwatch.desktop.geometry=false&lt;/code&gt;&lt;/pre&gt; to the Intellij IDEA custom VM options.

    No more lag spikes!
&lt;/div&gt;</description>
	<category>debugging</category><category>software</category>
	<link>https://benleskey.com/blog/intellj_kde_lag_spike_workaround</link>
	<guid isPermaLink="true">https://benleskey.com/blog/intellj_kde_lag_spike_workaround</guid>
	<pubDate>Thu, 17 Apr 2025 12:00:00 +0000</pubDate>
</item>
<item>
	<title>Fixing HP Victus 15 internal microphone drivers by compiling patched auto-updating kernel with openSUSE Tumbleweed Open Build Service</title>
	<description>&lt;div&gt;&lt;p&gt;
	I&#x27;ve recently moved to a new laptop. OpenSUSE tumbleweed is still my OS of choice, and my recent experience cemented its position as my favorite Linux distro. My new device is an HP Victus 15, specs below:
&lt;/p&gt;

&lt;pre&gt;
Operating System: openSUSE Tumbleweed 20241222
KDE Plasma Version: 6.2.4
KDE Frameworks Version: 6.9.0
Qt Version: 6.8.1
Kernel Version: 6.12.6-5.gfb072de-default (64-bit)
Graphics Platform: X11
Processors: 12 &amp;#215; AMD Ryzen 5 7535HS with Radeon Graphics
Memory: 14.8 GiB of RAM
Graphics Processor: AMD Radeon 660M
Manufacturer: HP
Product Name: Victus by HP Gaming Laptop 15-fb2xxx
&lt;/pre&gt;

&lt;p&gt;
	The only hardware issue encountered on this device was that the internal microphone was not recognized. For example, using &lt;code&gt;arecord -l&lt;/code&gt; to list my sound devices, I only saw the unplugged microphone device, even though my devices were shown in &lt;code&gt;inxi -A&lt;/code&gt;:
&lt;/p&gt;

&lt;pre&gt;
$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 2: Generic_1 [HD-Audio Generic], device 0: ALC245 Analog [ALC245 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
&lt;/pre&gt;

&lt;pre&gt;
$ inxi -A
Audio:
  Device-1: Advanced Micro Devices [AMD/ATI] Navi 21/23 HDMI/DP Audio
    driver: snd_hda_intel
  Device-2: Advanced Micro Devices [AMD/ATI] Rembrandt Radeon High
    Definition Audio driver: snd_hda_intel
  Device-3: Advanced Micro Devices [AMD] ACP/ACP3X/ACP6x Audio Coprocessor
    driver: snd_pci_acp6x
  Device-4: Advanced Micro Devices [AMD] Family 17h/19h/1ah HD Audio
    driver: snd_hda_intel
  API: ALSA v: k6.12.6-5.gfb072de-default status: kernel-api
  Server-1: PipeWire v: 1.2.7 status: active
&lt;/pre&gt;

After much research I found the fix. I needed to add a linux kernel quirk patch for my specific model in the ACP6X sound driver for the internal microphone. The patch to the kernel itself is extremely simple, just adding my hardware to the quirk list so that even though Linux does not autodetect the correct driver, it will load it anyway:


&lt;pre&gt;
&lt;code language=&quot;diff&quot;&gt;
diff --git a/sound/soc/amd/yc/acp6x-mach.c b/sound/soc/amd/yc/acp6x-mach.c
index ecf57a6..c95198c 100644
--- a/sound/soc/amd/yc/acp6x-mach.c
+++ b/sound/soc/amd/yc/acp6x-mach.c
@@ -458,6 +458,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = {
 			DMI_MATCH(DMI_PRODUCT_NAME, &quot;OMEN by HP Gaming Laptop 16z-n000&quot;),
 		}
 	},
+	{
+		.driver_data = &amp;amp;acp6x_card,
+		.matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, &quot;HP&quot;),
+			DMI_MATCH(DMI_PRODUCT_NAME, &quot;Victus by HP Gaming Laptop 15-fb2xxx&quot;),
+		}
+	},
 	{
 		.driver_data = &amp;amp;acp6x_card,
 		.matches = {
&lt;/code&gt;
&lt;/pre&gt;

&lt;p&gt;
	So far, so good. But here&#x27;s where OpenSUSE shines: using the Open Build Service, I was able to create a new set of kernel packages with my patch that &lt;i&gt;automatically keep up&lt;/i&gt; with the latest tumbleweed kernel. &lt;a href=&quot;https://www.reddit.com/r/openSUSE/comments/72wz1l/comment/dnm87nj/?utm_source=share&amp;amp;utm_medium=web3x&amp;amp;utm_name=web3xcss&amp;amp;utm_term=1&amp;amp;utm_content=share_button&quot;&gt;This reddit comment&lt;/a&gt; was very helpful, reproduced below:
&lt;/p&gt;

&lt;blockquote&gt;
	&lt;ol&gt;
		&lt;li&gt;Go to https://build.opensuse.org/package/show/openSUSE:Factory/kernel-source&lt;/li&gt;

		&lt;li&gt;sign in&lt;/li&gt;

		&lt;li&gt;click branch&lt;/li&gt;

		&lt;li&gt;optional step - use the command line tool osc to download, edit and test the build locally.&lt;/li&gt;

		&lt;li&gt;overwrite the config.tar.bz2 with your .config tar bzipped&lt;/li&gt;

		&lt;li&gt;Make package links to kernel-source and call them kernel-default, kernel-devel and kernel-syms&lt;/li&gt;

		&lt;li&gt;&lt;strike&gt;Draw the rest of the owl&lt;/strike&gt;&lt;/li&gt;

		&lt;li&gt;Wait for it to build successfully&lt;/li&gt;

		&lt;li&gt;Add the repo to your TW installation (links are on the webpage) and switch the kernel packages over&lt;/li&gt;
    &lt;/ol&gt;
&lt;/blockquote&gt;

&lt;p&gt;
	I more or less followed these steps, with some details below:
&lt;/p&gt;

&lt;p&gt;
	First, I installed the kernel-source package so I could test and install my fix locally, using the following:
&lt;/p&gt;

&lt;pre&gt;
&lt;code language=&quot;bash&quot;&gt;
$ cd linux-build-directory

$ make -C /usr/src/linux O=$PWD oldconfig # Create a kernel config based on my running kernel config
[...]

# In the .config file, I updated CONFIG_LOCALVERSION to differentiate my compiled kernel,
# and removed the reference to the OpenSUSE keys in CONFIG_MODULE_SIG_KEYS

# I also added a modprobe configuration file:
$ cat /etc/modprobe.d/10-unsupported-modules.conf
allow_unsupported_modules 1

$ make -j12 # It builds.

$ sudo make modules_install -j12 # Adds the kernel modules to /usr/lib/modules

$ sudo make install -j12 # Installs the kernel to /boot and updates the bootloader
&lt;/code&gt;
&lt;/pre&gt;

&lt;p&gt;At this point I created the patch diff of my changes using the original file and my new file:&lt;/p&gt;

&lt;pre&gt;
&lt;code language=&quot;bash&quot;&gt;
$ git diff /tmp/old-acp6x-mach.c ./sound/soc/amd/yc/acp6x-mach.c &amp;gt; /tmp/my-new-patch.patch
&lt;/code&gt;
&lt;/pre&gt;

&lt;p&gt;
	After this, I rebooted into my custom kernel to verify the fix. To remove the custom compiled kernel from the bootloader list, I just removed the files and updated the bootloader:

&lt;/p&gt;&lt;pre&gt;
&lt;code language=&quot;bash&quot;&gt;
$ cd /boot
$ mkdir /home/user/old-linux
$ find | grep my-custom-kernel | sudo xargs -O{} -n1 mv {} /home/user/old-linux # Replace my-custom-kernel with what you put in CONFIG_LOCALVERSION
$ sudo update-bootloader # Get the removed custom kernel off the bootloader menu
&lt;/code&gt;
&lt;/pre&gt;


&lt;p&gt;
	I then:
	&lt;/p&gt;&lt;ul&gt;
		&lt;li&gt;
			&quot;Branched&quot; a new package from the openSUSE tumbleweed kernel-source package. This created my own kernel-source package that I could modify as needed. Importantly, it is linked to the upstream openSUSE kernel, so it will stay up to date while applying my patches.
		&lt;/li&gt;
		&lt;li&gt;
			Checked out my new package locally, using osc: &lt;code&gt;$ osc -A https://api.opensuse.org checkout home:linewriter1024:branches:Kernel:stable/kernel-source&lt;/code&gt;
		&lt;/li&gt;
		&lt;li&gt;
			Linked repos as mentioned in the reddit comment + some additional.
&lt;pre&gt;
&lt;code language=&quot;bash&quot;&gt;
$ osc linkpac home:linewriter1024:branches:Kernel:stable/kernel-source home:linewriter1024:branches:Kernel:stable/kernel-default
$ osc linkpac home:linewriter1024:branches:Kernel:stable/kernel-source home:linewriter1024:branches:Kernel:stable/kernel-devel
$ osc linkpac home:linewriter1024:branches:Kernel:stable/kernel-source home:linewriter1024:branches:Kernel:stable/kernel-docs
$ osc linkpac home:linewriter1024:branches:Kernel:stable/kernel-source home:linewriter1024:branches:Kernel:stable/kernel-syms
$ osc linkpac home:linewriter1024:branches:Kernel:stable/kernel-source home:linewriter1024:branches:Kernel:stable/kernel-macros
&lt;/code&gt;
&lt;/pre&gt;
		&lt;/li&gt;
		&lt;li&gt;
			Added my patch to patches.addon.tar.bz2 inside my checked out directory, which has an empty directory &lt;code&gt;patches.addon&lt;/code&gt;, into which directory I added my patch file &lt;code&gt;6.12.6-9999-local.patch&lt;/code&gt; and a text file named &lt;code&gt;series&lt;/code&gt; with one line: &lt;code&gt;6.12.6-9999-local.patch&lt;/code&gt;, the name of the patch file.
		&lt;/li&gt;
		&lt;li&gt;
			Ran &lt;code&gt;osc build&lt;/code&gt; and verified that my patch was being used:
&lt;pre&gt;
&lt;code language=&quot;bash&quot;&gt;
$ cat /var/tmp/build-root/standard-x86_64/.build.log | grep addon
[   10s] + /usr/lib/rpm/rpmuncompress -x /home/abuild/rpmbuild/SOURCES/config.addon.tar.bz2
[   10s] + /usr/lib/rpm/rpmuncompress -x /home/abuild/rpmbuild/SOURCES/patches.addon.tar.bz2
[   22s] + patch -s -F0 -E -p1 --no-backup-if-mismatch -i /home/abuild/rpmbuild/BUILD/kernel-source-6.12.6/patches.addon/6.12.6-9999-local.patch
&lt;/code&gt;
&lt;/pre&gt;
		&lt;/li&gt;
		&lt;li&gt;
			Ran &lt;code&gt;osc commit&lt;/code&gt; and uploaded my changes. The open build service built my new kernel and after it was finished I added the repository to my package repositories and ran &lt;code&gt;sudo zypper dup --from=https://download.opensuse.org/repositories/home:/linewriter1024:/branches:/Kernel:/stable/standard/ --allow-vendor-change&lt;/code&gt; to upgrade my kernel to my new patched version.
		&lt;/li&gt;
		&lt;li&gt;
			Rebooted and profited!
		&lt;/li&gt;
	&lt;/ul&gt;


&lt;p&gt;
	This OpenSUSE infrastructure is incredibly useful, and I am very pleased with my choice of distro and the (relative!) ease of fixing this internal microphone issue without sacrificing update flow. Next step, getting this patch into the upstream Linux kernel!
&lt;/p&gt;
&lt;/div&gt;</description>
	<category>debugging</category><category>software</category>
	<link>https://benleskey.com/blog/opensuse_mic</link>
	<guid isPermaLink="true">https://benleskey.com/blog/opensuse_mic</guid>
	<pubDate>Wed, 25 Dec 2024 12:00:00 +0000</pubDate>
</item>
<item>
	<title>Debugging slow boot and a clogged router</title>
	<description>&lt;div&gt;&lt;p&gt;I powered on my laptop yesterday morning and saw the Ubuntu boot had stalled on two systemd services: trying to mount a disk by UUID, with a 90 second timeout, and waiting for the network to come up, with no timeout. Before the 90 seconds for mounting the disk was up, the boot continued and I got to the graphical login menu. Network manager tried to connect to my friends&#x27; home Wi-Fi, but the connection failed.&lt;/p&gt;

&lt;p&gt;This was odd:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;I had never seen these messages before during boot.&lt;/li&gt;
	&lt;li&gt;I had not installed or upgraded new software for several days.&lt;/li&gt;
	&lt;li&gt;I had not recently changed system configuration.&lt;/li&gt;
	&lt;li&gt;My phone was connected to the same Wi-Fi that my laptop could not connect to.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Hypothesis 1: Something was wrong with my laptop&lt;/h2&gt;

&lt;p&gt;I rebooted the laptop. Always gotta turn it off and back on again. Unfortunantely, the same things happened.&lt;/p&gt;

&lt;h3&gt;Hypothesis 1.1: Something was wrong with an fstab entry&lt;/h3&gt;

&lt;p&gt;The first step was to look at the odd error out: the timeout to mount a disk. I looked up the UUID and found that it was an entry in fstab that tried to mount an external volume as ntfs, but it did have nofail specified so the failure to mount shouldn&#x27;t be an error during boot. This entry had been working for months, so I didn&#x27;t see why it would be a problem now. Nevertheless I added &lt;code&gt;x-systemd.device-timeout=1&lt;/code&gt; to the mount options and rebooted. Mounting the disk timed out quickly during boot now, and didn&#x27;t cause any further issues. I guess the reason I never noticed that message before was that it does not affect graphical boot at all, and just quietly timed out after 90 seconds in the background.&lt;/p&gt;

&lt;p&gt;This left the long wait for the network to come up during boot, and the failure to connect to the Wi-Fi.&lt;/p&gt;

&lt;h3&gt;Hypothesis 1.2: Something was wrong with my laptop&#x27;s network ability&lt;/h3&gt;

&lt;p&gt;These two remaining problems were obviously tied together: Network manager waited during boot until the network was up, but because it kept trying unsuccessfully to connect to the Wi-Fi it took it until some timeout to bring the network up once it realized that it couldn&#x27;t connect to the Wi-Fi. Since I&#x27;m not running a network-critical server with my laptop, I ran &lt;code&gt;sudo systemctl disable NetworkManager-wait-online.service&lt;/code&gt; and turned off the boot delay. I don&#x27;t need network capability to start my laptop, network manager can connect later, even after I&#x27;m logged in.&lt;/p&gt;

&lt;p&gt;Now I was down to one problem: my laptop couldn&#x27;t connect to the Wi-Fi.&lt;/p&gt;

&lt;h4&gt;Hypothesis 1.2.1: Something was wrong with my laptop&#x27;s Wi-Fi radio&lt;/h4&gt;

&lt;p&gt;One of my fears was that I&#x27;d damaged my antenna or radio card somehow. To test this, I turned on my phone&#x27;s hotspot and tried to connect with my laptop. Success. While this didn&#x27;t entirely rule out my laptop as the problem, it did indicate the issue lay elsewhere.&lt;/p&gt;

&lt;p&gt;When I turned my phone&#x27;s hotspot off, it failed to connect back to the Wi-Fi. Now I was getting somewhere.&lt;/p&gt;

&lt;h2&gt;Hypothesis 2: Something was wrong with the router&lt;/h2&gt;

&lt;p&gt;The router was a &lt;a href=&quot;https://www.verizon.com/about/sites/default/files/fios-qgr-userguide140925.pdf&quot;&gt;Verizon FiOS-G1100&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This hypothesis seemed most reasonable now that I had two devices failing to connect. Other people in the house were still using the Wi-Fi, however, with no issues. One key to this hypothesis is that there were far more people on the WAP than normal: nearly a dozen people on the same Wi-Fi, each with their phones, laptops, tablets, etc. I would expect to see unusual failure under these relatively unusual conditions.&lt;/p&gt;

&lt;p&gt;Eventually I was able to reboot the router, expecting that to fix the issue. The problem persisted.&lt;/p&gt;

&lt;p&gt;I decided to try using a static IP address on my phone instead of using DHCP. It connected to the network with full internet access.&lt;/p&gt;

&lt;h3&gt;Hypothesis 2.1: Something was wrong with the router DHCP server&lt;/h3&gt;

&lt;p&gt;Using a static IP address on my laptop solved that connection issue as well. Clearly, there was something wrong with the DHCP server.&lt;/p&gt;

&lt;p&gt;When someone noticed that the Roku TV wouldn&#x27;t connect to the Wi-Fi, I tried to assign it a static IP address as well, but Roku only supports DHCP IP assigning. It was time to fix the router.&lt;/p&gt;

&lt;h4&gt;Hypothesis 2.1.1: Too many DHCP assignments&lt;/h4&gt;

&lt;p&gt;My working hypothesis was that somehow the amount of people on the network had run out of IP assignments. I couldn&#x27;t find evidence in the router console of too many outstanding leases, but I wanted to try resetting the DHCP server anyway, guessing that the outstanding leases were hidden and only the current devices were being show.&lt;/p&gt;

&lt;p&gt;There was no simple option to reset the DHCP server. Instead, I changed the IP assignment and gateway range from 192.168.1.x to 192.168.2.x, about which the console helpfully provided a warning saying it would require all devices to be assigned a new IP. Perfect.&lt;/p&gt;

&lt;p&gt;As soon as I hit apply, the problems vanished. I re-enabled using DHCP on my phone and laptop, and they connected perfectly. The Roku TV connected, as did every other device in the house.&lt;/p&gt;

&lt;p&gt;I still don&#x27;t know exactly what went wrong, but I&#x27;ve got more experience for next time I run into this kind of problem. Plus, being able to fix it was kinda fun!&lt;/p&gt;
&lt;/div&gt;</description>
	<category>debugging</category><category>software</category>
	<link>https://benleskey.com/blog/debugging_network</link>
	<guid isPermaLink="true">https://benleskey.com/blog/debugging_network</guid>
	<pubDate>Wed, 08 Mar 2023 12:00:00 +0000</pubDate>
</item>
<item>
	<title>Autodrive into a crater fix</title>
	<description>&lt;div&gt;&lt;a href=&quot;https://benleskey.com/blog/../images/cdda_truck_in_hole.png&quot;&gt;&lt;img src=&quot;https://benleskey.com/blog/../thumbs/cdda_truck_in_hole.50.png&quot; alt=&quot;A pickup truck fallen into a crater in Cataclysm: Dark Days Ahead&quot; class=&quot;right&quot;&gt;&lt;/a&gt;

&lt;p&gt;
	In my current &lt;a href=&quot;https://cataclysmdda.org&quot;&gt;Cataclysm: Dark Days Ahead&lt;/a&gt; &lt;a href=&quot;https://benleskey.com/blog/tags/cdda_erik&quot;&gt;playthrough&lt;/a&gt;, I ran into a problem with the autodrive feature: it&#x27;d drive me straight into a crater and crash the vehicle.
&lt;/p&gt;

&lt;p&gt;This seemed like a straightforward fix, so I checked out the master branch and set about debugging. Autodrive definitely has the capability to avoid certain terrain, so I guessed it was just a mistake in how it was calculating ledge traps or open air terrain.&lt;/p&gt;

&lt;p&gt;Sure enough, it was just an error in how the vehicle was being considered as &quot;able to drive over air&quot;. With the existing logic, autodrive thought every vehicle could fly. The fix was simple: only consider helicopters (the only flying vehicle) that have enough rotor power as flyable.&lt;/p&gt;

&lt;p&gt;I have &lt;a href=&quot;https://github.com/CleverRaven/Cataclysm-DDA/pull/63487&quot;&gt;a pull request fixing this issue&lt;/a&gt; ready to be merged.&lt;/p&gt;
&lt;/div&gt;</description>
	<category>cdda</category><category>debugging</category><category>software</category>
	<link>https://benleskey.com/blog/cdda_no_hole</link>
	<guid isPermaLink="true">https://benleskey.com/blog/cdda_no_hole</guid>
	<pubDate>Wed, 08 Feb 2023 12:00:00 +0000</pubDate>
</item>_
	</channel>
</rss>
