You are not logged in.

#1 2020-02-12 09:39:06

theoneyouknow
Member
Registered: 2020-02-11
Posts: 7

[SOLVED] systemd-nspawn problem

Hello.
I am trying to install Arch Linux in container using systemd-nspawn. I was following instructions from sysmemd-nspawn wiki page. I downloaded arch-install-scripts, unzippded it, and next step was to use pacstrap to install Arch in container, so I typed in the following command:

./pacstrap -c ~/ArchContainer/ base

And this is the output I received:

==> Creating install root at /root/ArchContainer/
==> Installing packages to /root/ArchContainer/
unshare: failed to execute pacman: No such file or directory
==> ERROR: Failed to install packages to new root

note - I am currently using Gentoo. I am beginner Linux user so I apologise in advance for lack of my knowledge smile
Could you please tell me what am I doing wrong. Any help is appreciated. Thank you in advance smile

Last edited by theoneyouknow (2020-02-14 20:37:15)

Offline

#2 2020-02-12 14:22:53

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] systemd-nspawn problem

arch-install-scripts depends on pacman for the pacstrap command. You'll need to install pacman.

There is an (old) version of pacman available in the Gentoo portage tree. You could also manually copy my static "pacman" binary available here: https://pkgbuild.com/~eschwartz/repo/x86_64-extracted/

(It is signed by my Trusted User signing key, but you don't yet have a pacman install to verify that my signing key is indeed part of the archlinux-keyring trusted set. I'm not sure how you prefer to solve that chicken-and-egg problem. big_smile You can do some legwork with https://www.archlinux.org/master-keys/ to verify my key has the right Web of Trust relationship, I guess.)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#3 2020-02-12 17:34:09

theoneyouknow
Member
Registered: 2020-02-11
Posts: 7

Re: [SOLVED] systemd-nspawn problem

Thanks, after a bit of research I figured it had to do something with me not having pacman installed.
So I installed pacman from portage tree and again tried pacstrap command, but now I get this:

warning: no 'XferCommand' configured
error: no usable package repositories configured.

I'm trying to find solution on other topics but I haven't managed so far.
Could you point me to what I should configure?
Thank you smile

Offline

#4 2020-02-12 17:38:18

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] systemd-nspawn problem

You'll need an /etc/pacman.conf configured with some suitable repositories, if the portage package does not ship this one: https://git.archlinux.org/svntogit/pack … ges/pacman then it really should...

You'd also want to have the mirrorlist file pointing to at least one mirror, of course. And an archlinux-keyring.

Last edited by eschwartz (2020-02-12 17:40:17)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#5 2020-02-12 18:15:16

theoneyouknow
Member
Registered: 2020-02-11
Posts: 7

Re: [SOLVED] systemd-nspawn problem

I did have pacman.conf, I added necessary lines, made a file containing list of mirrors, and installed archlinux-keyring.
Again tried pacstrap command, now I get this:

==> Creating install root at /root/ArchContainer/
==> Installing packages to /root/ArchContainer/
warning: no 'XferCommand' configured
:: Synchronizing package databases...
error: failed to update core (error invoking external downloader)
error: failed to update extra (error invoking external downloader)
error: failed to update community (error invoking external downloader)
error: failed to synchronize any databases
error: failed to init transaction (error invoking external downloader)
==> ERROR: Failed to install packages to new root

Last edited by theoneyouknow (2020-02-12 18:18:03)

Offline

#6 2020-02-12 19:59:11

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] systemd-nspawn problem

pacman has two methods for downloading files:

  • the internal libcurl downloader

  • the XferCommand configuration setting

The latter is commented out by default in order to use the former. You can uncomment it, or, you can make sure that your pacman program is built with curl enabled.

https://packages.gentoo.org/packages/sys-apps/pacman

I see that the Gentoo package has a "curl" global USE flag, is that enabled on your end? If not, then you'll either need to enable it and re-emerge pacman, or else you'll need to configure a suitable downloader in pacman.conf


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#7 2020-02-12 21:36:55

theoneyouknow
Member
Registered: 2020-02-11
Posts: 7

Re: [SOLVED] systemd-nspawn problem

I re-emerged pacman with "curl" flag enabled and that solved the problem.
But now I accidentally messed up my system. I created multiple folders for Arch container in root folder, and I wanted to remove them and start over, so I wanted to delete recursively all folders for container and files inside them, but I mistyped something, and all that while having root access in terminal, and I deleted everything in root folder so now my system is completely messed up roll

I'm gonna go give myself a few slaps in the face lol and then reinstall gentoo and repeat the whole process
But thank you very much for your help, if I encounter any errors while trying to use pacstrap I will post back smile

Offline

#8 2020-02-13 02:40:48

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] systemd-nspawn problem

Well, uh, two steps back and one step forward???

I'm happy to see that you successfully got pacman up and running, at least. One day I'm sure this will be a funny story for you?

If you had any important data, there are general methods for recovering it, which probably don't work if you've done further filesystem writes.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#9 2020-02-13 16:21:15

theoneyouknow
Member
Registered: 2020-02-11
Posts: 7

Re: [SOLVED] systemd-nspawn problem

Ah, it wasn't that bad, I am running dual boot configuration and I didn't keep any important files on Gentoo, the only hassle was waiting another 12-13 hours to get everything up and running again. Maybe I should make a backup of Gentoo just in case something like this happens again so that I don't have to waste time re-installing it...

Anyway, I tried again, but now I seem to have some problem with keys.

I used pacstrap command and this is what it dumped:
https://privatebin.net/?f2e1b7bef804c0e … zyRCDkH6ku

After a bit of research, I tried running "pacman-key populate archlinux" but than I get error that the keyring file /usr/share/pacman/keyrings/archlinux.gpg does not exist, so I tried again "pacman -S archlinux-keyring", but than I got this:
https://privatebin.net/?22c3a0e5156e902 … ihwwYNB7v1

Offline

#10 2020-02-13 16:39:16

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] systemd-nspawn problem

https://git.archlinux.org/archlinux-keyring.git/
https://git.archlinux.org/svntogit/pack … ux-keyring

You'll want to install this to get a trust store for archlinux -- the alternative is to change /etc/pacman.conf where it says "SigLevel    = Required DatabaseOptional" to no longer require PGP signatures.

Ideally Gentoo would package the keyring and mirrorlist in their portage tree, so you could rely on their having investigated and confirmed the authenticity of these keys. IIRC Fedora does have packages for this...


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#11 2020-02-14 19:09:53

theoneyouknow
Member
Registered: 2020-02-11
Posts: 7

Re: [SOLVED] systemd-nspawn problem

Thanks for the tip, I changed pacman.conf to not require PGP signatures.

However I receive an error when downloading one file, this specifically: gmp-6.1.2-3-x86_64.pkg.tar.xz. Pacman fails to download this file from every mirror I listed, so I tried removing some and adding new mirrors, but same error shows up every time i retry pacstrap command.

Offline

#12 2020-02-14 19:26:03

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,680
Website

Re: [SOLVED] systemd-nspawn problem

Why not just use a bootstrap image instead?

Here's a mini guide I wrote for the Alpine Linux wiki: https://wiki.alpinelinux.org/wiki/Runni … Arch_Linux

That uses arch-chroot(1) to enter the chroot but you can use the manual method instead. And change the download URL to a more recent image.

Offline

#13 2020-02-14 19:27:04

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] systemd-nspawn problem

pactrap normally run -Sy internally to ensure you are always up to date when doing pacstrap. I wonder how you ended up trying to download an old version of gmp -- we updated from 6.1.2 to 6.2.0 approximately 24 hours ago, and the stale file was auto-removed from the mirrors.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#14 2020-02-14 20:34:29

theoneyouknow
Member
Registered: 2020-02-11
Posts: 7

Re: [SOLVED] systemd-nspawn problem

I gave up on trying to use pacstrap and just used Arch bootstrap image as suggested by Head_on_a_Stick.
Now I'm finally able to succesfully boot into Arch container.

Thank you eschwartz and Head_on_a_Stick for your help smile

Offline

Board footer

Powered by FluxBB