From: Bernd Petrovitsch <bernd@petrovitsch.priv.at>
To: noloader@gmail.com
Cc: kernelnewbies <kernelnewbies@kernelnewbies.org>
Subject: Re: Alternate method of running swapon?
Date: Wed, 8 Jan 2020 19:26:53 +0100 [thread overview]
Message-ID: <7f477e10-8e55-fd1b-bc89-5399ba90395f@petrovitsch.priv.at> (raw)
In-Reply-To: <CAH8yC8kg1uoLhddNxjFN=wM8Gg4cz4qS6Sq1KsuD7pK3mgZ3bw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1646 bytes --]
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
[-- Attachment #2: pEpkey.asc --]
[-- Type: application/pgp-keys, Size: 2513 bytes --]
[-- Attachment #3: Type: text/plain, Size: 170 bytes --]
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
next prev parent reply other threads:[~2020-01-08 18:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-08 18:09 Alternate method of running swapon? Jeffrey Walton
2020-01-08 18:23 ` Valentin Vidić
2020-01-08 18:33 ` Jeffrey Walton
2020-01-08 18:42 ` Valentin Vidić
2020-01-08 20:08 ` Jeffrey Walton
2020-01-08 20:28 ` Valentin Vidić
2020-01-08 18:26 ` Bernd Petrovitsch [this message]
2020-01-08 22:23 ` Jeffrey Walton
2020-01-08 18:31 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7f477e10-8e55-fd1b-bc89-5399ba90395f@petrovitsch.priv.at \
--to=bernd@petrovitsch.priv.at \
--cc=kernelnewbies@kernelnewbies.org \
--cc=noloader@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).