how to fix (fallocate: fallocate failed: Text file busy) Ubuntu 22.04?

Asked by michael

While trying to change swap space size in Ubuntu 22.04, I get this error: fallocate: fallocate failed: Text file busy). I googled it, did not find answer. One answer gave steps on how to change swap space on 17.04, just what I was doing, when I got error. Any help will be appreciated.

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
michael (yellupcm-gmail) said :
#1

I read on google that you must take swap file to 0 before you can increase the size to what you want. true of false?

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#2

You need to run:

sudo swapoff

So that swap isn't used, then resize. You can then reboot or run

sudo swapon

I suggest you close as many applications as possible as the stuff in swap will need to be shifted back into RAM

Revision history for this message
michael (yellupcm-gmail) said :
#3

michael@michael-Inspiron-620:~$ sudo swapoff
[sudo] password for michael:
swapoff: bad usage
Try 'swapoff --help' for more information.
michael@michael-Inspiron-620:~$ swapoff --help

Usage:
 swapoff [options] [<spec>]

Disable devices and files for paging and swapping.

Options:
 -a, --all disable all swaps from /proc/swaps
 -v, --verbose verbose mode

 -h, --help display this help
 -V, --version display version

The <spec> parameter:
 -L <label> LABEL of device to be used
 -U <uuid> UUID of device to be used
 LABEL=<label> LABEL of device to be used
 UUID=<uuid> UUID of device to be used
 <device> name of device to be used
 <file> name of file to be used

For more details see swapoff(8).
michael@michael-Inspiron-620:~$

Revision history for this message
michael (yellupcm-gmail) said :
#4

Do I use -a ? Anything else?

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#5

Yes add -a

Can you help with this problem?

Provide an answer of your own, or ask michael for more information if necessary.

To post a message you must log in.