Bug 22748 - Deleting and recreating swap in (encrypted) LVM fails
Summary: Deleting and recreating swap in (encrypted) LVM fails
Status: NEW
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: All Linux
Priority: Normal normal
Target Milestone: ---
Assignee: Mageia tools maintainers
QA Contact:
URL:
Whiteboard: 8RC
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-11 21:41 CET by Morgan Leijström
Modified: 2021-01-21 22:38 CET (History)
2 users (show)

See Also:
Source RPM: drakxtools-17.88.1-1.mga6.src.rpm
CVE:
Status comment:


Attachments

Description Morgan Leijström 2018-03-11 21:41:17 CET
__Short description of problem:

Disk setup: LVM on LUKS, set up by diskdrake long ago
Remove swap in LVM, restart diskdrake, create new swap in LVM -> bang!, se below
Additionally: formatting and mounting swap do not make it listed in fstab.

___Version-Release number of selected component:

drakxtools-17.88.1-1.mga6.src.rpm, 
Fully normally updated Mageia 6 + kernel 4.14.25-desktop-1.mga6 from testing

__Long description:

I intend to test a full update to testing for all plasma stuff and maybe more from testing.  As this is a production machine i want to make a LVM snapshot of / first, and I needed to make swap smaller to make room for the snapshot.
My method was using diskdrake as follows:
  - i should better have just shrink swap, but the following should have worked.
0) start diskdrake
1) unmount swap
2) delete swap
3) exit diskdrake and let it write fstab
4) start diskdrake again
5) create a small swap in the now free space in the LVM

Relevant part of journal:
---
mar 11 19:17:27 svarten diskdrake[17327]: running: lvm2 lvcreate --size 528384k -n lv_swap vg-mga
mar 11 19:17:28 svarten systemd[1]: Activating swap /dev/vg-mga/swap...
mar 11 19:17:28 svarten swapon[17584]: swapon: cannot open /dev/vg-mga/swap: No such file or directory
mar 11 19:17:28 svarten systemd[1]: dev-vg\x2dmga-swap.swap: Swap process exited, code=exited status=255
mar 11 19:17:28 svarten systemd[1]: Failed to activate swap /dev/vg-mga/swap.
mar 11 19:17:28 svarten systemd[1]: dev-vg\x2dmga-swap.swap: Unit entered failed state.
---

--> Both diskdrake main window and "create new partition" dialog turned black!
And remained so for several minutes.  The i decided to hit the window frame close buttons but nothing happened until a minute later while i was doing other stuff.  Then then got visible, together with a error message "Lvcreate failed:" but nothing after that colon, but an OK button.

I see the new swap partition; lvs gives:                                                                                                                                                                                     
  LV      VG      Attr       LSize    Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert                                                                         
  tmp     vg-disk -wi-ao---- 1000,00m                                                                                                                             
  var     vg-disk -wi-ao----   69,30g                                                                                                                             
  home    vg-mga  -wi-ao----  185,19g                                                                                                                             
  lv_swap vg-mga  -wi-a-----  516,00m                                                                                                                             
  root    vg-mga  -wi-ao----   34,25g   


In diskdrake lv_swap had not shown up.
I closed diskdrake, it did not ask to write fstab.
I started diskdrake again, and it showed the swap.
I selected it and pressed mount, but that failed.

---
mar 11 21:19:36 svarten diskdrake[10350]: mount_part: device=vg-mga/lv_swap mntpoint= isMounted= real_mntpoint= device_UUID=6e48b976-2583-4172-876b-1f053ccf458d
mar 11 21:19:36 svarten diskdrake[10350]: swapon called with vg-mga/lv_swap
mar 11 21:19:36 svarten kernel: Swap area shorter than signature indicates
mar 11 21:19:36 svarten diskdrake[10350]: error: swapon(vg-mga/lv_swap) failed: Invalid argument at /usr/lib/libDrakX/fs/mount.pm line 21.
---

I then pressed format, then mount, and it succeeded.

---
mar 11 21:20:51 svarten diskdrake[10350]: formatting device vg-mga/lv_swap (type swap)
mar 11 21:20:51 svarten diskdrake[10350]: running: mkswap -U 6e48b976-2583-4172-876b-1f053ccf458d /dev/vg-mga/lv_swap
mar 11 21:20:51 svarten diskdrake[10350]: running: blkid -o udev -p /dev/vg-mga/lv_swap
mar 11 21:20:51 svarten diskdrake[10350]: blkid gave: swap 6e48b976-2583-4172-876b-1f053ccf458d
mar 11 21:21:03 svarten diskdrake[10350]: mount_part: device=vg-mga/lv_swap mntpoint= isMounted= real_mntpoint= device_UUID=6e48b976-2583-4172-876b-1f053ccf458d
mar 11 21:21:03 svarten diskdrake[10350]: swapon called with vg-mga/lv_swap
mar 11 21:21:03 svarten kernel: Adding 528380k swap on /dev/vg-mga/lv_swap.  Priority:-2 extents:1 across:528380k SSFS
---

I then closed diskdrake. New problem: it did not ask to write fstab.
I checked, and fstab do not contain a line for swap !
So I have now added it manually.
Marja Van Waes 2018-03-12 06:42:18 CET

CC: (none) => marja11
Assignee: bugsquad => mageiatools

Comment 1 Morgan Leijström 2018-03-12 17:22:07 CET
Also see similar Bug 18968 - Diskdrake fail mounting LVM partitions as it forgets to activate them (adding old drive to running system)
Comment 2 Aurelien Oudelet 2020-08-16 16:27:10 CEST
Is this still valid in Mageia 7?

CC: (none) => ouaurelien

Comment 3 Morgan Leijström 2021-01-21 22:37:58 CET
Yes

This problem have many faces

Now used 8RC classic installer, at custom partitioning selected the LUKS PP, unlocked it, deleted a partition inside, created a new one: disk activity but installer stopped responding with OK key stil pressed.  Mouse pointer moves, and Ctrl-Alt-Fsomething works; i see it seem to have executed lvcreate command, i did not verify if it was correct parameters.

As usual two passe sis needed: first delete, then restart installer/diskdrake, and make new.

Golden rule: Never proceed after having deleted a partition in LVM.
Morgan Leijström 2021-01-21 22:38:17 CET

Version: 6 => Cauldron
Whiteboard: (none) => 8RC


Note You need to log in before you can comment on or make changes to this bug.