do-release-upgrade on WSL failed horribly due to grub and others
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
systemd (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Xenial |
Fix Released
|
Undecided
|
Unassigned | ||
Bionic |
Fix Released
|
Undecided
|
Unassigned | ||
Cosmic |
Fix Released
|
Undecided
|
Unassigned | ||
Disco |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
[Impact]
* Package maintainer scripts and services use systemd-detect-virt and systemd's virtualization detection to determine the environment they are ran in and based on that skip not applicable operations, such as installing grub info to the MBR or to the EFI partition in a container. The WSL environment is similar to containers in that boot loader and initramfs preparations are not useful, but without this change only ad-hoc tests could be implemented in each separate package to avoid obsolete actions or failing in trying not applicable operations.
* The fix detects WSL as a container type, called wsl in systemd and as a result make packages behave like they would in classic Linuxcontainers.
[Test Case]
* Install the fixed systemd package in WSL and observe that it is detected as a container:
$ systemd-detect-virt --container
wsl
$
* Install the fixed systemd package in LXC and observe that it is still detected correctly:
$ systemd-detect-virt --container
lxc
$
* Install the fixed systemd package in a VM or on a bare metal systemd and observe that it is still detected correctly:
$ systemd-detect-virt --container
none
$ echo $?
1
* Observe the man page of sytemd-detect-virt mentioning wsl.
[Regression Potential]
* The changes is virtualization detection could break the detection logic but the test cases here cover most of the relevant code paths and the detection logic is also exercised in autopkgtests thus causing a regression is unlikely.
* The changes to the man pages could break the formatting, but a simple observation mitigates that risk, too.
[Original Bug Text]
Upon reading an Ubuntu page that said it was possible to upgrade my Ubuntu-
First it refused to run because system was not fully updated. Fine, I ran:
sudo apt update
sudo apt dist-upgrade
This process completed without any errors. I then ran do-release-upgrade again. This time it started okay and got through most of the process.
But then at some point it decided to run grub even though I am running Ubuntu under WSL, so presumably grub should not be used. It did apparently detect that it wasn't needed, because it asked me if I was sure I didn't want to install it on the boot device. I answered yes. Then the install proceeded to LXD but soon after came an error related to grub.
After that it went downhill fast with at least 2 other errors.
Additionally, when the system attempted to roll back the upgrade I got an error from a kernel package.
ProblemType: Package
DistroRelease: Ubuntu 18.04
Package: friendly-recovery 0.2.38ubuntu1
ProcVersionSign
Uname: Linux 4.4.0-17763-
ApportVersion: 2.20.9-0ubuntu7.5
Architecture: amd64
Date: Tue Feb 19 23:50:44 2019
Dmesg: [ 0.017808] Microsoft 4.4.0-17763.
ErrorMessage: installed friendly-recovery package post-installation script subprocess returned error exit status 1
PackageArchitec
Python3Details: /usr/bin/python3.6, Python 3.6.7, python3-minimal, 3.6.7-1~18.04
PythonDetails: /usr/bin/python2.7, Python 2.7.15rc1, python-minimal, 2.7.15~rc1-1
RelatedPackageV
dpkg 1.19.0.5ubuntu2.1
apt 1.6.8
SourcePackage: grub2
Title: package friendly-recovery 0.2.38ubuntu1 failed to install/upgrade: installed friendly-recovery package post-installation script subprocess returned error exit status 1
UpgradeStatus: Upgraded to bionic on 2019-02-20 (0 days ago)
description: | updated |
Changed in systemd (Ubuntu Disco): | |
status: | New → In Progress |
Changed in systemd (Ubuntu Cosmic): | |
status: | New → In Progress |
Changed in systemd (Ubuntu Bionic): | |
status: | New → In Progress |
Changed in systemd (Ubuntu Xenial): | |
status: | New → In Progress |
tags: | added: patch |
This particular grub failure occurred because grub tries systemd-detect-virt --quiet --container to see if it has to skip grub-install.
I'm fixing this in systemd to detect wsl as a container.