ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6228
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Easily run 64-bit Debian Buster packages on a Raspbian system: new RPi4 / RPi3 image released (systemd-nspawn, LXDE)

Wed Nov 20, 2019 9:22 am

jahboater wrote:
Wed Nov 20, 2019 8:11 am
I use:

Code: Select all

dpkg --print-architecture
in a makefile, which prints the user space architecture.
The problem is usually other software that you have no control over. Chromium, for example, will fail to build without setarch and finding every spot they incorrectly try to determine the architecture can be too tedious. Dpkg is rarely used because that will only work on debian derivatives.

In most cases, the best thing to do is to rely on the compiler defaults and provide configure flags where appropriate. Then things either just work and cause the least headaches.

jahboater
Posts: 5646
Joined: Wed Feb 04, 2015 6:38 pm
Location: West Dorset

Re: Easily run 64-bit Debian Buster packages on a Raspbian system: new RPi4 / RPi3 image released (systemd-nspawn, LXDE)

Wed Nov 20, 2019 9:45 am

ShiftPlusOne wrote:
Wed Nov 20, 2019 9:22 am
In most cases, the best thing to do is to rely on the compiler defaults and provide configure flags where appropriate. Then things either just work and cause the least headaches.
Yes, -march=native etc work well nowadays.
The only special flag needed for aarch64 is

-mcmodel=tiny

for programs with executable size less than 1MB, it produces vastly better code!
I don't know why its not the default.

User avatar
Botspot
Posts: 1240
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Website

Re: Easily run 64-bit Debian Buster packages on a Raspbian system: new RPi4 / RPi3 image released (systemd-nspawn, LXDE)

Wed Nov 20, 2019 5:34 pm

For a better and more seamless user experience, I suggest that as well as /home/pi being synchronized, /usr/share/themes and /usr/share/icons be synced as well. That way the icons, theme, and mouse pointer will look more familiar, instead of like this:
2019-11-20-112641_1280x1024_scrot.png
2019-11-20-112641_1280x1024_scrot.png (6.17 KiB) Viewed 5731 times
Want to make your own Raspbian image?
  • Hard way: Mess with confusing terminal commands.
  • Easy way: Let Pi-Power-Tools do it all for you!
Boot your image in a VM, Flash from the Internet at top speed, Mount (to drop files in), Edit partitions, Shrink/Expand, Repair, and more. Enjoy! :)
https://github.com/Botspot/Pi-Power-Tools

User avatar
MikeDB
Posts: 167
Joined: Sun Oct 12, 2014 8:27 am

Re: Easily run 64-bit Debian Buster packages on a Raspbian system: new RPi4 / RPi3 image released (systemd-nspawn, LXDE)

Wed Nov 27, 2019 11:56 am

davidcoton wrote:
Sat Nov 16, 2019 10:20 am
Remember Pi is a teaching computer, so showing the right way is better than hidden automagic when it comes to tasks that users need to learn.
I doubt teaching is its primary use nowadays so I vote for 'hidden automagic' that just works. I haven't got time to go chasing fixes to problems, just need something that works so I can focus all my time on the application I'm being paid to develop.
Will the forthcoming MIDI-2 spec at last allow us to set the volume to 11 !!

User avatar
Botspot
Posts: 1240
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Website

Re: Easily run 64-bit Debian Buster packages on a Raspbian system: new RPi4 / RPi3 image released (systemd-nspawn, LXDE)

Wed Nov 27, 2019 2:38 pm

A couple problems with synchronizing (mounting) /home/pi to the container's /home/pi:
  • .bash_history. It makes sense for the host and the guest to have separate bash histories. That way, there won't be commands listed as if they were ran in the 64-bit terminal, when actually they never were.
  • .config/. Syncing the config directory is usually desirable, but I found one time that it wasn't. Chromium. I have chromium installed in both the host and the guest. I would have liked both to run at once, but due to sharing the same config directory, they can't do that.
    8d0d3cead13ac677aad0a44431973f8b3108ea3d.png
    8d0d3cead13ac677aad0a44431973f8b3108ea3d.png (13.37 KiB) Viewed 5605 times
    Then it happened. Chromium (64-bit) got an upgrade. Now two completely different versions of Chromium shared the same config directory. Sure enough, the new chromium version interfered with the older 32-bit one, causing it to forget all my passwords and cookies every time it started. I had to uninstall chromium 64-bit, and then salvage an undamaged config directory from an older SD card.
Sakaki, would it be possible to exclude certain files and directories from being synchronized from host to guest, while allowing the rest of /home/pi to remain synced?
Want to make your own Raspbian image?
  • Hard way: Mess with confusing terminal commands.
  • Easy way: Let Pi-Power-Tools do it all for you!
Boot your image in a VM, Flash from the Internet at top speed, Mount (to drop files in), Edit partitions, Shrink/Expand, Repair, and more. Enjoy! :)
https://github.com/Botspot/Pi-Power-Tools

andrum99
Posts: 1191
Joined: Fri Jul 20, 2012 2:41 pm

Re: Easily run 64-bit Debian Buster packages on a Raspbian system: new RPi4 / RPi3 image released (systemd-nspawn, LXDE)

Wed Nov 27, 2019 3:26 pm

Botspot wrote:
Wed Nov 27, 2019 2:38 pm
A couple problems with synchronizing (mounting) /home/pi to the container's /home/pi:
  • .config/. Syncing the config directory is usually desirable, but I found one time that it wasn't. Chromium. I have chromium installed in both the host and the guest. I would have liked both to run at once, but due to sharing the same config directory, they can't do that.
There are two possible solutions as I see it:

1. Go in and edit the configuration of the 64-bit Chromium to look for its profile in a different directory.

2. Separate home directory in the container.

2 would be simpler, although it would still be desirable to have the host's /home tree available somewhere as well. Alternatively, just don't run the same app in the host and container.

User avatar
sakaki
Posts: 543
Joined: Sun Jul 16, 2017 1:11 pm

Re: Easily run 64-bit Debian Buster packages on a Raspbian system: new RPi4 / RPi3 image released (systemd-nspawn, LXDE)

Mon Dec 02, 2019 1:37 am

Botspot wrote:
Wed Nov 27, 2019 2:38 pm
Sakaki, would it be possible to exclude certain files and directories from being synchronized from host to guest, while allowing the rest of /home/pi to remain synced?
Since the container starts in its own mount namespace, it would be possible to bind mount a new .config directory inside the guest container, without this propagating to the host, yes. In fact, this is essentially how the filesystem protection in tools such as firejail works.

Whether or not this should be the default approach (or just worked around for those who are affected by particular apps) is up for discussion.

Best, sakaki

User avatar
Botspot
Posts: 1240
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Website

Re: Easily run 64-bit Debian Buster packages on a Raspbian system: new RPi4 / RPi3 image released (systemd-nspawn, LXDE)

Mon Dec 02, 2019 3:00 pm

sakaki wrote:
Mon Dec 02, 2019 1:37 am
Botspot wrote:
Wed Nov 27, 2019 2:38 pm
Sakaki, would it be possible to exclude certain files and directories from being synchronized from host to guest, while allowing the rest of /home/pi to remain synced?
Since the container starts in its own mount namespace, it would be possible to bind mount a new .config directory inside the guest container, without this propagating to the host, yes. In fact, this is essentially how the filesystem protection in tools such as firejail works.

Whether or not this should be the default approach (or just worked around for those who are affected by particular apps) is up for discussion.

Best, sakaki
One example of a file that should not be bound is ~.bash_history. That way users can see which commands they've ran in the 64-bit container, and which ones they've ran in Raspbian, instead of them both being 'mashed together'.

Also, I have had trouble opening chromium-browser after installing libreoffice in the 64-bit container. Attempting to run chromium-browser in the raspbian terminal fails with a segmentation fault. I haven't narrowed down exactly what's causing it, but chromium-browser worked OK again after purging raspbian-nspawn-64 and then deleting the whole ~.config/ folder. I plan to narrow down exactly what is causing this.
Want to make your own Raspbian image?
  • Hard way: Mess with confusing terminal commands.
  • Easy way: Let Pi-Power-Tools do it all for you!
Boot your image in a VM, Flash from the Internet at top speed, Mount (to drop files in), Edit partitions, Shrink/Expand, Repair, and more. Enjoy! :)
https://github.com/Botspot/Pi-Power-Tools

User avatar
sakaki
Posts: 543
Joined: Sun Jul 16, 2017 1:11 pm

Re: Easily run 64-bit Debian Buster packages on a Raspbian system: new RPi4 / RPi3 image released (systemd-nspawn, LXDE)

Sat Dec 14, 2019 6:07 pm

All,

just a friendly reminder that today is the deadline for any feedback on the test raspbian-nspawn-64 deb.

Best, sakaki

andrum99
Posts: 1191
Joined: Fri Jul 20, 2012 2:41 pm

Re: Easily run 64-bit Debian Buster packages on a Raspbian system: new RPi4 / RPi3 image released (systemd-nspawn, LXDE)

Thu Feb 13, 2020 11:42 pm

I was unable to get this working on the latest Raspbian version (2020-02-05) - the service failed to start. Also, are we to assume to that this functionality is about to be integrated into Raspbian?

User avatar
Botspot
Posts: 1240
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Website

Re: Easily run 64-bit Debian Buster packages on a Raspbian system: new RPi4 / RPi3 image released (systemd-nspawn, LXDE)

Thu Feb 13, 2020 11:45 pm

Please, some sort of bind editor. I uninstalled raspbian-nspawn-64 because it kept corrupting my config files.
Want to make your own Raspbian image?
  • Hard way: Mess with confusing terminal commands.
  • Easy way: Let Pi-Power-Tools do it all for you!
Boot your image in a VM, Flash from the Internet at top speed, Mount (to drop files in), Edit partitions, Shrink/Expand, Repair, and more. Enjoy! :)
https://github.com/Botspot/Pi-Power-Tools

User avatar
sakaki
Posts: 543
Joined: Sun Jul 16, 2017 1:11 pm

Re: Easily run 64-bit Debian Buster packages on a Raspbian system: new RPi4 / RPi3 image released (systemd-nspawn, LXDE)

Sat Feb 15, 2020 6:44 pm

andrum99 wrote:
Thu Feb 13, 2020 11:42 pm
I was unable to get this working on the latest Raspbian version (2020-02-05) - the service failed to start. Also, are we to assume to that this functionality is about to be integrated into Raspbian?
So, I've just done a fresh Raspbian install (of the 2020-02-13 "with desktop" image, SHA-256:
a82ed4139dfad31c3167e60e943bcbe28c404d1858f4713efe5530c08a419f50)
, installed raspbian-nspawn-64 from the deb (per my earlier instructions), and it all appears to work fine (4GB RPi4B).

Are you sure you have a 64-bit kernel running (check you get aarch64 reported from uname -m)?

Incidentally, I have a new version in the works that will hopefully be released (as a deb) in the next week or so.

Once this has been smoke-tested the next steps will be up to ShiftPlusOne, but he has indicated previously that this package could be migrated into the official repo, for convenience. It won't be officially supported though, so not "integrated into Raspbian" as such.
Botspot wrote:
Thu Feb 13, 2020 11:45 pm
Please, some sort of bind editor. I uninstalled raspbian-nspawn-64 because it kept corrupting my config files.
Do you mean some way of specifying which directories get bind mounted into spawned 64-bit container?

andrum99
Posts: 1191
Joined: Fri Jul 20, 2012 2:41 pm

Re: Easily run 64-bit Debian Buster packages on a Raspbian system: new RPi4 / RPi3 image released (systemd-nspawn, LXDE)

Sat Feb 15, 2020 6:48 pm

Ah. Apologies - I suspect I have forgotten to switch to the 64-bit kernel. My mistake. That's really good news that it was just my mistake actually, as I was worried I would no longer be build ZFS modules for my main Pi 4B.

Sorry!

User avatar
sakaki
Posts: 543
Joined: Sun Jul 16, 2017 1:11 pm

Re: Easily run 64-bit Debian Buster packages on a Raspbian system: new RPi4 / RPi3 image released (systemd-nspawn, LXDE)

Sat Feb 15, 2020 6:56 pm

No worries ^-^

Incidentally, the forthcoming version shows a zenity error dialog if it cannot start due to the running kernel being 32-bit, not 64-bit (and also offers to edit /boot/config.txt for you if necessary, to set arm_64bit=1, during the install phase).

andrum99
Posts: 1191
Joined: Fri Jul 20, 2012 2:41 pm

Re: Easily run 64-bit Debian Buster packages on a Raspbian system: new RPi4 / RPi3 image released (systemd-nspawn, LXDE)

Sat Feb 15, 2020 10:28 pm

Confirmed - I forgot to add arm_64bit=1 to /boot/config.txt then reboot before trying the container. :oops:

Thank you for all your work on this - I think this will be a great addition to Raspbian. I'm guessing if it does get added to the official repo, as expected, that you will remain responsible as package maintainer, in a similar way to how Kodi is currently handled?

User avatar
sakaki
Posts: 543
Joined: Sun Jul 16, 2017 1:11 pm

Re: Easily run 64-bit Debian Buster packages on a Raspbian system: new RPi4 / RPi3 image released (systemd-nspawn, LXDE)

Thu Feb 20, 2020 1:22 pm

Call for testing: new (v1.4.7) version of raspbian-nspawn-64 deb package

Hello,

I have packaged up a new (v1.4.7) version of raspbian-nspawn-64 as a deb*, so that it may be installed on an existing vanilla Raspbian system, just like any other regular package (rather than having to start with my custom image from GitHub). As before, this deb is available for testing (served from my own repo), and may be installed by following the instructions below.

The plan is that once any last issues have been ironed out, the deb will then been migrated (courtesy of ShiftPlusOne) into the official Raspbian repository (thus providing an easy interim solution for users looking to run 64-bit apps within the familiar 32-bit Raspbian userland and desktop). (@andrum99 to your question, I guess I will remain the maintainer for this - there's certainly no expectation that RPi engineers will or should be called on to supply any formal support for it.)

This update addresses some issues picked up by users on the prior (v1.3.1) release (many thanks to everyone who provided feedback!), and is hopefully a fairly final candidate for migration.


If you would like to try this out, you'll need a RPi3B, RPi3B+ or RPi4B running the standard Raspbian OS (one of the "with desktop" variants - although the package can also be used with the "lite" image too - see endnotes), with functioning networking etc.

Begin by ensuring that everything on your Raspbian system is up-to-date :

Code: Select all

pi@raspberrypi:~ $ sudo apt-get update
pi@raspberrypi:~ $ sudo apt-get -y upgrade
Next, make sure you have an (official) 64-bit kernel available in your bootfs:

Code: Select all

pi@raspberrypi:~ $ ls /boot/kernel*.img
kernel.img kernel7.img kernel7l.img kernel8.img
The important thing to check, is that there's a kernel8.img in the output of the above command (this is the official 64-bit kernel).

Assuming this is present, next, if you haven't already, specify that it should be used, and then reboot to take up the change:

Code: Select all

pi@raspberrypi:~ $ echo "arm_64bit=1" | sudo tee -a /boot/config.txt
pi@raspberrypi:~ $ sudo systemctl reboot
When your system comes back up, you will be running a 64-bit kernel, 32-bit Raspbian userland system. Check everything still works as expected.

Once done, (if you haven't already) add my custom deb repository, and update your metadata to reflect this:

Code: Select all

pi@raspberrypi:~ $ echo "deb http://isshoni.org/repo/ /" | sudo tee /etc/apt/sources.list.d/isshoni.list
pi@raspberrypi:~ $ wget -q -O - https://isshoni.org/repo/KEY.gpg | sudo apt-key add -
pi@raspberrypi:~ $ sudo apt-get update
That's a capital Oh, not a zero, in the wget invocation above. Don't forget the hyphens either ^-^

Now you can install the package! Just issue:

Code: Select all

pi@raspberrypi:~ $ sudo apt-get install -y raspbian-nspawn-64
This will pull in and install the debian-buster-64 dependency package (a vanilla arm64 Debian Buster guest rootfs for systemd-nspawn originally created via debootstrap) together with the raspbian-nspawn-64 (host-side tools and services) package itself, plus any additional deps required by your system.

Once the installation is complete you can immediately start using your new 64-bit guest system, exactly as you could with the original standalone image (there's no need to reboot first)!

Image

Should you at some point in the future want to remove the raspbian-nspawn-64 system, simply issue:

Code: Select all

pi@raspberrypi:~ $ sudo apt-get purge -y raspbian-nspawn-64 debian-buster-64
Note that this will permanently erase any content or packages you may have installed inside the 64-bit guest filesystem (if you want to keep those around instead, use the "remove" rather than "purge" verb in the above).

Have fun, and please report any issues you find (either in this thread, or via email to sakaki@deciban.com). I'm aiming to lock off a final version by end February 2020.

Changes in this Release

Some of the main changes for this (v1.4.7) wrt the previous (v1.3.1) release are:
  • Using debconf, the raspbian-nspawn-64 package will now prompt to set arm_64bit=1 for you in /boot/config.txt, if not running under an aarch64 kernel at the time of install, and this setting does not appear already to be present in that file. (In such a case, you'll still need to reboot, once the package installation has completed, to start using your new 64-bit kernel of course.)
  • On a similar note, menu commands like System Tools -> Run 64-bit Program... will now display an error dialog if attempted while running a 32-bit kernel (they used to just fail silently).
  • Graphical (host-side) dependencies have been moved to Recommends:, allowing the package to be installed on a 'lite' (CLI-only) Raspbian system, without pulling in stuff you don't want (NB for such a case, you'll need to use apt-get install --no-install-recommends raspbian-nspawn-64). This should have no effect on users installing onto a 'with desktop' system normally (who, for avoidance of doubt, should not use the --no-install-recommends qualifier when installing). NB at the CLI, you can use ds64-shell to enter a 64-bit container shell; Ctrl-d to exit back to the 32-bit shell again.
  • On a similar note, the various underlying commands (ds64-runner etc.) will not use zenity to display dialog boxes if this package is not installed (or the GUI isn't running), falling back to console output in this case.
  • The underlying 64-bit Debian Buster image deb (debian-buster-64) has been updated to a version debootstrapped on 19 Feb 2020.
  • I have left the Debian metadata in the debian-buster-64 image this time (since the most common issue I got emailed about was people not remembering to sudo apt-get update in the 64-bit shell, before trying to install new packages there - this way, while you may still need to update if it has become stale wrt certain packages, at least there's a helpful prompt to tell you that).
  • Added a mechanism to automatically bind mount 'shadow' copies of top-level dot-files and dot-directories for regular users, where an appropriate 'doppelganger' is provided. Specifically, for any (normal) file or directory ~/.foo, if a 'shadow' ~/.foo-debian-buster-64 is present, this will be automatically be bind mounted over the original inside the container only. No graphical editor for this is currently provided; however, it does allow for easy solution of the following (e.g.):
    • To work around the issue where e.g. Chromium has different format ~/.config/... entries in the 32-bit host and 64-bit container, create the directory ~/.config-debian-buster-64 - this will then be used as ~/.config within the 64-bit container context only. (NB - the automatic bind mounts only happen at container startup, so you may need to reboot your system, or use System Tools -> Stop 64-bit Container followed by System Tools -> Start 64-bit container to have your change 'take'.)
    • To have a separate 32-bit and 64-bit bash history, create the file ~/.bash_history-debian-buster-64 - this will then be used as ~/.bash_history within the 64-bit container context only. (Again, changes are applied at container startup.)
Thanks again to ShiftPlusOne for his assistance / pointers on the Debian packaging process!

Best, sakaki

* Actually, and just as before, two debs: the client-side image debian-buster-64, and the host-side integration package raspbian-nspawn-64. The former is a dependency of the latter and so pulled in automatically when the latter is installed.

bmscmoreira
Posts: 23
Joined: Sat Feb 22, 2020 8:09 pm

Re: Easily run 64-bit Debian Buster packages on a Raspbian system: new RPi4 / RPi3 image released (systemd-nspawn, LXDE)

Mon Feb 24, 2020 9:18 pm

Dear sakaki, first of all, thank you for all the great work into making this for mere mortals use. In my case, intending to use my pi4B-4GB as development web-server with docker.

Given that, I tried installing docker in the 64bit guest OS, using the Terminal (64-bit) and following the official instructions at https://docs.docker.com/install/linux/docker-ce/debian/ under Install Docker Engine - Community > Install using the repository > Arm64.

During install, after issuing the command:

Code: Select all

$ sudo apt-get install docker-ce docker-ce-cli containerd.io
everything works well until I see some errors appearing on the terminal:

Code: Select all

Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xe" for details.
invoke-rc.d: initscript docker, action "start" failed.
docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Mon 2020-02-24 21:07:32 WET; 15ms ago
Docs: https://docs.docker.com
Process: 3115 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
Main PID: 3115 (code=exited, status=1/FAILURE)
dpkg: error processing package docker-ce (--configure):
 installed docker-ce package post-installation script subprocess returned error exit status 1
 
 (...)
 
Errors were encountered while processing:
docker-ce
E: Sub-process /usr/bin/dpkg returned an error code (1)
Then I issue:

Code: Select all

pi@debian-buster-64:~ $ sudo docker run hello-world
and get:

Code: Select all

docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
Question is: is this way of installing docker incompatible with this 32+64bit Raspbian environment? Should I have installed Docker using the regular 32bit terminal? I would like to run docker (and docker-compose) and be able to deploy arm64 containers, for building a webserver, and being able to access that server in 32bit localhost.

Thanks once again for the great work and for your time.

bmscmoreira
Posts: 23
Joined: Sat Feb 22, 2020 8:09 pm

Re: Easily run 64-bit Debian Buster packages on a Raspbian system: new RPi4 / RPi3 image released (systemd-nspawn, LXDE)

Mon Feb 24, 2020 9:51 pm

I've run

Code: Select all

sudo dockerd --debug
and got

Code: Select all

ERRO[2020-02-24T21:47:47.808074890Z] 'overlay' not found as a supported filesystem on this host. Please ensure kernel is new enough and has overlay support loaded.  storage-driver=overlay2
ERRO[2020-02-24T21:47:47.817852676Z] AUFS was not found in /proc/filesystems       storage-driver=aufs
ERRO[2020-02-24T21:47:47.827198412Z] 'overlay' not found as a supported filesystem on this host. Please ensure kernel is new enough and has overlay support loaded.  storage-driver=overlay
DEBU[2020-02-24T21:47:47.857405182Z] Initialized graph driver vfs                 
WARN[2020-02-24T21:47:47.867200616Z] Your kernel does not support swap memory limit 
WARN[2020-02-24T21:47:47.867342762Z] Your kernel does not support cgroup cfs period 
WARN[2020-02-24T21:47:47.867572018Z] Your kernel does not support cgroup cfs quotas 
WARN[2020-02-24T21:47:47.867705312Z] Your kernel does not support cgroup rt period 
WARN[2020-02-24T21:47:47.867780459Z] Your kernel does not support cgroup rt runtime 
so I guess the kernel doesn't support running docker in this way.

User avatar
sakaki
Posts: 543
Joined: Sun Jul 16, 2017 1:11 pm

Re: Easily run 64-bit Debian Buster packages on a Raspbian system: new RPi4 / RPi3 image released (systemd-nspawn, LXDE)

Tue Feb 25, 2020 11:34 am

bmscmoreira,

the good news is that you can run docker inside a 64-bit nspawn container ^-^ ... for example:

Image

Getting this to work requires some modifications to the container and other system changes. The following is based on these notes plus a few additional points.

First (working as your regular pi user at a normal 32-bit terminal), modify the container configuration, so the cgroup namespace is accessible (this will increase the attack surface of course):

Code: Select all

pi@raspberrypi:~ $ sudo nano -w /etc/systemd/nspawn/debian-buster-64.nspawn
and, per the Arch wiki entry linked above, modify that file so it reads:

Code: Select all

[Exec]
PrivateUsers=no
#Capability=CAP_NET_ADMIN
# required for docker
Capability=all
SystemCallFilter=add_key keyctl

[Files]
Bind=/home
Bind=/run/user:/run/host-user/
BindReadOnly=/etc/resolv.conf
# required for docker
Bind=/sys/fs/cgroup

[Network]
Private=no
VirtualEthernet=no
Save, and exit nano.

Next, create an additional drop-in snippet for the container service, thus:

Code: Select all

pi@raspberrypi:~ $ sudo systemctl edit systemd-nspawn@debian-buster-64
and in the new file that opens, enter:

Code: Select all

[Service]
Environment=SYSTEMD_NSPAWN_USE_CGNS=0
Save, and exit the editor.

Running docker requires a few kernel modules to be loaded, but (for good reasons!) nspawn containers can't modprobe, so we need to set these up to be autoloaded by the host. Issue:

Code: Select all

pi@raspberrypi:~ $ sudo nano -w /etc/modules
and append to that file:

Code: Select all

overlay
bridge
br_netfilter
Leave the rest of the file as-is. Save, and exit nano.

Lastly, we also need to ensure (at least) IPv4 forwarding is turned on in the kernel. Again, we need to arrange this outside the container. To do this persistently, issue:

Code: Select all

pi@raspberrypi:~ $ sudo nano -w /etc/sysctl.conf
and uncomment the following line, so it reads:

Code: Select all

net.ipv4.ip_forward=1
Leave the rest of the file as-is. Save, and exit nano.

Restart your RPi. If you enter the container (64-bit) shell, you should hopefully find that e.g.

Code: Select all

pi@debian-buster-64:~ $ sudo docker run hello-world
now works (as per the screenshot above).

hth,

sakaki

PS: the above assumes you have docker installed in the 64-bit container already, as you appear to do. For others coming to this fresh, installation instructions for docker (requires adding a custom repo via the 64-bit shell) may be found here.

bmscmoreira
Posts: 23
Joined: Sat Feb 22, 2020 8:09 pm

Re: Easily run 64-bit Debian Buster packages on a Raspbian system: new RPi4 / RPi3 image released (systemd-nspawn, LXDE)

Tue Feb 25, 2020 5:01 pm

Thank you for the detailed explanation and guidelines. It worked perfectly!

User avatar
Botspot
Posts: 1240
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Website

Re: Easily run 64-bit Debian Buster packages on a Raspbian system: new RPi4 / RPi3 image released (systemd-nspawn, LXDE)

Sat Feb 29, 2020 12:18 am

I believe I have found how to reproduce a weird error. I'd be interested if anyone else experiences the same thing by repeating the below steps:
  1. Install a fresh raspbian-nspawn-64. (follow Sakaki's instructions) Be sure to reboot.
  2. Run 64-bit Firefox ESR, then close it.
  3. Close any instances of 32-bit Chromium.
  4. Run chromium-browser in the terminal.
  5. I got a Segmentation Fault.
Note: I did not install Chromium 64-bit in the container, so how this happens evades me.

Upon trial and error, I discovered that deleting /home/pi/.cache/fontconfig fixes the problem and then chromium will open properly. :?

I have no clue why/how this happens, but need to know if this is limited to my customized Raspbian, or is a universal bug.
Want to make your own Raspbian image?
  • Hard way: Mess with confusing terminal commands.
  • Easy way: Let Pi-Power-Tools do it all for you!
Boot your image in a VM, Flash from the Internet at top speed, Mount (to drop files in), Edit partitions, Shrink/Expand, Repair, and more. Enjoy! :)
https://github.com/Botspot/Pi-Power-Tools

User avatar
sakaki
Posts: 543
Joined: Sun Jul 16, 2017 1:11 pm

Re: Easily run 64-bit Debian Buster packages on a Raspbian system: new RPi4 / RPi3 image released (systemd-nspawn, LXDE)

Sat Feb 29, 2020 3:41 pm

Hi Botspot,

So, I have just tried this, installing basis a fresh copy of Raspbian (2020-02-13 "with desktop" image, SHA-256:
a82ed4139dfad31c3167e60e943bcbe28c404d1858f4713efe5530c08a419f50)
, followed your sequence and all seems to work fine (i.e., no segfault).

I then tried other combinations of e.g. opening 32-bit Chromium and 64-bit Firefox ESR at the same time, one after the other etc., RPi3B+ instead of RPi4B etc., but I still could not trigger the segfault you mentioned. For avoidance of doubt, I was using a shared ~/.config (and not an auto-bind-mounted shadow copy, as the latest raspbian-nspawn-64 now allows) in the container for these tests.

Perhaps you could check your findings on a 'vanilla' image like the above and see if they still occur your end? If not, then probably something specific to your setup.

hth, sakaki

User avatar
sakaki
Posts: 543
Joined: Sun Jul 16, 2017 1:11 pm

Re: Easily run 64-bit Debian Buster packages on a Raspbian system: new RPi4 / RPi3 image released (systemd-nspawn, LXDE)

Tue Mar 03, 2020 6:36 pm

raspbian-nspawn-64 is now installable from the official Raspbian repo!

Hello,

Thanks to ShiftPlusOne, the raspbian-nspawn-64 package (*) has just been migrated to the official Raspbian repo! That means it can now easily be installed, just like any other package, without having to make changes to /etc/apt/sources.list.d etc.

Please note: although it is now in the official repo, this package is not maintained by RPi engineers, so please don't ask them for support regarding it. Instead, please direct any such questions to me, either by posting in this thread, or by email, to sakaki@deciban.com

NB: if you have been using my custom repo previously (and, for avoidance of doubt, this won't apply to you if you are coming to this topic fresh), then you should instead follow the instructions given at the bottom of this post. Otherwise, please read on.

So now, to install, first simply run:

Code: Select all

pi@raspberrypi:~ $ sudo apt-get update
pi@raspberrypi:~ $ sudo apt-get -y upgrade
to ensure your system is fully up-to-date (rebooting if directed).

Once that's out of the way, simply issue:

Code: Select all

pi@raspberrypi:~ $ sudo apt-get install -y raspbian-nspawn-64
to install!

Then:
  • If you are not currently using the (official) 64-bit kernel, you'll be prompted whether to enable this during the install process (say yes!) and prompted again to reboot, once the install is complete, to begin using it (and raspbian-nspawn-64!).
  • If, on the other hand, you are already using the 64-bit kernel, you can start using raspbian-nspawn-64 immediately the installation completes (no need to reboot).
In either case you can now use the 64-bit container:

Image

Note that you can enter a 64-bit shell at the command line via the ds64-shell command; you don't have to use the GUI menu item as above; this can be handy when e.g. ssh-ing in:

Code: Select all

pi@raspberrypi:~ $ ds64-shell
pi@debian-buster-64:~ $
Ctrl-d will take you back to a 32-bit shell again.

Should you at some point in the future want to remove the raspbian-nspawn-64 system, simply issue:

Code: Select all

pi@raspberrypi:~ $ sudo apt-get purge -y raspbian-nspawn-64 debian-buster-64
Note that this will permanently erase any content or packages you may have installed inside the 64-bit guest filesystem (if you want to keep those around instead, use the "remove" rather than "purge" verb in the above).

Have fun!

Instructions for those previously using my custom isshoni.org repo

If you have, following the instructions earlier in this thread, previously installed this package from my custom (isshoni.org) repo, you need to follow a slightly different procedure.

NB: for avoidance of doubt, if you are coming to this post 'fresh' you don't need to follow these instructions, but should instead follow the main flow, above.

Issue:

Code: Select all

pi@raspberrypi:~ $ sudo apt-get remove -y raspbian-nspawn-64 debian-buster-64
pi@raspberrypi:~ $ sudo rm -f /etc/apt/sources.list.d/isshoni.list
pi@raspberrypi:~ $ sudo apt-key del DDE76CEA
pi@raspberrypi:~ $ sudo apt-get update
pi@raspberrypi:~ $ sudo apt-get -y upgrade
Once complete, reboot if prompted, then:

Code: Select all

pi@raspberrypi:~ $ sudo apt-get install -y raspbian-nspawn-64
Best, sakaki

* Actually, and just as before, two debs: the client-side image debian-buster-64, and the host-side integration package raspbian-nspawn-64. The former is a dependency of the latter and so pulled in automatically when the latter is installed.
Last edited by sakaki on Thu Mar 12, 2020 5:16 pm, edited 1 time in total.

TamaTamaGoGo
Posts: 45
Joined: Tue Dec 24, 2019 5:54 am
Location: Japan
Contact: Website Twitter

Re: Easily run 64-bit Debian Buster packages on a Raspbian system: new RPi4 / RPi3 image released (systemd-nspawn, LXDE)

Sat Mar 07, 2020 5:11 am

Is the
  • Raspi4B+ RAM4GB
  • using Raspbian Buster OS
  • Overclocking CPU frequency 1.75GHz. GPU frequency 600, overvoltage=3.
#overclock script
arm_freq=1750
gpu_freq=600
core_freq=600
force_turbo=1
gpu_freq_min=500
over_voltage=3
  • Total free RAM 3.5GB
  • already done sudo apt dist-upgrade
is possible to use it?

P.S.
I already done this command

Code: Select all

 pi@raspberrypi:~ $ sudo apt-get update && sudo apt-get install -y debian-buster-64 
But, it doesn’t work

Code: Select all

 s64-runner
..........

Have a great times! ,TamaTamaGoGo
Hello!
I am TamaTama.
I am Japanese, so I am not good at English. :|
Check my raspi site. :D
https://tamatechraspi.tech.blog
I am making a script of Minecraft for rasbian buster.
Search “MCPi” at forums!

User avatar
sakaki
Posts: 543
Joined: Sun Jul 16, 2017 1:11 pm

Re: Easily run 64-bit Debian Buster packages on a Raspbian system: new RPi4 / RPi3 image released (systemd-nspawn, LXDE)

Sat Mar 07, 2020 8:43 am

TamaTamaGoGo,

ah, apologies ><, that was a typo on one of my GitHub pages; you actually need to issue:

Code: Select all

pi@raspberrypi:~ $ sudo apt-get update && sudo apt-get install -y raspbian-nspawn-64
to install the package. At the moment, you only have debian-buster-64 (the guest OS image) installed.

best, sakaki

Return to “General discussion”