Something blogged (on pkgsrcCon 2018)

pkgsrcCon 2018 badge

For this years pkgsrcCon, the baton was passed on to Pierre Pronchery & Thomas Merkel, location Berlin. It wasn’t clear whether I would be able to attend this year until the very last minute, booking plane tickets and accommodation a couple of days before. The day before I flew out was really hectic and I did not get any sleep. I left home around 1:30am and made my way to St Pancras for the train to the  airport as It was an early morning flight. Once we’d boarded the flight, I passed out without any recollection and came to just before we were going to descend.  With less than two hours sleep and plenty of time to spare until the evening social I slowly made my way from the airport to the city centre. I roamed the city centre looking at the street art and jumping on and off metro stations between Jannowitzbruke and Westkreuz.

In the evening I headed to the social event and met up with others.  I heard about the state of The Unleashed Operating System, the latest buzzword soup to add to current projects for instant success (block chain, AI and something else I forgot the to note down), debug work flow and lots of other things over food and drinks. I had taken my ThinkPad X60s alongside a 12″ iBook G4 to Berlin, with the plan to see if jdolecek with the machine in person could shed any light on a deadlock issue I experience when hammering the CPU with a kernel build while 2 or more CVS operations are in progress and to also get setup with Yubikey on NetBSD so I could commit from any machine with a USB port without having to copy my keys around to different machines.

On the first day of talks, between preparing slides, spz pointed out what I needed to get the Yubikey working with SSH on NetBSD. The current Yubikeys support multiple features (U2F, OTP, CCID). In order to use a Yubikey as a CCID device with pcscd, pcscd expects a ugen(4) device which doesn’t work on NetBSD because the USB keyboard driver ukbd(4) attaches to the Yubikey and prevents other modes of access. The workaround is to roll a new kernel with the device explicitly hard coded to use ugen(4). With that in place, I was able to checkout the developers source repo on the iBook. For the X60s, jdolecek rolled a fresh kernel with with the DIAGNOSTIC and LOCKDEBUG which we booted and reproduced the deadlock, unfortunately, there was no new information provided by these option, possibly indicating that it’s not a locking issue. A new kernel was rolled with an extra printf() which I tested with, however I couldn’t reproduce the issue with this change. Instead the CVS update just got slower and slower while the system operated normally (without deadlock). Unsure if it was the lack of bandwidth or a new behaviour, I gave up after several hours of the cvs update running. To rule out connectivity, my next plan is to test locally using a mirror of the repository using rsync and perform the CVS operations from that source instead.

I gave a talk titled “Something Old, Something New, Something Borrowed”. Something Old was about NetBSD/macppc, a homage to my first pkgsrcCon back in 2014 where I gave a short talk about pkgsrc on Tiger PowerPC with my 12″ PowerBook, Something New was about Upspin, Something Borrowed was about Minix3. Slides.

For coverage of the different talks and leot‘s experience in Berlin, see this blog post.

After a day of presentations we headed over to a restaurant where we chatted some more over dinner. While we waited for our food to arrive, we were given a demo of  the J programming language by Martin, he described J as a pocket calculator on drugs. I’d previously heard of the K programming language and its cryptic syntax but had not seen anything with such a minimal and cryptic syntax in action.

For the following morning, uwe gave a talk about the Forth programming language and experiences with it, especially with OpenFirmware which originates from Sun Microsystems and was also used by Apple on the PowerPC based Macs. The cool thing about OpenFirmware is that hardware can itself contain a driver for OpenFirmware which gets loaded when the device is initialised, making OpenFirmware aware of how to interact with the device without any manual loading of software by the operator.uwe mentioned NetBSD/ofppc which builds on that by having a kernel without drivers for on-board hardware, instead relying on OpenFirmware to communicate with devices instead. He also described how it is possible to learn about how a system works by using the ccommand in OpenFirmware to disassemble modules, though he warned that unfortunately this didn’t work so well on Macs as symbols had been stripped from OpenFirmware environment. There was lots of references to follow up material to read up on, from The Evolution of Forth paper to uwe‘s notes.

After lunch time, we packed up and headed to a computer museum. On the way we spoke about emacs and workflows like using M-x make-frame-on-display.

On the Monday, I met up with sborrillfor breakfast before heading to the spy museum and doing some sightseeing. I headed back to c-base where I met Pierre, Youri & Sebastian. As it approached the evening, It was time to make way to the airport again. I was back home by around 1am, Tuesday morning, so glad I went 🙂

21/07/18 10:20BST – There has been backlash from residents to stop Google from setting up a new campus in Kreuzberg, Berlin.

IBM ThinkPad X60s – Part 1 “headless brick”

IMG_2941.JPG

Since the announcement regarding the X60 series becoming certified by the FSF I’ve been interested in getting my hands on one. Not because of the political statement but I really wanted to play with coreboot on something other than my Alix which at the time previously had ended disasterously.
Luckily my regular used computer hardware pusher told me he had an X60s albeit with a broken screen which I could have. I decided to put off collecting it until I had managed to source a replacement screen cheaply so that there’s one less computer to move around with, come summer time there were “compatible” panels being advertised on ebay for between £40 to £80, I collected the ThinkPad & eventually ordered a panel listed specifically for the model ThinkPad I had (1704-GL5).
Once the panel had showed up, I began stripping the display assembly to swap LCD panels, fairly straight forward to do apart from the bits of tape which stick to the side frame & LCD panel. With the old panel out, I began trying to fit the new panel in the frame, the screw holes lined up though things were slightly off alignment, the cover still fitted so I continued.
I connected the panel to the motherboard via the ribbon & to make sure the display actually worked before tightening the screws I switched the laptop on. The fan on the laptop spunup and the moment when the display is meant to become active the system switched off. Subsequent boot attempts resulted in even short runs before switching off. The panel the seller had sent was not compatible with the ThinkPad & the pinout on the panel was completely different.
IMG_2943.JPG

I was pointed to the X60 fuse list & advised to check those fuses were ok. Stripping the board & checking the fuses with a multimeter for circuit continuity showed that fuse F5 had blown (responsible for the LCD inverter).
I was unsure of the state of the motherboard at this point and whether there was further damage caused to the board. As I had stripped the system to test the fuses, the CMOS battery had been disconnected which obviously caused BIOS settings to be reset. Not sure of which, but on the first power attempt after a reset the system either opts to run from the first connected display or the VGA out, either way the system completed post with an external monitor connected, pressing the hot key to switch to the LCD panel exhibited the previous behavior and the system switching off promptly.
I obtained a full refund for the LCD display from the seller & the replacement fuses were with me after a couple of weeks of shipping blunders from RS.

IMG_2989.JPG

I’d never attempted to do surface-mount re-soldering before, attempting to remove & re-solder components on a scrap circuit board didn’t go too well, not sure if it was the soldering iron I was using or the solder used on the components but I didn’t make any component move. Thanks to the kindness of a member of the Hackspace with experience who offered to help with the use of 2 soldering irons the fuse came off & they were able to replace it with a new fuse. The problem was fixed, the system was able to drive the original (broken) panel and complete post successfully.

IMG_2996.JPG

Returning to search on ebay, I sourced a complete display assembly for £21 which saved the hassle of trying to fit thing back again into the old assembly.
The system was fully functional once again & ready for playing with CoreBoot.

IMG_2998.JPG

System fails to boot with root on ZFS

I’d installed FreeBSD on my ThinkPad X61s when the head branch of the source tree was at 9-CURRENT, multi-booting it with Windows 7 & OpenBSD.
At the time I was not aware that it was possible to boot FreeBSD from a root file system on a ZFS volume from a disk partitioned using a MBR scheme. Instead, I opted to store /boot on a UFS filesystem.
This install existed for a couple of years, the ThinkPad got a roasting every once in a while to build a new release to install for updates. At some point support for 4K sectors in ZFS was improved, zpool status began to report degraded performance as the disk had been using 512byte sectors where in fact it could support 4K sized sectors.

Eventually, I deleted the existing slices in the FreeBSD partition & attempted to reinstall but found this time the system would not boot.
Booting from the install CD & issuing zpool import reported the new pool & old pool from the previous install.
Destroying a pool before deleting slices stopped this problem from re-occurring but the system still wouldn’t boot from a ZFS volume on a MBR partition.
The next step was to see if things would work if the whole disk was dedicated to FreeBSD, with a GPT partition scheme, things worked but switching to MBR, again, it failed to boot, hanging at a flashing cursor.
Over the next four months, many installs were attempted. On a MBR partitioned disk
FreeBSD failed to boot but PCBSD could by using GRUB.

I stopped trying any further at this point & took a break from it, one thing that had been raised at BSDCan was the possibility it could be lingering metadata, I’d thought as zpool(8) wasn’t reporting any existing pools when asked to import that this wasn’t the case. To give the benefit of a doubt, I ran dd on the disk with no difference in result.
This approach to clearing old pools seemed a little rough so over the weekend I looked into what other options are available.

The zpool(8) man page documents the labelclear option as

zpool labelclear [-f] device

Removes ZFS label information from the specified device. The device
must not be part of an active pool configuration.

-v Treat exported or foreign devices as inactive.

I still had the FreeBSD snapshot from the last attempt which I booted the X61s with, headed to the shell, deleted the existing partitions & issued
zpool labelclear -f /dev/ada0

Everything worked as intended after that.

Thanks to Allan Jude & everyone who chipped in at BSDCan.
Through the trial of getting this working Allan added the option to use a BSD partition scheme to the FreeBSD installer as well as MBR & GPT, which was previously unavailable.

More on the ThinkPad X61s

I came across a couple of bits of information which are useful if your looking to improve performance on your ThinkPad.
First thing is though the X61s is specced as a system only capable of running 4GB of RAM, it can in fact take up to 8GB using 2x 4GB PC2-5300 or 6400 sodimms, Its can be quiet an expensive upgrade but very useful if you’re taking advantage of the VT extension on your CPU.
Second thing is the ICH8M chipset actually supports SATA II at 3Gbps but is soft locked in the bios to 1.5Gbps, this is a big difference in terms of performance, there is lots of information/rants/flames regarding the matter as it seems other vendors implemented the same restriction (completely missed this), it appears that there is a negotiation problem between the ICH8M chipset & marvel PATA to SATA bridges, this post provides a good summary of the situation & what changes are required to a bios image, but theres no need to get your hands dirty, there are modified bios images available from a couple of sources, I used the image available on the same forum, there are images available for other ThinkPads too, covering the X300, T61, T61p, R61 & R61e.

dmesg snippet from FreeBSD 9.0 before

ahci0: port 0x1c30-0x1c37,0x1c24-0x1c27,0x1c28-0x1c2f,0x1c20-0x1c23,0x1c00-0x1c1f mem 0xf8426000-0xf84267ff irq 16 at device 31.2 on pci0
ahci0: attempting to allocate 1 MSI vectors (4 supported)
msi: routing MSI IRQ 258 to local APIC 0 vector 58
ahci0: using IRQ 258 for MSI
ahci0: AHCI v1.10 with 3 1.5Gbps ports, Port Multiplier not supported
ahci0: Caps: 64bit NCQ SNTF ALP AL CLO 1.5Gbps PMD SSC PSC 32cmd CCC 3ports
ahci0: Caps2:

& after

ahci0: port 0x1c30-0x1c37,0x1c24-0x1c27,0x1c28-0x1c2f,0x1c20-0x1c23,0x1c00-0x1c1f mem 0xf8426000-0xf84267ff irq 16 at device 31.2 on pci0
ahci0: attempting to allocate 1 MSI vectors (4 supported)
msi: routing MSI IRQ 258 to local APIC 0 vector 58
ahci0: using IRQ 258 for MSI
ahci0: AHCI v1.10 with 3 3Gbps ports, Port Multiplier not supported
ahci0: Caps: 64bit NCQ SNTF ALP AL CLO 3Gbps PMD SSC PSC 32cmd CCC 3ports
ahci0: Caps2:

My MacBookPro3,1 is also locked to 1.5Gbps but there doesn’t seem to be any solution at the moment due to the signed firmware images.

Intel ICH8-M AHCI:

Vendor: Intel
Product: ICH8-M AHCI
Link Speed: 1.5 Gigabit
Negotiated Link Speed: 1.5 Gigabit
Description: AHCI Version 1.10 Supported

ThinkPad X61s

I couldn’t justify spending £1400+ on a built to order MacBook Air with 4GB of RAM, I settled on what has turned out to be a mint condition X61s with 8 cell battery & still under warranty for £172.98.
I’m really pleased with it so far but it’s still no MacBook Air (I went into the Apple store to double check) 🙂
Though they’re both “ultraportable laptops” they both scratch a totally different itch for me, the macbook is a sleek, tightly integrated with Mac OS, the ThinkPad is an extendible machine which is far more accommodating to various operating systems.
The reason I was looking to move to an ultraportable was so I have something I can with me at all times (obviously) which was to replace my back breaking 17″ MacBook Pro with the ability to run multiple operating systems with ease.
I was able to successfully multi-boot MacOS, FreeBSD & OpenBSD on my MacBook Pro using the gtpsync tool from rEFIT but support for the hardware wasn’t great e.g as It had an nVidia graphics card there was no resume support on OpenBSD, power management didn’t really work under FreeBSD either If I remember right & having a single mouse button meant it was a pain to use X, having to use workarounds with the eject button on the keyboard to emulate right clicks.
The 11″ MacBook Air seemed like the perfect machine for me, but the whole sealed unit really grinds my gears, it’s not that I wanted to take a screw driver to it but I’d like to have the option to extend the system at a later date instead of having to decide on the system configuration which would be set in stone, requiring a new system if I wanted to expand, the ram being the most important thing, buy it with 4GB of ram or be stuck with 2GB. Though 2GB is fine for OS X alone, it really doesn’t cut it when you’re multi tasking with iChat, Terminal.app, iTunes, Thunderbird, Safari, Omniweb or Opera. These are the apps which are usually always open on my system & my 2007 Mac Mini really struggled with this work load with 2GB or RAM, grinding to a halt regularly as the system swapped furiously, moving to 3GB gave the machine a new lease of life & stopped this behaviour, I would hate to be in the same position with a new system so the BTO Air was the only option for me.
I would also be stuck with another nVidia based system if I went for the Macbook Air which means I would still have problems with sleep & X acceleration so the second hand Thinkpad X61s with the intel chipset was the way to go.
The machine is currently multi-booting OpenBSD-CURRENT, FreeBSD-CURRENT & OpenIndiana 148a development build quiet happily.
The system works a treat under OpenBSD, sleep support is still not there in FreeBSD 9.0-CURRENT but I suspect that may just be a bug in acpi_ibm(4). I was hoping to be running Schillix on this system but was unable to get the system to boot after install, I suspect a change in device paths between booting from the optical drive in the ultrabase & hard disk is the cause but didn’t look into it in-depth settling for OpenIndiana after trying Solaris 11 express (which freaked out after the rwn driver was installed) while I work through the DTrace book , though I’ve compiled in dtrace support for FreeBSD & it’s there out of the box on MacOS X most of the examples in the book don’t work as covered in the book on these platforms.

Hardware wise I ditched the supplied intel wireless card & installed a AzureWave AW-NE766 Ralink chipset wireless card. The ThinkPads check minipci-e & wireless usb devices against a device id whitelist in the bios & if not listed the system presents a “1802: Unauthorized network card is plugged in – Power off and remove the miniPCI card” error & refuses to boot. Reflashing the bios with a modified bios image by someone called Zender turns this off & allows the system to boot without any problems.

All in all a great system which is cheaper than a netbook, far superior in build & spec but inferior to a MacBook Air in some ways 🙂

OpenBSD 4.8 dmesg
FreeBSD 9.0-CURRENT dmesg