# bootstrapper wants to get pkg package for wrong architecture



## mb2015 (Mar 31, 2019)

After upgrading from 11-STABLE to 12.0-RELEASE-p3 via source on my BeagleBone Black (buildworld now taking a full 3 days!) all seems to be well with the base system. Before updating all my installed packages, I deleted them as per the procedure at the end of the portmaster(8) man page. The next step is to reinstall `pkg`. I know I can build from source via ports-mgmt/pkg, but since the version is still the same, I would rather just use the built-in `pkg` bootstrap command. Weirdly, it is failing:


```
# pkg
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y
Bootstrapping pkg from pkg+https://pkg.FreeBSD.org/FreeBSD:12:armv7/quarterly, please wait...
Verifying signature with trusted certificate pkg.freebsd.org.2013102301... done
Installing pkg-1.10.5_5...
pkg-static: wrong architecture: FreeBSD:12:armv7 instead of FreeBSD:12:armv6

Failed to install the following 1 package(s): /tmp//pkg.txz.klqA0H
```

Why is it looking for the armv7 package? The BBB is armv6.

Another user suggested a workaround (updated for 12 by me here):

`env ABI=FreeBSD:12:armv6 pkg bootstrap`

And indeed, this worked well, but this does not seem like an ideal solution. Isn't it a bug?


----------



## acheron (Mar 31, 2019)

mb2015 said:


> Why is it looking for the armv7 package? The BBB is armv6.


BBB is definitely armv7. 11.2 doesn't "know" this arch, armv7 appears in 12.0
What's the content of /etc/pkg/FreeBSD.conf?


----------



## mb2015 (Mar 31, 2019)

```
# $FreeBSD: releng/12.0/usr.sbin/pkg/FreeBSD.conf 340161 2018-11-05 21:28:32Z gjb $
#
# To disable this repository, instead of modifying or removing this file,
# create a /usr/local/etc/pkg/repos/FreeBSD.conf file:
#
#   mkdir -p /usr/local/etc/pkg/repos
#   echo "FreeBSD: { enabled: no }" > /usr/local/etc/pkg/repos/FreeBSD.conf
#

FreeBSD: {
  url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly",
  mirror_type: "srv",
  signature_type: "fingerprints",
  fingerprints: "/usr/share/keys/pkg",
  enabled: yes
}
```

The BBB is an ARMv7 board, but "armv6" in FreeBSD has always meant something slightly different. As per https://www.freebsd.org/platforms/arm.html "FreeBSD/arm supports ARMv4 and ARMv5 processors. FreeBSD/armv6 supports ARMv6 and ARMv7 processors, including SMP on the latter."

Are you saying this has changed for 12.0?

Regardless, there's conflicting info in there somewhere...


```
# pkg -vv | grep ABI
ABI = "FreeBSD:12:armv6";
ALTABI = "freebsd:12:armv6:32:el:eabi:hardfp";
```

portmaster -P is also affected:


```
Installing package from: /usr/ports/packages/portmaster-download/db5-5.3.28_7.txz
Installing db5-5.3.28_7...
pkg-static: wrong architecture: FreeBSD:12:armv7 instead of FreeBSD:12:armv6
```

Any suggestions?


----------



## acheron (Mar 31, 2019)

Yes, all boards that are armv7 were moved to armv7 in 12.0: https://svnweb.freebsd.org/base?view=revision&revision=324341
Can you show the output of 
	
	



```
sysctl hw.machine_arch
readelf -A /bin/ls | grep Tag_CPU_arch
```


----------



## mb2015 (Mar 31, 2019)

```
# sysctl hw.machine_arch
hw.machine_arch: armv7
# readelf -A /bin/ls | grep Tag_CPU_arch
  Tag_CPU_arch: ARM v6
```

Interesting! Is it because I built 12 from source on 11? I would have thought this would have been a pretty ordinary upgrade path, though. I just followed the Handbook.

Let me know how else I can help figure out what went wrong and how to fix it.


----------



## acheron (Apr 1, 2019)

It was kind of documented in https://svnweb.freebsd.org/base?view=revision&revision=324365
You need to build an armv7 world.


----------



## mb2015 (Apr 1, 2019)

Indeed, MACHINE_ARCH=armv6 is all over my buildworld.out.

I finally found where it was documented in /usr/src/UPDATING ... I had overlooked this entry:

```
20171005:
    The arm port has split armv6 into armv6 and armv7. armv7 is now
    a valid TARGET_ARCH/MACHINE_ARCH setting. If you have an armv7 system
    and are running a kernel from before r324363, you will need to add
    MACHINE_ARCH=armv7 to 'make buildworld' to do a native build.
```

I'm guessing I should also run `ccache -C` just to be safe.
I also use meta mode, but I trust it will be fine since I obliterate /usr/obj before the buildworld.

I will report back in 3 or 4 days.


----------



## mb2015 (Apr 5, 2019)

It worked; thanks!

I used my armv6 FreeBSD 12 system to build and upgrade to armv7 FreeBSD 12, just following the normal upgrade procedure, but adding `MACHINE_ARCH=armv7` to the buildworld, buildkernel, and installkernel commands. I am not sure if it is also needed for installworld, but I used it there, too, just in case.

Everything works as it should now; no warnings about armv6/armv7 mismatches from `pkg`.


----------

