Hi all! On 08/01/2020 19:09, Jeffrey Walton wrote: [...] > I work with an open source project. We have a VM but it is low-end. > The machine suffers OOM kills. We don't have access to /etc/fstab.
Apparently you run too many (or too fat) programs;-)
> Everything is an upsell with the VPS provider.
>
> I'm trying to setup a swapfile during startup using Systemd but:
>
> # swapon /swapfile
> swapon: /swapfile: swapon failed: Operation not permitted
>
> This may be useful:
[... nope ....]
> My question is, is there a way to sidestep the restriction? Is it
> possible to ask the kernel to use the swapfile without using the
> command?
The swapon (and swapoff) command basically calls the swapon()
syscall (and swapoff() syscall, respectively) and their manual
page say the caller needs CAP_SYS_ADMIN capability which usually
means being "root".
Does it work in a root-shell?
The man page says further under errors:
---- snip ----
EPERM: The caller does not have the CAP_SYS_ADMIN capability.
Alternatively, the maximum number of swap files are already in
use; see NOTES below.
---- snip ----
The notes below just talk about the maximum numbers of swapfile
depending on the kernel version and activates features.
If the kernel is built/provided by the VPS provider, there may
be further limitations ....
MfG,
Bernd
PS: I'm not guessing why ....
--
"I dislike type abstraction if it has no real reason. And saving
on typing is not a good reason - if your typing speed is the main
issue when you're coding, you're doing something seriously wrong."
- Linus Torvalds
pEpkey.asc
Description: application/pgp-keys
_______________________________________________ Kernelnewbies mailing list [email protected] https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
