Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Debian packaging postinst partition finding #8529

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xzhangxa
Copy link
Contributor

@xzhangxa xzhangxa commented Oct 19, 2023

If the root partition is bind mounted with / and another, the current postinst script (using command lsblk) will fail to find the partition: $type will be "/" only and cause the following command may find the wrong partition.

And current command forces the root partition to be ext4.

This patch fixes the two issues.

Two setups with bind mounted root partition;

Ubuntu 22.04 desktop, bind mount firefox snap:

> lsblk
nvme0n1      259:19   0 931.5G  0 disk
├─nvme0n1p1  259:20   0   243M  0 part /boot/efi
├─nvme0n1p2  259:21   0 927.5G  0 part /var/snap/firefox/common/host-hunspell
│                                      /

Windows WSL2, bind mount WSLg:

> lsblk
sdc    8:32   0     1T  0 disk /mnt/wslg/distro
                               /

Tracked-On: #8532

@shuaizhx
Copy link
Contributor

@xzhangxa please add Tracked-On

@xzhangxa
Copy link
Contributor Author

@xzhangxa please add Tracked-On

Tracked-On: #8532

If the root partition is bind mounted with / and another, the current
postinst script (using command lsblk) will fail to find the partition:
$type will be "/" only and cause the following command may find the
wrong partition.

Ubuntu 22.04 desktop with firefox snap by default:
```
> lsblk
nvme0n1      259:19   0 931.5G  0 disk
├─nvme0n1p1  259:20   0   243M  0 part /boot/efi
├─nvme0n1p2  259:21   0 927.5G  0 part /var/snap/firefox/common/host-hunspell
│                                      /
```

And current command forces the root partition to be ext4.

This patch fixes the two issues.

Tracked-On: projectacrn#8532

Signed-off-by: Xin Zhang <xin.x.zhang@intel.com>
@xzhangxa
Copy link
Contributor Author

xzhangxa commented Oct 25, 2023

I'd like to change the code a little from using df to findmnt /. When using df if the kernel cmdline has "root=/dev/xxx" the df command will show "/" on partition "/dev/root", but we need the real hardware partition. So it won't work in this case (it's also the case that if you install a new acrn-hypervisor deb under the previous acrn hypervisor+SOS).

So lsblk fails when bind mount root partition and df fails when kernel cmdline has explicit "root=/dev/xxx".

Change to use findmnt / instead, it will always report the real hardware partition.

@yuhuanX
Copy link

yuhuanX commented Mar 4, 2024

start to run premerge test

@yuhuanX
Copy link

yuhuanX commented Apr 15, 2024

Please 'terryzouhao' or 'NanlinXie' approve this patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants