Bug 22748 - Deleting and recreating swap in (encrypted) LVM fails
Summary: Deleting and recreating swap in (encrypted) LVM fails
Status: RESOLVED DUPLICATE of bug 33787
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: All Linux
Priority: Normal critical
Target Milestone: ---
Assignee: Mageia tools maintainers
QA Contact:
URL:
Whiteboard: MGA9TOO
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-11 21:41 CET by Morgan Leijström
Modified: 2024-11-22 00:56 CET (History)
2 users (show)

See Also:
Source RPM: drakxtools-18.65-1.mga9
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

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

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

Comment 4 Morgan Leijström 2024-09-23 02:05:34 CEST
Mageia 9, 32 bit, spinning rust drive

Simple setup, no encryption
One partition for WinXP, two LVM pv
In LVM: /, /home, swap

Was running great, but i needed more space in / lv so had to remove swap in lvm
(plan was to shrink XP and make a swap there)
use diskdrake to delete swap in lvm, shut down, reboot
Fail: It can not boot because it cant find swap.

(I fixed it by booting sysresccd.org and create that lv again, and added another pv for the group in space from schrunk XP partition, then extended / lv)

Source RPM: drakxtools-17.88.1-1.mga6.src.rpm => drakxtools-18.65-1.mga9
Severity: normal => critical
Whiteboard: 8RC => MGA9TOO

Comment 5 Morgan Leijström 2024-11-22 00:56:27 CET
Fresh description, Cause identified: Bug 33787

*** This bug has been marked as a duplicate of bug 33787 ***

Status: NEW => RESOLVED
Resolution: (none) => DUPLICATE


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