Musings: libxo, Python code quality, and Linux kernel shenanigans

I’ve been inspired to actually make this in to an actual bloggy journal thing instead of just writing occasional long-winded well thought out articles. I still want to do long-winded well thought out articles, but the entire reason I got this thing in the first place is to share my knowledge and experiences with the world. Might as well.

Caught up on the backlog of happenings on the freebsd-current mailing list. Lots of people are upset about libxo, including myself. May mean a Linux migration in my professional future. Disappointing, especially since there is a lot of opposition, but it’s understandable that it’s going forward anyway. Juniper pays to keep the lights on at the FreeBSD foundation, so they have a lot of pull. Sad to see they don’t really care about the community or what we have to say.

Looked harder at GCC 5.1 code output. Then looked harder at switching default compiler from GCC to Clang on Gentoo. 😉 It’s not all there yet but it seems to be improving every day. Looking forward to trying out a Clang-compiled kernel if that patchset advances.

Played with Pylint and Pyflakes. Ran it on a few of the projects I work on and a few of the ones I write with Elly. PyIRC 3 got a rating of 8.5 out of 10. Really impressive. I hope to show Pylint to the people at work in the coming week and improve the quality and process there too.

Tried playing Minecraft. Already felt a bit dizzy before playing, so that was a mistake. Logged off after about 20 minutes from the ill feeling. Perhaps tomorrow.

Found out about a lovely years-old DoS vulnerability in the Linux kernel’s UDP stack. Ran netstat on my servers to make sure they had no UDP listeners. Not sure what to do about the Minecraft server, perhaps the DDoS protection we already have on it is good enough.

Read a hilarious article comparing the Pentium 4 Northwood to various new CPUs, where the AMD “accelerated” notebook CPUs performed worse. I can’t believe AMD has gone so downhill that a Pentium 4 from 2002 can spank its brand new designs.

Decided to start configuring a 4.1-rc7 kernel for my laptop. 3.18 is so old (by my own standards) and I really want to get off of this line since my checkout is still affected by that stupid exit race bug which sometimes causes Firefox to die. Found an interesting knob, CONFIG_EXT4_ENCRPYTION, which is apparently the same encryption stuff Android “M” will be using. Pretty neat but seems useless for my needs. Might try it on the Pentium II for the hilarity.

Tried to tinker with the internals of OS X Server 5.0 beta 1 before bed, but it’s compressed with a weird algorithm (ADC?) that none of my Linux utilities can break open. I’ll need to investigate that more tomorrow.

 

FreeBSD on Apple MacBook Pro 8,2: Epilogue.

Why I left FreeBSD.

It is with a fairly heavy heart that I write I am no longer running FreeBSD on my MacBook Pro.

What happened to improving?

Part of the problem is that I finally received gainful employment in March, and that work is almost impossible to do on FreeBSD. A lot of it involves Chrome (which I still have been unable to run on FreeBSD), Qt5-based applications (which crash due to known bugs in libv8 that Google do not care to resolve), and some Python libraries that have truly terrible performance on FreeBSD.

Why not run Linux in a VM for work?

Sure, I could have, if VirtualBox ever worked…

Weren’t you excited to fix up FreeBSD?

I was. I still am, but something just feels different. For over a decade, FreeBSD has for me been the go-to operating system for any use case: servers, embedded projects, desktop systems, and more. But the current heading of development seems to strongly suggest this is no longer encouraged or desired.

When I first started out with Gentoo nine years ago, they were pretty much bent on making it for newer hardware only. Back then, Pentium computers were like the Pentium 4s of now – something you give your grandma or little sister for web browsing, but nothing too serious. And Gentoo developers did not really care if they broke compatibility with these older systems. I can understand that, given that compiling the entire system by hand is something that is pretty taxing for older hardware.

The nice thing about FreeBSD was their community never looked down on you for using these older machines, and realised they still have use. My first interactions with #FreeBSDHelp on EFnet were in 2006 and related to getting SLIP support working in sysinstall so I could remotely install FreeBSD 6 on my Pentium 90 laptop. They were happy to help.

The roles have largely reversed now. Running into issues with older hardware get me looks of disdain and “great, upgrade your hardware and try again” from the FreeBSD community. Meanwhile, the Gentoo team was happy to help me with an issue regarding my retro Intel486 box, in 2015. This computer has no business still functioning, and they were still willing to help me configure a kernel that would boot on it with its anaemic 20 MB RAM.

The other thing I have noticed is that even now, months later, none of my Ports bugs have been handled. In the same amount of time, I have filed three bugs against Portage packages… and all of them were closed within one week of being opened. I feel like my contributions matter to the Gentoo Linux team.

What have you learned?

FreeBSD is more fun to hack on than Gentoo. FreeBSD is harder to get things done on than Gentoo.

FreeBSD is lighter on resources than Gentoo. FreeBSD is heavier on bug backlog than Gentoo.

Ports updates for FreeBSD: Minecraft, HFS reading, and more…

Some updates on what I’m working on for FreeBSD.

I have been spending my time lately doing some maintenance with Ports, updating and fixing the software packages I use. I’ve submitted a couple of PRs to the FreeBSD team and hopefully my changes will be merged very soon.

Minecraft (games/minecraft-client)
The minecraft-runtime script wasn’t working, and the JAVA_VERSION was, in my opinion incorrectly, bumped to 1.8 when it runs perfectly well on 1.7. I have submitted PR 197063 to rectify these issues, and additionally more correctly replace variables in the script templates.
HFSExplorer (sysutils/hfsexplorer)
The current version in Ports no longer exists on SourceForge, as they have moved to GitHub. With the move came a new release that brings some new features and enhanced compatibility. I have submitted PR 197209 to update the distfile location and version.
LWJGL (games/lwjgl)
This library, used by Minecraft, does not currently build with openjdk8. I am currently ironing out this bug so that I can submit a patch either upstream or to FreeBSD (or perhaps both), whichever one is necessary. I’ll note further progress on this here on my blog.
Symbola (x11-fonts/symbola)
Elly has submitted PR 197090 to add the Symbola Unicode 7.0 font to FreeBSD. Look for this coming soon.

An article about more MacBook stuff is coming shortly, but for now I’m still working out some issues. Until then, happy hacking everyone!

 

FreeBSD on Apple MacBook Pro 8,2: Now with more features

Making FreeBSD perform well on a MacBook Pro (Late 2011).

As an update to my last post, I have been able to make more of the features of my 13″ Late 2011 MacBook Pro work on FreeBSD 11.0-CURRENT.

Sensor Readings.

Simple: kldload coretemp. To have on boot, add coretemp_load="YES" in /boot/loader.conf.

Cool Temperatures and Power Saving.

You will need to ensure i915kms is loaded and add drm.i915.enable_rc6=7 to your /boot/loader.conf. This was pointed out by the FreeBSD wiki which I could not find, so thank you Elly for helping me find these docs.

Additionally, you can add hw.pci.do_power_nodriver=3 to power down unused PCI cards. They re-enable when you kldload the modules, so this will help if you do not use the SD card reader or FireWire port very much.

Touchpad Gestures.

The atp(4) driver is flaky, but does work. Just add atp_load="YES" to /boot/loader.conf. Two fingers = right-click, three fingers = middle-click. Three finger tap is somehow hilariously much more reliable than two fingers, but with a little persistence they work. Two-finger scroll is a bit wonky and scrolls at unpredictable speeds, but I have a feeling this is a sysctl that may be fixable.

Bluetooth.

This actually does work right out of the box. I can pair with my phone and use the nifty obexapp utility to transfer files to my Android phone, an HTC One (M8). Unfortunately I was unable to transfer any files or pictures from the phone; obexapp consistently reported “0 bytes streamed in 2 seconds”. I think it may be a permissions error as I able to upload files to my phone’s Download/ directory correctly but no other directory.

To establish a Bluetooth connection (with an Android phone at least), you have to do the following:

  1. Add your phone to /etc/bluetooth/hcsecd.conf. The examples are quite good. Remember your PIN.
  2. Enable hcsecd in /etc/rc.conf and set flags to ubt0.
  3. Enable sdpd in /etc/rc.conf.
    Your /etc/rc.conf should now have at least the following lines:

    hcsecd_enable="YES"
    hcsecd_flags="ubt0"
    sdpd_enable="YES"
  4. Start both services…
    /etc/rc.d/hcsecd start
    /etc/rc.d/sdpd start
  5. Now run obexapp -a phone:bluetooth:mac -C FTRN. Your phone will ask you for the PIN you specified in /etc/bluetooth/hcsecd.conf. Enter it, and you can see files on your FreeBSD computer!

Some More Bumps.

With all of these things fixed, I have had two more snags. One was that my tilde key (the ~ next to the 1 key) on my MacBook’s internal keyboard was not working. This was fixed by adding the following line to ~/.xmodmaprc and running xmodmap ~/.xmodmaprc:

keycode 94 = grave asciitilde

My other new bump is that when I plug in headphones, the sound still comes out of the external speakers (and there is no sound in the headphones). This is probably due to some weirdness in the Apple HDA and I will have to take a closer look at this.

In conclusion, I am still quite happy with this change and am looking forward to fixing the rest of these issues.