alibaba/cloud-kernel

A question about systemd-nspawn

eive001 opened this issue · 0 comments

I'm having some problems with systemd-nspawn and I'm not sure if I should report it here. If it shouldn't appear here, please close it

System Information

lsb_release -a

LSB Version:    :core-4.1-amd64:core-4.1-noarch

Distributor ID: AlibabaCloud

Description:    Alibaba Cloud Linux release 3 (Soaring Falcon) 

Release:        3

Codename:       SoaringFalcon

Problem Description

  1. Download an archlinux image file
  2. Extract the image file with the tar command
  3. Start the image file with systemd-nspawn
  4. Executing pacman-key --init in this container results in an error

like this

➜  img curl -f --remote-name-all https://archive.archlinux.org/iso/2022.06.01/archlinux-bootstrap-2022.06.01-x86_64.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  159M  100  159M    0     0  10.4M      0  0:00:15  0:00:15 --:--:-- 10.7M

➜  img tar -zxvf archlinux-bootstrap-2022.06.01-x86_64.tar.gz 
 
   ---------Some decompression operations----

➜  img ls 

archlinux-bootstrap-2022.06.01-x86_64.tar.gz  root.x86_64

➜  img systemd-nspawn -D root.x86_64 

Spawning container root.x86_64 on /home/eive/img/root.x86_64.

Press ^] three times within 1s to kill container.

-bash-5.1# pacman-key --init

==> ERROR: pacman configuration file '/etc/pacman.conf' not found.

-bash-5.1# ls /etc | grep "pacman*"

pacman.conf

pacman.d

However, this file exists

Some attempts

use chroot

➜  img chroot root.x86_64  bash

[root@iZ2ze9mjsaskd7fy9i8ioeZ /]# pacman-key --init

gpg: /etc/pacman.d/gnupg/trustdb.gpg: trustdb created
gpg: no ultimately trusted keys found
gpg: starting migration from earlier GnuPG versions
gpg: porting secret keys from '/etc/pacman.d/gnupg/secring.gpg' to gpg-agent
gpg: migration succeeded
==> Generating pacman master key. This may take some time.
gpg: Generating pacman keyring master key...
gpg: directory '/etc/pacman.d/gnupg/openpgp-revocs.d' created
gpg: revocation certificate stored as '/etc/pacman.d/gnupg/openpgp-revocs.d/AF76249FE74363ACD220398458CBB6E9C488DE86.rev'
gpg: Done
==> Updating trust database...
gpg: marginals needed: 3  completes needed: 1  trust model: pgp
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u

It works fine

####use debian

eive@eive-allseries:~/temp$ curl -f --remote-name-all https://archive.archlinux.org/iso/2022.06.01/archlinux-bootstrap-2022.06.01-x86_64.tar.gz

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  159M  100  159M    0     0  3369k      0  0:00:48  0:00:48 --:--:-- 4507k

eive@eive-allseries:~/temp$ tar -zxvf archlinux-bootstrap-2022.06.01-x86_64.tar.gz 

 ---------Some decompression operations----

eive@eive-allseries:~/temp$ ls

archlinux-bootstrap-2022.06.01-x86_64.tar.gz  root.x86_64

eive@eive-allseries:~/temp$ systemd-nspawn -D root.x86_64/

Need to be root.

eive@eive-allseries:~/temp$ sudo systemd-nspawn -D root.x86_64/

Spawning container root.x8664 on /home/eive/temp/root.x86_64.

Press ^] three times within 1s to kill container.

[root@root ~]# pacman-key --init

gpg: Warning: using insecure memory!
gpg: /etc/pacman.d/gnupg/trustdb.gpg: trustdb created
gpg: no ultimately trusted keys found
gpg: Warning: using insecure memory!

---- other information ------

Also works fine

Additional Information

I tried other versions of archlinux image files and the same thing happens