2015年7月30日木曜日

LaTeX Error: File `jarticle.cls' not found

FreeBSDでtexlive-2014から2015へアップデートすると、既存のLaTeXファイルの処理時に次のようなエラーが出るようになりました。
LaTeX Error: File `jarticle.cls' not found
jarticle.clsは/usr/local/share/texmf-dist/tex/platex/base/jarticle.clsにあるので、TeXの処理系がうまくこのファイルを見つけることができないようです。

別のFreeBSDサーバーの/usr/local/share/texmf-distディレクトリと比べてみると、これらのクラスファイルなどの一覧が収められたls-Rファイルがありません。

そこでmktexlsrコマンドで再生成してみました。
$ pwd
/usr/local/share/texmf-dist
$ sudo mktexlsr
パスワード:
mktexlsr: Updating /usr/local/share/texmf-config/ls-R...
mktexlsr: Updating /usr/local/share/texmf-dist/ls-R...
mktexlsr: Updating /usr/local/share/texmf-local/ls-R...
mktexlsr: Updating /usr/local/share/texmf-var/ls-R...
mktexlsr: Done.
$ ls ls-R
ls-R
$ head ls-R
% ls-R -- filename database for kpathsea; do not change this line.
./:
.keep_me
.texlive-tlmgr
README

$
こんどはうまく処理できるようになりました。

puttyでopensshサーバーにログインできない

勤務先のsshサーバーについて、以下のような報告がありました。
数日前から PuTTY で会社にログインできなかったのですが、
PuTTY 側の設定変更でログインできるようになったので報告します。
症状は、以下のとおりです。
・接続しようとするが、ユーザ名を聞いてこない
・接続が勝手に切れるわけではない
・ログを見ると Event Log: Doing Diffie-Hellman group exchange で
  データを送信した状態で止まっている
PuTTY 側の Connection - SSH - Kex - Algorithm selection policy で、
先頭になっている Diffie-Hellman group exchange の順位を Down すると
接続できるようになった
もう少し調べると次のような情報が見つかりました。
PuTTY Kex Error, or: "Hm, kex protocol error: type 30 seq 1 [preauth]"
https://blog.nytsoi.net/2015/07/13/putty-kex-error
このなかで、2015年6月30日にでたOpenSSH 6.9では以下の変更があったと記述されています。
From the OpenSSH changelog
http://www.openssh.com/txt/release-6.9
* ssh(1), sshd(8): deprecate legacy SSH2_MSG_KEX_DH_GEX_REQUEST_OLD
message and do not try to use it against some 3rd-party SSH
implementations that use it (older PuTTY, WinSCP).
なのでOpenSSH 6.9に接続するのにputtyを使っている場合には、 「Diffie-Hellman group exchange」の順位を下げる必要があります。

2015年7月29日水曜日

Surface Pro 3をUSB回復ドライブで初期化する場合は、BitLockerの回復キーが必要

Surface Pro 3をSurface Pro 3をUSB回復ドライブで初期化する場合は、BitLockerの回復キーが必要でした。
回復ドライブ作成と回復ドライブからの起動については以下のblogで詳しく説明されています。
Surface Pro 3 の「回復ドライブ」作成には 8GB 以上のデータを格納できる USBメモリーが必要?http://www.nanigoto.com/%E5%9B%9E%E5%BE%A9%E3%83%89%E3%83%A9%E3%82%A4%E3%83%96/Surface Pro 3 で電源を入れるときに「USB 回復ドライブ」で起動させる手順http://www.nanigoto.com/volume-down/
2つの目のblogでは回復ドライブまで起動したところで終わっていますが、その先がありました。以下のblog
USB 回復ドライブでリセットする(工場出荷状態に戻す)http://blogs.msdn.com/b/microsoft_surface_blogs/archive/2014/01/23/10492070.aspx
にある
もし BitLocker を設定されている場合、画面に指示に従って回復キーを取得し、入力します。
です。回復キーはの取得は、具体的には、Surface Pro 3にログインで使っていたMicrosoftアカウントで、MicrosoftのWWWページにログインした後、
BitLocker recovery keys: Frequently asked questionshttp://windows.microsoft.com/recoverykeyfaq 
にアクセスし、この中の
BitLocker Recovery Keys.http://go.microsoft.com/fwlink/?LinkId=237614
にアクセスすると表示されます。
初期化時に回復キーの入力を求められるので、そのときに上記のページに表示されている回復キー(かなり長い数字列)を入れます。

FreeBSDでtexlive-full-20140525からtexlive-full-20150521へのアップグレードしようとすると失敗する

FreeBSDでtexlive-full-20140525からtexlive-full-20150521へのアップグレードしようとすると、以下のように失敗します。
# portupgrade --batch -a -n

+ print/texlive-base (texlive-base-20140525_7 -> texlive-base-20150521_2)
+ print/texlive-texmf (texlive-texmf-20140525_4 -> texlive-texmf-20150523_2)
+ print/tex-luatex (tex-luatex-0.79.1_5 -> tex-luatex-0.80.0_1)
+ print/tex-dvipdfmx (tex-dvipdfmx-20140317_2 -> tex-dvipdfmx-20150315_1)
+ print/texlive-full (texlive-full-20140525_1 -> texlive-full-20150521)
---> Packages processed: 5 done, 2 ignored, 0 skipped and 0 failed
---> Session ended at: Wed, 29 Jul 2015 11:28:55 +0900 (consumed 00:01:28)
# portupgrade --batch print/texlive-full

checking for TeX specific libraries to build...
checking for pkg-config... pkgconf
configure: error: did not find kpathsea
===> Script "configure" failed unexpectedly.

** Fix the problem and try again.
** Listing the failed packages (-:ignored / *:skipped / !:failed)
! print/texlive-full (texlive-full-20140525_1) (configure error)
#
エラーメッセージをよく読むと「kpathsea」というものがないようです。portsにあるかどうか 確認してみます。
# cd /usr/ports
# ls -ld */*kpathsea*
drwxr-xr-x 3 root wheel 7 7月 28 17:56 devel/tex-kpathsea
#
確かにportsにはパッケージがあるようです。次にインストールされているかどうか調べます。
# pkg info -x texlive
texlive-base-20140525_7texlive-full-20140525_1texlive-texmf-20140525_4texlive-tlmgr-20150523_1
#
「pkg info -x パッケージ名」とすると「パッケージ名」に部分一致する、インストールされているパッケージが表示されます。上記の例では、texliveに部分一致するパッケージが表示されています。
# pkg info -x kpath
pkg: No package(s) matching kpath
#
tex-kpathseaはインストールされていないことがわかります。そこでportsからインストールします。
# cd /usr/ports/devel/tex-kpathsea/
# make

# make install

===> Installing for tex-kpathsea-6.2.1
===> tex-kpathsea-6.2.1 depends on executable: indexinfo - found
===> Checking if tex-kpathsea already installed
===> Registering installation for tex-kpathsea-6.2.1
Installing tex-kpathsea-6.2.1...
#
これでtex-kpathseaパッケージがインストールできました。
再び、texlive-fullのアップグレードをしてみます。
# portupgrade --batch print/texlive-full

checking for pkg-config... pkgconf
configure: error: did not find ptexenc
===> Script "configure" failed unexpectedly.
Please report the problem to hrs@FreeBSD.org [maintainer] and attach the
"/usr/ports/print/texlive-base/work/texlive-20150521-source/config.log"
including the output of the failure of your make command. Also, it might be
a good idea to provide an overview of all packages installed on your system
(e.g. a /usr/local/sbin/pkg-static info -g -Ea).
*** [do-configure] Error code 1
#
こんどはptexencがないようです。同様に確認してみます。
# pkg info -x ptexenc
pkg: No package(s) matching ptexenc
# ls -ld /usr/ports/*/*ptexenc*
drwxr-xr-x 3 root wheel 7 7月 28 17:56 /usr/ports/print/tex-ptexenc
#
tex-ptexencをportsからインストールします。
# cd /usr/ports/print/tex-ptexenc/
# make
# make install

===> Installing for tex-ptexenc-1.3.3_2
===> tex-ptexenc-1.3.3_2 depends on shared library: libkpathsea.so - found (/usr/local/lib/libkpathsea.so)
===> tex-ptexenc-1.3.3_2 depends on shared library: libiconv.so - found (/usr/local/lib/libiconv.so)
===> Checking if tex-ptexenc already installed
===> Registering installation for tex-ptexenc-1.3.3_2
Installing tex-ptexenc-1.3.3_2...
#
tex-ptextencがインストールできたので、試してみましょう。
# portupgrade --batch print/texlive-full

====> Compressing man pages (compress-man)
===> Installing for texlive-base-20150521_2
===> Checking if texlive-base already installed
===> An older version of texlive-base is already installed (texlive-base-20140525_7)
You may wish to ``make deinstall'' and install this port again
by ``make reinstall'' to upgrade it properly.

If you really wish to overwrite the old port of texlive-base
without deleting it first, set the variable "FORCE_PKG_REGISTER"
in your environment or the "make install" command line.
*** [check-already-installed] Error code 1

** Listing the failed packages (-:ignored / *:skipped / !:failed)
! print/texlive-full (texlive-full-20140525_1) (unknown build error)
#
古いtexlive-baseを削除してからインストールしなければいけないようです。
# cd /usr/ports/print/texlive-base/
# pkg info -x texlive-base
texlive-base-20140525_7
# make deinstall
===> Deinstalling for texlive-base
===> Deinstalling texlive-base-20140525_7
Updating database digests format: 100%
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 1 packages (of 0 packages in the universe):
Installed packages to be REMOVED:
texlive-base-20140525_7
The operation will free 12 MiB.
[1/1] Deinstalling texlive-base-20140525_7...
[1/1] Deleting files for texlive-base-20140525_7: 100%
# make reinstall
===> Installing for texlive-base-20150521_2
===> texlive-base-20150521_2 depends on executable: psbook - found
===> texlive-base-20150521_2 depends on file: /usr/local/share/texmf-dist/.texlive-tlmgr - found

mktexlsr: Updating /usr/local/share/texmf-var/ls-R...
mktexlsr: Done.
# pkg info -x texlive-base
texlive-base-20150521_2
#
確かにtexlive-baseは新しいバージョンになりました。
ふたたびtexlive-fullのアップグレードを試してみましょう。
# portupgrade --batch print/texlive-full
[Reading data from pkg(8) ... - 429 packages found - done]

===> Checking if texlive-texmf already installed
===> An older version of texlive-texmf is already installed (texlive-texmf-20140525_4)
You may wish to ``make deinstall'' and install this port again
by ``make reinstall'' to upgrade it properly.

If you really wish to overwrite the old port of texlive-texmf
without deleting it first, set the variable "FORCE_PKG_REGISTER"
in your environment or the "make install" command line.
こんどは古いtexlive-texmfを削除して再インストールする必要があるようです。
# cd /usr/ports/print/texlive-texmf
# make deinstall
===>  Deinstalling for texlive-texmf
===>   Deinstalling texlive-texmf-20140525_4
Updating database digests format: 100%
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 1 packages (of 0 packages in the unive
rse):

Installed packages to be REMOVED:
        texlive-texmf-20140525_4

The operation will free 1 GiB.
[1/1] Deinstalling texlive-texmf-20140525_4...
mktexlsr: Updating /usr/local/share/texmf/ls-R... 
mktexlsr: Done.
mktexlsr: Updating /usr/local/share/texmf-dist/ls-R... 
mktexlsr: Done.
[1/1] Deleting files for texlive-texmf-20140525_4: 100%
#
# make reinstall===>  Installing for texlive-texmf-20150523_2
===>   texlive-texmf-20150523_2 depends on file: /usr/local/share/texmf-dist/.texlive-tlmgr - found
===>   texlive-texmf-20150523_2 depends on package: texlive-base>=20150521 - found
===>   Registering installation for texlive-texmf-20150523_2
Installing texlive-texmf-20150523_2...
mktexlsr: Updating /usr/local/share/texmf/ls-R...
mktexlsr: Done.

削除と再インストールがでできたので、ふたたびtexlive-fullのアップグレードです。
# portupgrade --batch print/texlive-full
[Reading data from pkg(8) ... - 429 packages found - done]
--->  Upgrading 'texlive-full-20140525_1' to 'texlive-full-201

===>   Registering installation for texlive-full-20150521
Installing texlive-full-20150521...
===>  Cleaning for texlive-full-20150521
--->  Cleaning out obsolete shared libraries
やっとアップグレードができました。

念のためにアップグレードされていないパッケージがないか、確認します。
# portupgrade --batch -n -a

        + print/tex-luatex (tex-luatex-0.79.1_5 -> tex-luatex-0.80.0_1)
        + print/tex-dvipdfmx (tex-dvipdfmx-20140317_2 -> tex-dvipdfmx-20150315_1)

#
print/tex-luatex、print/tex-dvipdfmxも新しいバージョンは2015となっているので、こちらもアップグレードします。
# portupgrade --batch print/tex-luatex print/tex-dvipdfmx

===>   Registering installation for tex-dvipdfmx-20150315_1
Installing tex-dvipdfmx-20150315_1...
mktexlsr: Updating /usr/local/share/texmf/ls-R...
mktexlsr: Done.
===>  Cleaning for tex-dvipdfmx-20150315_1
--->  Cleaning out obsolete shared libraries
ふたたびアップグレードされていないパッケージがないか確認します。
# portupgrade --batch -n -a

#
こんどはだいじょうぶでした。

2015年7月24日金曜日

Lenovo ThinkCentre M73にWindows 8.1をリカバリメディアから再インストールするときの注意

Lenovo ThinkCentre M73にWindows 8.1をリカバリメディアから再インストールするときには、BIOS設定でCSM(Compatibiliy support Module)を有効にする必要がありました。
以下のような手順です。
  1. 電源を入れ、F1キー、もしくはEnterキーを押して、BIOSセットアップ画面に入る。
  2. Startupタブに移る
  3. CSMをEnabledに変更する(デフォルトはDisabled)
  4. Boot ModeがAuto、Boot PriorityがLegacy Firstになっていることを確認する。必要に応じて、Boot ModeをLegacy Onlyにする。
  5. Startupタブ内のPrimary Boot Sequenceを開いて、USB CDROMなど、起動のためのデバイスがSATA 1などより前にあることを確認する。

2015年7月20日月曜日

FreeBSD 10.1にscponlyをインストールする

他の組織からファイルを転送してもらう必要がでてきました。そのために、DMZにFreeBSD 10.1のサーバーを設置し、このサーバーにscponlyをインストールしました。scponlyを使えば、sshでのシェル操作は許さず、scpでのファイル転送だけを有効にすることができます。さらに、sshdでパスワードでのログインを無効・公開鍵でのログインを有効にすることで、安全性を高めることできます。

scponlyは以下のようにインストール、設定しました。
# sudo -s
Password: ******
# cd /usr/ports/shells/scponly
# make config
....
[x] CHROOT chroot(8) functionality
[ ] DEFAULT_CHDIR Chdir(2) by default
[x] DOCS Build and/or install documentation
[ ] GFTP gftp support
[ ] RSYNC rsync support
[x] SCP vanilla scp support
[ ] SVN Subversion support
[ ] SVNSERVE Suversion support for svn+ssh://
[ ] UNISON Unisson support
[x] WILDCARDS Wildcards processing
[x] WINSCP WinSCP support
# make install
...
To setup chroot cage, run the following commands:
1) cd /usr/local/share/examples/scponly/ && /bin/sh setup_chroot.sh
2) Set scponlyc_enable="YES" in /etc/rc.conf
3) Run /usr/local/etc/rc.d/scponly start
#
scponlyはCHROOT、SCP、WILDCARDS、WINSCPを有効にしました。WILDCARDSは微妙ですが、CHROOTオプションを有効にすることで、scponlyのホームディレクトリ以下にしかアクセスできないようにできるので、利便性と安全性が両立できると判断しました。

このあと、インストール時に表示された支持に従い、chroot.shを実行し、rc.confに記述を追加、scponlyスクリプトを実行しました。chroot.shで表示された選択肢にはすべてデフォルトを選びました(ただ、私の場合、scponly用のホームディレクトリ以下にうまくdevディレクトリが作成できなかったので、~scpoly/devを一度削除してから、chroot.shを再実行する必要がありました)。

そして、以下のようにscponlyを試してみます(公開鍵でのログインのみを有効にしています)。
$ scp ./FILE scponly@IPアドレス:incoming/
Enter passphrase for key '/home/ss/.ssh/id_rsa':
lost connection
$
lost connectionとなり、うまくファイルを転送することができません(scponlyではscponlyのホームディレクトリにあるincomingディレクトリにのみファイルを転送することができます)。

そこで、 /usr/local/etc/scponly/debeglevel の内容を「3」にしてデバッグ出力を有効にしてみます。
$ cat /usr/local/etc/scponly/debuglevel
3
$
ふたたびファイル転送を試みます。
$ scp ./FILE scponly@IPアドレス:incoming/
Enter passphrase for key '/home/ユーザー/.ssh/id_rsa':
scponly[6354]: chrooted binary in place, will chroot()
scponly[6354]: 3 arguments in total.
scponly[6354]: arg 0 is scponlyc
scponly[6354]: arg 1 is -c
scponly[6354]: arg 2 is scp -t incoming/
scponly[6354]: opened log at LOG_AUTHPRIV, opts 0x00000029
scponly[6354]: determined USER is "scponly" from environment
scponly[6354]: retrieved home directory of "/home/scponly" for user "scponly"
scponly[6354]: chrooting to dir: "/home/scponly"
scponly[6354]: chdiring to dir: "/"
scponly[6354]: setting uid to 2003
scponly[6354]: processing request: "scp -t incoming/"
scponly[6354]: Using getopt processing for cmd /usr/bin/scp
(username: scponly(2003), IP/port: IPアドレス 64023 22)
scponly[6354]: getopt processing returned 't' (username: scponly(2003), IP/port: IPアドレス 64023 22)
scponly[6354]: running: /usr/bin/scp -t incoming/ (username: scponly(2003), IP/port: IPアドレス 64023 22)
scponly[6354]: about to exec "/usr/bin/scp" (username: scponly(2003), IP/port: IPアドレス 64023 22)
scponly[6354]: failed: /usr/bin/scp -t incoming/ with error Too many levels of symbolic links(62) (username: scponly(2003), IP/port: IPアドレス 64023 22)
lost connection
$
転送先のホストで/usr/bin/scpコマンドを実行しようとしていますが、scpのあるディレクトリがシンボリックリンクの先にあるためにscpコマンドが実行できないようです。

実は、この前にscponlyコマンドがないというエラーが出ていたので、
# cd ~scponly
# cd usr
# mv bin bin.ORG
# ln -s /usr/bin .
#
のようにして~scponly/usr/binから/usr/binへのシンボリックリンクを設定したのですが、これではうまくいかないようです。

そこでこのシンボリックリンクは削除し、scpコマンドをコピーしてみることにしました。
# cd ~scpoly/usr
# rm bin
# mkdir ~scponly/usr/bin
# cp /usr/bin/scp .
#
ファイル転送を試してみます。
$ scp ./FILE scponly@IPアドレス:incoming/
Enter passphrase for key '/home/ユーザー/.ssh/id_rsa':
scponly[6368]: chrooted binary in place, will chroot()
scponly[6368]: 3 arguments in total.
scponly[6368]: arg 0 is scponlyc
scponly[6368]: arg 1 is -c
scponly[6368]: arg 2 is scp -t incoming/
scponly[6368]: opened log at LOG_AUTHPRIV, opts 0x00000029
scponly[6368]: determined USER is "scponly" from environment
scponly[6368]: retrieved home directory of "/home/scponly" for user "scponly"
scponly[6368]: chrooting to dir: "/home/scponly"
scponly[6368]: chdiring to dir: "/"
scponly[6368]: setting uid to 2003
scponly[6368]: processing request: "scp -t incoming/"
scponly[6368]: Using getopt processing for cmd /usr/bin/scp
(username: scponly(2003), IP/port: IPアドレス 24123 22)
scponly[6368]: getopt processing returned 't' (username: scponly(2003), IP/port: IPアドレス 24123 22)
scponly[6368]: running: /usr/bin/scp -t incoming/ (username: scponly(2003), IP/port: IPアドレス 24123 22)
scponly[6368]: about to exec "/usr/bin/scp" (username: scponly(2003), IP/port: IPアドレス 24123 22)
FILE 100% 260KB 260.2KB/s 00:00
$
こんどはうまくファイルを転送することができました。

2015年7月15日水曜日

マイナンバーの取り扱い

Q. 学会などの研究会でお願いしているアルバイトの方々に報酬を支払う場合、マイナンバーの扱いはどのようにすればよいのでしょうか。

A. 日払いのアルバイト(9300円/日未満)は対象外。
   根拠は以下のとおり。

   1. 源泉徴収税額は「給与所得の源泉徴収税額表」を使って求める。

   2. この税額表には、「月額表」と「日額表」と「賞与に対する源泉徴収税額の算出率の表」の3種類がある。

   3. 日払いバイトの場合、日額表が適用される。

   4. さらに、パートやアルバイトに対して日給や時間給で支払う給与は、あらかじめ雇用契約の期間が2か月以内と決められていれば、「日額表」の「丙欄」を使う。

   5. 「丙欄」を参照すると、9300円/日未満については源泉徴収税額は0円。

   具体的な通達については以下のWWWページを参照

   税額表の種類と使い方

   パートやアルバイトの源泉徴収

   平成27年分 源泉徴収税額表
    https://www.nta.go.jp/shiraberu/ippanjoho/pamph/gensen/zeigakuhyo2014/01.htm

   給与所得の源泉徴収税額表(日額表)
   https://www.nta.go.jp/shiraberu/ippanjoho/pamph/gensen/zeigakuhyo2014/data/02_1.pdf

   ただし、講演者謝金などについては2016年1月以降マイナンバーの取り扱いが必要となる。

2015年7月14日火曜日

FreeBSD 10.1でのsendmailの設定(すべてのメールを特定のホストに転送する)

FreeBSD 10.1でのsendmailを使い、すべてのメールを特定のホストに転送するには次のように設定します。
以下の記述は
送信メールをリレーさせる(SMART_HOST設定)
http://linuxexpert.ne.jp/modules/pukiwiki/163.html
を参考にしました。
# cd /var/mail
# hostname
valkyrie
# cp freebsd.mc `hostname`.mc
# cp freebsd.submit.mc `hostname`.submit.mc
# vi valkyrie.mc
...
dnl Dialup users should uncomment and define this appropriately
dnl define(`SMART_HOST', `your.isp.mail.server')

dnl Dialup users should uncomment and define this appropriately
define(`SMART_HOST', `[転送先ホストのIPアドレス]')dnl
 
もしくは 
dnl Dialup users should uncomment and define this appropriately
define(`SMART_HOST', `転送先ホストのホスト名')dnl
 
に変更
# make all
....
# make install
....
# vi /etc/rc.conf
...
# 以下の行を追加
sendmail_enable="YES"
...
# /etc/rc.d/sendmail start
...
# make restart
#
転送されるホスト側では、FreeBSD 10.1からのメールを受け取りを許可するように設定する必要があります。たとえば、postfixであればmain.cfのmynetworksにアドレス範囲を追加します。
mynetworks = 192.168.100.0/24, 172.25.0.0/16, … 

2015年7月13日月曜日

FreeBSDでログイン直後に表示されるメッセージを抑制する

FreeBSD 10.1などでではログイン時に、以下のように/etc/motdなどのメッセージが表示されるようになっています。
Last login: Mon Jul 13 06:30:31 2015 from firerock.acutus.co.jp
FreeBSD 10.1-RELEASE (GENERIC) #0 r274401: Tue Nov 11 21:02:49 UTC 2014

Welcome to FreeBSD!

Release Notes, Errata: https://www.FreeBSD.org/releases/
Security Advisories: https://www.FreeBSD.org/security/
FreeBSD Handbook: https://www.FreeBSD.org/handbook/
FreeBSD FAQ: https://www.FreeBSD.org/faq/
Questions List: https://lists.FreeBSD.org/mailman/listinfo/freebsd-questions/
FreeBSD Forums: https://forums.FreeBSD.org/

Documents installed with the system are in the /usr/local/share/doc/freebsd/
directory, or can be installed later with: pkg install en-freebsd-doc
For other languages, replace "en" with a language code like de or fr.

Show the version of FreeBSD installed: freebsd-version ; uname -a
Please include that output and any error messages when posting questions.
Introduction to manual pages: man man
FreeBSD directory layout: man hier

Edit /etc/motd to change this login announcement.
Having trouble using fetch through a firewall? Try setting the environment
variable FTP_PASSIVE_MODE to yes, and see fetch(3) for more details.
$
これを消したいときには、.hushloginというファイルをホームディレクトリに作ります。
$ touch ~/.hushlogin
$
hush upで黙らせるという意味です。

FreeBSD 10.1をHP DL120G5にインストールした時の操作記録

先日、HP DL120G5(PDF)にFreeBSD 10.1をインストールした時の記録を掲載します。
まずDL120G5のBIOS設定でCD/DVDからの起動を優先にしておきます。そしてDVDにFreeBSD 10.1のISOイメージファイル(FreeBSD-10.1-RELEASE-amd64-dvd1.iso)を書き込み、これから起動します。うまくCD/DVDからFreeBSDのインストーラーが起動すると、しばらくして以下の画面が表示されます。
キーボードの種別は必要に応じて設定します。私の場合は、英語キーボードを接続していたので、デフォルトのままにしました。
次はホスト名の設定です。これもそのサイトに応じた適切なもの指定します(同じネットワークに接続されているホストの名前と違うものにしなければなりません)。
インストールするソフトウェアパッケージを指定します。最低限、llib32とportsがあれば十分ですが、HDDの容量に比べてそれほど大きいものではないので、私はいつもすべて選んでいます。
ファイルシステムの構成を選びます。このマシンでは、500GBのHDDを2台接続しているので、ZFSでミラー構成ににするつもりです。
Auto(ZFS)を選ぶとオプションの画面になります。ディスク構成を設定するため、T(Pool Type/Disks:)を選びます。
開いた画面で、mirrorとします。
どのディスクを使うかの選択画面になります。
接続されている2台のディスクを選びます。
オプションの画面に戻り、Swap Sizeを選びこの値を変更します。
ここでは2GBから64GBに変更しました。
swap領域をmirrorするかどうかを選びます。
安全を考えて有効にしました。
その他、Force 4K Sectorsは、2TB以上のディスクではセクターサイズが512バイトではなくて4Kバイトになっていることが多いので、これを有効にします。今回は4Kセクターのディスクではありませんが、どのような構成になるのかを見たかったので、有効にしました。また、パーティションテーブルも大きなディスクが扱えるGPTにしました(これもどのような構成になるのかを確認したかったためです)。これらを確認したら、Installを選び、Selectを押します。
パーティション構成を書き込んでよいか確認を求められます。
YESを選びます。
インストールが始まります。
rootのパスワードを設定します。
複数のネットワークインターフェースがある場合、どれを使うかを選びます。
私の場合は、オンボードのbge0を使うことにしました。
選んだネットワークインターフェイスに対してIPv4アドレスを割り当てるかを訊かれます。
DHCPにするか固定IPアドレスにするかを選びます。私はとりあえずアドレスがほしいので、DHCPにしました。
DHCPでIPv4アドレスを割り当てます。
次はIPv6です。
IPv6でStateless Address autoconfiguration(SLAAC)を利用するかを選びます。
DHCPで得られたIPv4のなどのDNS情報です。
クロックの設定です。BIOSの時計は多くの場合、各地域での時刻になっていると思われます。なので、「No」にしました。
次はタイムゾーンです。
Asia/Japanとしました。
JSTという略称でよいかの確認です。

起動するデーモンを選びます。sshとntpd、powerdにしました。unboudは今までのresolv.confとは違う仕組みでアドレスを解決を図るものですが、この設定は別途学ぶことにして、これを無効としました。
root以外のユーザーを追加するかです。
必要に応じて追加していきます。
追加が終われば、Exitを選びます。
シェルでの独自の設定が必要ならYes、そうでないならNoです。
そして再起動。
このあと、CD/DVDを取り出して待っているとFreeBSD 10.1が起動します。

2015年7月10日金曜日

ChromeでのEmacsキーバインド

最近になり、ふだん使うWebブラウザをFirefoxからChromeに変えました。
仕事や自宅で使うMac mini✕2、MacBook Pro 13"(Retina)やSurfaceで動作させていたFirefoxのうち、MacBook Pro 13"以外は正常に終了しなくなったためです。設定の削除や再インストールなどをしてみましたが改善せず、Chromeに変更しました。

いつもはEmacsふうなキー操作でつかっていたので(FirefoxであればFiremacsを利用)、
Chromeで同様なものがあればと思い探したところ、以下のものがよいように感じました。
以下のblog:
Chrome 上で Emacs のキーバインドを – Emacs-mode for Google Chromehttp://android.benigumo.com/20120604/chrome-%E4%B8%8A%E3%81%A7-emacs-%E3%81%AE%E3%82%AD%E3%83%BC%E3%83%90%E3%82%A4%E3%83%B3%E3%83%89%E3%82%92-emacs-mode-for-google-chrome/
で紹介されているEmacs-modeです。
Chrome Web Store – Emacs-modehttps://chrome.google.com/webstore/detail/emacs-mode/miojjimhedbpnnjpneobbfhdicckhhkd

2015年7月7日火曜日

特定のパッケージについて、portupgrade/pkgでの自動的なアップデートを禁止する

あるサイトでインストールしているapache22はmod_proxyが必要なため、バイナリでのアップデートができない(現在のところ、apache22のバイナリパッケージにはmod_proxyが含まれていないため)。
そこで、
FreeBSDでpkg(8)を使うときの落とし穴
http://togetter.com/li/611632

メモ:FreeBSDでPHP-FPMを使っている場合、pkg upgradeするとPHP-FPMが削除されちゃうので、
pkg lock php5
でロックをかけておく。php5を更新したいときは
pkg unlock php5
してからportsで更新
のようにpkg lock/unlockをするようにした。
# pkg info -I apache22
apache22-2.2.29_2              Version 2.2.x of Apache web server with prefork MPM.
# pkg lock apache22
apache22-2.2.29_2: lock this package? [y/N]: y
Locking apache22-2.2.29_2
# pkg unlock -l

Currently locked packages:
apache22-2.2.29_2
# pkg unlock apache22
apache22-2.2.29_2: unlock this package? [y/N]: ^C
#
pkg lock apache22でロック、pkg unlock apache22でアンロックできる。