Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swap file automatically generates on boot #673

Open
SimplyCorbett opened this issue Mar 21, 2024 · 6 comments
Open

Swap file automatically generates on boot #673

SimplyCorbett opened this issue Mar 21, 2024 · 6 comments

Comments

@SimplyCorbett
Copy link

SimplyCorbett commented Mar 21, 2024

Hi,

I'm using the ubuntu-22.04.3-preinstalled-server-arm64-orangepi-5-plus image and there is a 1GB swap file in root that automatically generates every reboot. This is on a SD card so I definitely don't want a swap file to be generated on reboot. I have to manually disable swap by logging into SSH after rebooting. Deleting the file doesn't prevent it from regenerating on reboot.

This file doesn't exist in /etc/fstab. Is this documented anywhere? I can't find any details about this on google. What's the best method to permanently disable this?

Or does the x-systemd.growfs automatically generate it?

@icache
Copy link

icache commented Mar 22, 2024

try:

sudo systemctl stop swapfile.swap
sudo systemctl stop mkswap.service

sudo systemctl mask mkswap.service
sudo systemctl mask swapfile.swap

sudo rm -rf /swapfile

@SimplyCorbett
Copy link
Author

Yes, I had to mask it. Disabling the services didn't work.

Thank you so much :)

@SimplyCorbett
Copy link
Author

Wouldn't that also disable swap file generation on other specified devices? For example, I might want to put a swap file on the nvme drive.

The problem is the 1GB swap file still generates regardless on the root partition of the SD card, I've tested that.

@s1n7ax
Copy link

s1n7ax commented Sep 30, 2024

I can confirm. After disabling the swap using sudo systemctl disable swapfile.swap, swapon --show shows nothing but the swap file is generated regardless. Not a major issue but still it takes 1GB of storage right?

Copy link

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 14 days. Thank you for your contribution!

@github-actions github-actions bot added the stale Issues with a lack of recent activity label Nov 29, 2024
@MarcAndreWyss
Copy link

I have not tested it, but my assumption is that this is just happening for the desktop version and not the server version. Maybe someone has time to test my assumption. If I have some time I will probably test it myself.

During my try to fix #1130 @Joshua-Riek pointed me to the project / package ubuntu-rockchip-settings. If my interpretation of this project / package is correct, then the swapfile is generated, because of the settings here: https://github.com/Joshua-Riek/ubuntu-rockchip-settings/tree/noble/data/desktop (mkswap.service and swapfile.swap). Those settings to not exist in the server version here: https://github.com/Joshua-Riek/ubuntu-rockchip-settings/tree/noble/data/server

Therefore my interpretation (which may be wrong) is that these settings were done by intention for the desktop version and not by accident. Therefore my assumption would be that this is not a bug in the sense of an unexpected behaviour, because it looks like an architectual decision.

However I agree that a swap file does not make much sense on a board with a lot of RAM. But if one would remove the settings then people using boards with few RAM would have to always activate swap consciously. I have no idea what @Joshua-Riek tought's were. But when thinking of it, this might be a topic for the wiki here: https://github.com/Joshua-Riek/ubuntu-rockchip/wiki

@github-actions github-actions bot removed the stale Issues with a lack of recent activity label Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants