GeekLAN

27/02/2015

Virtualising retail Mac OS X images on OS X with virtualbox

Filed under: OS X — Tags: , , , — Venture37 @ 11:08 pm

For testing changes related to OS X in pkgsrc I revisited trying to get virtual machines of the various releases of OS X running to improve test coverage. At present I’m confined to testing on Tiger and Mavericks though I also have machines running Leopard and Lion but they need setting up.
By default, it’s not possible to boot an instance of Mac OS X from a genuine install image, on a Mac host, running OS X using virtualbox.
Searching around reveals using modified images intended for building Hackintosh as the solution most people use. Virtualbox supports OS X guests but when following the usual steps in the wizard to create a new VM & pointing it to your unmodified OS image, nothing much happens.
Depending on the version of OS X you’re trying to boot you’ll either end up with a XNU hang/panic or just dropped straight to an EFI prompt.
Again, depending on the version of OS X being attempted the issue differs. I’ve managed to install 10.7 to 10.10 successfully on virtualbox so far. 10.5 & 10.6 remain to be done.

10.7 – Lion

With the release of 10.7, Apple changed the way OS was packaged, the digital distribution came with a disk image named InstallESD.dmg nested inside an application named Install Mac OS X Lion.app. It’s possible to use this disk image with virtualbox as-is without change however the system will not boot from the image because it fails a test by the boot loader to ensure the image is being booted on a genuine Mac. In my case it is, but unfortunately the cpuid virtualbox presents to the operating system is not one that the OS recognise & so it fails.
The solution to this is to tell virtualbox to mask the cpuid of the guest, unfortunately depending on the version of hardware? or virtualbox that you’re using you may have to experiment with which ID works. I first tried the ID 00000001 000306a9 00020800 80000201 178bfbff listed in the post by BitTorrent engineering but it did not work on a Mid-2012 MacBookAir5,1 with VirtualBox 4.3.22 r98236.
Searching around I found the ID 1 000206a7 02100800 1fbae3bf bfebfbff to try in a comment on another guide which did work.

To create a working VM of Lion in virtual
1) Create a VM in virtualbox named something, type Mac OS X, version Mac OS X 10.7 Lion (64 bit).
2) Before booting the VM, switch to Terminal and change the cpuid of the guest by running
VBoxManage modifyvm something --cpuidset 1 000206a7 02100800 1fbae3bf bfebfbff
3) Right click on Install Mac OS X Lion.app, select “Show Package Contents” and navigate to Contents/SharedSupport. Copy InstallESD.dmg to a locate on your disk which is navigatable.
4) Start the VM & when asked for an install disk, point to the InstallESD.dmg which you copied out in the previous step. The system should boot without any need for further modification (most guides recommend other changes such as switching to a PIIX chipset).

10.8 – Mountain Lion and newer

With Montain Lion, InstallESD.dmg was changed once again, this time to contain multiple partitions (EFI, Boot/Rescue, Install), unfortunately it’s not possible to boot these images successfully as the notion of multiple partitions is not applicable to media such as optical so what happens is that the system is able to boot from the disk image & load the kernel but unable to continue to load the install environment.
What needs to happen is a new “flattened” image needs to be generated which is on a single partition & contains everything from the boot partition.
There is no need to modify any settings for the VM such as cpuid as previous or chipset as recommended by other guides like Engadgets

To flatten the image a tool called iESD is used.
iESD can either be installed via gem(1) or if you’re a pkgsrc user, I’ve created a WiP package.

The instruction in the Engadget guide pretty much covers everything needed. Just make sure that the disk images are fully detached before issuing the hdiutil commands, quickest way being to open Disk Utility.app, selecting mounted disk images & pressing eject or checkout the output of hdiutil info & using hdiutil detach $devicename to detach all device names associated with the disk images.

23/02/2015

A week of pkgsrc #7

Filed under: OS X — Tags: , , , , — Venture37 @ 9:10 pm

Time again to write up what’s been happening on the pkgsrc front since last time, this time the focus hasn’t been so much around pkgsrc on Darwin/PowerPC but more about pkgsrc in general & not necessarily code related.
At the end of the last post I mentioned a gentleman who’d been working on pkgsrc/Haiku and posting videos of his progress, I managed to make contact with him (James) & discussed his work that he’d been doing on pkgsrc. He sent me copy of the repo he’d be working off so I could assist with the aim of getting everything upstreamed as in the current state everything would need to be reintegrated per quarterly release rather than only having to pay attention if a new issue has arisen.
After getting the correct version of Haiku installed in virtualbox, I discovered a nasty bug in the Haiku network kit, it was unable to detect when the end of the file had been reached & would continue (restart?), this was revealed when I tried to download the pkgsrc tar ball from via WebPositive, ftp from the terminal was not affected however. pkgsrc bootstrapped unprivileged without issue. Hint: use the nightly snapshots until there is a newer release than Alpha 1 available.
The integration of pkgsrc into the user-land on Haiku is not currently possible due to the way the user-land is constructed, from what I understood, each Haiku package contains a piece of the filesystem, all the packages are union mounted to construct the user-land dynamically when the system comes up. That aside, with my system bootstrapped, I attempted to build Perl and ran into another bug, it seems that the library path for libperl is not populated on haiku hence perl is able to “build” but unable to run, the workaround for this in the tree I was given was to symlink libperl into ~/pkg/lib & move on. I tried various things but was unsuccessful, I believe the problem is pkgsrc specific as the version of Perl available in haikuports do not need any special treatment and the rpath is passed in correctly.
The problem was trying to isolate the required change to fix the problem, whereas in pkgsrc a policy file is passed to the build to set how Perl should be built, haikuports clobbers the source & patches in a replacement, I stopped at that point.

Haiku nightly running in virtualbox

At around about this time I received the good news about the NetBSD Foundation membership and commit bit so my focus moved to reading the various developer documentation & getting familiar with processes.

sevan.mit.edu finished a bulkbulid attempt of the entire tree which took the longest time so far to complete, through all the build attempts I uncovered a new bug, the range to use for numerical IDs of UID/GID, is not sufficient to cover all the packages in the tree that need to create an account. On further discussion with asau@, it was suggested the IDs are allocated randomly and should be fixed for consistency across builds. I started doing bulkbuilds of the entire tree on FreeBSD 10.1-RELEASE and stumbled across a very nasty bug. There is a version of tcsh package in the pkgsrc tree called shells/standalone-tcsh, this is tcsh built as a static binary & set to install to /bin (the only package in the pkgsrc tree which violates the rules and places files outside of $PREFIX by default?), this ended up overwriting the system bundled version of tcsh in FreeBSD & then deleting /bin/tcsh when the package is removed, this was fixed promptly by dholland@. It was also discovered that Python’s configure script had not been changed when FreeBSD switched to elf binaries and so still trimmed the name of libraries to account for the old linker which could not handle a minor version in a libraries filename (libpython.so.1, not libpython.so.1.0). All versions of Python had been patched in the pkgsrc tree to remove this change so that it used a consistent naming convention across all platforms. After discussing this with bapt@ (FreeBSD) at FOSDEM, it turned out to be bug and should be fixed in future Python versions once the fixes are upstreamed.

Koobs@ (FreeBSD) dug out the commit which introduced the change & the bug report.

The opportunity to join the pkg-security team came up & for the past few weeks I’ve been getting familiar with the processes of dealing with security advisories & listing them so that users who fetch the pkg-vulnerabilities database are notified if they have any vulnerable packages installed. The general advisory process is a little infuriating, based on my recent experience I’d say at the top of my list are the Oracle security advisories as they do not divulge any details other than “unknown” in version(s) X, PHP for the frequency, OpenSSL for the impact. On the one hand I was quite impressed that CVE IDs were becoming so familiar that I could spot, on the fly, an advisory that had been accounted for, but on the other hand quite upset that I was using brain capacity on this. The availability of information is quite frustrating too, issues which are assigned an ID but cannot by checked on Mitre’s site take extra effort to find the necessary information to include (Mitre are responsible for allocating the CVEs!), I should note that this is from public advisories, say from a distribution. Example, CVE-2015-0240 was announced today, the Redhat security team published a blog post covering the issue, the Mitre site at present says:
“** RESERVED ** This candidate has been reserved by an organisation or individual that will use it when announcing a new security problem. When the candidate has been publicised, the details for this candidate will be provided.”
The wording & the lack of information can also be frustrating because it’s not clear what is affected. Looking at it positively, the requirement for clarification on these discrepancies means I get lots of opportunities to approach new people in different communities to ask questions.

I created a new wiki article on the NetBSD wiki to start documenting the bootstrap process of pkgsrc on Solarish, Illumos based distributions. At present the article covers what’s required to bootstrap successfully on OmniOS, Tribblix, OpenIndiana and OpenSXCE.

One thing that’s clearly evident is my workflow needs attention, at the moment things are very clumsy, involving lots of switching around but hopefully that will be addressed in the coming month. The first thing I’ve down is setup templates for emails with the correct preferences specified so that I just need to fill the necessary information & hit send, the necessary settings are automatically applied. Still thinking about how to deal with the scenario where the system that work is being carried out on is different to the system where the patch is going to be committed from, this also happens to be a different system which a developer is using. How to deal with that in as few steps from reading, say a bug report, to generating a patch, testing it & committing a fix.

For testing patches on Mac OS X, I revisited running OS X as guest on a Mac running OS X with virtualbox. Attempts in the past had not been successful & it seemed from search results that the only approach taken was to use modified OS images for hackintosh which I did not want to take. I have a genuine machine & genuine license, I shouldn’t have to resort to 3rd party images to run this. After whinging on twitter & referencing some older links I was able to successfully virtualise Mac OS X 10.7 to 10.10 in virtualbox. Will follow up with the details on that in a separate post.

OS X Lion as a virtualbox guest

20/01/2015

NeXTstation Turbo Color

Filed under: NeXT/OPEN/GNUSTEP — Tags: , , , — Venture37 @ 11:32 am

NeXTstation Color
After many years of trying to get my hands on a NeXT machine, I finally received a turbo color slab as a gift from Joshua Elasser of the OpenBSD project last week. The machine with eventually made its way to my from Portland, OR after a lengthy delay at the customs here. The machine didn’t work out of the box, first I needed to find a sync on green LCD which the Dell UltraSharp 1901FPs could, then I discovered the system was net booting despite having a 4GB ST15150N SCSI disk installed. Following the manual I re-jumpered the disk to set it to delay start which fixed the issue. The system was running OPENSTEP which was configured to be connected to other machines on a private network which caused delays booting as the daemons waited to time out. Following the Apple KB article I entered the boot prom & boot the system in single user mode to reset the root password thanks to a post on the nextcomputers forum . The system has 32MB RAM (expandable to 128MB), according to /etc/hostconfig is called murphy and the keyboard is tagged “Fuller Brush CO.”. The Config.app is broken on the system so not sure as to wipe it & restart or just replace the affected binaries. I’d like to get my hands on a daydream rom box which’ll allow me to run classic Mac OS natively on this machine, there are plans on next computers to build one from scratch & progress is being slowly made.

Fuller

NeXT Mouse

A new addition to NetBSD.org

Filed under: NetBSD — Tags: , — Venture37 @ 11:00 am

Last Friday I received an invitation of membership by wiz@ to the NetBSD foundation and commit privileges to the project.
I’ll be working with my mentors Benny Siegert & Thomas Klausner on pkgsrc.

My first commit is sevan AT NetBSD DOT org.

NetBSD Membership offer

Update 20/1/2015
My first bug closed

07/01/2015

A week of pkgsrc #6

Filed under: OS X — Tags: , , — Venture37 @ 6:32 pm

Since the last post I’ve made some further progress with pkgsrc on Darwin/PowerPC again, the biggest achievement was fixing lang/ruby19-base, lang/ruby200-base and lang/ruby21-base which accounted for the breakage of some 1500 packages (variation of 500 or so modules for each version of Ruby). This was caused by the failure to build the DBM module, which on OS X required the inclusion of dbm.h as well as ndbm.h otherwise all tests fail and the module is not built. The frustrating thing is that there appears to be no documentation for the build process of Ruby, luckily, by Ruby 2.0 there was a comment added to ext/db/extconf.rb to shed some light on the issue:
# Berkeley DB's ndbm.h (since 1.85 at least) defines DBM_SUFFIX.
# Note that _DB_H_ is not defined on Mac OS X because
# it uses Berkeley DB 1 but ndbm.h doesn't include db.h.

pkg/49508 was committed prior to the 2014Q4 pkgsrc release but
pkg/49511 and pkg/49512 did not.

cross/h8300-hms-gcc, databases/java-tokyocabinet devel/py-argh lang/smalltalk net/ser include some additional files which weren’t accounted for previously pkg/49473 & pkg/49474 pkg/49476 pkg/49478 pkg/49496 pkg/49498 fixed that.

devel/commit-patch used the -a flag for cp(1) which isn’t available on older operating systems, pkg/49475 switched to the use of -pPR instead (which -a is an alias of).

graphics/ivtools failed to build successfully due to a packing issue due to the explicit specification of operating system in the name of one of the generated files. pkg/49497 switched the use of the LOWER_OPSYS & added missing item which addressed the issue.

security/CSP failed at the installation stage due to the target directory not existing, pkg/49499 fixed that.

mail/nullmailer referenced uid_t & guid_t but did not include sys/types.h, pkg/49523 fixed that.

net/dnsmasq referenced SIOCGIFAFLAG_IN6, IN6_IFF_TENTATIVE, IN6_IFF_DEPRECATED & SIOCGIFALIFETIME_IN6 but did not include netinet6/in6_var.h when building on OS X which broke the build. pkg/49524 fixed that.

lang/lua52 failed to build on Tiger due to sys/types.h, pkg/49526 fixed that.

lang/php55 bundles its own version of sqlite and requires the necessary flags to disable features not available pkg/49527 fixed that but the correct fix is to not build an entire new version solely for PHP’s use. I began to look but had flashbacks of dealing with the same issue in TCL.

For graphics/MesaLib I looked to build it using a newer version of binutils but it appears that support for Darwin/OS X/iOS and Mach-o is rudimentary and hence missing support in most of the tools. Support began being added upstream to binutils back in 2011 but is still not complete.

For devel/cmake supports the ability to specify the location of library & header files, this can be done by creating a file which includes the necessary declaration that is passed to the configuration process using the --init flag. Indeed when the configuration process displayed the correct versions of OpenSSL, CURL, Zlib, BZip among others from pkgsrc rather than the older system bundled versions, unfortunately the build still failed when it came to the linking stage as the paths to the libraries was prefixed with /Developer/SDKs/MacOSX10.4u.sdk, as a kludge just to progress with the builds, I symlinked /usr/pkg to /Developer/SDKs/MacOSX10.4u.sdk/usr, the build then succeeded without issue. Next task is to work out how to drop the /Developer/SDKs/MacOSX10.4u.sdk prefix correctly.

There are currently 11132 packages available on sevan.mit.edu for Mac OS X/PowerPC with a new bulkbuild of the entire tree in progress. There are also Intel builds of the entire tree being attempted by Save OS X (64-bit packages) and Jonathan Perkin (32-bit packages) which should further improve support for OS X in pkgsrc.

Whilst browsing I discovered a series of videos on youtube by DisneyDumbazz, he has also been covering his work on improving support for Haiku in pkgsrc at length.
He was also struggling with issue in Ruby, QT4 & Mesa it seems.

30/11/2014

A week of pkgsrc #5

Filed under: OS X — Tags: , , — Venture37 @ 6:33 pm

Definitely more than a week, I’ve not had a chance to devote much time to this over the past few months due but have made sufficient progress to qualify another post.
The most import thing is apart from one PR, all previously submitted patches have now been committed to pkgsrc-current, pkg/49082 still remains.

With the introduction of GCC 4.9, the same changes needed to be applied to lang/gcc49 as with previous versions, pkg/49178 took care of that, however this highlighted another problem. 32bit & 64bit hosts running Darwin both identify themselves as powerpc in the uname(1) output which means that GCC is always built with multilib support disabled, even when building on a 64bit host.

The pkgsrc guide pdf now has the correct date since pkg/49216, previously it reported 18/09/2007.

Some of the cross compilation tools for micro controllers were hardcoded to use ksh to build with when in fact it was only required for NetBSD >= 5, this caused the build to break on Tiger (assuming because of the old version of bundled ksh), pkg/49311 fixed that for cross/binutils but the changes were also applied to cross/freemint-binutils and devel/binutils by the maintainer.

cross/avr-libc was previously broken because it was using the system compiler & headers instead of avr-gcc and the headers installed in pkgsrc during builds. pkg/49316 fixed this issue and upgraded the version to v1.81 of avr-libc.

It’s no longer a requirement to declare the MACOSX_DEPLOYMENT_TARGET environment variable to build lang/perl5. By default Perl declares this to be 10.3 which is no longer applicable on modern systems and when building with clang mmacosx-version-min is specified, making it redundant. This had been removed in pkgsrc via a patch and it broke the build for GCC users as without this variable the target defaults to 10.1 and Perl needs specific attention for versions prior to Panther. pkg/49349 added this variable back in for Darwin 9 and prior which were GCC only releases. Bug #117433 in the Perl RT was the source of the patch proposed to resolve the issue.

lang/ocaml now builds on Tiger, the workaround for the lack of support for -no_compact_unwind in the shipped linker was applicable to prior releases and not just specifically Leopard, pkg/49417 fixed that.

devel/py-py2app previously failed to build on PowerPC OS X due to an error in the PLIST, the use of the MACHINE_ARCH variable would expand to powerpc which raised a packing error. pkg/49418 fixed that.

graphics/MesaLib and devel/cmake still remain broken in the pkgsrc tree for Darwin PowerPC, I was able to generate a MesaLib package successfully by forcing static binaries which allowed the previously unattempted packages to be tried in a bulk build of the entire tree. Unfortunately I hadn’t caught a merge conflict from when pkg/49077 was committed and so devel/icu was not built, this caused a another large subset of packages to not be built.

Thanks to the pointer from Jonathan Perkin, after I’d resolved the merge conflict I removed the entry in /mnt/bulklog/meta/error and ran bulkbuild-restart to re-attempt building devel/icu & those which depended on it.

With these changes, there were over 10000 packages available on sevan.mit.edu but unfortunately that included lots of duplicate packages from previous bulk builds. pkgtools/pkglint has the ability to scan packages against a pkgsrc tree & remove duplicate/stale packages. Running lintpkgsrc -K /mnt/packages -pr took the number of packages down to 9200. There is an AWK based solution but I’ve not had a chance to try it.

I was able to get devel/cmake to build successfully by removing the references to /Developer/SDKs in Modules/Platform/Darwin.cmake and subsequently build packages such as databases/mysql56-client but I’ve not added the changes to the tree yet. Will look to add this in a future bulk build, I want to get MesaLib linking correctly first before adding more kludges into the mix. The next thing I want to try is using a newer version of linker from devel/binutils instead of the one bundled with Xcode.

07/11/2014

IBM ThinkPad X60s – Part 1 “headless brick”

Filed under: General — Tags: , — Venture37 @ 11:20 am

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

02/11/2014

Restrictions on Apple hardware

Filed under: OS X — Tags: , , — Venture37 @ 4:58 pm

I was recently looking for a link I thought I’d bookmarked on how to install recent versions of Mac OS X on EoL Apple hardware, specifically the Mac Pro. I was unsuccessful in finding the link I was looking for but I did find that  you can re-flash a MacPro1,1 with a MacPro2,1 EFI firmware, main benefit being microcode updates. Turns out the hardware in the first & second generation Mac Pro is identical bar the model of CPU available. There’s also modified images to bring the MacPro4,1 to 5,1 which seems to provide much more benefit than the previously mentioned modification.

This got me thinking about some of the issues I’d experienced with older apple hardware and the work arounds, it has been a while since I’ve posted something here so I wrote this post.

On the old world SCSI Macs (pre biege G3?) the drive vendor on the disk firmware with be identified as Apple which the Drive Setup utility (predecessor of Disk Utility) would look for, if it was not found, you would not be able to format your drive as HFS and hence be unable to install Mac OS. Work around was either finding another platform to format the disk or modify a copy of Drive Setup utility with ResEdit & add the drive to the necessary table.

The first of blue & white PowerMac G3 systems logic board shipped with a buggy CMD IDE controller which would corrupt data when doing DMA transfer, Apple shipped the disks in these systems with the firmware tied to PIO mode which was lots of fun when you came to replace the disk with a newer/bigger/faster one. To complete the replacement successfully, the new disk with need to be connected to a PC first & using the firmware utility provided by the vendor, make the same change of restricting the disks operation mode to PIO, otherwise it would not be possible to rely on the disk as data would be corrupted as you began writing to it, there was a recall for the motherboard If you were aware of the issue at the time.

The Mid/Late 2007 MacBook Pro (per advisory?) has the SATA port on the ICH8-M south bridge locked to SATA I even though it is capable of SATA II.

Most systems with user replaceable RAM are capable of taking more than official specification documents list. MacTracker – an application which lists specs & information about Apple hardware provides advertised & actual maximum memory capabilities of system. Not so much a software based restriction but a documentation one.

25/08/2014

A week of pkgsrc #4

Filed under: OS X — Tags: , , , — Venture37 @ 5:54 pm

AnyConnect login banner

Shortly after the last blog post I had access to a couple of AIX LPAR. This would be my first time on a IBM PowerPC system and AIX, I’d applied for two AIX 7.1 instances, one defined as “AIX 7.1 Porting Image” and the other as plain “AIX 7.1″. The difference at a glance seemed to be the porting image had more gnu / common open source tools e.g GNU/Tar though both images had a version of GCC installed.

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/bin/../libexec/gcc/powerpc-ibm-aix7.1.0.0/4.6.0/lto-wrapper
Target: powerpc-ibm-aix7.1.0.0
Configured with: ./configure --disable-multilib --with-cpu=powerpc --enable-debug=no --with-debug=no --without-gnu-ld --with-ld=/usr/bin/ld --with-pic --enable-threads=aix --with-mpfr=/opt/freeware/lib --with-gmp=/opt/freeware/lib --with-system-zlib=/opt/freeware/lib --with-mpc=/opt/freeware/lib --with-mpicc=mpcc_r --with-libiconv-prefix=/usr --disable-nls --prefix=/software/gnu_c/bin --enable-languages=c,c++
Thread model: aix
gcc version 4.6.0 (GCC)

The stock version came with GCC 4.2 built on AIX 6.1 whereas the porting image came with GCC 4.6.
Alongside the open source tools each instance also had proprietary tools installed including IBM’s compiler XLC, cc without any options invokes a man page which describes the different commands that represent a language at a level.

c99 – Invokes the compiler for C source files, with a default language level of STDC99 and specifies compiler option -qansialias (to allow type-based aliasing). Use this invocation for strict conformance to the ISO/IEC 9899:1999 standard..

The pkgsrc bootstrap process didn’t work too well by trying to allow it to workout things out for itself via cc so opted to use GCC specifically.

export CC=gcc

pkgsrc happily bootstrapped without privilege and I proceeded to install misc/tmux and shells/pdksh on AIX.

pkgsrc pkg_info on AIX

security/openssl comes with 4 different configuration settings for AIX, a pair of settings for the XLC & GCC compilers with a 32bit or 64bit target. It turned out that in pkgsrc it just defaulted to aix-cc (XLC with a 32bit target), pkg/49131 is now committed so the correct configuration is used, XLC successfully builds OpenSSL with a 32bit or 64bit ABI but GCC is only able to manage a 32bit target.

To switch compiler to xlc, declare it as the value to PKGSRC_COMPILER in your mk.conf.

Over the week I attempted to compile components of GCC 4.8 without much success, starting off with lang/gcc48-cc++ & falling back to lang/gcc48-libs.
The build process was very unstable, again as with the Tiger/PowerPC, the build would spin off & hang, pegging the CPU until killed. Attempting to restrict the processor time via ulimit didn’t have much effect.

Alongside trying to get GCC built on AIX, I kicked off building meta-pkgs/bulk-medium on sevan.mit.edu, the previously reported unfixed components prevented some of the packages from building again (ruby, MesaLib, cmake).

I began looking into fixing devel/cmake so that it would link against the correct version of curl libraries & use the matching header files, Modules/FindCURL.cmake in the cmake source references 4 variables which provide some control but I was unsuccessful in being able to pass these to the pkgsrc make process. While trying to resolve this issue I also discovered that on more recent version of Mac OS, the dependencies from pkgsrc ignored, opting for the use of the Apple supplied versions even though the pkgsrc version would be installed.

-- Found ZLIB: /usr/lib/libz.dylib (found version "1.2.5")
-- Found CURL: /usr/lib/libcurl.dylib (found version "7.30.0")
-- Found BZip2: /usr/lib/libbz2.dylib (found version "1.0.6")
-- Looking for BZ2_bzCompressInit in /usr/lib/libbz2.dylib
-- Looking for BZ2_bzCompressInit in /usr/lib/libbz2.dylib - found
-- Found LibArchive: /usr/lib/libarchive.dylib (found version "2.8.4")
-- Found EXPAT: /usr/lib/libexpat.dylib (found version "2.0.1")
-- Looking for wsyncup in /usr/lib/libcurses.dylib
-- Looking for wsyncup in /usr/lib/libcurses.dylib - found
-- Looking for cbreak in /usr/lib/libncurses.dylib
-- Looking for cbreak in /usr/lib/libncurses.dylib - found

mail/mailman had a missing README in PLIST which was handled differently between Tiger & newer releases. pkg/49143 was committed to fix that.

19/08/2014

A week of pkgsrc #3

Filed under: OS X — Tags: , , — Venture37 @ 5:25 pm

Didn’t uncover anything new in pkgsrc last week as my attention was more on coreboot, I had previously been building different parts of the tree on a couple of Mac’s which where disconnected from each other & copying packages to sevan.mit.edu manually for serving, as a first off this was a good idea but bad as an ongoing thing. What ends up happening is stale packages become left behind as they are unaccounted for, luckily there aren’t too many duplicates currently but it’s something which needs to be addressed in the set of packages currently available.

There is now a page on the NetBSD wiki to keep note of issues & ideas.

To test the status of AIX support in pkgsrc I joined the IBM Power Developer Platform which provides access to Power7/7+/8 systems running AIX 6.1 & 7.1 to build software on. This’ll be my first time on a Power system & AIX, looking forward to seeing what the OS is like.

System reservation on IBM PDP

With the addition of a G5 iMac to the effort kindly donated again by Thomas Brand, I started testing builds of lang/gcc48 on sevang5.mit.edu. Next step will be to get the two systems at MIT working together to build packages once I’ve been able to get GCC 4.8 to build successfully.

11/08/2014

A week of pkgsrc #2

Filed under: OS X — Tags: , , — Venture37 @ 4:19 pm

Following on from last week, I worked on components which caused large numbers of packages not to build.
textproc/icu failed to build due to localtime_r() not being used if either _ANSI_SOURCE or _POSIX_C_SOURCE is defined & using an opcode that the shipped version of assembler didn’t understand. Ticket #9367 provided fixes for both issues spanning over 2 years, pkg/49077 covers this but has not been committed.
databases/sqlite3 failed to link with ld: Undefined symbols: _OSAtomicCompareAndSwapPtrBarrier error, this is due to the lack of zone memory allocator, PR #49081 fixed this issue by defining -DSQLITE_WITHOUT_ZONEMALLOC for OS X releases prior to Leopard. This is PR was committed. A subsequent PR (pkg/49082) was raised to do the same for lang/tcl which also bundles its own copy of sqlite3 for its sqlite module, but has not been committed.

devel/pango was broken on OS X releases prior to Leopard as the package enabled the CoreText option by default but failed due to packing errors  (CoreText is not available hence the .la file not existing when build has completed). pkg/49090 resolved the issue & was committed.

Packages for GCC 4.4 to 4.6 are now available, lang/gcc47 failed to build successfully with sh consumed all resources on a CPU before being terminated manually.

sh(22232) malloc: *** error for object 0x34e340: incorrect checksum for freed object - object was probably modified after being freed, break at szone_error to debug
sh(22232) malloc: *** set a breakpoint in szone_error to debug
sh(22232) malloc: *** Deallocation of a pointer not malloced: 0x34d7ab; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable MallocHelp to see tools to help debug
sh(22232) malloc: *** Deallocation of a pointer not malloced: 0x34e340; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable MallocHelp to see tools to help debug
checking sys/time.h usability... Makefile:16170: recipe for target 'configure-stage2-target-libgomp' failed
gmake[2]: *** [configure-stage2-target-libgomp] Error 137

This behaviour has previously been observed when attempting to build GCC on the PowerBook

The stability of sevan.mit.edu was improved by re-applying the 10.4.11 combo update.

Currently in the process of fixing devel/cmake, cmake now get through most of the build (it was previously failed at 3%) but fails at the linking stage due to path issues. It picks up the pkgsrc version of CURL as /usr/pkg/bin/curl but tries to link against libraries in /Developer/SDKs/MacOSX10.4u.sdk/usr/pkg/lib which doesn’t exist.

The TenFourFox blog mentioned the effort thanks to Cameron Kaiser of Floodgap.

10/08/2014

coreboot on PC Engines Alix 2c3

Filed under: General — Tags: , — Venture37 @ 12:29 am

IMG_2883.JPG
I’ve been following coreboot (formally LinuxBIOS) for quite a while but my last attempt to run it ended disastrously a couple of years back on the defunct coreboot 3 branch, requiring an RMA for a new Alix 2c3 board & the purchase of additional tools.
A ThinkPad X60s was offered up by my friendly local “old computer” pusher which I chose to try coreboot on but before I bricked that, I thought I’d try the Alix again as I was in possession of the everything needed to debug or recover the board if things went wrong.
A lot of time was wasted trying to get things built on OS X & diverged into briefly trying CentOS 7 (systemd, run away) before settling on Debian 7.6 to build on.

Running apt-get install gcc make libncurses-dev doxygen iasl gdb flex bison will install the necessary dependencies to build coreboot on Debian following the build guide.

Selecting a board from the menu should set the ROM size as well but I was advised to double check, on the Alix 2c3 the flash chip is located under the board, my board had a AMIC A49LF040ATY-33F.
IMG_2891

Once the image was built, coreboot.rom was copied to the Alix running FreeBSD/i386 10-RELEASE & flashed with sysutils/flashrom built from ports.
Flashrom currently assumes that there’s a device node named /dev/cpu0 and sysutils/devcpu-data offers the necessary device but on FreeBSD it’s named /dev/cpuctl0, a symlink allows you to work around the hardcoded assumption once the micro_code service has been started.

service micro_code onestart
ln -s /dev/cpuctl0 /dev/cpu0

coreboot can then be programmed with flashrom -p internal:laptop=this_is_not_a_laptop -w ~/coreboot.rom

flashrom v0.9.7-r1711 on FreeBSD 10.0-RELEASE-p7 (i386)
flashrom is free software, get the source code at http://www.flashrom.org

Calibrating delay loop… delay loop is unreliable, trying to continue OK.
========================================================================
WARNING! You may be running flashrom on an unsupported laptop. We could
not detect this for sure because your vendor has not setup the SMBIOS
tables correctly. You can enforce execution by adding
‘-p internal:laptop=this_is_not_a_laptop’ to the command line, but
please read the following warning if you are not sure.

Laptops, notebooks and netbooks are difficult to support and we
recommend to use the vendor flashing utility. The embedded controller
(EC) in these machines often interacts badly with flashing.
See the manpage and http://www.flashrom.org/Laptops for details.

If flash is shared with the EC, erase is guaranteed to brick your laptop
and write may brick your laptop.
Read and probe may irritate your EC and cause fan failure, backlight
failure and sudden poweroff.
You have been warned.
========================================================================
Proceeding anyway because user forced us to.
Found chipset “AMD CS5536″. Enabling flash write… OK.
Warning: unexpected second chipset match: “AMD CS5536″
ignoring, please report lspci and board URL to flashrom@flashrom.org
with ‘CHIPSET: your board name’ in the subject line.
Found AMIC flash chip “A49LF040A” (512 kB, LPC) at physical address 0xfff80000.
Reading old flash chip contents… done.
Erasing and writing flash chip… Erase/write done.
Verifying flash… VERIFIED.

Power cycling the box will result in text output or garbage depending on if your console speed settings have changed or not, coreboot defaults to the speed of 115200bps, the factory default speed of Alix is 38400bps & the default console speed of FreeBSD is 9600bps.

When attempting to generate a new image with different settings be sure to make clean before starting.
In my image I removed the “PS/2 keyboard init” option from the “Generic Drivers” menu. Still todo is building an image with PXE support, test booting other BSD’s, try different payloads, in particular Open Firmware & generate status data for submission to change board support status on wiki.

IMG_2886.JPG

Through the previously failed attempt to run coreboot 3 I ended up with a LPC.1a & a POST.5a mini-pci board, the LPC.1a is absolutely essential for testing if you do not have more advanced equipment which would allow you to re-program the flash chip. The LPC.1a is a secondary BIOS chip which can override the onboard the flash, allowing you to boot the system & reprogram the onboard chip again. J2 jumper allows you to select which chip to boot from. When reflashing the chip on the motherboard with flashrom with the LPC.1a inserted (and set to read only), flashrom trashed the image on the onboard chip. Rebooting the system & carefully removing the LPC.1a before re-flashing allowed the process to complete successfully.

05/08/2014

Issuing secure erase ATA command using camcontrol(8)

Filed under: FreeBSD — Tags: , , — Venture37 @ 1:28 am

The ATA command set has a command to instruct a device to secure erase itself.
Depending on the application & level of sensitivity of the data on disk, it can be a convenient way to decommission a disk or reset an SSD to regain performance. On FreeBSD this can be issued using camcontrol(8).

The command below performs an enhanced erase with a timeout of 60 seconds for the command to be accepted by the disk, this is needed if you get timeout errors when you do not specify it.
camcontrol security ada0 -U user -s Erase -h Erase -T 60

04/08/2014

A week of pkgsrc #1

Filed under: OS X — Tags: , , — Venture37 @ 6:50 pm

This is summary of the things I worked on along with the help of others over the last week on pkgsrc.
With the donation of sevan.mit.edu along with a G4 Mac Mini at pksrcCon 2014 I setup bulk package builds as per chapter 7 of the pkgsrc guide to generate packages for OS X.
The bootstrap process is now able to differentiate between gcc & clang, as clang tries to be GCC compatible it tries to pass itself as GCC in tests, this would cause an issue where the bootstrap would use /usr/bin/clang for some parts of the build & /usr/bin/gcc for others, on top of that, the bootstrap process was hardcoded to use gcc on Darwin. The bootstrap process now defaults to using cc & correctly detects if that is clang or gcc.

By default git attempts to use the Apple CommonCrypto framework which meant it would only build successfully on Leopard or newer, devel/git-base now links against openssl instead which means it’s consistent with other platforms using pkgsrc as well as being able to build on older releases of Mac OS X. Unprivileged builds of this are still currently broken on Tiger as tar tries to set the group ownership of files to wheel, a patch to fix the issue is awaiting to be committed.

security/sudo now builds on Darwin (confirmed on Tiger PowerPC & Mavericks), the no_exec module doesn’t build on Darwin & is switched off in the Apple supplied build of sudo, this wasn’t switched off in pkgsrc & caused the build to fail. There are more options set in the Apple build to improve posture which are not set in pkgsrc version, that needs looking into further & is on the TODO list.

The new release of help2man committed last week broke on Tiger due to NLS being switched off & the new version introducing additional translations of info pages. The patch in pkg/49059 fixes things so shared libraries are taken care of as with Leopard & the package is built with NLS support.

Currently working on trying to get graphics/MesaLib building with XQuartz, the version shipped with Tiger is based on XFree86 & MesaLib fails to link libraries, macports seem to have some fixes related to building on Tiger which I’m hoping may fix some of the issues.

Will also be looking at devel/cmake as it’s currently broken on Tiger which means things such as mysql server cannot be built at the moment.

Through the existence of a directory called devel in /tmp which was owned by a user other than the the one pbulk runs under, some critical components such as autoconf & tradcpp did not build on the Mac Mini, this caused many builds to fail, that aside, the Mini has managed to build 1064 out of a queue of 2083 packages over the last week.
sevan.mit.edu is currently down (due to possible hardware issues) & awaiting a reboot.

02/08/2014

Packages for PowerPC Mac OS X with pkgsrc

Filed under: OS X — Tags: , , — Venture37 @ 5:33 pm

In pkgsrc there’s a facility which allows you to perform bulk builds of packages called pbulk.
Using this facility on a couple of donated systems I have started to generate packages for PowerPC OS X. Currently builds are performed on 32bit PowerPC Macs running OS X with pkgsrc-current. The binaries should in theory work on 64bit PowerPC systems and on Leopard but have not tested to confirm.
The packages are made available at sevan.mit.edu.
To utilise the packages on your system, fetch & uncompress the bootstrap archive which contains the pkgsrc tools.
curl -s http://sevan.mit.edu/packages/bootstrap.tar.gz | sudo tar -zxpf - -C /

Update your PATH & MANPATH variables
PATH=/usr/pkg/sbin:/usr/pkg/bin:$PATH
On Tiger
MANPATH=/usr/pkg/man can be declared in /usr/share/misc/man.conf
On Leopard use path_helper(8) and create a file in /etc/manpaths.d which just contains /usr/pkg/man.
This can also be extended to PATH by creating a file in /etc/paths.d/ containing one path element per line. This requires testing however as the impact is system wide.

Set PKG_PATH to http://sevan.mit.edu/packages/All/

Packages can then be installed using the pkg_add command, for example to install wget
pkg_add wget

This service is very much in its infancy & not stable yet, the current offering of packages is small but more packages are building on a daily basis albeit very slowly due to the age of the hardware.

If you’re interested in pkgsrc on Intel Macs try the Save OS X blog and Joyent packages which offer packages for Ilumos derivatives, Linux as well as OS X on Intel hardware.

Thanks to the generosity of David Brownlee, Thomas Brand & Justin Cormack for their generous donation of hardware.

31/07/2014

Using ifstated to monitor links and dynamically adjust PF config on event

Filed under: OpenBSD — Tags: , , — Venture37 @ 11:30 am

It’s possible to misuse NAT to load balance outbound traffic across multiple internet connections from different service providers,see the Load Balance Outgoing Traffic section of PF FAQ.
The shortfall with this configuration is when implemented alongside unstable links, forwarding will continue to be attempted over the links which are down, this will cause issues such as long hangs for users behind the NAT while connections time out. To mitigate this, ifstated can be used to smooth things over.
ifstated can be used to run tests & on event perform tasks, if you’re familiar with Cisco IOS, this is similar to some of what is available in EEM. In this scenario, ifstated will be set to ping each gateway at the service provider end of each link every 10 seconds & upon failure, adapt the configuration so traffic is not forwarded down that link. ifstated will continue to perform the tests & when tests start passing because link has re-established successfully, ifstated will reconfigure the system again so links are utilised.

For this post we’ll use the example ruleset from the PF FAQ and adapt it so it can be manipulated by ifstated.

Original pf.conf

lan_net = "192.168.0.0/24"
int_if = "dc0"
ext_if1 = "fxp0"
ext_if2 = "fxp1"
ext_gw1 = "198.51.100.100"
ext_gw2 = "203.0.113.200"

# nat outgoing connections on each internet interface
match out on $ext_if1 from $lan_net nat-to ($ext_if1)
match out on $ext_if2 from $lan_net nat-to ($ext_if2)

# default deny
block in
block out

# pass all outgoing packets on internal interface
pass out on $int_if to $lan_net
# pass in quick any packets destined for the gateway itself
pass in quick on $int_if from $lan_net to $int_if
# load balance outgoing traffic from internal network.
pass in on $int_if from $lan_net \
route-to { ($ext_if1 $ext_gw1), ($ext_if2 $ext_gw2) } \
round-robin
# keep https traffic on a single connection; some web applications,
# especially "secure" ones, don't allow it to change mid-session
pass in on $int_if proto tcp from $lan_net to port https \
route-to ($ext_if1 $ext_gw1)

# general "pass out" rules for external interfaces
pass out on $ext_if1
pass out on $ext_if2

# route packets from any IPs on $ext_if1 to $ext_gw1 and the same for
# $ext_if2 and $ext_gw2
pass out on $ext_if1 from $ext_if2 route-to ($ext_if2 $ext_gw2)
pass out on $ext_if2 from $ext_if1 route-to ($ext_if1 $ext_gw1)

Modified pf.conf

lan_net = "192.168.0.0/24"
int_if = "dc0"
ext_if1 = "fxp0"
ext_if2 = "fxp1"
ext_gw1 = "198.51.100.100"
ext_gw2 = "203.0.113.200"

# nat outgoing connections on each internet interface
anchor nat-isp1
anchor nat-isp2

set skip on lo

# default deny
block in
block out

anchor "ftp-proxy/*"

# pass all outgoing packets on internal interface
pass out on $int_if to $lan_net
# pass in quick any packets destined for the gateway itself
pass in quick on $int_if from $lan_net to $int_if
# load balance outgoing traffic from internal network.
anchor loadbalance

# keep https traffic on a single connection; some web applications,
# especially "secure" ones, don't allow it to change mid-session
anchor applications

# general "pass out" rules for external interfaces
pass out on $ext_if1
pass out on $ext_if2

# route packets from any IPs on $ext_if1 to $ext_gw1 and the same for
# $ext_if2 and $ext_gw2
anchor pass-isp1
anchor pass-isp2

The rules for NAT, load balancing & routing are replaced with anchors, ifstated will use these anchors to add & manipulate rules.

ifstated.conf

isp1 = '( "ping -q -c 1 -w 1 -S 198.51.100.199 198.51.100.100 >/dev/null" every 10)'

#If inteface is configured dynamically via dhcp use this instead
#isp2 = '( "ping -q -c 1 -w 1 -S `ifconfig vr2 inet |awk \'/inet/ { print $2 }\'` `awk \'/routers/ { print $3 }\' /var/db/dhclient.leases.vr2 |tail -1 |sed \'s/;//\'`>/dev/null" every 10)'

isp2 = '( "ping -q -c 1 -w 1 -S 203.0.113.220 203.0.113.200 >/dev/null" every 10)'

state allworking {
init {
run 'pfctl -a loadbalance -F rules'
run 'pfctl -a applications -F rules'
run 'pfctl -a nat-isp1 -F rules'
run 'pfctl -a nat-isp2 -F rules'
run 'pfctl -a pass-isp1 -F rules'
run 'pfctl -a pass-isp2 -F rules'

run 'route change default 203.0.113.200'

run 'echo "pass in on vr1 from 192.168.1.0/24 \
route-to { (vr0 198.51.100.100), (vr2 203.0.113.200) } round-robin" | pfctl -a loadbalance -f -'

run 'echo "pass in on vr1 proto tcp from 192.168.1.0/24 to port https route-to (vr2 203.0.113.200)" | pfctl -a applications -f -'

run 'echo "match out on vr0 from 192.168.1.0/24 nat-to (vr0)" | pfctl -a nat-isp1 -f -'

run 'echo "match out on vr2 from 192.168.1.0/24 nat-to (vr2)" | pfctl -a nat-isp2 -f -'

run 'echo "pass out on vr0 from vr2 route-to (vr2 203.0.113.200)" | pfctl -a pass-isp2 -f -'

run 'echo "pass out on vr2 from vr0 route-to (vr0 198.51.100.100)" | pfctl -a pass-isp1 -f -'
}
if ! $isp1
set-state noisp1
if ! $isp2
set-state noisp2
}

state noisp1 {
init {
run 'pfctl -a loadbalance -F rules'
run 'pfctl -a applications -F rules'
run 'pfctl -a nat-isp1 -F rules'
run 'pfctl -a nat-isp2 -F rules'
run 'pfctl -a pass-isp2 -F rules'
run 'pfctl -a pass-isp1 -F rules'

run 'route change default 203.0.113.200'

run 'echo "pass in on vr1 from 192.168.1.0/24 route-to { (vr2 203.0.113.200) }" | pfctl -a loadbalance -f -'

run 'echo "pass in on vr1 proto tcp from 192.168.1.0/24 to port https route-to (vr2 203.0.113.200)" | pfctl -a applications -f -'

run 'echo "match out on vr2 from 192.168.1.0/24 nat-to (vr2)" | pfctl -a nat-isp2 -f -'

run 'echo "pass out on vr2 route-to (vr2 203.0.113.200)" | pfctl -a pass-isp2 -f -'
}
if $isp1
set-state allworking
if ! $isp2
set-state alldown
}

state noisp2 {
init {
run 'pfctl -a loadbalance -F rules'
run 'pfctl -a applications -F rules'
run 'pfctl -a nat-isp1 -F rules'
run 'pfctl -a nat-isp2 -F rules'
run 'pfctl -a pass-isp2 -F rules'
run 'pfctl -a pass-isp1 -F rules'

run 'route change default 198.51.100.100'

run 'echo "pass in on vr1 from 192.168.1.0/24 route-to { (vr0 198.51.100.100) }" | pfctl -a loadbalance -f -'

run 'echo "pass in on vr1 proto tcp from 192.168.1.0/24 to port https route-to (vr0 198.51.100.100)" | pfctl -a applications -f -'

run 'echo "match out on vr0 from 192.168.1.0/24 nat-to (vr0)" | pfctl -a nat-isp1 -f -'

run 'echo "pass out on vr0 route-to (vr0 198.51.100.100)" | pfctl -a pass-isp1 -f -'
}
if ! $isp1
set-state alldown
if $isp2
set-state allworking
}

state alldown {
init {
run 'pfctl -a loadbalance -F rules'
run 'pfctl -a applications -F rules'
run 'pfctl -a nat-isp1 -F rules'
run 'pfctl -a nat-isp2 -F rules'
run 'pfctl -a pass-isp2 -F rules'
run 'pfctl -a pass-isp1 -F rules'
}
if $isp1 && ! $isp2
set-state noisp2
if $isp2 && ! $isp1
set-state noisp1
if $isp1 && $isp2
set-state all working
}

As ifstated is initialised & when it switches states, it flushes the anchors in the pf.conf, sets the default gateway so the host itself can be reachable remotely on the WAN and then injects rules into the PF anchors.

26/07/2014

Switching from Zevo to OpenZFS on OS X

Filed under: OS X — Tags: , — Venture37 @ 7:54 pm

I recently moved my last Mac from Greenbytes Zevo to OpenZFS on OS X, the reason for both sticking with Zevo & switching to OpenZFS were one and the same, CPU usage.
Prior to the development of OpenZFS on OS X, the two choices for using ZFS on OS X where Zevo or MacZFS, Zevo originally started out as a commercial product but switched to a freebie after Greenbytes picked it up. Zevo had much better integration with OS X e.g disk would be automatically mounted when connected to system just like any other disk with a supported file system and it supported a v28 of the filesystem whereas MacZFS supported a much older version.

When the OpenZFS on OS X development began just over a year ago, I ran the test builds that where made available, though these supported new features through feature flags it was very early days, attempting to scrub a zpool on a i7 MacBook Air with a USB 3 disk would spike the CPU for the duration and again the integration was still missing, you manually had to import & export pools. I continued to try newer builds on my MacBook Air but stuck with Zevo on my 2007 MacBook Pro.

The two things which where annoying about Zevo was that it was a dead end, development had stopped, the last version available wasn’t compatible with Mavericks available and its conservative memory setting meant that disk performance wasn’t that great, during playing audio files it would break to buffer audio in iTunes for example (luckily not in Serato as mid set would’ve been embarrassing).

As the MacBook Pro was running low on disk space I tried to move around 40GB of files in several chunks in parallel to my external USB3 disk & noticed the CPU pegged and fans started up with Zevo too. OpenZFS on OS X is fairly robust now (though still rough around the edges) so I decided to switch over.

The OpenZFS on OS X disk image comes with uninstall scripts for Zevo & though the main script was unable to detect the installed copy of Zevo, I was able to run the subsequent scripts individually to remove Zevo from my system and reboot (eject the disk containing the filesystem beforehand (export the zpool)).

The integration with OS X is still missing though it seems that on boot zpools are imported, I’ve not worked out if that’s because the system caches the state from previous boot or this is the preliminary support for auto mounting???

If you want to eject a disk, you still have to export the pool manually from terminal, pressing the eject button in finder will remove the disk icon but the filesystem is still mounted. That aside, OpenZFS on OS X performed well, scrubbing the zpool on the 2007 MacBook Pro did not cause the CPU to spike at all, there is now a shorter delay in iTunes when starting to play a track but haven’t noticed any drops in audio yet, so things are looking positive.

Scrubbing the zpool on a 2007 17″ MacBook Pro with 4GB RAM

pool: tank
state: ONLINE
scan: scrub in progress since Fri Jul 25 18:58:48 2014
28.2G scanned out of 579G at 30.1M/s, 5h11m to go
0 repaired, 4.87% done
config:
NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
disk1s2 ONLINE 0 0 0

errors: No known data errors

All properties on the zpool I was using:
NAME PROPERTY VALUE SOURCE
tank type filesystem -
tank creation Mon Jul 29 5:00 2013 -
tank used 579G -
tank available 1.22T -
tank referenced 579G -
tank compressratio 1.00x -
tank mounted yes -
tank quota none default
tank reservation none default
tank recordsize 128K default
tank mountpoint /tank default
tank sharenfs off default
tank checksum on default
tank compression off default
tank atime on default
tank devices on default
tank exec on default
tank setuid on default
tank readonly off default
tank zoned off default
tank snapdir hidden default
tank aclmode discard default
tank aclinherit restricted default
tank canmount on default
tank xattr on default
tank copies 1 default
tank version 5 -
tank utf8only on -
tank normalization formD -
tank casesensitivity sensitive -
tank vscan off default
tank nbmand off default
tank sharesmb off default
tank refquota none default
tank refreservation none default
tank primarycache all default
tank secondarycache all default
tank usedbysnapshots 0 -
tank usedbydataset 579G -
tank usedbychildren 4.48M -
tank usedbyrefreservation 0 -
tank logbias latency default
tank dedup off default
tank mlslabel none default
tank sync standard default
tank refcompressratio 1.00x -
tank written 579G -
tank logicalused 578G -
tank logicalreferenced 578G -
tank snapdev hidden default
tank com.apple.browse on default
tank com.apple.ignoreowner off default

Upgrading the zpool with OpenZFS on OS X
This system supports ZFS pool feature flags.

Successfully upgraded 'tank' from version 28 to feature flags.
pool_set_props
Enabled the following features on 'tank':
async_destroy
pool_set_props
empty_bpobj
pool_set_props
lz4_compress

After Dark flying toasters clone

Filed under: OS X — Tags: , , — Venture37 @ 6:04 pm

Many years ago, the Uneasy Silence website had a clone of the After Dark flying toasters screensaver. Uneasy Silence is now defunct but archive.org has many snapshots of the site where you can download the Windows & OS X version of the screensaver & source code still.

 

Modern flying toasters

20/07/2014

GeekLAN is 10 years old

Filed under: General — Venture37 @ 8:54 pm

This blog started life with a zero dot release of wordpress on the end of a 512kb down/128k up cable modem connection 10 years ago. Originally I had intended to host it on my AlphaStation which at the time was acting as my gateway, running OpenBSD. Unfortunately gettext was broken on Alpha at the time which meant though php was available I couldn’t build extensions such as the mysql one, I had a slot 1 PIII which was my previous gateway using RRAS on Windows 2000 Server, it replaced the AlphaStation and assumed the role of gateway again, this time on OpenBSD.

Up until 2009 this blog was served from my bedroom by then on a VIA C7 mini-its board with a ADSL connection. At some point it gained an SSL certificate from CAcert & IPv6 connectivity. Through this domain I discovered that NTL overrode the TTL values for records in the early days, caching DNS records for a week by default. Blocked several IP addresses from Thailand for excessive hits to the site. Of all of the computers which I collected over the years, most are now gone. I still have the Cobalt Qube2, some Macs and the ThinkPad X61s, the rest found new homes or where thrown away. The most popular posts so far have been on Apple products, the post that’s still holds true is the Solaris installer misreporting disk failure if it finds a disk label other than the one it was expecting.

 

30/06/2014

Book review: The Art of Unix Programming

Filed under: General — Tags: , — Venture37 @ 10:59 pm

I picked this book by mistake, assuming that it was going to be a technically detailed book in line with the Advanced Programming in the Unix Environment book written by the late Richard Stevens, it turned out to be much more high level than that but I was not disappointed, It’s been a pleasure to read whilst travelling over the last month.
The book is 20 chapters split across four parts (context, design, implementation, community) with commentary from some big names of the UNIX world. There are lots of great advice in the book but I would look at what’s now available in regards to software today if I was looking to implement something. It does explain why lots of software relies on some common (and heavy weight?) components. Let me explain, long ago I was unaware that packages for the -current branch of OpenBSD were being built, whenever I grudgingly tried a new snapshot I went through & built my packages from the ports tree after a fresh install, then something would depend on XML related components & then pull in a bunch of things which would involve building ghostscript, on a Sun Blade 100, between Firefox & ghostscript, 24 hours would easily be wasted, I now understand that all that wasted time was thanks to someone taking the advice of ESR on how to prepare documentation for a software project.
Besides the dubious software recommendation (11-year-old book?) everything is explained in a clear manner that’s very easy to read.

Rule of Robustness: Robustness is the child of transparency and simplicity.
Rule of Generation: Avoid hand-hacking; write programs to write programs when you can.
Rule of Optimization: Prototype before polishing. Get it working before you optimize it.
Rule of Diversity: Distrust all claims for “one true way”.
Rule of Extensibility: Design for the future, because it will be here sooner than you think.

The Pragmatic Programmer articulates a rule for one particular kind of orthogonality that is especially important. Their “Don’t Repeat Yourself” rule is: every piece of knowledge must have a single, unambiguous, authoritative representation within a system. In this book we prefer, following a suggestion by Brian Kernighan, to call this the Single Point Of Truth or SPOT rule.

The book is critical of Microsoft & their approach to software, explaining some of the design decisions (some inherited from the world of VMS).

From a complexity-control point of view, threads are a bad substitute for lightweight processes with their own address spaces; the idea of threads is native to operating systems with expensive process-spawning and weak IPC facilities.

the Microsoft version of CSV is a textbook example of how not to design a textual file format.

Criticisms of MacOS are of version 9 and prior which don’t really apply to OS X e.g. single shared address space. There are explanations of why things are such in the world of Unix and lots of great advice.

The ’rc’ suffix goes back to Unix’s grandparent, CTSS. It had a command-script feature called “runcom”. Early Unixes used ’rc’ for the name of the operating system’s boot script, as a tribute to CTSS runcom.

most Unix programs first check VISUAL, and only if that’s not set will they consult EDITOR. That’s a relic from the days when people had different preferences for line-oriented editors and visual editors

When you feel the urge to design a complex binary file format, or a complex binary application protocol, it is generally wise to lie down until the feeling passes.

One of the main lessons of Zen is that we ordinarily see the world through a haze of preconceptions and fixed ideas that proceed from our desires.

Doug McIlroy provides some great commentary too

As, in a different way, was old-school Unix. Bell Labs had enough resources so that Ken was not confined by demands to have a product yesterday. Recall Pascal’s apology for writing a long letter because he didn’t have enough time to write a short one. —Doug McIlroy

I’d recommend the book for anyone involved with computers and not necessarily involved with Unix or open source variants/likes. The author does a great job of explaining the theory of an approach to developing software and the operating it typically runs on, It’s accessible, easy to read and doesn’t require a computer to work through. You may need one however if you want to read it online for free.

My ideal for the future is to develop a filesystem remote interface (a la Plan 9) and then have it implemented across the Internet as the standard rather than HTML. That would be ultimate cool. —Ken Thompson

Older Posts »

Powered by WordPress