I was wondering about something, I used AWS to resize a swap partition on an EC2 instance. When I ssh into the instance and use the command swapon --show in the console I still get the old GB value of the partition, however, if I use lsblk for example, the correct GB value is shown. Is that a bug? Which one of these can I trust now? I want to be certain that the swap space is also properly assigned and used.
You have to swapoff first and use mkswap and then swapon.
sudo swapoff /dev/nvmelnl
sudo mkswap /dev/nvmelnl
sudo swapon /dev/nvmelnl
sudo swpaon --show
Related
I changed /etc/sysctl.conf file and added statement vm.max_map_count=262144, restarted laptop and still the same error keeps occurring whenever I execute: docker-compose -f docker-amundsen.yml up on terminal.
Can anyone please suggest some solution?
EDIT: Solved now.
To make it persistent, you can add this line:
$ sudo nano /etc/sysctl.conf
vm.max_map_count=262144
$ sudo sysctl -p
I ran the following command to install Nix on my Mac:
sh <(curl -L https://nixos.org/nix/install) --daemon --darwin-use-unencrypted-nix-store-volume
And I got the following error:
error: refusing to create Nix store volume because the boot volume is
FileVault encrypted, but encryption-at-rest is not available.
Manually create a volume for the store and re-run this script.
See https://nixos.org/nix/manual/#sect-macos-installation
https://nixos.org/nix/manual/#sect-macos-installation says:
If you're using a recent Mac with a T2 chip, your drive will still be encrypted at rest (in which case "unencrypted" is a bit of a misnomer). To use this approach, just install Nix with:
sh <(curl -L https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume
If you don't like the sound of this, you'll want to weigh the other approaches and tradeoffs detailed in this section.
I don't have a mac with a T2 chip, so what do I do?
I found some related github issues, but no direct answer.
I chose to use the Use a separate encrypted volume suggestion as outlined in by Philipp Haussleiter:
This approach only works if you have a Disk that is formated with APFS (that should always be the case, if your OS is running of a SSD).
You can check this with:
% diskutil list | grep APFS
…
0: APFS Container Scheme - +250.8 GB disk1
…
Create another Volume on your Disk for NIX:
% sudo diskutil apfs addVolume disk1 'APFS' nix
Will export new APFS Volume "nix" from APFS Container Reference disk1
Started APFS operation on disk1
Preparing to add APFS Volume to APFS Container disk1
Creating APFS Volume
Created new APFS Volume disk1s6
Mounting APFS Volume
Setting volume permissions
Disk from APFS operation: disk1s6
Finished APFS operation on disk1
Your disk may not be named disk1s6. Find the name of your disk with:
% diskutil list | grep nix
4: APFS Volume nix 7.7 GB disk1s6
Again, your disk may not be named disk1s6.
Encrypt disk:
You need to enter a passphrase for the encryption. You have to
remember that passphrase once – you can add it to your key chain later
on. After that the disk encryption will start in the background.
% sudo diskutil apfs encryptvolume disk1s6 -user disk
Passphrase for the new "Disk" user (672C4CFF-34C6-4407-83ED-294C1C42E161):
Repeat passphrase:
Starting background encryption with the new "Disk" crypto user on disk1s6
The new "Disk" user will be the only one who has initial access to disk1s6
The new APFS crypto user UUID will be 672C4CFF-34C6-4407-83ED-294C1C42E161
Background encryption is ongoing; see "diskutil apfs list" to see progress
Setup Mount Point:
MacOS Catalina does not allow to create folders directly under your
Root Path /. But we can use another method to have MacOS create that
folder for us. To do this, we have to add an entry into the file
/etc/synthetic.conf:
% sudo bash -c 'echo nix >> /etc/synthetic.conf'
Now, the next time, the system starts, a mount point /nix will be
created. The next task is to have our Volume mounted at Boot.
Setup Mount:
For the Mount Configuration, we need to the UUID of the Volume. We can
find this via the diskutil tool (again, your disk may not be named
disk1s6):
% diskutil info /dev/disk1s6 | grep UUID
We must edit /etc/fstab with vifs:
% sudo vifs
(vifs behaves just like vi, so use vi commands to edit the file):
UUID=1D9389C1-5676-4077-88F5-8D5304A0B1A6 /nix apfs rw
(Your UUID will be different!)
Reboot. You will get a GUI prompt to enter your encryption passphrase,
and save it to the keychain.
I then ran:
sh <(curl -L https://nixos.org/nix/install) --daemon
The --darwin-use-unencrypted-nix-store-volume option isn't necessary because we have an encrypted volume now.
I am trying to run ELK docker images on my windows10 as below.
C:\WINDOWS\system32> docker run -p 5601:5601 -p 9200:9200 -p 9300:9300 -p 5044:5044 -p 9600:9600 -p 9700:9700 -it --memory="3g" --name elk sebp/elk
I got below error, could i set vm.max_map_count at docker run command line?
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
Any suggestion or hints are more than welcome!
This can be done via WSL's support of a .wslconfig file (stored in your Windows %userprofile% folder), which can apply and persist such setting across restarts, for example:
[wsl2]
kernelCommandLine = sysctl.vm.max_map_count=262144
(Note that's NOT a space after sysctl, but a period, which is necessary for it to work, from my testing.)
After saving the file, restart wsl with wsl --shutdown. Before reopening your WSL, make sure the vm is shutdown, using wsl -l -v, as it can take several seconds sometimes.
For more on this file, its many available settings, and even that need to wait for the shutdown, see the docs.
I've had similar experience with running elastic/elastic, so this might help.
When you're running it in WSL2, you might want to log in to your WSL VM:
wsl -d docker-desktop (Where docker-desktop is the name of the vm, you can check for them with wsl --list
Once in your docker-desktop, do the following:
echo "vm.max_map_count = 262144"> /etc/sysctl.d/999-docker-desktop-conf
followed by:
sysctl -w vm.max_map_count=262144
You can then exit the docker-host by typing exit.
Persistent setting via windows powershell:
wsl su-
[sudo] password for root:<type your root password>
sysctl vm.max_map_count
vi /etc/sysctl.conf
vm.max_map_count = 262144
sysctl -p
sysctl vm.max_map_count
I am trying to make Elasticsearch start automatically when I restart the server by following the steps here.
The problem is that When I restart the server, /tmp is being mounted with the noexec option and I need to run mount -o remount,exec /tmp and manually start Elasticsarch again.
Someone told me that I need to remove noexec from /etc/fstab but noexec is not there.
Edit:
I think that the noexec option might be added by /scripts/securetmp
When I run mount I see:
/usr/tmpDSK on /tmp type ext3 (rw,relatime,data=ordered)
/usr/tmpDSK on /var/tmp type ext3 (rw,nosuid,noexec,relatime,data=ordered)
Solved by deactivating /scripts/securetmp. For more information, look at this post.
I extracted the steps just in case the post disappears in the future.
Run
# /scripts/securetmp
Is going to appear this:
Would you like to secure /tmp & /var/tmp at boot time? (y/n)
Type n
Is going to appear this:
securetmp will not be added to system startup at this time.
Would you like to disable securetmp from the system startup? (y/n)
Type y
Is going to appear this:
Would you like to secure /tmp & /var/tmp now? (y/n)
Type n
Is going to appear this:
/tmp & /var/tmp will not be secured at this time.
I'm trying to run Elastic search in an Ubuntu EC2 machine (t2.medium).
But I'm getting the message:
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
How can I increase the vm.max_map_count value?
To make it persistent, you can add this line:
vm.max_map_count=262144
in your /etc/sysctl.conf and run
$ sudo sysctl -p
to reload configuration with new value
I use
# sysctl -w vm.max_map_count=262144
And for the persistence configuration
# echo "vm.max_map_count=262144" >> /etc/sysctl.conf
Att.
Note that
From version 207 and 21x, systemd only applies settings from
/etc/sysctl.d/*.conf and /usr/lib/sysctl.d/*.conf. If you had
customized /etc/sysctl.conf, you need to rename it as
/etc/sysctl.d/99-sysctl.conf. If you had e.g. /etc/sysctl.d/foo, you
need to rename it to /etc/sysctl.d/foo.conf.
See https://wiki.archlinux.org/index.php/sysctl#Configuration
So add vm.max_map_count=262144 in /etc/sysctl.d/99-sysctl.conf and then run
sudo sysctl --system
sysctl -w vm.max_map_count=262144
When:
permission denied on key 'vm.max_map_count'
sudo sysctl -w vm.max_map_count=262144
If you are using ubuntu VM, then navigate to etc folder.
Run vim sysctl.conf
Add vm.max_map_count=262144 to the end of the file and save
Finally run sudo sysctl -w vm.max_map_count=262144 this command
you will see vm.max_map_count=262144
Following command as worked fine on Fedora 28 (Linux 4.19 Kernel)
sudo echo "vm.max_map_count=262144" >> /etc/sysctl.d/elasticsearchSpecifications.conf && sudo sysctl --system
I found that when adding the settings to /etc/sysctl.conf, the system actually saved the changes to /etc/sysctl.d/99-sysctl.conf.
And when saving the changes to /etc/sysctl.d/99-sysctl.conf, it's also saved to /etc/sysctl.conf, so I think they both point to the same file.