> - curtin in-target --target=/target -- sh -c 'printf "root:root\n" |
> chpasswd'
> - sed -i -r 's/^#?PermitRootLogin .*$/PermitRootLogin yes/'
> /target/etc/ssh/sshd_config
> - curtin in-target --target=/target -- apt-get -y -q purge snapd
> - sleep 10000 # Just to have time to ssh on the installer and retrieve
> all logs.
> ```
>
> In the installer, I can see this error (via journalctl):
>
> ```
> Oct 10 23:36:30 ubuntu-server subiquity_log.2004[36987]: Removing snap
> snapd and revision 12704
> Oct 10 23:36:30 ubuntu-server subiquity_log.2004[36987]: Removing
> snap-snapd-12704.mount
> Oct 10 23:36:30 ubuntu-server subiquity_log.2004[36987]: Discarding
> preserved snap namespaces
> Oct 10 23:36:30 ubuntu-server subiquity_log.2004[37372]: umount:
> /run/snapd/ns/lxd.mnt: not mounted.
> Oct 10 23:36:30 ubuntu-server subiquity_log.2004[37373]: rm: cannot remove
> '/run/snapd/ns/lxd.mnt': Device or resource busy
> Oct 10 23:36:30 ubuntu-server subiquity_log.2004[36986]: dpkg: error
> processing package snapd (--purge):
> Oct 10 23:36:30 ubuntu-server subiquity_log.2004[36986]: installed snapd
> package post-removal script subprocess returned error exit status 1
> Oct 10 23:36:30 ubuntu-server subiquity_log.2004[36986]: Errors were
> encountered while processing:
> Oct 10 23:36:30 ubuntu-server subiquity_log.2004[36986]: snapd
> Oct 10 23:36:32 ubuntu-server subiquity_log.2004[36772]: E: Sub-process
> /usr/bin/dpkg returned an error code (1)
> ```
>
Hmmm. You might have better luck with chroot /target apt-get purge snapd.
Or at least it would be worth a try :)
> Maybe there is a way to avoid this error when snapd is purged but, to be
> honest, I would much prefer an option in the `user-data` file to have a
> **minimal** install, so without snapd installed, something with just
> `apt-get` basically.
>
Well, luckily for you this feature has been implemented in the soon to be
released Ubuntu 21.10!
> - curtin in-target --target=/target -- sh -c 'printf "root:root\n" | tLogin .*$/PermitRootLogin yes/' etc/ssh/ sshd_config log.2004[ 36987]: Removing snap log.2004[ 36987]: Removing 12704.mount log.2004[ 36987]: Discarding log.2004[ 37372]: umount: ns/lxd. mnt: not mounted. log.2004[ 37373]: rm: cannot remove ns/lxd. mnt': Device or resource busy log.2004[ 36986]: dpkg: error log.2004[ 36986]: installed snapd log.2004[ 36986]: Errors were log.2004[ 36986]: snapd log.2004[ 36772]: E: Sub-process
> chpasswd'
> - sed -i -r 's/^#?PermitRoo
> /target/
> - curtin in-target --target=/target -- apt-get -y -q purge snapd
> - sleep 10000 # Just to have time to ssh on the installer and retrieve
> all logs.
> ```
>
> In the installer, I can see this error (via journalctl):
>
> ```
> Oct 10 23:36:30 ubuntu-server subiquity_
> snapd and revision 12704
> Oct 10 23:36:30 ubuntu-server subiquity_
> snap-snapd-
> Oct 10 23:36:30 ubuntu-server subiquity_
> preserved snap namespaces
> Oct 10 23:36:30 ubuntu-server subiquity_
> /run/snapd/
> Oct 10 23:36:30 ubuntu-server subiquity_
> '/run/snapd/
> Oct 10 23:36:30 ubuntu-server subiquity_
> processing package snapd (--purge):
> Oct 10 23:36:30 ubuntu-server subiquity_
> package post-removal script subprocess returned error exit status 1
> Oct 10 23:36:30 ubuntu-server subiquity_
> encountered while processing:
> Oct 10 23:36:30 ubuntu-server subiquity_
> Oct 10 23:36:32 ubuntu-server subiquity_
> /usr/bin/dpkg returned an error code (1)
> ```
>
Hmmm. You might have better luck with chroot /target apt-get purge snapd.
Or at least it would be worth a try :)
> Maybe there is a way to avoid this error when snapd is purged but, to be
> honest, I would much prefer an option in the `user-data` file to have a
> **minimal** install, so without snapd installed, something with just
> `apt-get` basically.
>
Well, luckily for you this feature has been implemented in the soon to be
released Ubuntu 21.10!