Bug 1785109

Summary: The arm installer writes in the host file system instead the SDcard if the host has a LVM system named fedora.
Product: [Fedora] Fedora Reporter: Jean-frederic Clere <jclere>
Component: fedora-arm-installerAssignee: Paul Whalen <pwhalen>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 31CC: jonc_mailbox, oliver, pbrobinson, pwhalen
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-01-04 20:32:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jean-frederic Clere 2019-12-19 07:30:56 UTC
Description of problem:

I have used:
rm-image-installer --image=/home/jfclere/Downloads/Fedora-Server-31-1.9.aarch64.raw.xz --target=rpi3 --media=/dev/mmcblk0 --norootpass --addkey=/home/jfclere/.ssh/id_rsa.pub --resizefs --relabel
then ssh -l root rpi_box and get a password being asked...

Looking to my laptop disk I have:
[root@pc-7 TMP]# ls -lt /.autorelabel
-rw-r--r--. 1 root root 0 Dec 18 19:27 /.autorelabel
[root@pc-7 TMP]# grep root /etc/passwd
root::0:0:root:/root:/bin/bash
operator:x:11:0:operator:/root:/sbin/nologin
Obviously arm-image-installer wrote in the wrong disk...

Version-Release number of selected component (if applicable):
31

How reproducible:
Always

Steps to Reproduce:
1. run /usr/bin/arm-image-installer take the SD card out.
2. put it back and run /usr/bin/arm-image-installer again
3. check /etc/passwd and /.autorelabel they changed.

Actual results:
/etc/passwd and /.autorelabel of the host system are changed.

Expected results:
/etc/passwd and /.autorelabel of the SD card are changed and the host filesystem is unchanged.


Additional info:
[root@pc-7 TMP]# pvs -o +vguuid
  PV                                                    VG     Fmt  Attr PSize   PFree  VG UUID                               
  /dev/mapper/luks-2714fdba-306c-49e6-abfe-b0002c29d4da fedora lvm2 a--  475.93g     0  TeSaZz-iIrL-N3V9-c1SP-9xa5-mj6u-z9Saqp
  /dev/mmcblk0p3                                        fedora lvm2 a--   28.22g 22.81g nuX1yZ-zMw7-Qd7p-Lxfh-qCnl-keR2-lyz7wf
[root@pc-7 TMP]# vgrename nuX1yZ-zMw7-Qd7p-Lxfh-qCnl-keR2-lyz7wf image
  /dev/image: already exists in filesystem
[root@pc-7 TMP]# echo $?
0
[root@pc-7 TMP]# pvs -o +vguuid
  PV                                                    VG     Fmt  Attr PSize   PFree  VG UUID                               
  /dev/mapper/luks-2714fdba-306c-49e6-abfe-b0002c29d4da fedora lvm2 a--  475.93g     0  TeSaZz-iIrL-N3V9-c1SP-9xa5-mj6u-z9Saqp
  /dev/mmcblk0p3                                        fedora lvm2 a--   28.22g 22.81g nuX1yZ-zMw7-Qd7p-Lxfh-qCnl-keR2-lyz7wf

Comment 1 Jean-frederic Clere 2019-12-19 07:44:13 UTC
Looking to the host file system it looks like arm-image-installer won't work on fedora using LVM...
[root@pc-7 TMP]# ls -lt /dev/image
total 0
lrwxrwxrwx. 1 root root 7 Dec 16 22:26 root -> ../dm-4
[root@pc-7 TMP]# ls -lt /dev/dm-4
brw-rw----. 1 root disk 253, 4 Dec 16 22:26 /dev/dm-4
[root@pc-7 TMP]# ls -lt /dev/fedora
total 0
lrwxrwxrwx. 1 root root 7 Dec  6 21:39 home -> ../dm-3
lrwxrwxrwx. 1 root root 7 Dec  6 21:39 swap -> ../dm-2
lrwxrwxrwx. 1 root root 7 Dec  6 21:39 root -> ../dm-1

Comment 2 Jean-frederic Clere 2019-12-19 08:16:04 UTC
to remove /dev/image:
[root@pc-7 TMP]# dmsetup info | grep image
Name:              image-root
[root@pc-7 TMP]# ls -lt /dev/mapper/ | grep image
lrwxrwxrwx. 1 root root       7 Dec 16 22:26 image-root -> ../dm-4
[root@pc-7 TMP]# dmsetup clear /dev/mapper/image-root
[root@pc-7 TMP]# ls -lt /dev/image
total 0
lrwxrwxrwx. 1 root root 7 Dec 16 22:26 root -> ../dm-4
[root@pc-7 TMP]# dmsetup info | grep image
Name:              image-root
[root@pc-7 TMP]# dmsetup remove /dev/mapper/image-root
[root@pc-7 TMP]# dmsetup info | grep image
[root@pc-7 TMP]# ls -lt /dev/image
ls: cannot access '/dev/image': No such file or directory

Comment 3 Jean-frederic Clere 2019-12-19 08:35:45 UTC
In fact to reproduce:
Steps to Reproduce:
1. run /usr/bin/arm-image-installer
2. check /etc/passwd and /.autorelabel they changed.

I have added exit 1 in line 394 of the /usr/bin/arm-image-installer script and try by hands...
+++
[root@pc-7 NOTES]# vgrename image fedora
  /dev/fedora: already exists in filesystem
[root@pc-7 NOTES]# pvs -o +vguuid
  PV                                                    VG     Fmt  Attr PSize   PFree VG UUID                               
  /dev/mapper/luks-2714fdba-306c-49e6-abfe-b0002c29d4da fedora lvm2 a--  475.93g    0  TeSaZz-iIrL-N3V9-c1SP-9xa5-mj6u-z9Saqp
  /dev/mmcblk0p3                                        image  lvm2 a--   28.22g    0  nuX1yZ-zMw7-Qd7p-Lxfh-qCnl-keR2-lyz7wf
+++

Also:
+++
[root@pc-7 TMP]# vgrename nuX1yZ-zMw7-Qd7p-Lxfh-qCnl-keR2-lyz7wf fedora
  /dev/fedora: already exists in filesystem
[root@pc-7 TMP]# pvs -o +vguuid
  PV                                                    VG     Fmt  Attr PSize   PFree VG UUID                               
  /dev/mapper/luks-2714fdba-306c-49e6-abfe-b0002c29d4da fedora lvm2 a--  475.93g    0  TeSaZz-iIrL-N3V9-c1SP-9xa5-mj6u-z9Saqp
  /dev/mmcblk0p3                                        image  lvm2 a--   28.22g    0  nuX1yZ-zMw7-Qd7p-Lxfh-qCnl-keR2-lyz7wf
+++

I have also tried vgrename -f and vgrename --force

Comment 4 Fedora Update System 2019-12-19 22:58:51 UTC
FEDORA-2019-7d06d79076 has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2019-7d06d79076

Comment 5 Fedora Update System 2019-12-19 22:58:52 UTC
FEDORA-2019-540c480868 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-540c480868

Comment 6 Fedora Update System 2019-12-20 01:50:25 UTC
arm-image-installer-2.14-1.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-540c480868

Comment 7 Fedora Update System 2019-12-20 02:11:21 UTC
arm-image-installer-2.14-1.fc31 has been pushed to the Fedora 31 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-7d06d79076

Comment 8 Fedora Update System 2019-12-20 21:44:51 UTC
FEDORA-2019-540c480868 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-540c480868

Comment 9 Fedora Update System 2019-12-20 21:45:37 UTC
FEDORA-2019-7d06d79076 has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2019-7d06d79076

Comment 10 Fedora Update System 2019-12-21 01:26:54 UTC
arm-image-installer-2.15-1.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-540c480868

Comment 11 Fedora Update System 2019-12-21 01:41:29 UTC
arm-image-installer-2.15-1.fc31 has been pushed to the Fedora 31 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-7d06d79076

Comment 12 Jean-frederic Clere 2019-12-21 07:09:17 UTC
[root@pc-7 NOTES]# pvs -o +vguuid
  PV                                                    VG            Fmt  Attr PSize   PFree VG UUID                               
  /dev/mapper/luks-2714fdba-306c-49e6-abfe-b0002c29d4da fedora        lvm2 a--  475.93g    0  TeSaZz-iIrL-N3V9-c1SP-9xa5-mj6u-z9Saqp
  /dev/mmcblk0p3                                        fedora-server lvm2 a--   28.22g    0  nuX1yZ-zMw7-Qd7p-Lxfh-qCnl-keR2-lyz7wf

and the RPI boots with problem (the ssh key, selinux relabelled etc)

thanks and Merry Xmas.

Comment 13 Paul Whalen 2019-12-21 21:10:46 UTC
(In reply to Jean-frederic Clere from comment #12)
> [root@pc-7 NOTES]# pvs -o +vguuid
>   PV                                                    VG            Fmt 
> Attr PSize   PFree VG UUID                               
>   /dev/mapper/luks-2714fdba-306c-49e6-abfe-b0002c29d4da fedora        lvm2
> a--  475.93g    0  TeSaZz-iIrL-N3V9-c1SP-9xa5-mj6u-z9Saqp
>   /dev/mmcblk0p3                                        fedora-server lvm2
> a--   28.22g    0  nuX1yZ-zMw7-Qd7p-Lxfh-qCnl-keR2-lyz7wf
> 
> and the RPI boots with problem (the ssh key, selinux relabelled etc)

What problem? 

> thanks and Merry Xmas.

Thanks, you too!

Comment 14 Jean-frederic Clere 2019-12-23 07:17:00 UTC
what problem?

Oops I meant without problem.

Comment 15 Fedora Update System 2020-01-04 20:32:37 UTC
arm-image-installer-2.15-1.fc31 has been pushed to the Fedora 31 stable repository. If problems still persist, please make note of it in this bug report.

Comment 16 Fedora Update System 2020-01-04 22:15:15 UTC
arm-image-installer-2.15-1.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.