每特17劃

及時當勉勵 2004/06/07

試用 zswap — 2022-09-03

試用 zswap

根據 Pellaeon 的 blog 分享的資訊:

原本要安裝 systemd-swap ,就改為直接用 tmpfiles.d 來設定。

主要調整參數為:

  • /sys/module/zswap/parameters/max_pool_percent => 30
  • /proc/sys/vm/swappiness => 100

編輯 /etc/tmpfiles.d/zswap.conf 設定如下:

w- /proc/sys/vm/swappiness - - - - 100
w- /sys/module/zswap/parameters/max_pool_percent - - - - 30

但重開機後,發現只有部份參數生效,原因是 /proc/sys/vm/swappiness 有 race condition,會被 sysctl 的開機設定蓋寫如下:

/etc/sysctl.d/99-sysctl.conf:1:vm.swappiness = 10

改修改 /etc/tmpfiles.d/zswap.conf 設定如下:

w+ /etc/sysctl.d/99-sysctl.conf - - - - vm.swappiness = 100
w- /sys/module/zswap/parameters/max_pool_percent - - - - 30

重開機之後就生效開始運作了。

FAQ

Q: hibernate 的機制跟 swap 有關,是否能正常運作?

目前測試 OK 。但不確定在 MEM 吃緊時,是否還是正常

Q: 如果 reset swap 讓 swap 歸零?

可執行下述指令

sudo swapoff -a; sleep 30; sudo swapon -a

Reference

試用 Open Build Service —

試用 Open Build Service

註冊帳號

  1. 先至 Open Build Service 網站: URL
  2. 點選 "Sign Up"

  1. 將註冊表單填一填

  1. 之後 … ,跑完 email 認證手續後,即可登入使用。

設定 Repository

作業系統環境

以 Ubuntu 22.04 作業系統為例:

方法A: 使用 Live CD/USB

至 Ubuntu 官方網站下載 ISO 檔

URL: https://releases.ubuntu.com/22.04/

(選取 "64-bit PC (AMD64) desktop image" 的項目)

再以此 ISO 開機直接使用

方法B: 使用 docker

以下使用 docker 作示例:

$ docker run --rm --tty --interactive ubuntu:22.04 bash

進到 docker container 後,先建立一般使用者 ubuntu 並以該身份執行:

# apt update && apt install -y sudo
# useradd ubuntu --create-home --groups sudo --shell /bin/bash
# echo "ubuntu ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/casper
# su - ubuntu

上傳套件

先安裝必要的工具程式如下:

$ sudo apt update
$ sudo apt install -y software-properties-common dpkg-dev osc

其中:

  • software-properties-common: 提供 add-apt-repository 指令
  • dpkg-dev: 在下載 firefox source package 時用到
  • osc: Open Build Service 的專屬 CLI 工具指令

執行下述指令引入 firefox 的 PPA,注意這裡要加上 --enable-source

sudo add-apt-repository --enable-source ppa:mozillateam/ppa

之後執行下述指令,下載 firefox 的 debian source package:

apt source firefox

下載完後,會得到檔案及目錄概況如下:

.
|-- firefox-104.0.1+build1
|   |-- debian
|   |   |-- ...
|   |   |-- changelog
|   |   |-- control
|   |   |-- rules
|   |   `-- ...
|-- firefox_104.0.1+build1-0ubuntu0.22.04.1~mt1.debian.tar.xz
|-- firefox_104.0.1+build1-0ubuntu0.22.04.1~mt1.dsc
`-- firefox_104.0.1+build1.orig.tar.xz

接著 checkout 在 Open Build Server 上的 repository

osc checkout home:matlinuxer2

首次下載, 在輸入完帳號跟密碼之後,若遇到下列 prompt 時,可選擇 4

1) chainer ChainerBackend (Backend provided by python-keyring)
2) fail Keyring (Backend provided by python-keyring)
3) Config file credentials manager (Store the credentials in the config file (plain text))
4) Obfuscated Config file credentials manager (Store the credentials in the config file (obfuscated))
5) Transient password store (Do not store the password and always ask for the password)
Select credentials manager: 4

Reference