Error when I purge snapd package in late-commands
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
subiquity |
New
|
Undecided
|
Unassigned |
Bug Description
Hi,
I use this iso https:/
```yaml
#cloud-config
autoinstall:
version: 1
locale: en_US.UTF-8
keyboard:
layout: fr
variant: ""
proxy: http://
apt:
preserve_
primary:
- arches: [amd64]
uri: "http://
geoip: false
network:
network:
version: 2
ethernets:
enp0s3:
dhcp4: true
storage:
layout:
name: direct
identity:
hostname: focal-vbox
realname: packer
username: packer
password: $6$e70e7d9a7b03
ssh:
install-server: yes
user-data:
timezone: "Europe/Paris"
late-commands:
- curtin in-target --target=/target -- sh -c 'printf "root:root\n" | chpasswd'
- sed -i -r 's/^#?PermitRoo
- 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_
Oct 10 23:36:30 ubuntu-server subiquity_
Oct 10 23:36:30 ubuntu-server subiquity_
Oct 10 23:36:30 ubuntu-server subiquity_
Oct 10 23:36:30 ubuntu-server subiquity_
Oct 10 23:36:30 ubuntu-server subiquity_
Oct 10 23:36:30 ubuntu-server subiquity_
Oct 10 23:36:30 ubuntu-server subiquity_
Oct 10 23:36:30 ubuntu-server subiquity_
Oct 10 23:36:32 ubuntu-server subiquity_
```
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.
Feel to handle this "bug" (is it really a bug?) as you want.
As an attachment, a .gz file with:
- the file /autoinstall.yml from the installer server.
- the output of `journalctl` from the installer server.
- the /var/log/ directory from the installer server (ignore the ssh errors, it's just paker which tries to ssh on the VM during the installation).
Regards.
> - 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!