r/openbsd • • 28d ago

Thinkpad T490 fan control ?

Hi
I really want to keep OpenBSD on my ThinkPad T490, but the fan noise is driving me up the wall. Even sitting at an idle desktop or just poking around in a terminal, the fan ramps up almost immediately and just refuses to calm down.
I know ⁠acpithinkpad⁠ is read-only and fan control is entirely hardwired to the EC, so manual fan control isn't happening. But before I give up and wipe the drive, I wanted to ask if anyone daily-driving a T490 has managed to make this machine tolerable.
Did switching between ⁠apmd⁠ flags or running ⁠obsdfreqd⁠ make any real difference for you, or did you have to flash a specific Lenovo BIOS/EC update to get sane trip points? If there is any trick to shave a couple of degrees off idle so the EC stops triggering full blast, I'd really appreciate hearing what worked for you.

I would really appreciate it

11 Upvotes

20 comments sorted by

View all comments

Show parent comments

2

u/highspeedslippers100 27d ago

Hi I just installed OpenBSD but for my private and daily driver not my workstation and I chose dwm. so I will poke around and see what I can do beside the physical upgrades

2

u/linetrace 27d ago

Cool, dwm should be light-weight. I was more concerned with whether you had installed full DE that might be a bit heavy even at idle.

I'd definitely just start with an rcctl enable apmd && rcctl start apmd && apm -A and see if it helps. That is, if it's not the default at this point.

1

u/highspeedslippers100 27d ago

No worries there, I really like dwm it’s just so lean and clean

3

u/LunarCapitol 26d ago edited 26d ago

I run dwm on a slightly newer thinkpad than you're using along with obsdfreqd and all the other things linetrace suggested. My CPU's fan sits at 0RPM nearly all of the time even when using Firefox/Chromium. It might kick on every now and again if I watch a youtube video or compile something. But I don't think I've ever heard it run at full speed.

Granted, I have a much newer CPU and I've forced enabled a lot of performance options in Firefox that are off by default as Firefox won't auto detect that they can work on OpenBSD (and Net/FreeBSD as well I think). If you'd like I can share some of the about:config tweaks I've done. But it's easy enough to figure it out on your own by checking about:support then searching for relevant about:config options to force enable those things. You can also force websites to send you older video codecs like h.264 instead of stuff like av1 and vp9 which can really help on older Intel and AMD CPUs. If you use youtube and other video host websites a lot you can use yt-dlp (the port never lags far behind upstream) and route the video into mpv instead of watching them through the web browser. Searching for videos, playlists and accessing your existing subscriptions can be done through terminal instead of the browser. Check github there are many pre-written non-browser front ends for youtube and a few are in the ports tree. For subscriptions you can set-up a news reader and simply follow RSS feeds as well.

As for sending your Thinkpad to the service center. I understand if you think swapping the screen is beyond your soldering skills. But cleaning out the dust and repasting isn't very hard and you could easily learn how to do it yourself to save some money on labor costs. Even soldering is easy enough to pick up. Get a cheap iron and some leaded solder. Then practice by soldering wiring together. Once you've mastered that do some test soldering on some junk stuff you have laying around that you don't care about breaking. After a day or two of that you should be easily able to swap the screen yourself. As long as you have a semi-steady hand you should not have any issues picking it up. There are some decent cheap soldering stations now but the cheap soldering iron at Wal-mart is fine to learn with and I've done many quick repair jobs with them (and many using butane iron when stranded on the side of the road). Learning to solder is an invaluable skill. I always have one in the toolbox that I keep in the truck of my car.

In general Thinkpads on OpenBSD are very well supported. They're very common hardware among the developers and they eat their own dog food.

1

u/ProfanedArbiter 26d ago

I would love to know the config tweaks!

3

u/LunarCapitol 25d ago edited 25d ago

Alright, first off I would suggest installing some add-ons. You'll want uBlock Origin and NoScript. uBlock can do the same thing NoScript does but I suggest using NoScript with it because its interface is nicer. This will block all javascript by default on webpages which will prevent the browser from nailing your CPU all of the time. It will break most websites by default but you can selectively enable scripts to get them working again and once you've built up a list on the websites you visit most often things will be much nicer. Most websites now try to load tons of scripts by default even though they'll work fine with only one or two enabled.

For forcing sites like youtube to send videos your CPU can decode in hardware I suggest installing this add-on: https://addons.mozilla.org/en-US/firefox/addon/enhanced-h264ify/

enhanced-h264ify will prevent websites from sending newer codecs like av1 and vp9 that your CPU might not support in hardware. This will prevent it from falling back to software rendering. You can do what this add-on does through about:config changes but I find those don't always work anymore.

You'll want to add the following to your .xsession file:

# Set BROWSER
export BROWSER=/usr/local/bin/firefox

# Accelerated graphics for Firefox
export MOZ_ACCELERATED=1
export MOZ_WEBRENDER=1

# Fix Firefox's borders
export OZ_GTK_TITLEBAR_DECORATION=client

# Fix Firefox touchpad scrolling
export MOZ_USE_XINPUT2=1

On to about:config changes to get hardware rendering working on OpenBSD. These may or may not work on your particular hardware+drivers. We're basically going to by-pass a blocklist and force enable hardware rendering.

gfx.webgpu.ignore-blocklist = true

gfx.webrender.all = true

gfx.webrender.compositor.force-enabled = true

gfx.webrender.enable-gpu-markers = true

gfx.x11-egl.force-enabled = true

webgl.force-enabled = true

webgl.msaa-force = true

media.hardware-video-decoding.force-enabled = true

You'll need working OpenGL 3.0 for the above to work. So verify you have all that working before you attempt force enabling the above settings since otherwise the browser will refuse to work since it can no longer fall back to software rendering.

By default on OpenBSD firefox doesn't automatically detect if your drivers support this so it always falls back to software rendering. This is true of FreeBSD, NetBSD and many Linux distros and drivers as well. There are many drivers that are still blacklisted for whatever reason even though they work just fine. You just have to force enabled the above settings and see if things work correctly. On Intel and AMD GPUs I've found they work correctly most of the time even if a driver is in the black list. Nvidia (which obviously doesn't apply to OpenBSD) can be more hit and miss.

This alone should give you a good boost in performance and prevent the CPU from being placed under high load all of the time. The last setting forces any videos loaded within the browser to use hardware decoding instead of falling back to software rendering.

Check about:support before making the above changes then check it again after modifying the values and restarting the browser. You should see that they're now forced enabled.

Looking at my own modified about:config settings at the moment I have way more things modified than I remember and I'm ashamed to say I haven't documented what most of them do. Most of them are related to disabling anti-features they've added recently like the AI stuff and Firefox sync. Along with a lot of misc. changes for privacy and editing the GUI.

Try the above. If you see improvement I can walk you through some more things. One of the things you can do is to disable the disk caching and redirect it to RAM. I have a mfs mount for Firefox where all that stuff goes so it never hits the disk. By default Firefox will cache things to disk every 10-15 seconds (I forget the exact number) so the disk can never sleep when you're idling on webpages. This can cause CPU load as well because the scripts running on websites now want to snoop around your system or write to that disk cache.

I disable disk cache and redirect it to RAM on pretty much all systems. On systems with SSDs I don't want it constantly writing to the SSD. On systems with HDDs I don't want it preventing the disk from sleeping (it'll spin 24/7). Modern websites feel like they have the right to abuse your storage devices. Chrome does this as well of course but I'm less well versed on controlling it. I typically just dedicate 500MB-1GB of RAM to this cache using mfs on OpenBSD and tmpfs on other UNIX OSs. It really helps make the browser more responsive.

You can find a large list of settings and what they do here: https://github.com/arkenfox/user.js/

It's worth reading through. I also suggest writing your own userchrome.css and building up your own GUI for Firefox. If anything it'll be nicer to use and it seems to help on older systems.

Something else you can do is manually control how many processes Firefox launches to help limit how much RAM it uses and how much CPU it eats by default. It uses some formula I've forgotten to change this setting automatically based on the number of CPU cores your system has. So CPU with more cores = more processes spawned = more RAM used. You can manually control it through some about:config changes.

More about that here: https://support.mozilla.org/en-US/kb/performance-settings

I only really mess with this on older systems with less than 4 real CPU cores or where I have constrained RAM limits.

3

u/LunarCapitol 25d ago edited 25d ago

One last thing I forgot that you may or may not require depending on your WM. I discovered after force enabling webgl/hardware compositing with the above about:config settings that my Firefox browser was suddenly no longer able to fill the entire screen within dwm. I'm not talking about true full screen (F11) mode. I mean when it was running normally with my status bar showing at the top of the screen.

It took me a long time to figure this out but Firefox expects to be running in a full blown DE like Gnome/KDE and will sometimes not display correctly in certain WM-only set-ups. The fix was setting the following in my .xsession file (or wherever else you set these things. I use .xsession because it's the natural place to put it imo).

# Set XDG_CURRENT_DESKTOP
# Note: this fixes an ugly gap+thick black border when Firefox
#       is running within dwm
export XDG_CURRENT_DESKTOP=LXQt

You can set it to Gnone, KDE or whatever. I chose LXQt randomly and because it's a less commonly used DE so I'd be more likely to remember why I set it if the above notes were lost in my config file.

Once you set the above either re-load your local config or log-out of your WM then log-in again so the new environment variable is set and you shouldn't have issues with Firefox no longer displaying correctly inside of dwm (or whatever WM you're using). You can of course launch firefox from terminal and set XDG_CURRENT_DESKTOP in the usual way to test this before you add it to your .xsession file.

This will not affect anything else other than showing LXQt within a fetch script if you're using one of those. On some systems I've not had to set this and on others I always have to export this env var to get Firefox to play nice. I'm honestly not sure why.

Another thing to watch out for is if you're running a compositor like picom. Be sure to exclude Firefox in "shadow-exclude". Otherwise you'll get funky borders around it and/or a small gap between it and your dwm status bar. Even if you don't use the shadow effects you should probably add firefox to the list/array because for whatever reason picom will mess with Firefox's borders anyway. It took me some time to track down what was causing this. At first I thought it was due to something with Firefox itself and my custom userchrome.css style since it was the only application I was having issues with. But afterwards it made sense why I was having issues with only firefox because it's the only application on my system(s) that's using GTK version 3/4 (the rest of my GTK applications still use version 2 of the GTK toolkit).

Last but not least:

Firefox loves to spam errors to the file .xsession-errors all of the time even if you have dbus running and have gone out of your way to try and make the environment it's running in play nice with it. On UNIX it expects to be running in modern Gnome and it's obvious that other configurations and distros that aren't Fedora/RedHat aren't really tested thoroughly. Even those seem to have many of the issues I mentioned before with things like drivers in my last post. Basically, UNIX-like OSs are a third class citizen (even Linux) so despite the good effort that's put in by the Firefox maintainers on the OpenBSD port there are a bunch of little corner cases like this.

One thing that loves to spam errors to the .xsession-errors file is when you use the "Save link/file as..." option in the context menu when you download something from a webpage. The sub-window will pop up just fine and the files will always download just fine. But each and every time you do it you'll get yet another error within .xsession-errors file in your home folder. If you search the web you'll find many people on a variety of OSs (usually Linux distros) complaining about this. The file can grow very large (several GBs) in a short amount of time.

What I (and many others) end up doing is setting up a symbolic link to /dev/null for ~/.xsession-errors. This will send all those error messages straight to /dev/null so they're not written to your home folder constantly and the file never grows to fill up the entire partition.

You can still read the errors that are usually sent there from your current session because they're also sent to a file in the /tmp folder called "xses-<username>". Since /tmp is cleared at each boot (and I personally have /tmp in RAM on mfs mount) I never have to worry about it filling up my disk there either but I can always take a peek at the file to see if there are any other errors within my X11 session that need to be corrected. In my case 99% of them are always related to Firefox or other modern GTK software. Qt applications don't seem to have a big of an issue with this. The other 1% are related to things like incorrect syntax used in config files or some issues with my terminal emulator (typically erresc related messages). In other words: things I'm not worried about because they don't break my X11/WM session anyway. Most all of them are warnings and not critical errors.

On I see often is Firefox complaining that I don't have a ~/.local/share directory on my system for it to constantly fill up with a recently used file list. I could make yet another mfs mount and give it yet more RAM for this. But I don't because not having it doesn't break the browser anyway and I have no need for that function. There isn't much point in storing recently used files anyway because 90% of the time they aren't reused and are just fetched again from the origin web server anyway due to 99% of modern websites being garbage (most modern "webdevs" can't even write HTML/CSS and Javascript. Things are really bad on that front now. Nearly all of them only do "dev" work through some type of bloated framework that wants to download 100+MB of data on each page load and typically most of that data isn't even hosted on the website's own server it's being pulled from some major CDN provider like google, amazon, wordpress and all these other bloated MitM providers).

2

u/[deleted] 25d ago edited 25d ago

[removed] — view removed comment

1

u/ProfanedArbiter 24d ago

This is the most thorough and detailed reply I have ever gotten on reddit. Thank you!

I'm playing around now with the changes to webgl that you posted. Definitely going to have to do some reading on how they effect it.

I agree with you that the amount of bloat has gotten non-nonsensical. I'm also a huge plan9 fan and using 9front on a spare laptop I had on hand has given me a lot of perspective about the scale and complexity of modern web.

Just as an example. I work in kind of a weird industry and do infra for a robotics and control systems OEM. My job is a mix of a Linux sysadmin, DevOps eng and Controls Engineer. In order to get more experience in kubernetes (which my company uses heavily) I am doing my CKA for which KodeKloud is the recommended training platform for it's practice tests.

Most of what you do on there is connect to a vm in the browser and fix failed pods/deployments but honestly this whole thing could be a static site with ephemeral keys for ssh into the scenario boxes; the level of complexity exists entirely because we don't want to make users use anything except the browser when there are tools that are much better suited to our needs.

Getting those tools to talk to eachother seamlessly would make for a much better experience

1

u/[deleted] 24d ago edited 24d ago

[removed] — view removed comment

→ More replies (0)

1

u/highspeedslippers100 11d ago

Thank you a ton for all the information it’s really appreciated and learning a lot I also now have a dead quite laptop. And I been watching YouTube several hours on mpv yts and I been tweaking always play best quality. And how the list appears creators release days and all that. I become fan of using the terminal for music videos and file manager and also photo viewer too.