Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) by nld3-dev1.alpinelinux.org (Postfix) with ESMTPS id 0CF3F780ED8 for <~alpine/apk-tools@lists.alpinelinux.org>; Sun, 9 Feb 2020 14:10:41 +0000 (UTC) Received: by mail-lj1-f181.google.com with SMTP id a13so4146272ljm.10 for <~alpine/apk-tools@lists.alpinelinux.org>; Sun, 09 Feb 2020 06:10:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cf/YYCaozrtpYVGgQeayMFXcIADMF5X6fW+LXCnJLcc=; b=pxTT0BmmFBmv0Xdd8ef+CVmy8m/3MX75GvZuSh6ZY1bU/mgSqHqg68Tg6vPWL2dCDk U3klDlsrFHjcEVv/n+LeEjljuzS4uoGRPpODXhHcc1bvgGZ5IB3D52iUMt7/7kHqqkc3 5jh06fM6mQN11o3M+LYcLynNqyDY3yVDJgMxO1UBUccmloxkPzJLY15auuSjNGXXQnzD s2CwtggwaQipxazyLjl254Tq4V39L/Wq/VwgQ6M5TCnURzqWPAJFG8HcguqvVt3AxJ5r VwT4R4LFhKxTG+SWF9hxUIbOIM9P8/Lh0aVW0/UAv2yPoXqXbueYKFTs9WLPIBSUKt8M 7EQg== X-Gm-Message-State: APjAAAWp067+VrFUp0yPq6qWEhNZP0uMRh4U0d5rGLWe9xBpVA6xjVwB S3/CA6DEs7p2GYq/tJd7iQY= X-Google-Smtp-Source: APXvYqzShtLgmaG+B9jDL0iSDX6CsD0Eo9dLpUwR8zrNRI1+E9K896EB/1rvX1pZEcwRjyLh8hudJA== X-Received: by 2002:a2e:9d0f:: with SMTP id t15mr5227794lji.171.1581257440474; Sun, 09 Feb 2020 06:10:40 -0800 (PST) Received: from vostro.wlan (dtc5qkyyyyyyyyyyyyx9y-3.rev.dnainternet.fi. [2001:14ba:80b2:d400::4fa]) by smtp.gmail.com with ESMTPSA id y11sm4657403lfc.27.2020.02.09.06.10.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Feb 2020 06:10:40 -0800 (PST) Date: Sun, 9 Feb 2020 16:10:37 +0200 From: Timo Teras To: "A. Wilcox" Cc: adelie-devel@lists.adelielinux.org, ~alpine/apk-tools@lists.alpinelinux.org Subject: Re: Handling cross-architecture installations with package scripts Message-ID: <20200209161033.584ce4c2@vostro.wlan> In-Reply-To: <31e3f4af-bab2-a54f-de37-8bc39a701f46@adelielinux.org> References: <31e3f4af-bab2-a54f-de37-8bc39a701f46@adelielinux.org> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-alpine-linux-musl) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Hi, On Sun, 9 Feb 2020 05:02:07 -0600 "A. Wilcox" wrote: > I'm trying to figure out the best way to handle cross-architecture > installations. Right now, I can create a pretty much bootable RPi 3 > image with KDE using this command: > > apk --arch aarch64 --root /path/to/sdcard -X > https://distfiles.adelielinux.org/adelie/1.0/system -X > https://distfiles.adelielinux.org/adelie/1.0/user --initdb add > adelie-base-posix kde x11 > > However, some packages fail to install properly if the host computer > isn't aarch64. Notably, this includes D-Bus, which needs to generate > a machine ID during installation: > > == user/dbus/dbus.post-install == > > #!/bin/sh > > exec dbus-uuidgen --ensure > > > This doesn't work because dbus-uuidgen is in the SD card root. It is > an ARM binary, not a PowerPC binary as my host system expects. So we > end up with: Exec format error. > > It's possible to pass --no-scripts to apk to avoid the attempted > execution of these scripts, which would then prevent world from being > marked broken on the SD card. This would silently break D-Bus, > though. > > Alternatively, one could set up a oneshot service to run 'apk fix' on > first system boot. My concern is that it would have to pull the apks > off the network, which could be slow or even non-existent. > > As you can see, neither of these options are very appealing. > > Does anyone have any ideas on how we could handle this usage? One > idea I had was to add a --scripts-only flag to apk fix, to avoid > redownload and reinstall of the package and simply re-run any scripts > that have failed execution. > > I suppose some scripts may need to be reworked to handle being called > multiple times, but this shouldn't be a large issue and is probably a > good idea from a correctness perspective anyway. > > However, I'm open to other ideas. Let's discuss! Yes, this is something I've been thinking also a bit earlier. But it's fundamentally an upstream problem if one needs to run the pre/post/trigger script. Of course this is limited to packages needed to be installed form the host on different architecture. Some options are: 1) Try to get rid of these scripts. Perhaps some could be moved to init.d stage. 2) Think if we can make scripts be run on the host instead. That have the cross builder install the same packages on host, and use it's binaries to run on the target root. This would require awareness of the scripts that it should be targetting chroot, and apk awareness of checking host packages. Though, this does not work if upstream has e.g. arch specific format on the data the utilities launced in the script produces. Or if it's trying to dlopen the libraries on the target plugin directory. 3) Have a generic initscript for apk that runs all pending scripts. This will become possible in the new architecture since we will store all scripts in the database in future. Maybe you have additional ideas? Thanks, Timo