"Unexpected output" when cleaning LVM swap partition

Bug #1092792 reported by Johnny Ooi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
BleachBit
Fix Released
Undecided
Andrew Ziem
bleachbit (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Console output:
>>
debug: disabling swap
debug: running cmd ['swapoff', '-a', '-v']
Traceback (most recent call last):
  File "/usr/share/bleachbit/bleachbit/Worker.py", line 88, in execute
    for ret in cmd.execute(self.really_delete):
  File "/usr/share/bleachbit/bleachbit/Command.py", line 131, in execute
    for func_ret in self.func():
  File "/usr/share/bleachbit/bleachbit/Memory.py", line 246, in wipe_memory
    devices = disable_swap_linux()
  File "/usr/share/bleachbit/bleachbit/Memory.py", line 70, in disable_swap_linux
    % { 'args' : str(args), 'stdout' : stdout, 'stderr' : stderr } )
RuntimeError: Unexpected output:
args='['swapoff', '-a', '-v']'
stdout='swapoff on /dev/mapper/lubuntu-swap_1
'
stderr=''
Unexpected output:
args='['swapoff', '-a', '-v']'
stdout='swapoff on /dev/mapper/lubuntu-swap_1
'
stderr=''
<<

This only occurs when attempting to clean the swap on a system where LVM is used. A consequence of this problem is that the swap area is left off, and must be enabled again, manually.

This problem does not occur when running the same operation under a system where LVM is not used.

Checked on various systems running Natty, Oneiric, Precise, Quantal and Ringtail

ProblemType: Bug
DistroRelease: Ubuntu 13.04
Package: bleachbit 0.9.3-1
ProcVersionSignature: Ubuntu 3.7.0-7.15-generic 3.7.0
Uname: Linux 3.7.0-7-generic i686
ApportVersion: 2.7-0ubuntu2
Architecture: i386
Date: Fri Dec 21 05:18:05 2012
InstallationDate: Installed on 2012-12-14 (6 days ago)
InstallationMedia: Lubuntu 13.04 "Raring Ringtail" - Alpha i386 (20121214)
MarkForUpload: True
PackageArchitecture: all
SourcePackage: bleachbit
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Johnny Ooi (johnny-jy-ooi+launchpad) wrote :
Revision history for this message
Andrew Ziem (ahziem1) wrote :

Thank you for the detailed bug report. Potential fix commited in SVN revision 2743. Could you verify this patch?

http://bleachbit.svn.sourceforge.net/viewvc/bleachbit/trunk/bleachbit/Memory.py?r1=2624&r2=2743

Changed in bleachbit (Ubuntu):
assignee: nobody → Andrew Ziem (ahziem1)
status: New → Fix Committed
Revision history for this message
Johnny Ooi (johnny-jy-ooi+launchpad) wrote :

I have applied that fix, and whilst I no longer get the same error, it still does not complete successfully:

>>
debug: disabling swap
debug: running cmd ['swapoff', '-a', '-v']
debug: detected swap devices: ['/dev/mapper/lubuntu-swap_1']
info: wiping swap device '/dev/mapper/lubuntu-swap_1'
Traceback (most recent call last):
  File "/usr/share/bleachbit/bleachbit/Worker.py", line 88, in execute
    for ret in cmd.execute(self.really_delete):
  File "/usr/share/bleachbit/bleachbit/Command.py", line 131, in execute
    for func_ret in self.func():
  File "/usr/share/bleachbit/bleachbit/Memory.py", line 250, in wipe_memory
    wipe_swap_linux(devices, proc_swaps)
  File "/usr/share/bleachbit/bleachbit/Memory.py", line 227, in wipe_swap_linux
    if get_swap_size_linux(device, proc_swaps) > 8*1024**3:
  File "/usr/share/bleachbit/bleachbit/Memory.py", line 140, in get_swap_size_linux
    (device, proc_swaps))
RuntimeError: error: cannot find size of swap device '/dev/mapper/lubuntu-swap_1'
Filename Type Size Used Priority
/dev/dm-1 partition 6283260 19292 -1

error: cannot find size of swap device '/dev/mapper/lubuntu-swap_1'
Filename Type Size Used Priority
/dev/dm-1 partition 6283260 19292 -1
Disk space recovered: 16.4kB
Files deleted: 4
Special operations: 14
Errors: 2
<<

Andrew Ziem (ahziem1)
Changed in bleachbit (Ubuntu):
status: Fix Committed → In Progress
Revision history for this message
Andrew Ziem (ahziem1) wrote :

Years ago I used LVM a little, but I am not familar with it---especially with regards to swap. To find out how big the swap file is, BleachBit is expecting to find /dev/mapper/lubuntu-swap_1 in /proc/swaps, but the only device there is /dev/dm-1. Are these somehow synonymous?

Revision history for this message
Johnny Ooi (johnny-jy-ooi+launchpad) wrote :

LVM can be a real bum to manage, I agree.

And yes, dm-1 is the same as lubuntu_swap_1:

$ ls -l /dev/mapper
total 0
crw------- 1 root root 10, 236 Dec 22 10:59 control
lrwxrwxrwx 1 root root 7 Dec 22 10:59 lubuntu-root -> ../dm-0
lrwxrwxrwx 1 root root 7 Dec 22 10:59 lubuntu-swap_1 -> ../dm-1

$ ls -l /dev/dm*
brw-rw---- 1 root disk 252, 0 Dec 22 10:59 /dev/dm-0
brw-rw---- 1 root disk 252, 1 Dec 22 10:59 /dev/dm-1

$ swapon -s
Filename Type Size Used Priority
/dev/mapper/lubuntu-swap_1 partition 6283260 200732 -1

So I guess you could use the output from swapon to determine the size (third column)

Revision history for this message
Andrew Ziem (ahziem1) wrote :

Would you also run these commands and show me the output?

blkid /dev/mapper/lubuntu-swap_1
size /dev/mapper/lubuntu-swap_1
fdisk -s /dev/mapper/lubuntu-swap_1

Revision history for this message
Johnny Ooi (johnny-jy-ooi+launchpad) wrote :

Sure:

$ sudo blkid /dev/mapper/lubuntu-swap_1
/dev/mapper/lubuntu-swap_1: UUID="015c1a05-8877-45c1-bad5-520c25b9306c" TYPE="swap"

$ sudo size /dev/mapper/lubuntu-swap_1
size: Warning: '/dev/mapper/lubuntu-swap_1' is not an ordinary file

$ sudo fdisk -s /dev/mapper/lubuntu-swap_1
6283264

Andrew Ziem (ahziem1)
Changed in bleachbit (Ubuntu):
status: In Progress → New
Changed in bleachbit:
status: New → In Progress
Changed in bleachbit (Ubuntu):
assignee: Andrew Ziem (ahziem1) → nobody
Changed in bleachbit:
assignee: nobody → Andrew Ziem (ahziem1)
milestone: none → 0.9.5
Revision history for this message
Andrew Ziem (ahziem1) wrote :

Jonny Ooi:

Please try replacing your Memory.py with this file
https://sourceforge.net/p/bleachbit/code/2810/tree/trunk/bleachbit/Memory.py?format=raw

Revision history for this message
Johnny Ooi (johnny-jy-ooi+launchpad) wrote :

I copied that file over the existing one and ran bleachbit. It now berhaves correctly, with no errors when wiping the swap.

Andrew Ziem (ahziem1)
Changed in bleachbit:
status: In Progress → Fix Committed
Changed in bleachbit (Ubuntu):
status: New → Fix Committed
Revision history for this message
Luca Falavigna (dktrkranz) wrote :

Fixed in 0.9.5

Changed in bleachbit (Ubuntu):
status: Fix Committed → Fix Released
Changed in bleachbit:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.