New user's registration have been closed due to high spamming and low trafic on this forum. Please contact forum admins directly if you need an account. Thanks !

Gentoo live USB updated (Linux 3.17.1, shellshock fix)

Discuss development on Bubba
sakaki
Posts: 172
Joined: 15 Aug 2014, 11:20

Gentoo live USB updated (Linux 3.17.1, shellshock fix)

Post by sakaki »

Hello,

As you may be aware, mach-kirkwood has been deleted from the 3.17 kernel (see this commit).

The good news is that 3.17 can still be used with the B3 (since the latter has device-tree support, and so can leverage mach-mvebu)...

The not-so-good news is that deletion of mach-kirkwood has also changed the config schema significantly, such that you can't simply "make olddefconfig" (or similar) on a 3.15 or 3.16 config, and get a 3.17 config that will yield a bootable kernel for a B3. It needs a bit of manual tweaking to make it go again. /><\

So, rather than leave anyone in the lurch over this, I've released a 1.2.0 version of the Gentoo live-USB image for B3 on GitHub, featuring the updated 3.17.1-r1 kernel (and permuted config).

A few minor upgrades to the supplied precompiled apps have also been provided (the set is now up to date as of 21 Oct 2014), and the shellshock fixes for bash have been applied.

As before, you can run it on a standard or diskless B3, no U-Boot flashing is necessary, and since it is a 'live USB', it will not affect your existing Excito system.

Full instructions are provided on the GitHub page linked above (including how to specify initial network settings, so you can ssh in once booted).

Please let me know if you have any problems. Best,

sakaki
Ubi
Posts: 1549
Joined: 17 Jul 2007, 09:01

Re: Gentoo live USB updated (Linux 3.17.1, shellshock fix)

Post by Ubi »

I'm no kernel hacker, but do you mean that the linux kernel has dropped support for kirkwood altogether?
Gordon
Posts: 1462
Joined: 10 Aug 2011, 03:18

Re: Gentoo live USB updated (Linux 3.17.1, shellshock fix)

Post by Gordon »

Ubi wrote:I'm no kernel hacker, but do you mean that the linux kernel has dropped support for kirkwood altogether?
No, this is about native support. As of kernel 3.17 you now need to walk the device tree, which essentially means that specific board functions will likely need additional CPU cycles. My guess is that disk I/O, which even with the standard Bubba kernel can't keep up with the speed of a WD green drive, may be a tad slower with this new kernel.
sakaki
Posts: 172
Joined: 15 Aug 2014, 11:20

Re: Gentoo live USB updated (Linux 3.17.1, shellshock fix)

Post by sakaki »

Hi Ubi -

as Gordon says, kirkwood boards with mainline device tree info (including the B3) are still supported, but arch-kirkwood itself has been folded into mvebu/multi_v5. See this link and this earlier discussion.

The problem is really that "make olddefconfig" (and friends) doesn't handle the config upgrade from 3.15/6 to 3.17 automatically - at least, not at the moment, and not for the kernel configs I used for the Gentoo live USB image. So that would have left people stranded with a non-booting system, if they'd tried to upgrade their v1.1.0 Gentoo system's 3.16.1 kernel to 3.17+ themselves (using the instructions on the GitHub page).

The (manually tweaked) 3.17 config from the new v1.2.0 should be fine to use (with "make olddefconfig") going forward however (for those users wishing to upgrade under their own steam to 3.18 etc., when it comes out).

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

Re: Gentoo live USB updated (Linux 3.17.1, shellshock fix)

Post by sakaki »

Thomas Petazzoni's "Device Tree for Dummies" is definitely worth a read (really nice presentation, shame about the title!)

Also, for anyone else out there interested in creating an alternative OS image (Arch, Debian etc.) for the B3, it may be worth just clarifying something here, since it is not immediately obvious (at least, it wasn't to me when I started), viz:
Older versions of U-Boot, present on many (most?/all?) shipped B3 systems:
  • don't turn off the L2 cache properly during early boot, which clashes with CONFIG_ARM_PATCH_PHYS_VIRT (in turn required by CONFIG_ARCH_MULTIPLATFORM, which you will need in a modern armv5 kernel)... result - the infamous 'hang immediately after the uImage is loaded' problem; and
  • don't do the right thing with device tree blob (DTB) files (see Petazzoni's slide 8 ), so the kernel doesn't know anything about the hardware on which it is running, which will also kill the boot (albeit a little later on); and
  • don't (appear to) specify an appropriate root or delay when booting from USB as part of the kernel command line, so that even if the kernel does boot, it can't start init (and panics).
To address these problems (so you can run a 3.15/16/17 kernel), you can either re-flash U-Boot, or take the approach I have done, and:
  • add a small amount of machine code to the start of the kernel zImage to (temporarily) turn the L2 cache off during early boot, as suggested by Ian Campbell (Debian workaround 658904); and
  • ensure your kernel is built with CONFIG_ARM_APPENDED_DTB=y, and then stick the compiled B3 DTB (compiled device tree blob) file at the end of the zImage (per Petazzoni's slide 8 ); and
  • ensure your kernel is built with CONFIG_CMDLINE, to explicitly specify the kernel command line (for example, to something like "root=/dev/sdb2 rootfstype=ext4 rootdelay=5 console=ttyS0,115200n8 earlyprintk")
then use mkimage to create a uImage as normal. I have a provided a script to do this as part of the gentoo-on-b3 GitHub archive.

By taking this path, you minimise your OS image's dependency on U-Boot (or its version) - it just has to load your kernel binary and start it, nothing else (as the kernel itself takes care of the L2 caches issue, contains its own DTB, and has its own command line embedded). Also, there's less 'barrier to entry' for a potential user of your image, as they won't have to reflash anything (or worse yet, connect the dreaded serial console!)...

Ultimately, the choice of which route (reflash or patch) to take is yours. Both work, both have advantages and disadvantages. I took the latter since I didn't want anyone bricking their B3 while trying out Gentoo ^-^

hope that helps someone out there...

sakaki
Gordon
Posts: 1462
Joined: 10 Aug 2011, 03:18

Re: Gentoo live USB updated (Linux 3.17.1, shellshock fix)

Post by Gordon »

As business is slow these days, I finally got around to having a go on this. Still running on the USB, trying to get the old config applied. Had to install some additional packages for networking: dnsmasq, vconfig and iproute2. Most of the configs transfer without issues, although I did find that with dnsmasq Debian defaults to reading components from /etc/dnsmasq.d where in gentoo you need to specify this in /etc/dnsmasq.conf.

Note: I did add a udev rule to rename that silly cryptic name for the wireless interface to wlan0. Otherwise you will have to change every config that references that interface.

Getting hostapd to run was still somewhat troublesome, because Gentoo networking defaults to attempt automatic configuration of interfaces. This includes running DHCP discovery on individual bridge members and running wpa_supplicant on wireless (virtual) interfaces. Got most of my original networking implemented now and the setup already proved to be more stable as I can now shut down virtual interfaces that would previously require me to perform a bunch of tricks to prevent needing to reboot the B3. A definite win.

Must definitely need to setup the crosscompile thingy. Currently installing layman, which I hope gives me access to installing LMS, and it is taking its time.
Gordon
Posts: 1462
Joined: 10 Aug 2011, 03:18

Re: Gentoo live USB updated (Linux 3.17.1, shellshock fix)

Post by Gordon »

Grmbl...

Bit of an oversight on my behalf. Got all the changes stored on the USB drive and at the next boot al the network configuration was gone. Obviously this gets overwritten by the net and resolv.conf file on the boot partition. Luckily the amount of alcohol I take in does not seem to have a strong effect on my memory. :twisted:

Ever the wiser I copied the working setup to /dev/sdb1, so that should not happen again.

Layman turned out to require some manual tweaking to portage's make.conf. Can't remember ever having to do that before, so that seems like a bug to me. Tried to pull in LMS and it turned out I had to rebuild perl and each of its modules on account of an additional USE flag (ithreads). Got distcc running, so that cut off a lot of the time involved. Did not manage to get LMS installed because of its size (disk full), so I'll need to extend the Gentoo root partition on the USB drive.

Replacing the postfix config with the original one worked out of the box. At least it seemed so. As it turned out the aliases file is relocated from /etc to /etc/mail and a warning was thrown in the log file. I also had to recompile postfix because I added sasl verification through dovecot for smtps in my original config and this of course required adding the USE flag dovecot-sasl. Dovecot itself is a completely different story. The config file on the original B3 OS is useless and you will have to start from scratch. Shamefully the modular conf.d setup that is supposed to simplify setup actually makes it harder to find the matching items you need to implement from the old config. I ended up changing 4 of its config files.

What I do love about this live USB is that you can actually make changes to it, slowly converging to mimic all the components of the original installation with just a simple reboot separating you from the working original environment. It gives you time to figure out things and the actual transfer will be a breeze.
sakaki
Posts: 172
Joined: 15 Aug 2014, 11:20

Re: Gentoo live USB updated (Linux 3.17.1, shellshock fix)

Post by sakaki »

Hi Gordon,

good to hear about your progress ^-^

As to the point about your network settings (on the USB) being overwritten each boot, this is done by the copynetsetup service. There is a note about it on the project's github page (in the "Using Gentoo" section), but it should probably be a bit more prominent (in the motd for example). Anyway, once you have the settings as you like them on the USB, if you then do:

Code: Select all

b3 ~ # rc-update del copynetsetup default 
that'll prevent changes getting overwritten next time you boot (the equivalent for my Arch Linux live USB, which uses systemd, is "systemctl disable copynetsetup"). Alternatively, simply delete or rename the /install/net and /install/resolv.conf files on the USB's first partition; if copynetsetup cannot find them, it'll leave the originals untouched.

What changes did you need to make to /etc/portage/make.conf to get layman working? It does now require you to have the line

Code: Select all

source "/var/lib/layman/make.conf"
in there, and possibly set PORTDIR_OVERLAY too, per the current Gentoo wiki instructions... this has changed a bit from how it used to be, I think.

Would you be willing to post some sanitised versions of your application configs when you have them running, for anyone else looking to migrate to gentoo? I can open up a public wiki on the github project page (similar to this one on another project of mine; uses the normal github markdown), if that'd be helpful... or we could maybe use the mybubba.org wiki?

PS gentoo on the bubba2 now appears to be relatively stable; hoping to release that sometime in Jan, when I have the bootloader wrinkles sorted out... there'll be no Arch Linux version though... as the ArchPPC project appears to have died ><

Best

sakaki
Gordon
Posts: 1462
Joined: 10 Aug 2011, 03:18

Re: Gentoo live USB updated (Linux 3.17.1, shellshock fix)

Post by Gordon »

Yes that `source "/var/lib/layman/make.conf"` is the one. I don't have it on my desktop system and layman still works. Quite puzzling...

As for network setup, I should have realized it but was to preoccupied with getting every element of networking implemented and simply forgot. Got all of it running now, three SSID's, a bridge, a VLAN and some static routes. 8)

Today I have been doing a lot of moving files around, changing the original setup of my B3. I deleted the home and swap partition and created a new swap as /dev/sda2, a reserved space of 10GiB and a new home partition on /dev/sda4 that I formatted as ext4. Next step is to get LMS working and see if ftp and www is transferred just as easily. Then as far as I'm concerned I'm good to go and transfer should be smooth with the data already in place.

I'll see about the config files. Should not be too much of an issue.

'Till next year :mrgreen:
Gordon
Posts: 1462
Joined: 10 Aug 2011, 03:18

Re: Gentoo live USB updated (Linux 3.17.1, shellshock fix)

Post by Gordon »

I'm an @ss....

Trying to install LMS I had it stuck on unpacking a 166MB zip file with just over 50MB in the target directory after three full hours :shock: Apparently adding binds for /tmp, /var/tmp and /usr/portage was not sufficient. Then it struck me that I had already prepared my disk for the right order of partitions and all I needed to do to switch between platforms is copy uImage to /boot on /dev/sda1.

<sigh>

So I installed mariadb (freeware version of mysql) and that proved to cause some issues. The accompanying tools threw errors when trying to initialize the system, but when copying the original data from the mysql install on the B3 it worked straight out of the box. I've created a binary package for it - in fact I'm building binary packages for everything now - and can upload this if anyone is interested.

LMS is giving me headaches I'm afraid. Have not managed to get it running yet. This is because the LMS developers have chosen not to include ARM binaries in their bundle for Perl versions over 5.14 and shamefully pulling in the required modules via emerge throws a conflict on a hardcoded version dependency. Still unsure how to solve that. Changing that value to match the installed version already proved to be a wrong idea, because although it doesn't show any errors any more LMS now stalls. That could be caused by something completely different though. A hint to that is given by the fact that I also get a notice that I should install something that is already installed. It all feels like bad bad programming to me.
Gordon
Posts: 1462
Joined: 10 Aug 2011, 03:18

Re: Gentoo live USB updated (Linux 3.17.1, shellshock fix)

Post by Gordon »

Man oh man...

I finally got LMS running. Don't know what those devs are thinking, but it's one consecutive string of version conflicts with them expecting you to compile ancient modules against current perl. At one point I managed to get it started without any errors, but then the web interface was completely messed up, showing me either just the top part of the page without colours and navigation buttons, or the right colour but no content except some sort of animated cursor.

Got it running now and may try to create an ebuild for it. Had my old setup running against a MySQL database, but that proved to be useless as LMS uses SQLite for cache and will therefore still allocate the resources for it. Will have to look into eliminating the use of MySQL for other software I use (specifically: RoundCube).

Also got Samba running. It almost works out of the box, except that the paths for some of the .tdb files have changed. If you put those files in the right directory and start Samba, you can log straight on and from Windows it will seem like nothing has changed. This will go into my cookbook...
sakaki
Posts: 172
Joined: 15 Aug 2014, 11:20

Re: Gentoo live USB updated (Linux 3.17.1, shellshock fix)

Post by sakaki »

Wow - your B3 setup seems pretty advanced! Is migration nearly complete now?

When you do get done, if you'd like to share any of your configs / tips / suggestions for the benefit of future users, I've set up a simple wiki on gentoo-on-b3 here, so feel free to add stuff there as and when you get time (you just need to have a github account, which is free, to be able to add content; the syntax is normal github markdown, with the addition of double square brackets to make internal wiki links).

Also, if you have suggestions for improvements you'd like to see in the live-USB, please let me know!

Best

sakaki
Gordon
Posts: 1462
Joined: 10 Aug 2011, 03:18

Re: Gentoo live USB updated (Linux 3.17.1, shellshock fix)

Post by Gordon »

Advanced?

Well I guess my network setup is somewhat 'different', but the rest of it is pretty straight forward.

The reason why LMS wasn't running is because they don't ship armv5 specific files any more for perl versions > 5.10. In fact the only binaries they do still ship are for Windows and other people are expected to compile a load of ancient pre- perl 5.8 module versions against current perl and similarly as old media libraries. So I figured the simplest way to go about this was to grab the sources for perl 5.10 and make this a standalone application. Alas, that proved to not work as well. Except for three of the modules (four if you count Locale::Hebrew) I now have everything running on the current modules for perl 5.18. It's a biggy though: with all the recursed dependencies it counts up to 100 packages being installed :shock: It does feel quicker than the old installation on Squeeze and it also writes to the logs, which it never did before.

I did create an ebuild for this and I have precompiled binaries.

Some new issues:

Proftpd on Squeeze had a modules section in the config, pulling in a lot of extra functions that are not enabled in the version you put in the image. Disabling the modules got me the content that I was expecting, except that I had to disable another config line as well. This line appears to be related to the (also not enabled) 'ident' USE flag, but what does this do? Should I recompile with at least this module and possibly all the others as well?

Apache won't work with my config. I found that php was not installed, but I also need it to do proxy_html. With the module compiled and in place I now get undefined symbol errors though. I also would like to get fastcgi going so I can make an attempt to port the B3 frontend to this installation, but enabling this module shows similar errors as proxy_html.
Gordon
Posts: 1462
Joined: 10 Aug 2011, 03:18

Re: Gentoo live USB updated (Linux 3.17.1, shellshock fix)

Post by Gordon »

My progress so far:

distccd
I found that my troubles with adding functionality were most likely caused by my distcc environment, using my desktop system for 'pump'. This actually became clear when I attempted to reinstall apache with different USE flags and saw it failing on including ldap libraries (for which the USE flags were not enabled). As it turns out my earlier compile of mariadb did not function when I attempted to use it with roundcube webmail and I would have to do rebuild it without the use of distcc. I've decided I won't do the effort unless I really (really) do require mysql.

apache
The install on the live USB is somewhat crippled by missing some of the elements that are present on the original B3 operating system (Debian Squeeze). This includes proxy and fastcgi, but also php is not present on the live system. While this may be sufficient for some users, these would be better of with a webserver that has a far smaller footprint, like Nginx.

As it turns out, adding the apache modules present in the repository will cause errors on missing symbols. Emerge does not track these dependencies, probably because they can't know if these are present in the main apache install or need to be installed as separate modules. The trouble is that I can't find at least one of those modules in the repository (unixd).

So I have now compiled apache 2.4.10-r1 with the following additional settings in portage's make.conf:

Code: Select all

APACHE2_MODULES="${APACHE2_MODULES} proxy proxy_fcgi proxy_http remoteip access_compat"
APACHE2_MPMS="prefork"
The extra module 'access_compat' is to let apache 2.4 accept your old vhost configs, but you will have to replace access control lines to the new syntax to actually get access to folders. 'remoteip' is the replacement for mod_rpaf and it should allow me to log the correct IP's for visitors being proxied by Nginx on my second B3.

cups
This is lacking on the live USB. I installed it, but for some reason I can't get it to print a testpage to my old HP LaserJet 2100. If it spits out anything, it's random error messages and (mostly) empty pages. It does function as a print queue for raw (pcl5) print jobs though, so the issue seems to be related to it not recognizing and transcoding postscript (and I think pdf?). Again, distcc may be the culprit here and the problem may be with ghostscript rather than cups itself.

iproute
The live USB only has ifconfig support. While sufficient for many users, it would be better to offer full networking options as supplied by iproute2. This is also required if one wishes to use VLAN's (vconfig package needed as well) which are very useful if you have 'loud' devices (such as squeezebox, or Mac/Avahi components in a Windows network).

dnsmasq
Not the most powerful, but on a B3 definitely sufficient and should be included on the Live USB. Since it is also included in the original Bubba OS it also makes it very easy to transfer this basic required functionality (DHCP+DNS) over to the Live USB: just copy the config files from [/dev/sda1] /etc/dnsmasq.
sakaki
Posts: 172
Joined: 15 Aug 2014, 11:20

Re: Gentoo live USB updated (Linux 3.17.1, shellshock fix)

Post by sakaki »

Gordon -

very useful feedback, thanks. As I'm just in the middle of finalizing userland for the gentoo B2 image, it'd be great to incorporate these changes, after which I can put out a 1.3.0 for the B3 also. As such, would you mind doing me a favour, and posting below your B3's:
  • /var/lib/portage/world
  • /etc/portage/package.use
  • /etc/portage/package.accept_keywords
  • /etc/portage/package.mask
  • and anything different (global USE flags, APACHE2 settings etc) from /etc/portage/make.conf
(obviously dropping anything you feel is not of general use)?

Then I can double-check that I haven't missed anything.
Many thanks, sakaki
Post Reply