media with label already exists error

Jan 5, 2023
6
2
8
Had an issue with labeling an expired tape after removing an encryption key connected to it. The bug appears to begin once you remove an old encryption key and not invalidating the inventory for the tape.

After removing the encryption key, when you try to format the tape output is:
Code:
unable to read media label: unknown tape encryption key 'xx:xx:xx:xx:xx:xx:xx:xx'
format anyways
TASK OK

The problem is the format doesn't clear the label and attempting to label it now results in an error:
Code:
TASK ERROR: Media with label 'XXXXXXXX' already exists.

Further trying to backup to this tape results in this message:
Code:
found empty media without label (please label all tapes first)

Trying to catalog the tape results in:
Code:
TASK ERROR: media is empty (no media label found)

My work-around for this was to remove the media entry in inventory.json which allowed the tape to be labeled and the backup process to work.
I have opened bug report 6045 for this.

Thanks,
Ned