見出し画像

[MINISFORUM] MS-S1 MAX へ Debian 13.1 の導入と設定 #1

ちまちまと MS-S1 MAX をセットアップしています。
何をどうやったかの記録を残しておきます。


SSD の換装

もともと Windows 11 Pro が入っていた SSD は、なんとなく何かがあった時用に残しておいて、より高速な SSD へと換装しました。爆裂に速いわけじゃないけれども 1割以上は高速化されています。体感はほとんどないに等しいけれども。

カバーをあけてすぐにアクセスできる所に 1枚目のSSDがあります。

もともとの Kingston を Crucial へと換装しました

ねじの場所がせせこましいので、気をつけて準備しましょう。季節柄、作業する時には絶縁手袋がオススメです。

UEFI(BIOS) の設定はほぼ変えていません。

しいて言えば VRAM を 64GB をアサインしたくらいです。状況みながらではありますが、必要に応じて調整します。Local LLM を使ったりも想定しているので、いったん 64GB 割り当てた感じです。128GB もあるけど、Linux サーバでそこまで使うってなかなか無いし。

Debianのインストール

わたしは今回、久しぶりに Debian へ戻ってきました。Debian 13.1 の ISO イメージを USB へ dd してからインストール作業開始です。

debian にした理由は、最小インストール構成が minimum なのと、提供時期がたまたまといったらそれまでなんですが、Ubuntu よりも新しいパッケージを採用されていたからとかです。

過去の使い勝手的に、Debian カーネルのほうが信頼を置いているというのもあります。

debian 系じゃないとパッケージ管理の使い方が分からないので、他のものは原則として選択肢に入っていません。

ただ Ubuntu も Debian も有線LAN のアダプタはないので、インストール時には無線LANでインストールすることになります。無線LAN は "MediaTek MT7925" なので、長いリストから MediaTek MT7925 (USB) を指定してインストールすれば使えました。

インストールパッケージは "SSH" だけインストールしました。
残りの必要なものはセットアップ終わってから必要なものだけをインストールすることにします。

sudo を利用できるようにする

何も入れていないので su するしかなかったりしますが、su しかないのも考えものなので、sudo できるようにしておきましょう。
一度 su - してからの apt install sudo だけです。

apt install sudo
Installing:
  sudo

Summary:
  Upgrading: 0, Installing: 1, Removing: 0, Not Upgrading: 0
  Download size: 2,087 kB
  Space needed: 6,865 kB / 91.9 GB available

Get:1 http://deb.debian.org/debian trixie/main amd64 sudo amd64 1.9.16p2-3 [2,087 kB]
Fetched 2,087 kB in 0s (12.4 MB/s)
Selecting previously unselected package sudo.
(Reading database ... 29340 files and directories currently installed.)
Preparing to unpack .../sudo_1.9.16p2-3_amd64.deb ...
Unpacking sudo (1.9.16p2-3) ...
Setting up sudo (1.9.16p2-3) ...
Processing triggers for libc-bin (2.41-12) ...

あとは /etc/group の sudo グループに自分を追加。

sudo:x:27:sho

わいのアカウントは sho です。

/etc/sudoers.d/apt で sho がパスワードなしに apt update/install できるようにしています。定期的に apt コマンドだけ手動で実行するので、このコマンドだけパスワードなしにしちゃっています。

sho ALL=(root) NOPASSWD: /usr/bin/apt

あまりよくはないけれども。

有線LAN デバイスドライバのインストールと設定

次に有線LAN を有効化しましょう。無線でも十分ではありますが、やはり有線は正義です。特に 10GbE まで対応しているのですから、きちんと有線を利用できるに越したことはありません。

MINISFORUM MS-S1 MAX で採用している 10GbE は Realtek 8127 です。これは Linux Kernel 6.16 以降で採用されているのですが、Debian も Ubuntu も現行最新にはまだ採用されていません。その為、個別にインストール作業が必要です。

まずは Realtek のサイトから "10G Ethernet LINUX driver r8127 for kernel up to 6.15" をダウンロードします。

直接リンク https://www.realtek.com/Download/ToDownload?type=direct&downloadid=4636

このダウンロードサイトを Linux から直接は厳しいので、mac や Windows などでダウンロードしてから Linux へ scp で転送しましょう。

Linux 上で tar を解凍する場合には bzip2 が必要なのでこれも追加します。

$ sudo apt install bzip2h

Installing:
  bzip2

Suggested packages:
  bzip2-doc

Summary:
  Upgrading: 0, Installing: 1, Removing: 0, Not Upgrading: 0
  Download size: 40.5 kB
  Space needed: 116 kB / 91.3 GB available

Get:1 http://deb.debian.org/debian trixie/main amd64 bzip2 amd64 1.0.8-6 [40.5 kB]
Fetched 40.5 kB in 0s (194 kB/s)
Selecting previously unselected package bzip2.
(Reading database ... 33802 files and directories currently installed.)
Preparing to unpack .../bzip2_1.0.8-6_amd64.deb ...
Unpacking bzip2 (1.0.8-6) ...
Setting up bzip2 (1.0.8-6) ...

次に /usr/src ディレクトリへ cd してから tar xvjf です。

/usr/src$ sudo tar xvjf ~/r8127-11.015.00.tar.bz2

r8127-11.015.00/
r8127-11.015.00/autorun.sh
r8127-11.015.00/Makefile
r8127-11.015.00/README
r8127-11.015.00/src/
r8127-11.015.00/src/Makefile
r8127-11.015.00/src/Makefile_linux24x
r8127-11.015.00/src/r8127.h
r8127-11.015.00/src/r8127_dash.h
r8127-11.015.00/src/r8127_fiber.c
r8127-11.015.00/src/r8127_fiber.h
r8127-11.015.00/src/r8127_firmware.c
r8127-11.015.00/src/r8127_firmware.h
r8127-11.015.00/src/r8127_n.c
r8127-11.015.00/src/r8127_ptp.c
r8127-11.015.00/src/r8127_ptp.h
r8127-11.015.00/src/r8127_realwow.h
r8127-11.015.00/src/r8127_rss.c
r8127-11.015.00/src/r8127_rss.h
r8127-11.015.00/src/rtltool.c
r8127-11.015.00/src/rtltool.h
r8127-11.015.00/src/rtl_eeprom.c
r8127-11.015.00/src/rtl_eeprom.h

DKMS のために必要なファイルをインストールします。最小限の構成でインストールしたのに、ここで開発系をインストールせねばならないなんて…。

$ sudo apt install dkms build-essential linux-headers-$(uname -r)

Installing:
  build-essential  dkms  linux-headers-6.12.48+deb13-amd64

Installing dependencies:
  binutils                   gcc-14                     libdpkg-perl            libsframe1
  binutils-common            gcc-14-x86-64-linux-gnu    libdw1t64               libstdc++-14-dev
  binutils-x86-64-linux-gnu  gcc-x86-64-linux-gnu       libfakeroot             libtsan2
  cpp                        libalgorithm-diff-perl     libfile-fcntllock-perl  libubsan1
  cpp-14                     libalgorithm-diff-xs-perl  libgcc-14-dev           linux-headers-6.12.48+deb13-common
  cpp-14-x86-64-linux-gnu    libalgorithm-merge-perl    libgomp1                linux-kbuild-6.12.48+deb13
  cpp-x86-64-linux-gnu       libasan8                   libgprofng0             linux-libc-dev
  dpkg-dev                   libbinutils                libhwasan0              make
  fakeroot                   libc-dev-bin               libisl23                manpages
  g++                        libc6-dev                  libitm1                 manpages-dev
  g++-14                     libcc1-0                   liblsan0                pahole
  g++-14-x86-64-linux-gnu    libcrypt-dev               libmpc3                 rpcsvc-proto
  g++-x86-64-linux-gnu       libctf-nobfd0              libmpfr6
  gcc                        libctf0                    libquadmath0

Suggested packages:
  binutils-doc    cpp-14-doc                 g++-14-multilib  libtool  gcc-14-multilib       libstdc++-14-doc
  gprofng-gui     menu                       gcc-14-doc       flex     gdb-x86-64-linux-gnu  make-doc
  binutils-gold   debian-keyring             gcc-multilib     bison    libc-devtools         man-browser
  cpp-doc         debian-tag2upload-keyring  autoconf         gdb      glibc-doc
  gcc-14-locales  g++-multilib               automake         gcc-doc  bzr

Summary:
  Upgrading: 0, Installing: 57, Removing: 0, Not Upgrading: 0
  Download size: 93.4 MB
  Space needed: 367 MB / 91.3 GB available

Continue? [Y/n] y

 :
 :
(後略)

インストールが終わったら、/usr/src/r8127-11.015.00 へ cd しておいてから、このディレクトリに "dkms.conf" を次の内容で作成します。

PACKAGE_NAME="r8127"
PACKAGE_VERSION="11.015.00"
CLEAN="make -C /lib/modules/$(uname -r)/build M=/usr/src/r8127-11.015.00/src clean"
MAKE[0]="make -C /lib/modules/$(uname -r)/build M=/usr/src/r8127-11.015.00/src modules"
BUILT_MODULE_NAME[0]="r8127"
BUILT_MODULE_LOCATION[0]="src/"
DEST_MODULE_LOCATION[0]="/kernel/driver/net/ethernet/realtek"
AUTOINSTALL="yes"
BUILD_EXCLUSIVE_KERNEL_MAX="6.15"



/usr/src/r8127-11.015.00$ sudo dkms add r8127/11.015.00

Creating symlink /var/lib/dkms/r8127/11.015.00/source -> /usr/src/r8127-11.015.00

/usr/src/r8127-11.015.00$ sudo dkms build r8127/11.015.00

Sign command: /lib/modules/6.12.48+deb13-amd64/build/scripts/sign-file
Signing key: /var/lib/dkms/mok.key
Public certificate (MOK): /var/lib/dkms/mok.pub

Building module(s)... done.
Signing module /var/lib/dkms/r8127/11.015.00/build/src/r8127.ko

/usr/src/r8127-11.015.00$ sudo dkms install r8127/11.015.00

Installing /lib/modules/6.12.48+deb13-amd64/updates/dkms/r8127.ko.xz
Running depmod... done.

/usr/src/r8127-11.015.00$ sudo modprobe r8127

modprobe: ERROR: could not insert 'r8127': Key was rejected by service

なんと最後の modprobe でエラーが発生します。これは UEFI の "Secure Boot" が絡んできます。"Secure Boot" を disable にする方法もありますが、あまり好ましくもないので署名を登録します。

dkms の処理中に署名は作られているので、これを import するだけです。コマンドを実行後、書名を登録する時にパスワード設定になりますから、ここで何かパスワードを設定しておきます。

sudo mokutil --import /var/lib/dkms/mok.pub
input password: 
input password again:

このまま再起動すると、MOK 管理の画面になります。

MOK management なんてものがあるのだね。
  1. enroll MOK

  2. continue

  3. enroll the key(s)?: yes

  4. enter password

  5. reboot

MOK を登録した後、modprobe が成功するようになります。
そうすると、起動後の dmesg には r8127 関連のメッセージも表示されます。きちんと Dual 10GbE が認識されていますね。

r8127: This product is covered by one or more of the following patents: US6,570,884, US6,115,776, and US6,327,625.
r8127  Copyright (C) 2025 Realtek NIC software team <nicfae@realtek.com>
                This program comes with ABSOLUTELY NO WARRANTY; for details, please see <http://www.gnu.org/licenses/>.
                This is free software, and you are welcome to redistribute it under certain conditions; see <http://www.gnu.org/licenses/>.
r8127 Ethernet controller driver 11.015.00-NAPI loaded
1225a1218,1223
r8127: This product is covered by one or more of the following patents: US6,570,884, US6,115,776, and US6,327,625.
r8127  Copyright (C) 2025 Realtek NIC software team <nicfae@realtek.com>
                This program comes with ABSOLUTELY NO WARRANTY; for details, please see <http://www.gnu.org/licenses/>.
                This is free software, and you are welcome to redistribute it under certain conditions; see <http://www.gnu.org/licenses/>.
r8127 0000:c2:00.0 enp194s0: renamed from eth1
r8127 0000:c1:00.0 enp193s0: renamed from eth0

ssh の設定

有線LAN も利用できるようになったので、使い慣れたコンソールで作業をする為に ssh の設定を行います。インストール時に ssh パッケージはインストールされているもののパスワードログインができたり、root ログインできたりはしないようにさせたいものです。

ユーザの home directory 配下に .ssh/authorized_keys を作成して公開鍵を登録します。

後は /etc/ssh/sshd_config.d/50-custom.conf などを作成して

# ポートを10022
Port 10022

# ルートログイン禁止
PermitRootLogin no

# パスワード認証無効
PasswordAuthentication no

この様に設定してから systemctl で restart または reload しておきます。

systemctl restart ssh.service

$ sudo sshd -T
port 10022
addressfamily any
listenaddress [::]:10022
listenaddress 0.0.0.0:10022
usepam yes
pamservicename sshd
logingracetime 120
x11displayoffset 10
maxauthtries 6
maxsessions 10
clientaliveinterval 0
clientalivecountmax 3
requiredrsasize 1024
streamlocalbindmask 0177
unusedconnectiontimeout none
permitrootlogin no
ignorerhosts yes
ignoreuserknownhosts no
hostbasedauthentication no
hostbasedusesnamefrompacketonly no
pubkeyauthentication yes
kerberosauthentication no
kerberosorlocalpasswd yes
kerberosticketcleanup yes
gssapiauthentication no
gssapicleanupcredentials yes
gssapikeyexchange no
gssapistrictacceptorcheck yes
gssapistorecredentialsonrekey no
gssapikexalgorithms gss-group14-sha256-,gss-group16-sha512-,gss-nistp256-sha256-,gss-curve25519-sha256-,gss-group14-sha1-,gss-gex-sha1-
passwordauthentication no
kbdinteractiveauthentication no
printmotd no
printlastlog yes
x11forwarding yes
x11uselocalhost yes
permittty yes
permituserrc yes
strictmodes yes
tcpkeepalive yes
permitemptypasswords no
compression yes
gatewayports no
usedns no
allowtcpforwarding yes
allowagentforwarding yes
disableforwarding no
allowstreamlocalforwarding yes
streamlocalbindunlink no
fingerprinthash SHA256
exposeauthinfo no
refuseconnection no
debianbanner yes
pidfile /run/sshd.pid
modulifile /etc/ssh/moduli
xauthlocation /usr/bin/xauth
ciphers chacha20-poly1305@openssh.com,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr
macs umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
banner none
forcecommand none
chrootdirectory none
trustedusercakeys none
revokedkeys none
securitykeyprovider internal
authorizedprincipalsfile none
versionaddendum none
authorizedkeyscommand none
authorizedkeyscommanduser none
authorizedprincipalscommand none
authorizedprincipalscommanduser none
hostkeyagent none
kexalgorithms mlkem768x25519-sha256,sntrup761x25519-sha512,sntrup761x25519-sha512@openssh.com,curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
casignaturealgorithms ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256
hostbasedacceptedalgorithms ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256
hostkeyalgorithms ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256
pubkeyacceptedalgorithms ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256
sshdsessionpath /usr/lib/openssh/sshd-session
sshdauthpath /usr/lib/openssh/sshd-auth
persourcepenaltyexemptlist none
loglevel INFO
syslogfacility AUTH
authorizedkeysfile .ssh/authorized_keys .ssh/authorized_keys2
hostkey /etc/ssh/ssh_host_rsa_key
hostkey /etc/ssh/ssh_host_ecdsa_key
hostkey /etc/ssh/ssh_host_ed25519_key
acceptenv LANG
acceptenv LC_*
acceptenv COLORTERM
acceptenv NO_COLOR
authenticationmethods any
channeltimeout none
subsystem sftp /usr/lib/openssh/sftp-server
maxstartups 10:30:100
persourcemaxstartups none
persourcenetblocksize 32:128
permittunnel no
ipqos lowdelay throughput
rekeylimit 0 0
permitopen any
permitlisten any
permituserenvironment no
pubkeyauthoptions none
persourcepenalties crash:90 authfail:5 noauth:1 grace-exceeded:10 refuseconnection:10 max:600 min:15 max-sources4:65536 max-sources6:65536 overflow:permissive overflow6:permissive

やるならもっとがちがちにした方が良いのかもなんだけれども。

時刻合わせ

最小化インストールだと、時刻合わせすら入っていなかったので、いろいろ調べてから systemd-timesyncd を選びました。理由は今まで使ったことがないからです。

$ sudo apt install systemd-timesyncd

Installing:
  systemd-timesyncd

Summary:
  Upgrading: 0, Installing: 1, Removing: 0, Not Upgrading: 0
  Download size: 92.9 kB
  Space needed: 207 kB / 91.9 GB available

Get:1 http://deb.debian.org/debian trixie-updates/main amd64 systemd-timesyncd amd64 257.8-1~deb13u2 [92.9 kB]
Fetched 92.9 kB in 0s (2,793 kB/s)
Selecting previously unselected package systemd-timesyncd.
(Reading database ... 29315 files and directories currently installed.)
Preparing to unpack .../systemd-timesyncd_257.8-1~deb13u2_amd64.deb ...
Unpacking systemd-timesyncd (257.8-1~deb13u2) ...
Setting up systemd-timesyncd (257.8-1~deb13u2) ...
Creating group 'systemd-timesync' with GID 989.
Creating user 'systemd-timesync' (systemd Time Synchronization) with UID 989 and GID 989.
Created symlink '/etc/systemd/system/dbus-org.freedesktop.timesync1.service' → '/usr/lib/systemd/system/systemd-timesyncd.service'.
Created symlink '/etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service' → '/usr/lib/systemd/system/systemd-timesyncd.service'.
systemd-time-wait-sync.service is a disabled or a static unit, not starting it.
Processing triggers for dbus (1.16.2-2) ...
root@tina:~# systemctl status systemd-timesyncd
● systemd-timesyncd.service - Network Time Synchronization
     Loaded: loaded (/usr/lib/systemd/system/systemd-timesyncd.service; enabled; preset: enabled)
     Active: active (running) since Mon 2025-11-10 09:27:24 JST; 7h ago
 Invocation: a3dee36100ec48839b071be45d97a9a4
       Docs: man:systemd-timesyncd.service(8)
   Main PID: 6026 (systemd-timesyn)
     Status: "Contacted time server 167.179.119.205:123 (0.debian.pool.ntp.org)."
      Tasks: 2 (limit: 151486)
     Memory: 1.9M (peak: 2.7M)
        CPU: 26ms
     CGroup: /system.slice/systemd-timesyncd.service
             └─6026 /usr/lib/systemd/systemd-timesyncd

Nov 9 09:27:24 tina systemd[1]: Starting systemd-timesyncd.service - Network Time Synchronization...
Nov 9 09:27:24 tina systemd[1]: Started systemd-timesyncd.service - Network Time Synchronization.
Nov 9 16:27:26 tina systemd-timesyncd[6026]: Contacted time server 167.179.119.205:123 (0.debian.pool.ntp.org).
Nov 9 16:27:26 tina systemd-timesyncd[6026]: Initial clock synchronization to Mon 2025-11-10 16:27:26.046432 JST.

やたらと時間ずれていたので、これで調整しました。

Default だとちょっと ntp サーバーが離れていたので、nict へ変更しています。

/etc/systemd/timesyncd.conf
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it under the
#  terms of the GNU Lesser General Public License as published by the Free
#  Software Foundation; either version 2.1 of the License, or (at your option)
#  any later version.
#
# Entries in this file show the compile time defaults. Local configuration
# should be created by either modifying this file (or a copy of it placed in
# /etc/ if the original file is shipped in /usr/), or by creating "drop-ins" in
# the /etc/systemd/timesyncd.conf.d/ directory. The latter is generally
# recommended. Defaults can be restored by simply deleting the main
# configuration file and all drop-ins located in /etc/.
#
# Use 'systemd-analyze cat-config systemd/timesyncd.conf' to display the full config.
#
# See timesyncd.conf(5) for details.

[Time]
#NTP=
#FallbackNTP=0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org 3.debian.pool.ntp.org
#RootDistanceMaxSec=5
#PollIntervalMinSec=32
#PollIntervalMaxSec=2048
#ConnectionRetrySec=30
#SaveIntervalSec=60
NTP=ntp.nict.jp
FallbackNTP=ntp1.jst.mfeed.ad.jp ntp2.jst.mfeed.ad.jp ntp3.jst.mfeed.ad.jp

まずは、ここまで。

  • SSD の換装

  • Debian 13.1 のインストール

  • sudo の設定

  • 有線LAN ドライバのインストールと設定

  • ssh の設定

  • systemd-timesyncd の設定

既に動いているサーバの移動が多いので、ちまちまと時間をかけてゆっくりとやっていきますよ…。

いまは 50,000円オフクーポンでお安く購入できますよ。


いいなと思ったら応援しよう!

しょっさん あなたの支えが、私の心の糧になります。 note の収益はガジェットのレビューや、自費出版に使わせていただきます。