Problems creating vm alpine, with cloud-init password

Hello!! to all
I am trying to create an alpinelinux virtual machine with LXD VM, but I have not been successful
with the configuration of the user and the password (Cloud-init) sentenced in the created profile.
The debian-based machines with the steps indicated here https://cloudinit.readthedocs.io/en/latest/topics/examples.html that are the same as the one used in my alpine profile run without problems, but in alpine and others distro not based on debian there are problems.
I think it could be the kind of algorithm that alpine uses.
any suggestion.
I have also used this configuration, only successfully on debian-based distro.

config:

user.user-data: |
#cloud-config
ssh_pwauth: yes
apt_mirror: http://us.archive.ubuntu.com/ubuntu/
users:
- name: ubuntu
passwd:
“$6$s.wXDkoGmU5md$d.vxMQSvtcs1I7wUG4SLgUhmarY7BR.5lusJq1D9U9EnHK2LJx18x90ipsg0g3Jcomfp0EoGAZYfgvT22qGFl/”
lock_passwd: false
groups: lxd
shell: /bin/bash
sudo: ALL=(ALL) NOPASSWD:ALL
description: VM specific configuration
devices:
config:
source: cloud-init:config
type: disk
eth1:
name: eth1
nictype: bridged
parent: lxd0
type: nic
name: ubuntu
used_by: []

Which image did you use to launch the VM?

alpine edge for vm

Can you give me the specific launch/init command you used please

lxc init images:alpine/edge vm-edge -p vm-edge -s local --vm

That wont have cloud init in it, you need to use images:alpine/edge/cloud I think.

Although I don’t know if that image exists yet. @monstermunchkin do we have an alpine cloud image?

Use this image from alpine vm, and no more images
alpine/edge (3 more) | 5351f1245ad3 | yes | Alpine edge amd64 (20210216_13:00) | x86_64 | VIRTUAL-MACHINE | 95.25MB | Feb 16, 2021 at 12:00am (UTC)

Alpine traditionally did not have the cloud-init package.
When LXD got /cloud container/VM images, there was such an image for Alpine but obviously could not work due to the absence of that package. And that container image/vm image for Alpine was removed.

However, in Alpine 3.13, Alpine got support for cloud-init.
Therefore, use version 3.13. There are /cloud packages for that.

2 Likes

We have a cloud-init VM for Alpine Linux 3.13. However, I don’t see why we shouldn’t have one for edge as well.

1 Like

I tested the image in cloud 13 which leaving the following errors
https://pastebin.ubuntu.com/p/DmsgrTkftw/

I’ll look into that.

@darmon77 what LXD version are you using? I cannot reproduce your error on the master branch.

This is what I get:

   OpenRC 0.42.1.788529e388 is starting up Linux 5.10.15-0-virt (x86_64)

 * /proc is already mounted
 * Mounting /run ... * /run/openrc: creating directory
 * /run/lock: creating directory
 * /run/lock: correcting owner
 * Caching service dependencies ... [ ok ]
 * Remounting devtmpfs on /dev ... [ ok ]
 * Mounting /dev/mqueue ... [ ok ]
 * Mounting security filesystem ... [ ok ]
 * Mounting debug filesystem ... [ ok ]
 * Mounting persistent storage (pstore) filesystem ... [ ok ]
 * Mounting efivarfs filesystem ... [ ok ]
 * Starting udev ... [ ok ]
 * Generating a rule to create a /dev/root symlink ... [ ok ]
 * Populating /dev with existing devices through uevents ... [ ok ]
 * Waiting for uevents to be processed ... [ ok ]
 * Loading modules ... [ ok ]
 * Setting system clock using the hardware clock [UTC] ... [ ok ]
 * Checking local filesystems  ... [ ok ]
 * Remounting root filesystem read/write ... [ ok ]
 * Remounting filesystems ... [ ok ]
 * Activating swap devices ... [ ok ]
 * Mounting local filesystems ... [ ok ]
 * Starting busybox acpid ... [ ok ]
 * Configuring kernel parameters ... [ ok ]
 * Creating user login records ... [ ok ]
 * Wiping /tmp directory ... [ ok ]
Cloud-init v. 20.4.1 running 'init-local' at Tue, 16 Feb 2021 16:12:08 +0000. Up 2.71 seconds.
 [ ok ]
 * Setting hostname ... [ ok ]
 * Starting networking ... *   lo ... [ ok ]
 *   eth0 ...udhcpc: started, v1.32.1
udhcpc: sending discover
udhcpc: sending select for 10.190.108.18
udhcpc: lease of 10.190.108.18 obtained, lease time 3600
 [ ok ]
 * Starting busybox syslog ... [ ok ]
 * Initializing random number generator ... [ ok ]
 * /run/lxd_config: creating directory
 * /run/lxd_config/drive: creating directory
 * Starting lxd-agent-virtiofs ... [ ok ]
 * ERROR: lxd-agent-9p failed to start
 * Starting lxd-agent ... [ ok ]
Cloud-init v. 20.4.1 running 'init' at Tue, 16 Feb 2021 16:12:12 +0000. Up 7.05 seconds.
ci-info: +++++++++++++++++++++++++++++++++++++++++++++Net device info+++++++++++++++++++++++++++++++++++++++++++++
ci-info: +--------+------+------------------------------------------+---------------+--------+-------------------+
ci-info: | Device |  Up  |                 Address                  |      Mask     | Scope  |     Hw-Address    |
ci-info: +--------+------+------------------------------------------+---------------+--------+-------------------+
ci-info: |  eth0  | True |              10.190.108.18               | 255.255.255.0 | global | 00:16:3e:15:07:71 |
ci-info: |  eth0  | True | fd42:680c:e730:94ab:216:3eff:fe15:771/64 |       .       | global | 00:16:3e:15:07:71 |
ci-info: |  eth0  | True |        fe80::216:3eff:fe15:771/64        |       .       |  link  | 00:16:3e:15:07:71 |
ci-info: |   lo   | True |                127.0.0.1                 |   255.0.0.0   |  host  |         .         |
ci-info: |   lo   | True |                 ::1/128                  |       .       |  host  |         .         |
ci-info: +--------+------+------------------------------------------+---------------+--------+-------------------+
ci-info: ++++++++++++++++++++++++++++++Route IPv4 info++++++++++++++++++++++++++++++
ci-info: +-------+--------------+--------------+---------------+-----------+-------+
ci-info: | Route | Destination  |   Gateway    |    Genmask    | Interface | Flags |
ci-info: +-------+--------------+--------------+---------------+-----------+-------+
ci-info: |   0   |   0.0.0.0    | 10.190.108.1 |    0.0.0.0    |    eth0   |   UG  |
ci-info: |   1   | 10.190.108.0 |   0.0.0.0    | 255.255.255.0 |    eth0   |   U   |
ci-info: +-------+--------------+--------------+---------------+-----------+-------+
ci-info: ++++++++++++++++++++++++++++++++++Route IPv6 info++++++++++++++++++++++++++++++++++
ci-info: +-------+--------------------------+--------------------------+-----------+-------+
ci-info: | Route |       Destination        |         Gateway          | Interface | Flags |
ci-info: +-------+--------------------------+--------------------------+-----------+-------+
ci-info: |   0   | fd42:680c:e730:94ab::/64 |            ::            |    eth0   |   Ue  |
ci-info: |   1   |        fe80::/64         |            ::            |    eth0   |   U   |
ci-info: |   2   |           ::/0           | fe80::216:3eff:fed4:2072 |    eth0   |  UGe  |
ci-info: |   4   |          local           |            ::            |    eth0   |   U   |
ci-info: |   5   |          local           |            ::            |    eth0   |   U   |
ci-info: |   6   |        multicast         |            ::            |    eth0   |   U   |
ci-info: +-------+--------------------------+--------------------------+-----------+-------+

4.9

What distribution are you using?

voidlinux

OK, thanks. It looks like your system is unable to use virtiofs which is fine. In that case it’ll try to use 9p as a fallback which doesn’t seem to work for some odd reason. That might be a problem with our images though. I’m currently looking into that.

virtiofs is present in the kenerl of voidlinux

When starting the VM, is virtiofsd running as well? That’s needed for virtiofs to work. It should be part of qemu.

@monstermunchkin with the alpine vm image it does not start virtiofs, with other images such as debian ubuntu it starts without problems.

I tried with LXD 4.9 using virtiofs and 9p. Both work fine.

Looking at the provided log again, you seem to be missing /run/lxd_config/drive/lxd-agent inside of the VM. I don’t know why though. If you’re running the snap, lxd-agent should be in /var/snap/lxd/common/lxd/virtual-machines/<vm-name>/config/.