swapoff falhou: argumento inválido

2

Descobri recentemente que sempre que encerro / reinicializo minha máquina, ocorre um erro registrado que diz swapoff failed: Invalid argument .

Jul 22 21:09:02 Frederick-Kubuntu systemd[1]: Stopping Update UTMP about System Boot/Shutdown...
Jul 22 21:09:02 Frederick-Kubuntu swapoff[5049]: swapoff: /dev/disk/by-uuid/cc08e210-8609-4cf8-9b7c-6af95b0c38eb: swapoff failed: Invalid argument
Jul 22 21:09:02 Frederick-Kubuntu systemd[1]: Stopped target Remote File Systems.
Jul 22 21:09:02 Frederick-Kubuntu systemd[1]: Stopped target Remote File Systems (Pre).
Jul 22 21:09:02 Frederick-Kubuntu systemd[1]: Stopped target User and Group Name Lookups.
Jul 22 21:09:02 Frederick-Kubuntu systemd[5049]: dev-disk-by\x2duuid-cc08e210\x2d8609\x2d4cf8\x2d9b7c\x2d6af95b0c38eb.swap: Executing: /sbin/swapoff /dev/disk/by-uuid/cc08e210-8609-4cf8-9b7c-6af95b0c38eb
Jul 22 21:09:02 Frederick-Kubuntu systemd[5048]: dev-nvme0n1p9.swap: Executing: /sbin/swapoff /dev/nvme0n1p9
Jul 22 21:09:02 Frederick-Kubuntu systemd[5051]: systemd-update-utmp.service: Executing: /lib/systemd/systemd-update-utmp shutdown
Jul 22 21:09:02 Frederick-Kubuntu systemd[1]: Stopped Load/Save Random Seed.
Jul 22 21:09:02 Frederick-Kubuntu systemd[1]: Stopped Load/Save Screen Backlight Brightness of backlight:acpi_video0.
Jul 22 21:09:02 Frederick-Kubuntu systemd[1]: dev-disk-by\x2duuid-cc08e210\x2d8609\x2d4cf8\x2d9b7c\x2d6af95b0c38eb.swap: Swap process exited, code=exited status=255
Jul 22 21:09:02 Frederick-Kubuntu systemd[1]: Deactivated swap /dev/disk/by-uuid/cc08e210-8609-4cf8-9b7c-6af95b0c38eb.
Jul 22 21:09:02 Frederick-Kubuntu systemd[1]: dev-disk-by\x2duuid-cc08e210\x2d8609\x2d4cf8\x2d9b7c\x2d6af95b0c38eb.swap: Unit entered failed state.
Jul 22 21:09:02 Frederick-Kubuntu systemd[1]: Deactivated swap /dev/disk/by-partuuid/3c715e0f-205c-4138-9249-127984925f66.
Jul 22 21:09:02 Frederick-Kubuntu systemd[1]: Deactivated swap /dev/disk/by-partlabel/Linux\x20Swap.
Jul 22 21:09:02 Frederick-Kubuntu systemd[1]: Deactivated swap Swap Partition.
Jul 22 21:09:02 Frederick-Kubuntu systemd[1]: Stopped Update UTMP about System Boot/Shutdown.

Eu tentei executar o comando manualmente e nada de errado foi encontrado.

frederick@Frederick-Kubuntu:~$ sudo blkid /dev/nvme0n1p9 # this is the swap part
/dev/nvme0n1p9: UUID="cc08e210-8609-4cf8-9b7c-6af95b0c38eb" TYPE="swap" PARTLABEL="Linux Swap" PARTUUID="3c715e0f-205c-4138-9249-127984925f66"
frederick@Frederick-Kubuntu:~$ free -m
            total        used        free      shared  buff/cache   available
Mem:          16000        1828       12462          88        1709       13734
Swap:          7629           0        7629
frederick@Frederick-Kubuntu:~$ sudo /sbin/swapoff /dev/disk/by-uuid/cc08e210-8609-4cf8-9b7c-6af95b0c38eb
frederick@Frederick-Kubuntu:~$ free -m
            total        used        free      shared  buff/cache   available
Mem:          16000        1826       12466          88        1708       13736
Swap:             0           0           0
frederick@Frederick-Kubuntu:~$ sudo /sbin/swapon /dev/disk/by-uuid/cc08e210-8609-4cf8-9b7c-6af95b0c38eb
frederick@Frederick-Kubuntu:~$ free -m
            total        used        free      shared  buff/cache   available
Mem:          16000        1828       12463          88        1708       13734
Swap:          7629           0        7629

Eu tentei usar mkswap para reconstruir a partição swap, mas não funcionou (eu especifiquei o UUID, então /etc/fstab ainda está correto).

Como posso suprimir esse erro? Agradecemos antecipadamente.

    
por Frederick Zhang 22.07.2016 / 13:26

1 resposta

3

swapoff informa swapoff failed: Invalid argument quando o dispositivo já não está sendo usado para troca. Exemplo:

deltik@node51 [~]$ sudo swapoff /dev/zero
swapoff: /dev/zero: swapoff failed: Invalid argument

Isso não é um erro. Significa apenas que o dispositivo não está sendo usado como swap no momento em que você desligou o computador.

Se você está se perguntando por que o systemd sequer tenta swapoff , ele é criado ( ênfase meu):

Before shutting down, this binary will try to unmount all remaining file systems, disable all remaining swap devices, detach all remaining storage devices and kill all remaining processes.

    
por 22.07.2016 / 14:01