Install 32-bit chroot on 64-bit devuan for compiling i386 packages

By accident, I installed 32-bit devuan instead of 64-bit, so all my self-hosted dpkgs didn’t work because they are for x86_64 architecture. So I started trying to compile the dpkgs in the new environment, and one in particular (palemoon) would always exhaust memory.

I found a wonderful reference [1] that explains how to set up a 32-bit chroot on 64-bit debian-based GNU/Linux. I tested my adaptation of the instructions on devuan ceres x86_64.

Install schroot and debootstrap.

sudo apt-get install schroot debootstrap

Set up schroot.

tf=/etc/schroot/chroot.d/ceres32
touch "${tf}" ; chmod 0644 "${tf}"
cat <<EOF >"${tf}"
[ceres32]
description=Devuan ceres 32-bit
directory=/32
type=directory
personality=linux32
users=bgstack15
groups=users,admin
EOF

Install the new distribution.

mkdir /32
debootstrap --arch i386 ceres /32 http://pkgmaster.devuan.org/merged

Now the chroot is minimally viable, but there are a few recommended steps to take before using it.
Symlink in the mtab.

ln -s /proc/mounts /32/etc/mtab

Copy in any system-wide setting as desired.

cp -p /etc/apt/apt.conf /32/etc/apt/      # for proxy settings
cp -p /etc/apt/sources.list /32/etc/apt/  # for universe, security, etc
cp -p /etc/environment /32/etc/           # for proxy and locale settings
cp -p /etc/sudoers /32/etc/               # for custom sudo settings

Disable services in the chroot.

tf=/32/usr/sbin/policy-rc.d
touch "${tf}" ; chmod 0755 "${tf}" ; chown root.root "${tf}" ;
cat <<EOF >"${tf}"
#!/bin/sh
## Don't start any service if running in a chroot.
## See /usr/share/doc/sysv-rc/README.policy-rc.d.gz
if [ "$(stat -c %d:%i /)" != "$(stat -c %d:%i /proc/1/root/.)" ]; then
  exit 101
fi
EOF

Now load up the chroot and prepare a few more packages.

schroot -c ceres32
sudo apt-get update
sudo apt-get install lsb-core

From here, you can install your build dependencies and build i386 dpkgs!

References

Weblinks

  1. Ripped entirely from How do I run 32-bit programs on a 64-bit Debian/Ubuntu? – Unix & Linux Stack Exchange

		
Advertisements

List files in dpkg that is not installed

Ripped directly from dpkg – How do I get a list of installed files from a package? – Ask Ubuntu
To see all the files the package installed onto your system, do this:

dpkg-query -L

To see the files a .deb file will install

dpkg-deb -c

To see the files contained in a package NOT installed, do this once (if you haven’t installed apt-file already:

sudo apt-get install apt-file
sudo apt-file update

then

apt-file list

Fixing problem Repository ceres InRelease changed its Label value from Master to Devuan

tl;dr

rm /var/lib/apt/lists/*

The fix

If you encounter an error that resembles the following, on Devuan GNU/Linux, there is a fix for it!

# sudo apt-get update
Reading package lists... Done
E: Repository 'http://packages.roundr.devuan.org/merged ceres InRelease' changed its 'Label' value from 'Master' to 'Devuan'
N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details.

There’s a new label in use, it seems. Big deal, except for the fact you can’t really get around it. The apt-secure(8) page does not seem to provide any answers.

To view the current labels for the enabled repos:

# apt policy
Package files:
 100 /var/lib/dpkg/status
     release a=now
 500 http://packages.devuan.org/merged ceres/non-free i386 Packages
     release v=1.0.0,o=Devuan,a=unstable,n=ceres,l=Master,c=non-free,b=i386
     origin packages.devuan.org
 500 http://packages.devuan.org/merged ceres/contrib i386 Packages
     release v=1.0.0,o=Devuan,a=unstable,n=ceres,l=Master,c=contrib,b=i386
     origin packages.devuan.org
 500 http://packages.devuan.org/merged ceres/main i386 Packages
     release v=1.0.0,o=Devuan,a=unstable,n=ceres,l=Master,c=main,b=i386
     origin packages.devuan.org
Pinned packages:

The fix is to remove the cached lists for the repositories and fetch it all again.

rm /var/lib/apt/lists/*

That’s all there is to it! Then run apt-get update again, and you’re back on your way.

References

Weblinks

  1. man page apt_preferences(5)

Local resources

  1. bash autocomplete for apt and apt-get

Unattended software updates on Devuan

Devuan, as a fork of debian that uses sysvinit (or another– your choice), still uses debian-based utilities. I come from the Fedora/Red Hat/CentOS rpm-based family of distributions, and I struggle with the dpkg-based package management on occasion.

I really dislike how the software upgrades will sometimes pause in the middle, to display the changelog. If I wanted a changelog, I’d go read it! When I issue a command to update packages, I want to walk away, and come back, and it be done, not get stuck at 20% because openssh changed some defaults and wants to tell me. It emails me anyway! I find the defaults of apt-get to be not sane.

Here is how to configure apt-get to run without pausing to display duplicate information or ask you questions.

export DEBIAN_FRONTEND=noninteractive
apt-get -q -y upgrade

References

Weblinks

  1. https://obviate.io/2008/12/04/truly-non-interactive-unattended-apt-get-install/