system fontが汎用CJKになっていた

なんかPCを再起動してからフォントが変になっていました.中国語混じりのような汎用CJKらしきフォントになっています.今のフォントを調べるのは何だろうと探すと以下のページを見つけました.

fc-matchコマンドで確認するとWenQuanYi Zen Heiというフォントが設定されている状態のようです.パッケージを確認するとfonts-wqy-microheiのようです.おまけにfonts-wqy-zenheiという中国語フォントも入っていたのでこれらを削除しました.(fonts-notoも入っているのでもし中国語を表示する必要が出ても問題ないはず)

$ fc-match :lang=ja
wqy-zenhei.ttc: "WenQuanYi Zen Hei" "Regular"
$ apt-cache search WenQuanYi
fonts-wqy-microhei - Sans-serif style CJK font derived from Droid
fonts-wqy-zenhei - "WenQuanYi Zen Hei" A Hei-Ti Style (sans-serif) Chinese font
xfonts-wqy - WenQuanYi Bitmap Song CJK font for X
$ dpkg -l|grep -i  fonts-wqy
ii  fonts-wqy-microhei                            0.2.0-beta-3                            all          Sans-serif style CJK font derived from Droid
ii  fonts-wqy-zenhei                              0.9.45-7                                all          "WenQuanYi Zen Hei" A Hei-Ti Style (sans-serif) Chinese font
$ sudo apt purge fonts-wqy-microhei fonts-wqy-zenhei

dgm3を再起動してログインし直すと以前設定したフォントになっていました.

$ fc-match 
umeplus-p-gothic.ttf: "UmePlus P Gothic" "Regular"

logを見るとfonts-wqy-microheiの0.2.0-beta-3 で0.2.0-beta-2をアップデートしたものが見つかりました.恐らくこのタイミングで置き換わったのではないかと思います.それ以前の1年ほどのログの中にはなかったのでそれ以前に導入されたパッケージのようです.

中を見るとこのような設定が.

$ find fonts-wqy-microhei_0.2.0-beta-3_all -type f -print | grep etc
fonts-wqy-microhei_0.2.0-beta-3_all/etc/fonts/conf.avail/65-wqy-microhei.conf

以下を見ると標準より大きい数字なので手動で設定したフォントより優先度が高いので置き換わったのでしょうか?だとすると中途半端に設定をいじっていた自分のせいのようですorz

  1. 各日本語フォントパッケージは、/usr/share/fonts/truetype/

ttf-japanese-mincho.ttf または ttf-japanese-gothic.ttf をalternativesパスとして登録する。alternatives優先順位は次のように 規定する。

100より上: サードパーティまたはユーザ作成のフォント(IPA フォントなどはこのカテゴリに入る)
60: vl-gothic(標準)
50: ttf-sazanami-mincho, ttf-sazanami-gothic
20: ttf-kochi-mincho, ttf-kochi-gothic
20より下: 日本語を字形に含むがunified領域で中国語字形が使われているなど
日本語の表現には使いにくいフォント

とりあえず使わないであろうフォントが削除できてディスクスペースが開いたので良かったとしましょう.

環境

$ uname -m
x86_64
$ lsb_release -d
Description:    Debian GNU/Linux unstable (sid)
$ dpkg-query -W fontconfig
fontconfig      2.13.0-5

SteamのアプリがAndroidでリモートプレイが出来るSteam Linkを試す

20180521_01:05:06-2769

AndroidでSteamのホームストリーミングで遊べるSteam Linkというアプリが公開されていたのでちょっと試してみました.

先ずはPCのSteamでホームストリーミングを有効にしておきます.
20180519_01:05:27-31428

firewallはこの辺りを参考に空けておきます.

ホームストリーミングだけならこの辺?

UDP 27031 and 27036 (incoming, for In-Home Streaming)
TCP 27036 and 27037 (incoming, for In-Home Streaming)

PCでSteamを起動した状態でAndroidのSteam Linkを起動したらPCが見つかりました.しかしネットワークテストがいまいち.Wi-Fiが2.4GHz 11gの54MbpsでHostのPCもClientのAndroidも同じAPなのでこのままでは無理がありますね…….

Screenshot_20180519-015144

とりあえず強行してみるとHostPC側では動いていますが,Androidでは表示が崩れてこんな感じ.

Screenshot_20180519-015239

ちなみにHostPCはCore2DuoかつGPUもCPUのものなのでかなりスペック低いのでそのせいもありそうです.
近いうちに回線は有線1GHz+Wi-Fi 300Mbpsの環境で試してみようと思います.

このアプリケーションはPCのHost側もゲーム画面を表示してそれをAndroidに転送して動いているのでPCで別の作業をするという向けには使いづらい感じです.もし併用するなら仮想画面や別モニタに別のXを動かすとかしないといけないと思います.
とはいえAndroidでSteamゲームが遊べるのは便利そう.それにまだBETAなのでもっと良くなるでしょう.

add 2018-05-26)
iOS版はblockされたようです(◞‸◟)

画像ファイルのタイムスタンプをexifの時間に合わせる

画像ファイルをSNSなどにアップロードするときに回線が細かったりデータ転送料金が従量制だったりするときにリサイズしてアップロードしたりするのですが,サービスによってはファイルのタイムスタンプを参照して悲しいことになることも.
オリジナルのexifが残っている場合はそれを参照してファイルのタイムスタンプを修正することが可能です.
というメモ.

$ exiftool "-FileModifyDate<DateTimeOriginal" DP1M0???.resized.JPG
   10 image files updated

環境

$ dpkg-query -W libimage-exiftool-perl
libimage-exiftool-perl  10.96-1
$ lsb_release -d
Description:    Debian GNU/Linux unstable (sid)
$ uname -m
x86_64

関連

Mozcでシークレットモードやサジェストのオンオフをするコマンド機能を試す

以下のスライドを見て案外絵文字対応サービス多いのかもと思ったけど入力に日本語入力システムを使うとパスワードを覚えちゃうのが嫌だなとか,Emoji Pickerみたいなのを使うのも面倒.Mozcにはシークレットモードがあるけど( mozc_tool --mode=config_dialog のプライバシータブ )設定画面を呼び出して設定しないといけないので面倒.ショートカットか何かで切り替えが出来ないかなと探してみました.

Google日本語入力のヘルプページを見ても載っていない

フォーラムを検索すると以下ような要望と解答が.

試してみると問題なく動作するようです.

shutter_18-05-03_18:22:31_001

以下のページを見ると「こまんど」以外にも複数の単語で切り替えが出来るようです.

  • Google Developers Japan: Google 日本語入力の開発版をアップデートしました。(1.4.1003.10x)

    「コマンド」機能が追加されました。「コマンド」と入力し、変換候補を選択することで、設定ツールを起動することなく、【シークレットモード】のオン・オフ、および【プレゼンテーションモード】のオン・オフを変更することができます。

    「秘密」「シークレット」「シークレットモード」「プライバシー」「プライベート」と入力することで、【シークレットモード】のオン・オフを変更することができます。
    「サジェスト」「予測」「予測入力」「予測変換」「プレゼンテーション」「プレゼン」と入力することで、【プレゼンテーションモード】のオン・オフを変更することができます。

「きょう」「きのう」「おととい」「ことし」「きょねん」などで年月,「2018ねん」等で和暦,郵便番号で住所,「ばーじょん」でMozcのバージョンなどは知っていましたが「こまんど」は知りませんでした.
この辺りの一覧をヘルプページ辺りに作ってくれるといいのになとか.

環境

$ dpkg-query -W mozc-server
mozc-server     2.23.2815.102+dfsg-1
$ neofetch
       _,met$$$$$gg.          mk@x200 
    ,g$$$$$$$$$$$$$$$P.       ------- 
  ,g$$P"     """Y$$.".        OS: Debian GNU/Linux unstable (sid) x86_64 
 ,$$P'              `$$$.     Model: 74574PJ ThinkPad X200 
',$$P       ,ggs.     `$$b:   Kernel: 4.14.0-2-amd64 
`d$$'     ,$P"'   .    $$$    Uptime: 8 hours, 52 minutes 
 $$P      d$'     ,    $$P    Packages: 5617 
 $$:      $$.   -    ,d$$'    Shell: bash 4.4.19 
 $$;      Y$b._   _,d$P'      Resolution: 1280x800 
 Y$$.    `.`"Y$$$$P"'         WM: awesome 
 `$$b      "-.__              Terminal: sakura 
  `Y$$                        Terminal Font: Fira Code 11 
   `Y$$.                      CPU: Intel Core 2 Duo P8400 (2) @ 2.267GHz 
     `$$b.                    GPU: Intel® GM45 Express Chipset 
       `Y$$b.                 Memory: 5292MiB / 7878MiB 
          `"Y$b._ 
              `"""                                    

OpenJDK で JOSM

Javaで動作するOpenStreetMapエディタのJOSMをLinux上のOpenJDKで動かすメモです.
Debian sid amd64 / Ubuntu 16.04 LTS ARM64 で確認しています.

JOSMの入手

JOSMを次のページから入手します.josm-tested.jar をよく使っています.

OpenJDKインストール

2015年12月くらいにはこんなメッセージが出ていて現在はJava 8以上が必要になっています.

このバージョンのJavaはもうすぐサポート対象から外れます。 Java 8以上にアップグレードしてください!

ここでは OpenJDK 8 を導入

$ sudo apt install openjdk-8-jre

javaの確認

OpenJDK 8になっている.もし違うバージョンが表示されたら次の項目へ.

$ java -version
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.16.04.2-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)

javaが複数入っていてjavaコマンドの結果が想定しているバージョンではない場合切り替える

OpenJDK 8の場合はここはスキップする.

$ sudo update-alternatives --config java

JOSM起動

-Dawt.useSystemAAFontSettings=onはフォントのアンチエイリアスを有効にするオプション.LCDの場合onの代わりにlcd.

$ java -jar -Dawt.useSystemAAFontSettings=on ./josm-latest.jar
追記)
他の環境だとこの辺のどれかが使えそう(未確認)

Let’s Encryptの更新に失敗する

最近はこんな感じでLet’s Encryptの証明書の更新を更新しているのですが今回失敗しました.
(DocumenteRootをFQDNにしている前提)

$ sudo /bin/sh -c "/usr/bin/find /etc/letsencrypt/renewal/*.conf -type f | /usr/bin/xargs /usr/bin/basename -s .conf | xargs -n1 -I{} /usr/bin/letsencrypt renew --webroot -w /var/www/{}/ -d {}"

こんなふうに怒られます.
(仕様が変わった?)

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Currently, the renew verb is capable of either renewing all installed certificates that are due to be renewed or renewing a single certificate specified by its name. If you would like to renew specific certificates by their domains, use the certonly command. The renew verb may provide other options for selecting certificates to renew in the future.

とりあえずはletsencrypt renewletsencrypt certonlyにしたら通りました.

$ sudo /bin/sh -c "/usr/bin/find /etc/letsencrypt/renewal/*.conf -type f | /usr/bin/xargs /usr/bin/basename -s .conf | xargs -n1 -I{} /usr/bin/letsencrypt certonly --webroot -w /var/www/{}/ -d {}"

これで更新できたと思ったら1つのドメインで失敗しています.

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Cert is due for renewal, auto-renewing...
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for files.matoken.org
Using the webroot path /var/www/files.matoken.org for all unmatched domains.
Waiting for verification...
Cleaning up challenges
Failed authorization procedure. files.matoken.org (http-01): urn:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://files.matoken.org/.well-known/acme-challenge/Be7Aiai4UH9CDqacTaEZOMH4SxSQbtFqxFcPXcCtJEs: "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>  
</head><body>
<h1>Not Found</h1>
<p"

IMPORTANT NOTES:
 - The following errors were reported by the server:

   Domain: files.matoken.org  
   Type:   unauthorized
   Detail: Invalid response from
   http://files.matoken.org/.well-known/acme-challenge/Be7Aiai4UH9CDqacTaEZOMH4SxSQbtFqxFcPXcCtJEs:
   "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
   <html><head>
   <title>404 Not Found</title>
   </head><body>
   <h1>Not Found</h1>
   <p"

   To fix these errors, please make sure that your domain name was
   entered correctly and the DNS A record(s) for that domain
   contain(s) the right IP address.

ファイルをDoumentRootに置いてLet’s Encryptからアクセスされるのですがそこでそのファイルが見つからないと失敗しています.このドメインはhttpを設定していませんでした.
てことでapacheでRewriteの設定をしてあげると

RewriteEngine On
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]

通りました.

$ sudo /usr/bin/letsencrypt certonly --webroot -w /var/www/files.matoken.org/ -d files.mato
ken.org
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Cert is due for renewal, auto-renewing...
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for files.matoken.org
Using the webroot path /var/www/files.matoken.org for all unmatched domains.
Waiting for verification...
Cleaning up challenges
Generating key (2048 bits): /etc/letsencrypt/keys/0003_key-certbot.pem
Creating CSR: /etc/letsencrypt/csr/0003_csr-certbot.pem

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at
   /etc/letsencrypt/live/files.matoken.org/fullchain.pem. Your cert
   will expire on 2018-05-31. To obtain a new or tweaked version of
   this certificate in the future, simply run certbot again. To
   non-interactively renew *all* of your certificates, run "certbot
   renew"
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

certbotのversionがかなり古いですね…….

$ dpkg -l|grep -i certbot
ii  certbot                               0.10.2-1                          all          automatically configure HTTPS using Let's Encrypt
ii  python-certbot                        0.10.2-1                          all          main library for certbot

てことでbackportのものに入れ替え.

$ sudo apt remove certbot
$ sudo apt install python-certbot-apache -t stretch-backports
$ apt show certbot
Package: certbot
Version: 0.21.1-1~bpo9+1
Priority: optional
Section: web
Source: python-certbot
Maintainer: Debian Let's Encrypt <letsencrypt-devel@lists.alioth.debian.org>
Installed-Size: 53.2 kB
Provides: letsencrypt
Depends: python3-certbot (= 0.21.1-1~bpo9+1), python3:any
Suggests: python3-certbot-apache, python3-certbot-nginx, python-certbot-doc
Breaks: letsencrypt (<= 0.6.0)
Replaces: letsencrypt
Homepage: https://certbot.eff.org/
Download-Size: 20.4 kB
APT-Manual-Installed: no
APT-Sources: http://ftp.jp.debian.org/debian stretch-backports/main amd64 Packages
Description: automatically configure HTTPS using Let's Encrypt
 The objective of Certbot, Let's Encrypt, and the ACME (Automated
 Certificate Management Environment) protocol is to make it possible
 to set up an HTTPS server and have it automatically obtain a
 browser-trusted certificate, without any human intervention. This is
 accomplished by running a certificate management agent on the web
 server.
 .
 This agent is used to:
 .
   - Automatically prove to the Let's Encrypt CA that you control the website
   - Obtain a browser-trusted certificate and set it up on your web server
   - Keep track of when your certificate is going to expire, and renew it
   - Help you revoke the certificate if that ever becomes necessary.
 .
 This package contains the main application, including the standalone
 and the manual authenticators.

N: There is 1 additional record. Please use the '-a' switch to see it

てことでclientが古かったのであまり参考になら無さそうなメモでした.

Devuan ascii armhf(Raspberry Pi)で時計合わせ

Raspberry PiにはRTCが付いていません.なのでシステム停止すると時間情報が飛んでしまいます.fake-hwclockが設定されていたら前回停止時(に近い)時間がファイルに保存されていてその時間に設定されますが,停止時の時間はカウントされないので時間がずれます.ということでネットワークが有効な場合ntpを参照して時計合わせをしたいです.
最近のDebianやRaspbianはsystemdなのでtimesyncd.confでNTP serverを指定してtimedatectlコマンドで有効にする感じだと思うのですが(既定値でそうなっている),Devuanは脱systemdなディストリビューションなのでこの方法は使えません.

$ sudo vi /etc/systemd/timesyncd.conf
$ sudo timedatectl set-ntp true`

詳細はman timesyncd.conf, man timedatectl

ということでntpdateを入れてみました.

$ sudo apt install ntpdate
$ sudo ntpdate 192.168.1.102
$ grep -A1 -B2 ntp /etc/rc.local
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
  /usr/sbin/ntpdate 192.168.1.102
fi

長時間動かすならcrontabで定期的に設定したほうがいいかも?(若しくは何らかのntpd)

$ sudo -u root crontab -l|tail -2
@reboot /usr/sbin/ntpdate 192.168.1.102
3 3 * * *       /usr/sbin/ntpdate 192.168.1.102

追記)
このシステムはRaspbian stretchをDevuan asciiにdist-upgradeしたシステムなのでntpの設定がないだけかもしれません.Devuan asciiをクリーンインストールすれば必要ない設定かも(未確認)

mysqlのdatadirを変更したらapparmorに怒られて起動しなくなった

ディスクの都合でmysqlのデータの置き場所を変更しました.
mysqldを停止して,データを移動して,シンボリックリンクも一応貼っておく.
/etc/mysql/mysql.conf.d/mysqld.cnfでdatadirを変更.

[mysqld]
datadir         = /export/data/var/lib/mysql

この状態でmysqlを起動するとこんな感じのエラーで起動しなくなってしまいました.

2018-02-17T16:12:54.184655Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2018-02-17T16:12:54.184718Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2018-02-17T16:12:54.184734Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2018-02-17T16:12:54.785643Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2018-02-17T16:12:54.786151Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2018-02-17T16:12:54.786272Z 0 [ERROR] Failed to initialize builtin plugins.
2018-02-17T16:12:54.786415Z 0 [ERROR] Aborting

該当ファイルは一見問題無さそうに見えます.

$ sudo ls -la /export/data/var/lib/mysql/ibdata1
-rw-rw---- 1 mysql mysql 102760448  2月 18 05:15 /export/data/var/lib/mysql/ibdata1
$ sudo -u mysql dd if=/export/data/var/lib/mysql/ibdata1 bs=10 count=1|od -xc
1+0 レコード入力
1+0 レコード出力
10 bytes copied, 9.8366e-05 s, 102 kB/s
0000000    2214    405b    0000    0000    0000
        024   "   [   @  \0  \0  \0  \0  \0  \0
0000012

何でだ?と思ったらkernel logにこんなログが.apparmorで引っかかっているようです.

Feb 18 00:35:26 micro kernel: [ 3569.631324] audit: type=1400 audit(1518881726.300:24): apparmor="DENIED" operation="open" prof
ile="/usr/sbin/mysqld" name="/proc/18795/status" pid=18795 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=114 ouid=114

/etc/apparmor.d/usr.sbin.mysqldでパスを変更します.

diff --git a/apparmor.d/usr.sbin.mysqld b/apparmor.d/usr.sbin.mysqld
index 2619e7d..adb8259 100644
--- a/apparmor.d/usr.sbin.mysqld   
+++ b/apparmor.d/usr.sbin.mysqld
@@ -46,16 +46,16 @@
   /usr/share/mysql/** r,  

 # Allow data dir access   
-  /var/lib/mysql/ r,
-  /var/lib/mysql/** rwk,  
+  /export/data/var/lib/mysql/ r,  
+  /export/data/var/lib/mysql/** rwk,

 # Allow data files dir access
-  /var/lib/mysql-files/ r,
-  /var/lib/mysql-files/** rwk,
+  /export/data/var/lib/mysql-files/ r,
+  /export/data/var/lib/mysql-files/** rwk,

 # Allow keyring dir access
-  /var/lib/mysql-keyring/ r,
-  /var/lib/mysql-keyring/** rwk, 
+  /export/data/var/lib/mysql-keyring/ r,
+  /export/data/var/lib/mysql-keyring/** rwk,

 # Allow log file access 
   /var/log/mysql.err rw,

この状態でapparmorを再起動して設定を反映してからmysqlを起動でOKでした.

$ sudo service apparmor restart
$ sudo service mysql start

この後iostat -xを眺めて大丈夫そうかなーって思ったのですがディスクアクセス音が大きくなったのでまた別の場所に移動するかも…….

環境

$ dpkg-query -W mysql-server
mysql-server    5.7.21-0ubuntu0.16.04.1
$ lsb_release -a
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.3 LTS
Release:        16.04
Codename:       xenial
$ uname -m
x86_64

Debian sidのkernel.sysrqの値が変わった?

先日Debian sid amd64環境でprocpsの更新がありました.

$ apt show procps
Package: procps
Version: 2:3.3.12-4
Priority: important
Section: admin
Maintainer: Craig Small <csmall@debian.org>
Installed-Size: 712 kB
Provides: watch
Depends: libc6 (>= 2.15), libncurses5 (>= 6), libncursesw5 (>= 6), libprocps6, libtinfo5 (>= 6), lsb-base (>= 3.0-10), init-system-helpers (>= 1.29~)
Recommends: psmisc
Conflicts: pgrep (<< 3.3-5), w-bassman (<< 1.0-3)
Breaks: guymager (<= 0.5.9-1), open-vm-tools (<= 2011.12.20-562307-1)
Homepage: https://gitlab.com/procps-ng/procps
Tag: admin::monitoring, implemented-in::c, interface::commandline,
 interface::text-mode, role::program, scope::utility,
 uitoolkit::ncurses, use::checking, use::monitor,
 works-with::software:running
Download-Size: 251 kB
APT-Manual-Installed: yes
APT-Sources: http://ftp.jp.debian.org/debian sid/main amd64 Packages
Description: /proc ファイルシステムユーティリティ
 本パッケージは procfs を閲覧するためのコマンドラインおよび全画面のユーティ
 リティを提供します。procfs とは "擬似的な" ファイルシステムで、カーネルによ
 り動的に生成されます。カーネルのプロセステーブル内のエントリの状態に関する
 情報 (例えば、プロセスが稼働中、停止中、または "ゾンビ" である、など) が提
 供されます。
 .
 本パッケージには次のものが含まれます: free, kill, pkill, pgrep, pmap, ps,
 pwdx, skill, slabtop, snice, sysctl, tload, top, uptime, vmstat, w, watch。

更新に伴い/etc/sysctl.confの更新がありました.

設定ファイル '/etc/sysctl.conf'
 ==> これはインストールしてから (あなたかスクリプトによって) 変更されています。
 ==> パッケージ配布元が更新版を提供しています。
   どうしますか? 以下の選択肢があります:
    Y か I  : パッケージメンテナのバージョンをインストールする
    N か O  : 現在インストールされている自分のバージョンを残す
      D     : 両バージョンの差異を表示する
      Z     : 状況を調査するためにシェルを開始する
 デフォルトでは現在使っている自分のバージョンを残します。
*** sysctl.conf (Y/I/N/O/D/Z) [デフォルト=N] ? D

差分を見ると自分で編集した部分以外はコメントだけだったのですが,気になる項目が.

@@ -61,18 +61,13 @@

 ###################################################################
 # Magic system request Key
-# 0=disable, 1=enable all
-# Debian kernels have this set to 0 (disable the key)
-# See https://www.kernel.org/doc/Documentation/sysrq.txt
+# 0=disable, 1=enable all, >1 bitmask of sysrq functions
+# Debian kernels have this set to 438 which is the OR of:
+#  64 = enable signalling of processes
+#  128 = allow reboot/poweroff
+#  256 = allow nicing of all RT tasks
+#
+# See https://www.kernel.org/doc/html/latest/admin-guide/sysrq.html
 # for what other values do
-#kernel.sysrq=1
+#kernel.sysrq=438

Magic system request Keyの項目が以前は0 or 1で有効か無効化のみだったと思うのですが,細かく指定できるようになっているようです.

0 – disable sysrq completely
1 – enable all functions of sysrq
>1 – bitmask of allowed sysrq functions (see below for detailed function description):

てことでkernel.sysrq=438は16進数で0x1B6なので

$bc
obase=16
438
1B6

以下が有効ということのようです.

2 = 0x2 – enable control of console logging level
4 = 0x4 – enable control of keyboard (SAK, unraw)
16 = 0x10 – enable sync command
32 = 0x20 – enable remount read-only
128 = 0x80 – allow reboot/poweroff
256 = 0x100 – allow nicing of all RT tasks

無効になっているのは以下の項目.

8 = 0x8 – enable debugging dumps of processes etc.
64 = 0x40 – enable signalling of processes (term, kill, oom-kill)

kernel configを見るとこの項目になっています.少なくとも4.13.0-1〜4.14.13-1以降は同じみたい.

$ zgrep ONFIG_MAGIC_SYSRQ /boot/config-`uname -r`
CONFIG_MAGIC_SYSRQ=y
CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x01b6
CONFIG_MAGIC_SYSRQ_SERIAL=y

ということでコメントが実際のkernelの項目と同じになったということみたいなので動作は変わらないようです.

追記)

昔使い方を知りたくて調べたときに見つけた文章は@miurahrさん翻訳のものでした.その後 で本人に遭遇.

porgを一般ユーザで利用する

porgを一般ユーザで利用するメモ

一般ユーザで普通に使おうとするとログ保存場所の/var/lib/porgへの権限がないと怒られてしまう.

$ porg -D ~/.porg -lp program-0.10.61 make install
porg: /var/lib/porg: Permission denied

ログ保存ディレクトリを指定すると行ける.

$ porg -L ~/.porg -lp program-0.10.61 make install

manより

   -L, --logdir=DIR
          Base log  directory.  The  logs  for  the  installed  packages  are  saved  in  this  directory.  Default  is
          '/var/lib/porg', unless variable LOGDIR is set in the configuration file (type 'man porgrc' for more informa‐
          tion).

--PREFIX=${HOME}/usrみたいな時向けに

version等

$ porg -V
porg-0.10 (17 May 2016)
Written by David Ricart <http://porg.sourceforge.net>
$ dpkg-query -W porg
porg    2:0.10-1.1