Photon OS 5.0にrealmやoddjobなどをソースインストールしてドメイン参加する

構築

0.前書き

この手順には大きな欠陥があるため、

とても商用に利用できる代物ではありませんのでご注意ください。

 

え、普段の手順も適当じゃないかって?

正論パンチはやめてください…

 

というわけで本題です。

 

Photon OSとは…

こちらに詳しい情報が簡潔にまとめられている素晴らしいサイトありましたのでご覧ください。

Photon OS を使って、Docker / Docker Compose 環境を作ってみよう - DENET 技術ブログ

 

今回は先日公開されたばかりの5.0(GA)を使っていきます。

 

さて、今回の目的はドメイン参加になります。

※そもそもコンテナサーバをドメイン参加させるメリットはほとんどないと思います

 

実はPhoton OS 5.0を触る前にPhoton OS 4.0もドメイン参加しました。

Photon OS 4.0ではレポジトリにLikewise Openというパッケージが存在し、これを使ってドメイン参加させることができます。(Likewise Openでのドメイン参加に関する情報は少ないですが…)

 

Photon OS 5.0へのバージョンアップでいくつかのパッケージが削除されており、Likewise Openもものの見事に消え去っていました。

 

Photon OS 5.0のリポジトリを見る限りほかにドメイン参加できそうなパッケージも存在しないので、ソースインストールすること決めた次第です。

 

まとめるとこんな感じ

【Photon OS 4.0】

■必要ツール

パッケージ:Likewise Open

■メリット:リポジトリからインストールするだけ

■デメリット:Likewise Openの情報が少なく、ハードモード

【Photon OS 5.0】

■必要ツール

パッケージ:sssd,krb5

非パッケージ:realmd,oddjob,oddjob-mkhomedir,adcli

※最低限realm joinする際に必要なものが「realmd,oddjob,oddjob-mkhomedir,adcli」ユーザ情報を統合するために必要なのが「sssd,krb5」になります。

■メリット:ソースインストールした後は簡単

■デメリット:無限コンパイル編突入

 

1.環境説明

今回赤字部分を構築します。

 

①Active Direcroty Domain Controller(以降ADDC)

 

OS:AlmaLinux release 9.1 (Lime Lynx)

ホスト名:sambaserver

構築システム:Samba4.17.4

IPアドレス:172.16.1.7

備考:DNSサーバも同居

 

②ドメイン環境

 

DNSドメイン名:home.miyamo83.com

 

③dockerサーバ

 

ホスト名:dockerserver

OS:Photon OS 5.0(GA)

IPアドレス:172.16.1.5

 

2.構築

 

①デプロイからログインまで

私は以下のOVAファイルからのデプロイを行いました。

OSイメージ:https://github.com/vmware/photon/wiki/Downloading-Photon-OS

OVA with virtual hardware v15 (Supports both BIOS and UEFI boot, default is UEFI)

 

ESXiホストからのデプロイだとウィザードに従ってボタンをポチポチするだけですね。

手順は割愛します。

 

デプロイできたら起動ですが、ほかのLinuxでディストリビューションより起動が遅いような気がします。あとブート画面でエラーが出ていたため最初はブート失敗しているのかと思いましたがログイン画面に遷移できれば問題ないと思います。

 

ブート中

 

起動できたら初期状態でipv6のリンクローカルが有効になっているので、sshで操作可能です。

というかESXiのコンソール使い悪すぎてssh一択です。

 

リンクローカルにsshする注意点としては

①ssh送信元のリンクローカルが割り当てられているインターフェースのIDを指定する

linuxの場合は「ip a」Windowsの場合は「route print」などで見れます。

②ルータ越えできない

 

詳しくはこちらから

【図解】IPv4/IPv6のリンクローカルアドレスの使い方~ユニークローカルとの違い,ルーティング,中間セグメントとの関係
リンクローカルアドレスとは Ethernet 等のマルチアクセス環境において、L2 範囲内でのみ有効な IP アドレスのことをリンクローカルアドレスと呼びます。 例えば Ethernet のブロードキャストドメイン内のホスト同士であれば、リ

 

まとめるとlinuxからのssh場合以下のコマンドになります。

ssh root@fe80::20c:29ff:fec4:caef%ens192

※%以下が送信元のインターフェースのIDです。

 

ログインは注釈に書いている通りです。

ユーザー:root

初期パスワード:changeme

初期パスワードを変更したらログイン完了です。

 

②環境整備

 

ではIPやらDNSやらの環境設定を行います。

 

# vi /etc/systemd/network/10-static-eth0.network

中身はこんな感じ。

——————————————————————————————————-

[Match]
Name=eth0

[Network]
Address=172.16.1.5/24
Gateway=172.16.1.254
DNS=172.16.1.7

——————————————————————————————————-

権限を変更して

# chmod 644 /etc/systemd/network/10-static-eth0.network

 

サービスを再起動

# systemctl restart systemd-networkd.service

 

確認コマンド

# ip a

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:0c:29:c4:ca:ef brd ff:ff:ff:ff:ff:ff
altname eno1
altname enp11s0
altname ens192
inet 172.16.1.5/24 brd 172.16.1.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fec4:caef/64 scope link
valid_lft forever preferred_lft forever

 

 

続いてiptablesの穴あけです。

現状確認すると、ICMPが開いていなかったりします。

# iptables --list

Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT all — anywhere anywhere
ACCEPT all — anywhere anywhere ctstate RELATED,ESTABLISHED
ACCEPT tcp — anywhere anywhere tcp dpt:ssh

Chain FORWARD (policy DROP)
target prot opt source destination

Chain OUTPUT (policy DROP)
target prot opt source destination
ACCEPT all — anywhere anywhere

 

# vi /etc/systemd/scripts/ip4save

赤字が追記部分です、icmp以外はお好みでお願いします。

——————————————————————————————————-

# init
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [0:0]
# Allow local-only connections
-A INPUT -i lo -j ACCEPT
-A INPUT -m conntrack –ctstate RELATED,ESTABLISHED -j ACCEPT
#keep commented till upgrade issues are sorted
#-A INPUT -j LOG –log-prefix “FIREWALL:INPUT ”
-A INPUT -p tcp -m tcp –dport 22 -j ACCEPT
-A INPUT -p tcp -m tcp –dport 8001 -j ACCEPT
-A INPUT -p tcp -m tcp –dport 8080 -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A OUTPUT -j ACCEPT
COMMIT

——————————————————————————————————-

 

設定反映

# systemctl restart iptables.service

設定確認

# iptables --list

Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT all — anywhere anywhere
ACCEPT all — anywhere anywhere ctstate RELATED,ESTABLISHED
ACCEPT tcp — anywhere anywhere tcp dpt:ssh
ACCEPT tcp — anywhere anywhere tcp dpt:vcom-tunnel
ACCEPT tcp — anywhere anywhere tcp dpt:http-alt
ACCEPT icmp — anywhere anywhere

Chain FORWARD (policy DROP)
target prot opt source destination

Chain OUTPUT (policy DROP)
target prot opt source destination
ACCEPT all — anywhere anywhere

 

 

お気づきかもしれませんが、Photon OSはRed HutベースのOSのようなコマンド体系です。

ただエイリアス設定がほぼ皆無のため、結構使いづらい印象があります。

なので、エイリアスを設定していきます。

 

シェル起動時に読み込まれるファイルの中でも、最初期に当たると思われる

プロファイルの編集を行います。

# vi /etc/profile

# System wide aliases and functions should go in /etc/bashrc. Personal
# environment variables and startup programs should go into
# ~/.bash_profile. Personal aliases and functions should go into
# ~/.bashrc.

 

ここに記載の通り、全体のエイリアス設定を行いたいのなら「/etc/bashrc」

ユーザ独自のエイリアス設定を行いたいのなら「~/.bashrc」

 

なので、「/etc/bashrc」に記載したいところなのですが、

今回目的のドメインユーザでのログインでは「/etc/bashrc」に記載したところで、root権限がないので反映されません。

 

よって、私は今回「~/.bashrc」に記載しました。

(「/etc/bashrc」の権限を変更すれば解決かもしれませんがお勧めできません…)

 

ファイルの最後尾(# End /etc/profileの上)に以下を追記します。

. ~/.bashrc

 

ファイルがないので、作ってエイリアスを記載します。

(当然、「~/.bashrc」はユーザごとに必要になります。)

# vi ~/.bashrc

——————————————————————————————————-

alias ll=’ls –color=auto -al’

——————————————————————————————————-

 

設定の即時反映

# . ~/.bashrc

(ssh接続を切断→接続でも大丈夫です。)

 

つぎはNTPとタイムゾーンです。

ADドメイン参加の場合、ADDCとの時刻同期が必須なので変更が必要です。

また、タイムゾーンはUTCになっています。

# date

Sun Jun 11 07:46:38 AM UTC 2023

 

NTPサーバの設定

# vi /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 by creating “drop-ins” in
# the timesyncd.conf.d/ subdirectory. The latter is generally recommended.
# Defaults can be restored by simply deleting this file and all drop-ins.
#
# See timesyncd.conf(5) for details.

[Time]
NTP=172.16.1.7
#FallbackNTP=time1.google.com time2.google.com time3.google.com time4.google.com
#RootDistanceMaxSec=5
#PollIntervalMinSec=32
#PollIntervalMaxSec=2048
#ConnectionRetrySec=30
#SaveIntervalSec=60


 

設定反映

# systemctl restart systemd-timesyncd.service

 

設定確認

# systemctl status systemd-timesyncd.service

 

タイムゾーンの変更

# timedatectl set-timezone Asia/Tokyo

 

時刻確認

# date

 

 

続いてresolv.confのsearchの記載

 

そもそもsearchとは、searchで記載したドメインまでを省略して名前を引けるようにする項目で、

たとえば、本来「ping sambaserver.home.miyamo83.com」としなければならないところを「ping sambaserver」と省略できるようになります。

 

# ll /etc | grep resolv.conf

Photon OSの「resolv.conf」はシンボリックシンクが張られており、

実態は「/run/systemd/resolve/stub-resolv.conf」になります。

 

 

見ていただくとわかりますが

# cat /run/systemd/resolve/stub-resolv.conf

# This is /run/systemd/resolve/stub-resolv.conf managed by man:systemd-resolved(8).
# Do not edit.

 

ファイルのコメントアウト部分に「systemd-resolved」というサービスによって管理されているため編集禁止となっています。

※厳密には編集しても再起動すると、編集前に巻き戻されます。

 

詳細は省きますが「systemd-resolved」で管理されている環境でsearchを変更したい場合、nmcliコマンドでNetwork-Manager経由で変更することになるみたいです。

 

※「systemd-resolved」を停止して、「/etc/resolv.conf」を編集する方法もできなくはないが他への影響がないか未確認

 

ところがPhoton OSのレポジトリを見てもNetwork Managerのパッケージが見当たらない…

 

Photon OSには代わりに「netmgr」というコマンドがあるらしい…がsearchが変更できると書いてない。

https://vmware.github.io/photon/assets/files/html/3.0/photon_cli/netmgr-cli.html

そもそもPhoton OS5.0(GA)のレポジトリにnetmgmtはなかったので訂正

 

色々調べていると、序盤に記載した「systemd-networkd」ならsearchの設定変更ができるとのことなので追記します

# vi /etc/systemd/network/10-static-eth0.network

——————————————————————————————————-

[Match]
Name=eth0

[Network]
Address=172.16.1.5/24
Gateway=172.16.1.254
DNS=172.16.1.7
Domains=home.miyamo83.com

——————————————————————————————————-

 

設定を反映し

# systemctl restart systemd-networkd.service

 

「resolv.conf」を除くと

# cat /etc/resolv.conf

nameserver 127.0.0.53
options edns0 trust-ad
search home.miyamo83.com

 

確かに追記されている

ただ、nameserverは172.16.1.7にならないのはなぜ…

 

とはいえ、

# ping sambaserver

64 bytes from 172.16.1.7 (172.16.1.7): icmp_seq=1 ttl=64 time=0.038 ms

 

やりたいことはできたので、次はホスト名の変更

# hostnamectl set-hostname dockerserver.home.miyamo83.com

 

パッケージのアップデート

# tdnf -y update

※結構時間かかります

 

パーティション操作のパッケージインストール

# tdnf -y install parted

 

一度電源を落とし、CPU,メモリ,ディスク容量の変更を行います。

# poweroff

 

私はとりあえずこんな感じにしてます。

minikubeでメモリを16GB利用するため中途半端な数になっています。

変更が終わったら起動します。

 

パーティションへディスク容量の再割り当てするため、現在のパーティションを確認します。

# df -h

Filesystem Size Used Avail Use% Mounted on
devtmpfs 4.0M 0 4.0M 0% /dev
tmpfs 12G 0 12G 0% /dev/shm
tmpfs 4.7G 656K 4.7G 1% /run
/dev/sda2 16G 743M 15G 5% /
tmpfs 12G 0 12G 0% /tmp
/dev/sda3 10M 2.2M 7.9M 22% /boot/efi
tmpfs 2.4G 0 2.4G 0% /run/user/0

 

ルートディレクトリを増やしたいので、今回は「/dev/sda2」のようです。

増やした分のディスク容量300GBが認識されているか確認します。

# fdisk -l

GPT PMBR size mismatch (33554431 != 629145599) will be corrected by write.
Disk /dev/sda: 300 GiB, 322122547200 bytes, 629145600 sectors
Disk model: Virtual disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 7833ABBE-6584-44B8-AEAD-AF3450599E43

Device Start End Sectors Size Type
/dev/sda1 2048 10239 8192 4M BIOS boot
/dev/sda2 30720 33554398 33523679 16G Linux filesystem
/dev/sda3 10240 30719 20480 10M EFI System

 

認識されていそうです。

ではパーティションのリサイズを行います。

 

物理ディスク名である「/dev/sda」を指定します。

# parted /dev/sda

 

念のためこちらでも確認します。

(parted) print

print
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 322GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
1 1049kB 5243kB 4194kB bios_grub
3 5243kB 15.7MB 10.5MB fat16 boot, esp
2 15.7MB 17.2GB 17.2GB ext4

 

2で問題なさそうなので最大までリサイズします

(parted) resizepart 2 100%

Warning: Partition /dev/sda2 is being used. Are you sure you want to continue?
Yes/No?

と聞かれるのでYesでリターン

 

確認

(parted) print

print
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 322GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
1 1049kB 5243kB 4194kB bios_grub
3 5243kB 15.7MB 10.5MB fat16 boot, esp
2 15.7MB 322GB 322GB ext4

 

partedの対話を抜けます。

(parted) quit

 

パーティションの増設はできましたが、このままではファイルシステム側が増設を把握していないのでファイルシステムをリサイズします。

# resize2fs /dev/sda2

※少し時間がかかります

resize2fs 1.46.5 (30-Dec-2021)
Filesystem at /dev/sda2 is mounted on /; on-line resizing required
old_desc_blocks = 2, new_desc_blocks = 38
The filesystem on /dev/sda2 is now 78639355 (4k) blocks long.

 

確認

# df -h

Filesystem Size Used Avail Use% Mounted on
devtmpfs 4.0M 0 4.0M 0% /dev
tmpfs 12G 0 12G 0% /dev/shm
tmpfs 4.7G 656K 4.7G 1% /run
/dev/sda2 296G 743M 283G 1% /
tmpfs 12G 0 12G 0% /tmp
/dev/sda3 10M 2.2M 7.9M 22% /boot/efi
tmpfs 2.4G 0 2.4G 0% /run/user/0

# fdisk -l

Disk /dev/sda: 300 GiB, 322122547200 bytes, 629145600 sectors
Disk model: Virtual disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 7833ABBE-6584-44B8-AEAD-AF3450599E43

Device Start End Sectors Size Type
/dev/sda1 2048 10239 8192 4M BIOS boot
/dev/sda2 30720 629145566 629114847 300G Linux filesystem
/dev/sda3 10240 30719 20480 10M EFI System

 

GPT PMBR size mismatch (33554431 != 629145599) will be corrected by write.」エラーも消えています。

 

これで環境整備は完了です。一度再起動しておきます。

また、ここから結構ハードコースなのでスナップショット取得推奨です。

# reboot

 

③realmdのソースインストール

 

パッケージをインストール

# tdnf install -y sudo wget git less tar make autoconf

 

ソースファイルを展開するために移動

# cd /usr/src

 

gitからクローン

# git clone https://gitlab.freedesktop.org/realmd/realmd

 

インストール方法はこちらに載っています。

Contributing to realmd

 

移動

# cd realmd

 

autogen.shの実行

# sh autogen.sh --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib64 --enable-strict --enable-debug

autoreconf: export WARNINGS=
autoreconf: Entering directory ‘.’
autoreconf: running: autopoint –force
Can’t exec “autopoint”: No such file or directory at /usr/share/autoconf/Autom4te/FileUtils.pm line 293.
autoreconf: error: autopoint failed with exit status: 2

 

早速エラーが出ました。

ソースインストールはこんな感じで無限にエラーと戦うことになるので、鋼の心が必要です。

 

gettextが足りないようです。

MacOSXでautopointが実行できなくてautoreconf -iが失敗する場合の対処 - Qiita
MacOSX上でautoreconf -ifvなどと打った場合に、次のようなエラーが出ることがあります。$ autoreconf -ifvautoreconf: Entering directo…

 

gettextインストール

# tdnf -y install gettext

 

再度実行

# sh autogen.sh --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib64 --enable-strict --enable-debug

autoreconf: running: aclocal –force -I build/m4 ${ACLOCAL_FLAGS}
sh: line 1: aclocal: command not found
autoreconf: error: aclocal failed with exit status: 127

 

こんにちは、エラーさん。いつもお世話になっております。

 

automakeがいるみたいです。

Can't exec "aclocal": No such file or directoryの対処法 - Qiita
OSXでjson-cをビルドしようとしたらエラーが出ました。$ json-c ./autogen.shautoreconf: Entering directory `.'au…
# tdnf -y install automake

 

リベンジ

# sh autogen.sh --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib64 --enable-strict --enable-debug

configure: error: Couldn’t detect the distro to configure for. Specify one with –with-distro

 

「–with-distro」をつけてディストリビューションを指定しろと言っています。

Photon OSのディストリビューションって何ですか?僕にもわかりません。

 

指定できる値はこちらに書いてます。

configure.ac · master · realmd / realmd · GitLab
freedesktop.org GitLab login

 

Red Hut系っぽいので「–with-distro=redhat」を追加して実行

# sh autogen.sh --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib64 --enable-strict --enable-debug --with-distro=redhat

configure: error: in `/usr/src/realmd’:
configure: error: no acceptable C compiler found in $PATH
See `config.log’ for more details

 

通りましたが、また別のエラーです。

Cのコンパイラー、つまりgccがないみたいです。

gccはソースインストールの常連さんです。

# tdnf -y install gcc

※時間かかります

 

つぎこそは

# sh autogen.sh --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib64 --enable-strict --enable-debug --with-distro=redhat

configure: error: in `/usr/src/realmd’:
configure: error: C compiler cannot create executables
See `config.log’ for more details

 

ログを見ます

# cat config.log

gcc: fatal error: cannot execute ‘as’: execvp: No such file or directory

 

どうやら「binutils」がいるようです、知らんけど

Fatal error: cannot execute 'as': execvp: no such file or directory
Whenever I try to compile c/cpp files it gives this error: gcc: fatal error: cannot execute ‘as’: execvp: No such file o...
# tdnf -y install binutils

 

もっかい

# sh autogen.sh --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib64 --enable-strict --enable-debug --with-distro=redhat

configure: error: in `/usr/src/realmd’:
configure: error: C compiler cannot create executables
See `config.log’ for more details

 

ログを見ます

# cat config.log

/usr/bin/ld: cannot find Scrt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory

 

glibcライブラリが足りないみたいです。

How to fix linker error "cannot find crt1.o"?
I have a virtual Debian system which I use to develop. Today I wanted to try llvm/clang. After installing clang I can't ...
# tdnf -y install glibc-devel

 

うぇーい

# sh autogen.sh --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib64 --enable-strict --enable-debug --with-distro=redhat

configure: error: in `/usr/src/realmd’:
configure: error: C preprocessor “/lib/cpp” fails sanity check
See `config.log’ for more details

 

ログを見ます

# cat config.log

/usr/include/bits/local_lim.h:38:10: fatal error: linux/limits.h: No such file or directory

 

「linux-api-headers」を入れればいいようです。

No such file or directory "limits.h" when installing Pillow on Alpine Linux
I'm running alpine-linux on a Raspberry Pi 2. I'm trying to install Pillow via this command: pip install pillow This is ...
# tdnf -y install linux-api-headers

 

にゃーん

# sh autogen.sh --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib64 --enable-strict --enable-debug --with-distro=redhat

checking for polkit-gobject-1… no
configure: error: Package requirements (polkit-gobject-1) were not met:

No package ‘polkit-gobject-1’ found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables POLKIT_CFLAGS
and POLKIT_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

 

あちゃー、そういえば「polkit」がいるのわすれてましたわぁ(polkitってなに

# tdnf -y install polkit-devel

 

# sh autogen.sh --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib64 --enable-strict --enable-debug --with-distro=redhat

checking for ldap.h… no
configure: error: “Couldn’t find OpenLDAP headers or libraries”

 

はい、「OpenLDAP」くんいれます

# tdnf -y install openldap-devel

 

# sh autogen.sh --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib64 --enable-strict --enable-debug --with-distro=redhat

checking for xmlto… no
configure: error: the xmlto command was not found (perhaps –disable-doc)

 

「xmlto」

# tdnf -y install xmlto

 

# sh autogen.sh --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib64 --enable-strict --enable-debug --with-distro=redhat

configure: creating ./config.status
config.status: creating Makefile
config.status: creating doc/version.xml
config.status: creating po/Makefile.in
config.status: creating po/Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing po-directories commands
config.status: creating po/POTFILES
config.status: creating po/Makefile

CFLAGS: -g -O2 -g -O0 -Wall -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wdeclaration-after-statement -Wformat=2 -Winit-self -Waggregate-return -Wmissing-format-attribute -Wmissing-include-dirs -Wundef -Werror -DG_DISABLE_DEPRECATED

OPTIONS:
Debug: yes
Coverage: no
Strict: yes
Documentation: yes

OPTIONAL DEPENDENCIES:
systemd unit dir: /usr/lib/systemd/system
systemd journal: yes

Now type ‘make’ to compile realmd.

 

やっと通りました。

 

手順に従って

# make all

service/realm-credential.h:22:10: fatal error: krb5/krb5.h: No such file or directory

 

ですよね~、一回じゃうまくいきませんよね

 

まぁ、「krb5」は結局必要になるので

# tdnf -y install krb5-devel

 

再度コンパイル

# make all

/usr/include/krb5/krb5.h:8626:10: fatal error: et/com_err.h: No such file or directory

 

「e2fsprogs」がいるとのこと

"com_err.h: No such file or directory" error?
Questioning why you are getting "com_err.h: No such file or directory" error? Install the following e2fsprogs-devel pack...
# tdnf -y install e2fsprogs-devel

 

今度こそ…

# make all

I/O error : Attempt to load network entity http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd
warning: failed to load external entity “http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd”
validity error : Could not load the external subset “http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd”
Document /usr/src/realmd/./doc/manual/realmd-docs.xml does not validate

 

「docbook」が必要みたい

xorg-docs: I/O error : Attempt to load network entity · Issue #11 · maxim-belkin/homebrew-xorg
/gsc/btl/linuxbrew/bin/xsltproc --path "/gsc/btl/linuxbrew/Cellar/xorg-sgml-doctools/1.11/share/sgml/X11" --path "/var/t...
# tdnf -y install docbook-xml

 

頼む…

# make all

コンパイル終わった…?

 

確認します

# make check -j4

====================
# TOTAL: 101
# PASS: 101
# SKIP: 0
# XFAIL: 0
# FAIL: 0
# XPASS: 0
# ERROR: 0
====================

 

完全勝利!(完全敗北)

 

インストール!

# make install -j4

これでrealmdは終わりです。realmdは…

 

念のため確認

# which realm

/usr/sbin/realm

 

realmd 完

 

④oddjob,oddjob-mkhomedirのソースインストール

 

ディレクトリを戻ります

# cd /usr/src/

 

ソースコードのダウンロード(oddjob-0.34.7は2023年6月12日現在 最新)

# wget https://releases.pagure.org/oddjob/oddjob-0.34.7.tar.gz

 

ファイルの解凍と展開

# tar xvfz oddjob-0.34.7.tar.gz

 

tarファイルの削除と移動

# rm -Rf oddjob-0.34.7.tar.gz && cd oddjob-0.34.7

 

./configureの実行

# ./configure --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib64 --libexecdir=/usr/libexec

No package ‘dbus-1’ found

 

「dbus」のインストール

# tdnf install -y dbus-devel

 

りべんじ

# ./configure --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib64 --libexecdir=/usr/libexec

No package ‘libxml-2.0’ found

 

「dbus」のインストール

# tdnf install -y libxml2-devel

 

通ってくれ

# ./configure --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib64 --libexecdir=/usr/libexec

通った。Mikefileもできてる。

 

コンパイル

# make -j4

エラーなし

 

インスコ

# make install -j4

エラーなし…

意外とあっさり

 

確認

# which oddjobd

/usr/sbin/oddjobd

 

サービスをサンプルからコピーして作成します

# cp /usr/src/oddjob-0.34.7/scripts/oddjobd.service /usr/lib/systemd/system/oddjobd.service

 

書き換え

# vi /usr/lib/systemd/system/oddjobd.service

[Unit]
Description=privileged operations for unprivileged applications
After=syslog.target network.target dbus.service

[Service]
Type=simple
PIDFile=/run/oddjobd.pid
Environment=LC_ALL=C.UTF-8
ExecStart=/usr/sbin/oddjobd -n -p /run/oddjobd.pid -t 300

[Install]
WantedBy=multi-user.target

 

systemctl status oddjobd.service

 

# systemctl start oddjobd.service

 

# systemctl enable oddjobd.service

Created symlink /etc/systemd/system/multi-user.target.wants/oddjobd.service → /usr/lib/systemd/system/oddjobd.service.

 

oddjob 完

 

⑤adcliのソースインストール

 

ディレクトリを戻ります

# cd /usr/src/

 

gitからクローン

# wget https://releases.pagure.org/oddjob/oddjob-0.34.7.tar.gz

 

移動

# cd adcli

 

autogen.shの実行

# sh autogen.sh --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib64 --enable-strict --enable-debug

library/Makefile.am:22: error: Libtool library used but ‘LIBTOOL’ is undefined

 

久しぶりのエラーですね。

「libtool」のインストール

# tdnf install -y libtool

 

まだまだいける

# sh autogen.sh --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib64 --enable-strict --enable-debug

configure: build options:
Host: x86_64-pc-linux-gnu
Debug build: yes (-g, -O0, debug output)
Strict build: yes (-Werror, fatals)
Documentation: yes

 

ちょろい、こんなにちょろくていいのか??(かなり調子に乗っています)

 

コンパイル

# make -j4

エラーなし

 

インスコ

# make install -j4

エラーなし!(脳汁があふれた顔)

 

確認

# which adcli

/usr/sbin/adcli

 

adcli 完

 

⑥sssdインストール

 

パッケージからインストール

# tdnf install -y sssd

※時間かかります

 

⑦ドメイン参加

 

ではすべてのパッケージがそろったので、いよいよドメイン参加です

# realm join home.miyamo83.com

See: journalctl REALMD_OPERATION=r11428.30269
realm: Couldn’t join realm: Necessary packages are not installed: oddjob oddjob-mkhomedir sssd adcli

 

おやおや…

 

ログ確認

# journalctl REALMD_OPERATION=r11428.30269

Couldn’t find file: /usr/libexec/oddjob/mkhomedir

 

調べると確かに「/usr/libexec/oddjob/mkhomedir」なんてファイルは存在していない…

 

【ここで5時間トラブルシューティング】

 

結局インターネッツの力を借りても原因がわからなかったため、

ダメもとですでにパッケージインストールでドメイン参加しているCentOS7から「/usr/libexec/oddjob/mkhomedir」をコピーしてみました。

 

# realm join home.miyamo83.com

See: journalctl REALMD_OPERATION=r12754.30867
realm: Couldn’t join realm: Enabling SSSD in nsswitch.conf and PAM failed.

 

エラーになったものの、どうやらドメイン参加はできた模様

これが今回の手順の一番の欠陥になります。

 

原因がわからないままとりあえず進めるという最悪の手段を使いましたが、

検証環境なので良しとした次第です。

 

言うまでもないですが、確実にエラーのもとになるので商用では絶対にマネしないでください。

 

では「sssd.conf」の編集をしてすべての設定が完了になります。

# vi /etc/sssd/sssd.conf

# TODO: Replace ad.example.com with your domain in all locations.

[sssd]
domains = home.miyamo83.com
config_file_version = 2
debug_level=9
services = nss, pam

[domain/home.miyamo83.com]
default_shell = /bin/bash
krb5_store_password_if_offline = True
cache_credentials = True
krb5_realm = HOME.MIYAMO83.COM
realmd_tags = manages-system joined-with-adcli
id_provider = ad
fallback_homedir = /home/%u
ad_domain = home.miyamo83.com
use_fully_qualified_names = false
ldap_id_mapping = True
access_provider = ad

 

設定ファイルの読み込みのためサービス再起動

# systemctl restart sssd

 

最後の確認です。実際にログインしてみます。

# su domain_user

domain_user@dockerserver [ /usr/src/adcli ]$

 

無事ログインできました。

これですべての作業が完了となりましたが、腑に落ちない点が多々あります。

 

それとやはりホームディレクトリの挙動がおかしいような気がします。

ログインしても自動で作成されないため手動作成することになりました。

 

おそらくoddjob-mkhomedirがうまく動いていないのだと思います。

 

試していないですが「/usr/libexec/oddjob/mkhomedir」に完成したバイナリをそのままコピーしてもうまくいっていないということは、このバイナリファイルは空でも同じ結果になっている気がします。

 

ファイルがなければそもそもドメイン参加できないですが、空で作ってしまえば最悪ドメイン参加だけは可能という感じです。

 

有識者の方、今回のエラーについて何か知っていればコメントお願いします…!

 

3.後書き

このブログ史上最高の長さになってしまいました。

軽い気持ちでソースインストールに手を出してはいけませんと、義務教育で教えるべきですね…

 

とはいってもやはり、ソースインストールは結構楽しいですね。

達成感がすごい。

 

今は二度とソースインストールなんてやるかって思ってますが、

多分明日にはソースインストールやりてぇなぁってなってると思います。

 

4.参考サイト

Photon OS を使って、Docker / Docker Compose 環境を作ってみよう - DENET 技術ブログ
Downloading Photon OS
Minimal Linux container host. Contribute to vmware/photon development by creating an account on GitHub.
【図解】IPv4/IPv6のリンクローカルアドレスの使い方~ユニークローカルとの違い,ルーティング,中間セグメントとの関係
リンクローカルアドレスとは Ethernet 等のマルチアクセス環境において、L2 範囲内でのみ有効な IP アドレスのことをリンクローカルアドレスと呼びます。 例えば Ethernet のブロードキャストドメイン内のホスト同士であれば、リ

Photon Network Manager Command-line Interface (netmgr) · VMware Photon OS 3.0 Documentation
VMware Photon OS 3.0 の参照DNS サーバ設定。(systemd-resolved)
VMware Photon OS 3.0 の参照 DNS サーバの設定は、これまでの Photon OS とは様子が変わっているようです。今回は、Photon OS 3.0 の DNS サーバ アドレスの確認と、設定変更をしてみます。 Ph...
Contributing to realmd
MacOSXでautopointが実行できなくてautoreconf -iが失敗する場合の対処 - Qiita
MacOSX上でautoreconf -ifvなどと打った場合に、次のようなエラーが出ることがあります。$ autoreconf -ifvautoreconf: Entering directo…
Can't exec "aclocal": No such file or directoryの対処法 - Qiita
OSXでjson-cをビルドしようとしたらエラーが出ました。$ json-c ./autogen.shautoreconf: Entering directory `.'au…
configure.ac · master · realmd / realmd · GitLab
freedesktop.org GitLab login
Fatal error: cannot execute 'as': execvp: no such file or directory
Whenever I try to compile c/cpp files it gives this error: gcc: fatal error: cannot execute ‘as’: execvp: No such file o...
How to fix linker error "cannot find crt1.o"?
I have a virtual Debian system which I use to develop. Today I wanted to try llvm/clang. After installing clang I can't ...
No such file or directory "limits.h" when installing Pillow on Alpine Linux
I'm running alpine-linux on a Raspberry Pi 2. I'm trying to install Pillow via this command: pip install pillow This is ...
"com_err.h: No such file or directory" error?
Questioning why you are getting "com_err.h: No such file or directory" error? Install the following e2fsprogs-devel pack...

 

コメント

タイトルとURLをコピーしました