Trying install NCP over latest Debian Buster, installation fails when try execute “dphys-swapfile”.
Configurando dphys-swapfile (20100506-5) …
Job for dphys-swapfile.service failed because the control process exited with error code.
See “systemctl status dphys-swapfile.service” and “journalctl -xe” for details.
invoke-rc.d: initscript dphys-swapfile, action “start” failed.
● dphys-swapfile.service - dphys-swapfile - set up, mount/unmount, and delete a swap file
Loaded: loaded (/lib/systemd/system/dphys-swapfile.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2021-11-01 08:23:20 CET; 17ms ago
Process: 468 ExecStart=/sbin/dphys-swapfile setup (code=exited, status=0/SUCCESS)
Process: 500 ExecStart=/sbin/dphys-swapfile swapon (code=exited, status=255/EXCEPTION)
Main PID: 500 (code=exited, status=255/EXCEPTION)
nov 01 08:23:20 nextcloudpi systemd: Starting dphys-swapfile - set up, mount/unmount, and delete a swap file…
nov 01 08:23:20 nextcloudpi dphys-swapfile: computing size, want /var/swap=4010MByte, restricting to 50% of remaining disk size: 3101MBytes, restricting to config limit: 2048MBytes, generating swapfile … of 2048MBytes
nov 01 08:23:20 nextcloudpi dphys-swapfile: swapon: /var/swap: swapon ha fallado: Argumento inválido
nov 01 08:23:20 nextcloudpi systemd: dphys-swapfile.service: Main process exited, code=exited, status=255/EXCEPTION
nov 01 08:23:20 nextcloudpi systemd: dphys-swapfile.service: Failed with result ‘exit-code’.
nov 01 08:23:20 nextcloudpi systemd: Failed to start dphys-swapfile - set up, mount/unmount, and delete a swap file.
dpkg: error al procesar el paquete dphys-swapfile (–configure):
el subproceso instalado paquete dphys-swapfile script post-installation devolvió el código de salida de error 1
Procesando disparadores para man-db (2.8.5-2) …
Procesando disparadores para systemd (241-7~deb10u8) …
Se encontraron errores al procesar:
E: Sub-process /usr/bin/dpkg returned an error code (1)
Any sugestion about?
Thank you very much.
Afaik, This can happen when there is swap already configured.
What worked for me was; to disable normal swap and use dphys-swapfile instead.
If you manage to fix it, please paste the commands you used to disable swap and we’ll add them to the curl script
I found the cause of my problem.
I instaled debian 10 with btrfs file system and when swapon try initialize the swap file crash due file has holes like show next explanation on manpage of swapon:
You should not use swapon on a file with holes. This can be seen in the system log as
swapon: swapfile has holes.
The swap file implementation in the kernel expects to be able to write to the file directly, without the assistance of the filesystem. This is a problem on preallocated files (e.g. fallocate(1)) on filesystems like XFS
or ext4, and on copy-on-write filesystems like btrfs.
It is recommended to use dd(1) and /dev/zero to avoid holes on XFS and ext4.
swapon may not work correctly when using a swap file with some versions of btrfs. This is due to btrfs being a copy-on-write filesystem: the file location may not be static and corruption can result. Btrfs actively dis‐
allows the use of swap files on its filesystems by refusing to map the file.
One possible workaround is to map the swap file to a loopback device. This will allow the filesystem to determine the mapping properly but may come with a performance impact.
Swap over NFS may not work.
swapon automatically detects and rewrites a swap space signature with old software suspend data (e.g. S1SUSPEND, S2SUSPEND, ...). The problem is that if we don't do it, then we get data corruption the next time an attempt
at unsuspending is made.
@nachoparker only must put one explanation before use the script showing that BTRFS file system on root mount point “/” is not compatible with it.
Maybe another telling that is not necesary a swap partition (The script execute well anyway but spend disk space innecesarely) and recomended at least 16Gb for root partition to alocate the swapfile, if installer is thinking on use another HD for data like me.
Script run ok with EXT4 and XFS root filesystem with or without swap partition.
Thanks for your help @OliverV and @nachoparker .