[Swap] Le swap ne fonctionne plus? [Résolu]
Depuis ma mise à jour de ce matin j'ai un "failed to active swap" et aussi "dependency failed for swap" au boot donc du coup je ne sais pas si mon swap fonctionne comment corriger ce problème?
Merçi
Forum d'entraide ! Posez vos questions ici
https://forums.archlinux.fr/
Code : Tout sélectionner
$ cat /etc/fstab
Code : Tout sélectionner
$ lsblk -f
Code : Tout sélectionner
[jean@flash ~]$ cat /etc/fstab
# Static information about the filesystems.
# See fstab(5) for details.
# <file system> <dir> <type> <options> <dump> <pass>
# /dev/sda2
UUID=1d06123c-8152-44f7-8c7b-2c4480ba8442 / ext4 rw,relatime 0 1
# /dev/sda1
UUID=5C5A-F13C /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 2
/swapfile none swap defaults 0 0
Code : Tout sélectionner
[jean@flash ~]$ lsblk -f
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINT
sda
├─sda1 vfat FAT32 5C5A-F13C 931,4M 6% /boot
└─sda2 ext4 1.0 1d06123c-8152-44f7-8c7b-2c4480ba8442 413,1G 4% /
sr0
Code : Tout sélectionner
$ sudo swapon --show
$ ls -lh /swapfile
$ free -h
Code : Tout sélectionner
[jean@flash ~]$ ls -lh /swapfile
-rw------- 1 root root 1,9G 1 mai 14:47 /swapfile
Code : Tout sélectionner
[jean@flash ~]$ free -h
total utilisé libre partagé tamp/cache disponible
Mem: 15Gi 1,0Gi 13Gi 245Mi 1,1Gi 13Gi
Partition d'échange: 0B 0B 0B
Code : Tout sélectionner
swapoff -a
rm -f /swapfile
fallocate -l 2G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
Code : Tout sélectionner
/swapfile swap swap defaults 0 0
Code : Tout sélectionner
[root@flash jean]# swapoff -a
[root@flash jean]# rm -f /swapfile
[root@flash jean]# fallocate -l 2G /swapfile
[root@flash jean]# chmod 600 /swapfile
[root@flash jean]# mkswap /swapfile
Configure l'espace d'échange (swap) en version 1, taille = 2 GiB (2147479552 octets)
pas d'étiquette, UUID=77ff9b07-4e17-4006-91ab-784b32eefebc
[root@flash jean]# swapon /swapfile
swapon: /swapfile : échec de swapon: Argument invalide
Non ça ne corrige rien, c'est pour cette raison que j'ai bien précisé dans un "premier temps", dans le cas où l'erreur était gênante.Ensuite, j'ai commenté la ligne correspondant au swapfile dans le fichier /etc/fstab et je n'ai plus le message d'erreur mais je pense que le problème n'est peut-être pas corrigé?
Code : Tout sélectionner
$ journalctl --since now
Code : Tout sélectionner
$ sudo swapon -v
Code : Tout sélectionner
$ sudo mount -vvv -a
essayes avec ça:J'ai un souci avec la dernière ligne
Code : Tout sélectionner
/swapfile none swap defaults 0 0
C'est à dire ?
Code : Tout sélectionner
swapon /swapfile
swapon: /swapfile : échec de swapon: Argument invalide
Je veux dire qu'au lieu de chercher d'où venait l'erreur , tu as mis un grand coup de balaibenjarobin a écrit :C'est à dire ?
tu t'es trompé dans le fstab voir mon message plus haut.Je ne comprend pas comment cela peut échouer... Étrange. Ton problème vient bien de là... Je vais essayer de creuserCode : Tout sélectionner
swapon /swapfile swapon: /swapfile : échec de swapon: Argument invalide
Non le fstab n'a aucun rapport, ici. Et les 2 sont valides que je sache.
CoudUr a écrit : ↑sam. 13 juin 2020, 17:03 essayes avec ça:Code : Tout sélectionner
/swapfile none swap defaults 0 0
Code : Tout sélectionner
Static information about the filesystems.
# See fstab(5) for details.
# <file system> <dir> <type> <options> <dump> <pass>
# /dev/sda2
UUID=1d06123c-8152-44f7-8c7b-2c4480ba8442 / ext4 rw,relatime 0 1
# /dev/sda1
UUID=5C5A-F13C /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iochar>
/swapfile none swap defaults 0 0
Peut-être mais dans le doute suivre les recommandations ne fait pas de malbenjarobin a écrit : Non le fstab n'a aucun rapport, ici. Et les 2 sont valides que je sache.
This field describes the mount point (target) for the filesystem. For swap partitions, this field should be specified as `none'.
SI on se fie à son fichier fstab c'est du ext4benjarobin a écrit :Tu as quoi comme système de fichier pour ta partition racine ??
On en sera un peu plus en voyant les erreurs, voir mon message plus haut. Utilises dmesg aussi en complément.maskarin a écrit :Alors qu'est ce qu'il ne va pas
Ce n'est pas faux
dmesg
va bien aider à comprendre ce qui se passe suite au lancer du swapon.Code : Tout sélectionner
swapon /swapfile
dmesg | tail -20
Code : Tout sélectionner
uname -a
zcat /proc/config.gz| grep -i swap
Code : Tout sélectionner
[root@flash jean]# swapon /swapfile
swapon: /swapfile : échec de swapon: Argument invalide
[root@flash jean]#
Code : Tout sélectionner
[jean@flash ~]$ dmesg | tail -20
[ 25.822091] audit: type=1131 audit(1592064949.720:66): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=user-runtime-dir@974 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[ 26.011514] audit: type=1131 audit(1592064949.910:67): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=NetworkManager-dispatcher comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[ 34.944602] audit: type=1131 audit(1592064958.843:68): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-hostnamed comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[ 35.012560] audit: type=1334 audit(1592064958.913:69): prog-id=10 op=UNLOAD
[ 35.012563] audit: type=1334 audit(1592064958.913:70): prog-id=9 op=UNLOAD
[ 283.620106] audit: type=1100 audit(1592065207.688:71): pid=1541 uid=1000 auid=1000 ses=2 msg='op=PAM:authentication grantors=pam_unix acct="root" exe="/usr/bin/su" hostname=flash addr=? terminal=pts/1 res=success'
[ 283.620192] audit: type=1101 audit(1592065207.688:72): pid=1541 uid=1000 auid=1000 ses=2 msg='op=PAM:accounting grantors=pam_unix acct="root" exe="/usr/bin/su" hostname=flash addr=? terminal=pts/1 res=success'
[ 283.620601] audit: type=1103 audit(1592065207.688:73): pid=1541 uid=1000 auid=1000 ses=2 msg='op=PAM:setcred grantors=pam_unix acct="root" exe="/usr/bin/su" hostname=flash addr=? terminal=pts/1 res=success'
[ 283.620690] audit: type=1105 audit(1592065207.688:74): pid=1541 uid=1000 auid=1000 ses=2 msg='op=PAM:session_open grantors=pam_unix acct="root" exe="/usr/bin/su" hostname=flash addr=? terminal=pts/1 res=success'
[ 288.773609] swapon: swapfile has holes
[ 358.735370] audit: type=1106 audit(1592065282.801:75): pid=1541 uid=1000 auid=1000 ses=2 msg='op=PAM:session_close grantors=pam_unix acct="root" exe="/usr/bin/su" hostname=flash addr=? terminal=pts/1 res=success'
[ 358.735376] audit: type=1104 audit(1592065282.801:76): pid=1541 uid=1000 auid=1000 ses=2 msg='op=PAM:setcred grantors=pam_unix acct="root" exe="/usr/bin/su" hostname=flash addr=? terminal=pts/1 res=success'
[ 393.913698] audit: type=1100 audit(1592065317.978:77): pid=1608 uid=1000 auid=1000 ses=2 msg='op=PAM:authentication grantors=? acct="root" exe="/usr/bin/su" hostname=flash addr=? terminal=pts/1 res=failed'
[ 409.445863] audit: type=1100 audit(1592065333.511:78): pid=1610 uid=1000 auid=1000 ses=2 msg='op=PAM:authentication grantors=pam_unix acct="root" exe="/usr/bin/su" hostname=flash addr=? terminal=pts/1 res=success'
[ 409.445976] audit: type=1101 audit(1592065333.511:79): pid=1610 uid=1000 auid=1000 ses=2 msg='op=PAM:accounting grantors=pam_unix acct="root" exe="/usr/bin/su" hostname=flash addr=? terminal=pts/1 res=success'
[ 409.446411] audit: type=1103 audit(1592065333.511:80): pid=1610 uid=1000 auid=1000 ses=2 msg='op=PAM:setcred grantors=pam_unix acct="root" exe="/usr/bin/su" hostname=flash addr=? terminal=pts/1 res=success'
[ 409.446517] audit: type=1105 audit(1592065333.511:81): pid=1610 uid=1000 auid=1000 ses=2 msg='op=PAM:session_open grantors=pam_unix acct="root" exe="/usr/bin/su" hostname=flash addr=? terminal=pts/1 res=success'
[ 414.093565] swapon: swapfile has holes
[ 451.952638] audit: type=1106 audit(1592065376.018:82): pid=1610 uid=1000 auid=1000 ses=2 msg='op=PAM:session_close grantors=pam_unix acct="root" exe="/usr/bin/su" hostname=flash addr=? terminal=pts/1 res=success'
[ 451.952819] audit: type=1104 audit(1592065376.018:83): pid=1610 uid=1000 auid=1000 ses=2 msg='op=PAM:setcred grantors=pam_unix acct="root" exe="/usr/bin/su" hostname=flash addr=? terminal=pts/1 res=success'
Code : Tout sélectionner
[jean@flash ~]$ uname -a
Linux flash 5.7.2-arch1-1 #1 SMP PREEMPT Wed, 10 Jun 2020 20:36:24 +0000 x86_64 GNU/Linux
Code : Tout sélectionner
[jean@flash ~]$ zcat /proc/config.gz| grep -i swap
CONFIG_SWAP=y
CONFIG_MEMCG_SWAP=y
CONFIG_MEMCG_SWAP_ENABLED=y
CONFIG_ARCH_USE_BUILTIN_BSWAP=y
CONFIG_ARCH_WANTS_THP_SWAP=y
CONFIG_THP_SWAP=y
CONFIG_FRONTSWAP=y
CONFIG_ZSWAP=y
# CONFIG_ZSWAP_COMPRESSOR_DEFAULT_DEFLATE is not set
# CONFIG_ZSWAP_COMPRESSOR_DEFAULT_LZO is not set
# CONFIG_ZSWAP_COMPRESSOR_DEFAULT_842 is not set
CONFIG_ZSWAP_COMPRESSOR_DEFAULT_LZ4=y
# CONFIG_ZSWAP_COMPRESSOR_DEFAULT_LZ4HC is not set
# CONFIG_ZSWAP_COMPRESSOR_DEFAULT_ZSTD is not set
CONFIG_ZSWAP_COMPRESSOR_DEFAULT="lz4"
# CONFIG_ZSWAP_ZPOOL_DEFAULT_ZBUD is not set
CONFIG_ZSWAP_ZPOOL_DEFAULT_Z3FOLD=y
# CONFIG_ZSWAP_ZPOOL_DEFAULT_ZSMALLOC is not set
CONFIG_ZSWAP_ZPOOL_DEFAULT="z3fold"
CONFIG_ZSWAP_DEFAULT_ON=y
CONFIG_MTD_SWAP=m
CONFIG_NFS_SWAP=y
CONFIG_SUNRPC_SWAP=y
CONFIG_RING_BUFFER_ALLOW_SWAP=y
# CONFIG_TRACER_SNAPSHOT_PER_CPU_SWAP is not set
Code : Tout sélectionner
df /swapfile
# Récupère le /dev/XXX qui est retourné par la commande df
mount
tune2fs -l /dev/XXX
Code : Tout sélectionner
swapoff -a
rm -f /swapfile
dd if=/dev/zero of=/swapfile count=2048 bs=1M
chmod 600 /swapfile
echo "-- test swapon --" > /dev/kmsg
mkswap /swapfile
swapon -v /swapfile
dmesg | tail -20
Code : Tout sélectionner
[root@flash jean]# df /swapfile
Sys. de fichiers blocs de 1K Utilisé Disponible Uti% Monté sur
/dev/sda2 478674668 21246704 433042892 5% /
Code : Tout sélectionner
[root@flash jean]# tune2fs -l /dev/XXX
tune2fs 1.45.6 (20-Mar-2020)
tune2fs: Aucun fichier ou dossier de ce type lors de la tentative d'ouverture de /dev/XXX
Impossible de trouver un superbloc de système de fichiers valide.
mount
tune2fs -l /dev/sda2