Bubbagen live-USB for B3 updated (Gentoo profile 17)

Discuss development on Bubba
Post Reply
Gordon
Posts: 1294
Joined: 10 Aug 2011, 03:18

Bubbagen live-USB for B3 updated (Gentoo profile 17)

Post by Gordon » 15 Aug 2018, 10:35

Hi,

I've just released version 1.11 of the Bubbagen live-USB image for B3 on GitHub.

Because the new Gentoo profile defaults to building position-independent executables and this may lead to incompatibilities with non-pie libraries this is a complete rebuild of the Live-USB. If you are already running Bubbagen and like to migrate to profile 17 as well I suggest you take your configs and move them to this new release rather than rebuild your world yourself.

Following up on Sakaki's kexec kernel starting method this release now also features a second stage bootloader to load the final kernel with a configurable command line. This second stage bootloader was in fact designed from the ground up, because Sakaki's kexec loader left my B3 (with the older U-Boot 2010.06-rc2-00064-gf41e8d8-dirty) without network. If you like it will allow you to use Sakaki's kernel package though, but you should note that Sakaki's kernel thus far does not support systemd init system so you can only do that with the OpenRC version of the Live USB. Please reference the directions in /boot/boot.ini on how to make the bootloader select a different kernel.

Tip:
Sakaki publishes a binhost that can help you keep your instance of Bubbagen up to date. The Live-USB is not subscribed to that binhost, but you can add it yourself by referencing this topic. To fetch binaries from that host run emerge with `-g` or `--getbinpkg` option. Do note that because the Bubba UI requires specific USE flags on some packages emerge may disregard some of the available binaries on that binhost.

Known issues:
  • When changing the time zone the web interface may show you an incorrect time on some pages (the extensible clock on the right is actually javascript and thus should show your client's time rather than the B3's). To align them all you should restart the B3 (or at least apache2 and bubba-adminphp services).
  • Changing the network profile may completely destroy networking on the B3 if you have wifi enabled or added custom interfaces and/or bridges. If you need to change the profile please do so before making any changes to the default network setup and then never touch it again.
The supplied kernel is the current Gentoo LTS version 4.14.52. All packages have been brought up to date as of Aug 10, 2018 ¹)


Enjoy,
Gordon


¹) Some packages withheld due to patent restrictions or because the newer versions are incompatible with core Bubba functionality.

sakaki
Posts: 170
Joined: 15 Aug 2014, 11:20

Re: Bubbagen live-USB for B3 updated (Gentoo profile 17)

Post by sakaki » 10 Sep 2018, 18:16

Gordon wrote:
15 Aug 2018, 10:35
This second stage bootloader was in fact designed from the ground up, because Sakaki's kexec loader left my B3 (with the older U-Boot 2010.06-rc2-00064-gf41e8d8-dirty) without network.
Hi Gordon - did you experience the above networking issue booting the gentoo-on-b3 image, or your own? I found that the Ethernet MACs that U-Boot sets often got zeroed by the kexec (leaving networking dead, in effect), so I put a "setethermac" service on the Gentoo and Arch images to read the appropriate variable from U-Boot's nvram and (re)set the MACs.

The OpenRC version looks like this:

Code: Select all

#!/sbin/openrc-run
# Ensure that the B3's ethernet interfaces have the correct MACs set
# (because, if the kernel was kexec-booted, the MACs will initally
# both be be 0, and networking will not start unless this is corrected)
# Copyright (c) 2017 sakaki <sakaki@deciban.com>
# License: GPL 3.0+
# NO WARRANTY

depend() {
        need localmount
        before net
}

start() {
        ebegin "Starting setethermac on eth0 and eth1"
        ip link set dev eth0 address $(fw_printenv ethaddr|rev|cut -c -17|rev)
        ip link set dev eth1 address $(fw_printenv eth1addr|rev|cut -c -17|rev)
        eend $?
}
How did you work around this in your own bootloader?

Best, sakaki

Gordon
Posts: 1294
Joined: 10 Aug 2011, 03:18

Re: Bubbagen live-USB for B3 updated (Gentoo profile 17)

Post by Gordon » 11 Sep 2018, 03:47

First my own kernel. I then tried kernels from both your arch and gentoo images with the same result. I saw it happen on the serial console as the kernel was loading. Figured it was something in kexec masking part of the device tree, but then I found that if I ran kexec from a live system it did have all the networking.

The trick is to initialize the NICs. And you must access them both or the one that you did not touch will still show mac 00:00:00:00:00:00

Code: Select all

ifconfig eth0 10.250.251.252 netmask 255.255.255.255
ifconfig eth1 10.250.251.253 netmask 255.255.255.255
In hindsight I could have used 127.x.x.x addresses, but these are ridiculous enough to not cause conflicts in home networks.

sakaki
Posts: 170
Joined: 15 Aug 2014, 11:20

Re: Bubbagen live-USB for B3 updated (Gentoo profile 17)

Post by sakaki » 11 Sep 2018, 05:15

Thanks Gordon -

yes, without my setethermac userland service from the Arch or gentoo-on-b3 live-USBs running, that's what I'd expect to happen.

Setting a spoof IP address before kexec sounds like a nice trick to workaround this though, and I should be able to add this to the kexec.sh script the kexec bootloader sources, without building the initramfs.

I'll try it, and if it works, modify the gentoo-on-b3 image (and the arch one, if I do a respin) accordingly (the current approach works on my images, but not relying on a userland service to patch things up would be more robust).

Best, sakaki

sakaki
Posts: 170
Joined: 15 Aug 2014, 11:20

Re: Bubbagen live-USB for B3 updated (Gentoo profile 17)

Post by sakaki » 11 Sep 2018, 14:05

In testing, adding the ifconfig stanzas into /boot/kexec.sh (and disabling the setethermac service) seems to work fine.

Accordingly I've just posted a tweaked 2.1.1 release of the image with this incorporated.

Thanks again!

sakaki

Gordon
Posts: 1294
Joined: 10 Aug 2011, 03:18

Re: Bubbagen live-USB for B3 updated (Gentoo profile 17)

Post by Gordon » 11 Sep 2018, 14:59

You're welcome.

Fun thing is that I thought it might be related to the uboot version. Never crossed my mind that you might have created a post-boot solution for it.

Post Reply