0

So I recently got a new raspberry pi 4 and I went to update it and ran the following commands: sudo apt-get update and sudo apt-get upgrade. The update command ran perfectly fine but when I ran upgrade I got errors stating this:

* dphys-swapfile.service - dphys-swapfile - set up, mount/unmount, and delete a swap file
   Loaded: loaded (/lib/systemd/system/dphys-swapfile.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2021-01-06 10:39:20 GMT; 17ms ago
     Docs: man:dphys-swapfile(8)
  Process: 7793 ExecStart=/sbin/dphys-swapfile setup (code=exited, status=0/SUCCESS)
  Process: 7816 ExecStart=/sbin/dphys-swapfile swapon (code=exited, status=255/EXCEPTION)
 Main PID: 7816 (code=exited, status=255/EXCEPTION)
Jan 06 10:39:20 raspberrypi systemd[1]: dphys-swapfile.service: Failed with result 'exit-code'.
Jan 06 10:39:20 raspberrypi systemd[1]: Failed to start dphys-swapfile - set up, mount/unmount, and delete a swap file.
dpkg: error processing package dphys-swapfile (--configure):
 installed dphys-swapfile package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 dphys-swapfile
E: Sub-process /usr/bin/dpkg returned an error code (1)

I've done a fair bit of googling and researching but I just can't seem to find anything. I've tried running this command sudo apt-get reinstall coreutils to maybe reinstall swapfile but it gave me a similar error. I also tried a fresh flash of Raspbian but the same error came up when I went to update that too. I'm new to linux as this is my first time using it and I'm not sure how to go about fixing this.

Also sorry if I messed up in the format for this post in some way. This is my first post here :)

0

Your Question lacks detail BUT is tagged rpi-update

"In normal circumstances there is NEVER a need to run rpi-update as it always gets you to the leading edge firmware and kernel and because that may be a testing version it could leave your RPi unbootable". https://www.raspberrypi.org/forums/viewtopic.php?p=916911#p916911 Even the rpi-update documentation now warns "Even on Raspbian you should only use this with a good reason. This gets you the latest bleeding edge kernel/firmware."

sudo apt update; sudo apt install --reinstall raspberrypi-bootloader raspberrypi-kernel will put it back to the latest supported kernel/bootcode.

1
  • I couldn't even run that command. I just tried and got the same error that showed: Failed to start dphys-swapfile - set up, mount/unmount, and delete a swap file. – Rossi Jan 6 at 18:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.