Let’s Encryptのサーバー証明書の移行方法

サイトを別サーバーに移行する際、サーバー証明書の移行が必要になります。その移行の手順について書いてみます。

example1.comというドメインのサイトを別サーバーに移行するのですが、移行先のサーバーではすでにexample2.comというドメインのサイトを運営中で、1台のWEBサーバーに運営サイトを集約します。移行先のWEBサーバーではApacheが稼働していてバーチャルホストの設定を行います。

移行前はこのような構成です。

これをこんな感じの構成にします。

移行手順をまとめると、以下のようになります。

  1. 移行先のサーバーでバーチャルホストの設定をする。
  2. サイトを移行する。
  3. サーバー証明書を一時的に移行する。
  4. DNSの設定を変える。
  5. 移行先のサーバーでサーバー証明書の再取得をする。
  6. サーバー証明書の更新をする。

バーチャルホストの設定とサイトの移行は出来ているものとします。

サーバー証明書を一時的に移行する。

移行元サーバーでサーバー証明書の確認をします。

Let’s Encryptのサーバー証明書は /etc/letsencrypt/live/(ドメイン名)にあります。ただこのディレクトリのファイルはシンボリックリンクになっており実体のファイルは別の場所になります。実体のファイルがどこにあるかというと /etc/letsencrypt/archive/(ドメイン名)です。複数のファイルで構成されており証明書を何度か更新していると連番がつきます。live および archiveディレクトリはroot権限がないと入れませんのでrootユーザーで作業してください。

cert.pem ・・ サーバー証明書ファイル
chain.pem ・・ 中間CA証明書ファイル
fullchain.pem・・ サーバー証明書ファイル
privkey.pem ・・ 秘密鍵ファイル

fullchain.pem は cert.pem と chain.pem をマージしたものです。Apacheではこれらのファイルすべてを使うわけではなくApacheのバージョンによって使うファイルが異なります。

Apache2.4.7以前では3つのファイルを使います。
・cert.pem
・chain.pem
・privkey.pem

Apache2.4.8以降では2つのファイルを使います。
・fullchain.pem
・privkey.pem

archive配下にある最新のサーバー証明書を移行します。最新のファイルは /etc/letsencrypt/live のシンボリックリンクがされているファイルです。今回は移行先のApacheが2.4.6なので cert.pem、chain.pem、privkey.pem を持っていきます。

ここから移行先サーバーでの作業です。

サーバー証明書を配置するディレクトリを作成します。サーバー証明書が漏洩しないようにroot権限でないとアクセスできない場所にしましょう。今回は /etc/letsencrypt/live 配下にしました。live配下にドメイン名とは異なるディレクトリを作成してサーバー証明書を配置します(ドメイン名とは異なるディレクトリ名にする理由は後述します)。本来はlive配下はシンボリックリンクにするべきでしょうが実体のファイルを直に置いてしまいます。サーバー証明書に連番がついていた場合は連番を取り除いて(リネームして)配置します。

作成するディレクトリ
/etc/letsencrypt/live/dummy.com

配置するファイル
・cert.pem
・chain.pem
・privkey.pem

バーチャルホストにSSL設定を追記します。このような感じです。


SSLCertificateFile /etc/letsencrypt/live/dummy.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/dummy.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/dummy.com/chain.pem

記載が出来たらApacheを再起動して設定を反映させます。

# systemctl restart httpd

ただこのままだとユーザーのサイトへのアクセスは移行元サーバーになっているためDNSの設定を変更して移行先のサーバーに向くようにします。DNSのAレコードを移行先サーバーのIPアドレスに変更するだけで良く、ドメインの移管は不要です。この手順はドメインを取得した会社で操作手順(ゾーン編集の管理画面)が用意されていると思いますので、ここでは割愛します。

これでサーバー証明書の移行は完了です。httpsでサイトにアクセスすればブラウザのアドレスバーに鍵マークが表示されると思います。

いったんはこれで移行したサイトの安定稼働を確認しましょう。

なお、ここで移行した証明書は一時的なものです。サーバー証明書の更新は出来ないと思われるため改めて証明書の再取得を行います。

移行先のサーバーでサーバー証明書の再取得をする。

移行先サーバーでは別のドメイン(example2.com)がSSLで稼働しており、またcertbotはインストール済みとします。

サーバー証明書を再取得する前に移行元サーバーで使っていた証明書を失効させる必要があるか?が気になるところですが、証明書を失効させる必要はありません。サーバー証明書の秘密鍵が漏洩でもしない限り、そのままにしておいても良いでしょう。

サーバー証明書を再取得するにはrootユーザーで以下のコマンドを実行します。


# certbot certonly --webroot -w /var/www/html/example1 -d example1.com -d www.example1.com

コマンドの説明をしておくと、-w オプションで指定する /var/www/html/example1 はドキュメントルートです。また -d オプションですが証明書を取得するドメイン名を指定します。上記の例だと example1.com および www.example1.com の2つに対して証明書を取得するようにしています。

ただこのコマンドをバーチャルホストを設定したまま実行したら失敗しました。--dry-run オプションを付けて実行した時のログです。IPアドレスは伏せさせていただきました。


# certbot certonly --webroot -w /var/www/html/example1 -d example1.com -d www.example1.com --dry-run
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator webroot, Installer None
Starting new HTTPS connection (1): acme-staging-v02.api.letsencrypt.org
Simulating a certificate request for example1.com and www.example1.com
Performing the following challenges:
http-01 challenge for example1.com
http-01 challenge for www.example1.com
Using the webroot path /var/www/html/example for all unmatched domains.
Waiting for verification...
Challenge failed for domain example1.com
Challenge failed for domain www.example1.com
http-01 challenge for example1.com
http-01 challenge for www.example1.com
Cleaning up challenges
Some challenges have failed.

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

   Domain: example1.com
   Type:   unauthorized
   Detail: Invalid response from
   http://example1.com/.well-known/acme-challenge/JV-O1y2bfSzQ7sODnO8NMJx8nIRTluM-M0VUo3FJSjE
   [xxx.xxx.xxx.xxx]: "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML
   2.0//EN\">\n<html><head>\n<title>404 Not
   Found</title>\n</head><body>\n<h1>Not Found</h1>\n<p"

   Domain: www.example1.com
   Type:   unauthorized
   Detail: Invalid response from
   https://www.example1.com/.well-known/acme-challenge/4Jfu0yAM2LR7VO8fDtajGRzgtk2WxWWanNeq96cqHpg
   [xxx.xxx.xxx.xxx]: "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML
   2.0//EN\">\n<html><head>\n<title>404 Not
   Found</title>\n</head><body>\n<h1>Not Found</h1>\n<p"

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

いろいろ試した結果わかったことですがバーチャルホストにexample2があるとどうもうまくいかない。バーチャルホストの設定からexample2を外します。

バーチャルホストの設定(修正前)
= = = = = = = = = = = = = = = =
[httpd.conf]
<VirtualHost *:80>
  ServerName www.example2.com
  :
</VirtualHost>
<VirtualHost *:80>
  ServerName www.example1.com
  :
</VirtualHost>

[ssl.conf]
<VirtualHost *:443>
  ServerName www.example2.com:443
  :
</VirtualHost>
<VirtualHost *:443>
  ServerName www.example1.com:443
  :
</VirtualHost>
= = = = = = = = = = = = = = = =

バーチャルホストの設定(修正後)
= = = = = = = = = = = = = = = =
[httpd.conf]
<VirtualHost *:80>
  ServerName www.example1.com
  :
</VirtualHost>

[ssl.conf]
<VirtualHost *:443>
  ServerName www.example1.com:443
  :
</VirtualHost>
= = = = = = = = = = = = = = = =

example1を先に持ってくればうまくいくかもしれませんがそれは試してないです。example1だけの設定にして実行したログです。


# certbot certonly --webroot -w /var/www/html/example1 -d example1.com -d www.example1.com
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator webroot, Installer None
Starting new HTTPS connection (1): acme-v02.api.letsencrypt.org
Requesting a certificate for example1.com and www.example1.com
Performing the following challenges:
http-01 challenge for example1.com
http-01 challenge for www.example1.com
Using the webroot path /var/www/html/example1 for all unmatched domains.
Waiting for verification...
Cleaning up challenges

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/example1.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/example1.com/privkey.pem
   Your certificate will expire on 2021-06-13. 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

実際にサーバー証明書が出来たか確認します。/etc/letsencrypt/live 配下は以下のようになっています。

/etc/letsencrypt/live 配下のディレクトリ
・dummy.com
・example1.com
・example2.com

example1.comディレクトリの配下を見ると4つのサーバー証明書が出来ていました。
・cert.pem
・chain.pem
・fullchain.pem
・privkey.pem

少し話が戻ります。/etc/letsencrypt/live 配下にドメイン名とは異なるディレクトリを作成してサーバー証明書を配置した理由ですが、サーバー証明書を再取得するとドメイン名のディレクトリが出来るので、それと分けるために別の名前にしていました。サーバー証明書が再取得できたのでdummy.com配下の証明書は不要です。削除しておきましょう。

SSL設定もdummy.comからexample1.comになおしておきます。


SSLCertificateFile /etc/letsencrypt/live/example1.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example1.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/example1.com/chain.pem

なお、再取得が出来たらバーチャルホストの設定は戻しておいてください(httpd.conf、ssl.confにexample2を追加する)。

サーバー証明書の更新をする。

Let’s Encryptでは証明書の有効期間が90日なので期限が来る前にサーバー証明書の更新が必要です。サーバー証明書を更新するにはrootユーザーで以下のコマンドを実行します。

# certbot renew

ただこのコマンドもそのまま実行してもうまくいきませんでした。example2 もしくは example1 のどちらかが失敗してしまいます。--dry-run オプションを付けて実行した時のログです。


# certbot renew --dry-run
Saving debug log to /var/log/letsencrypt/letsencrypt.log

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/example2.com.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cert not due for renewal, but simulating renewal for dry run
Plugins selected: Authenticator webroot, Installer None
Starting new HTTPS connection (1): acme-staging-v02.api.letsencrypt.org
Simulating renewal of an existing certificate for example2.com and www.example2.com
Performing the following challenges:
http-01 challenge for example2.com
http-01 challenge for www.example2.com
Waiting for verification...
Cleaning up challenges

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
new certificate deployed without reload, fullchain is
/etc/letsencrypt/live/example2.com/fullchain.pem
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/example1.com.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cert not due for renewal, but simulating renewal for dry run
Plugins selected: Authenticator webroot, Installer None
Starting new HTTPS connection (1): acme-staging-v02.api.letsencrypt.org
Simulating renewal of an existing certificate for example1.com and www.example1.com
Performing the following challenges:
http-01 challenge for example1.com
http-01 challenge for www.example1.com
Waiting for verification...
Challenge failed for domain example1.com
http-01 challenge for example1.com
Cleaning up challenges
Failed to renew certificate example1.com with error: Some challenges have failed.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
The following simulated renewals succeeded:
  /etc/letsencrypt/live/example2.com/fullchain.pem (success)

The following simulated renewals failed:
  /etc/letsencrypt/live/example1.com/fullchain.pem (failure)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1 renew failure(s), 0 parse failure(s)

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

   Domain: example1.com
   Type:   unauthorized
   Detail: Invalid response from
   http://example1.com/.well-known/acme-challenge/jxPd1NdUyLp-HoKR-SwSD9DDkgwcf4N319xkWscY_T8
   [xxx.xxx.xxx.xxx]: "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML
   2.0//EN\">\n<html><head>\n<title>404 Not
   Found</title>\n</head><body>\n<h1>Not Found</h1>\n<p"

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

Let’s Encryptでは外部のサーバーからcertbotがドキュメントルート配下に作成した一時ファイル(.well-known/acme-challengeの配下に作成されるファイル)にアクセスしてサイトの所有者を確認しているのですが、どうもcertbotがバーチャルホストに設定した1つ目のドメインの方に常に一時ファイルを作成しているように思われる。証拠はないのだけれどApacheのアクセスログを確認すると外部のサーバーは正しいドメインにアクセスして来ているからファイルが作成される場所が間違っているとしか思えない。

エラーになる原因は不明ですが、回避するためにexample1とexample2を別々に更新する方法にしました。良い方法とは言えませんが、それを書いておきます。certbotのコマンドで指定したドメインのみを更新するオプションがあればそれを使えそうですが、わかりませんでしたので。

まず、example1とexample2を別々に実行するためにcertbotの設定ファイルを修正(リネーム)します。場所は /etc/letsencrypt/renewal 配下のファイルです。example2だけサーバー証明書を更新する場合です。

修正前
example1.com.conf
example2.com.conf
 ↓
修正後
example1.com.conf.back
example2.com.conf

次に、バーチャルホストの設定も修正します。httpd.conf、ssl.confのバーチャルホストの1つ目にexample2.comを、2つ目にexample1.comを記載します。

= = = = = = = = = = = = = = = =
[httpd.conf]
<VirtualHost *:80>
  ServerName www.example2.com
  :
</VirtualHost>
<VirtualHost *:80>
  ServerName www.example1.com
  :
</VirtualHost>

[ssl.conf]
<VirtualHost *:443>
  ServerName www.example2.com:443
  :
</VirtualHost>
<VirtualHost *:443>
  ServerName www.example1.com:443
  :
</VirtualHost>
= = = = = = = = = = = = = = = =

Apacheで設定ファイルのリロードをします。

# systemctl reload httpd

改めてサーバー証明書の更新をします。以下がその時のログです。--dry-run オプションを付けてます。


# certbot renew --dry-run
Saving debug log to /var/log/letsencrypt/letsencrypt.log

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/example2.com.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cert not due for renewal, but simulating renewal for dry run
Plugins selected: Authenticator webroot, Installer None
Starting new HTTPS connection (1): acme-staging-v02.api.letsencrypt.org
Simulating renewal of an existing certificate for example2.com and www.example2.com
Performing the following challenges:
http-01 challenge for example2.com
http-01 challenge for www.example2.com
Waiting for verification...
Cleaning up challenges

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
new certificate deployed without reload, fullchain is
/etc/letsencrypt/live/example2.com/fullchain.pem
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations, all simulated renewals succeeded: 
  /etc/letsencrypt/live/example2.com/fullchain.pem (success)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

面倒なのですが、example1のサーバー証明書を更新する場合も同様にcertborの設定ファイルをリネームしてからバーチャルホストの設定を書き換えて実行します。

/etc/letsencrypt/renewal 配下のファイル
example1.com.conf
example2.com.conf.back

バーチャルホストの設定
= = = = = = = = = = = = = = = =
[httpd.conf]
<VirtualHost *:80>
  ServerName www.example1.com
  :
</VirtualHost>
<VirtualHost *:80>
  ServerName www.example2.com
  :
</VirtualHost>

[ssl.conf]
<VirtualHost *:443>
  ServerName www.example1.com:443
  :
</VirtualHost>
<VirtualHost *:443>
  ServerName www.example2.com:443
  :
</VirtualHost>
= = = = = = = = = = = = = = = =

Apacheの設定ファイルのリロード
# systemctl reload httpd

サーバー証明書の更新
# certbot renew

example1.comのサーバー証明書を更新したときのログは省略します。

これで無事、サーバー証明書の移行が完了です。

ubuntuで動画を見たくて動画再生ソフトのVLCを入れてみた。

ubuntuで動画を見ることはなかったのですが、諸事情によりDVDの再生が必要になったのでVLCという動画再生ソフトをインストールしてみました。OSのバージョンは ubuntu 18.04 LTS です。SMPlayerという動画再生ソフトもあったのですがVLCのほうがダウンロード容量が少ないので、こっちにしました。

インストールする前にネットで調べてみるとVLCで動画を見るには

・ubuntu-restricted-extras
・libdvd-pkg
・libdvdcss2

・・等が必要と書いてあったり、なかったり、、です。とりあえずubuntuにインストールされているパッケージを確認してみました。

ubuntu-restricted-extras ではないけど、ubuntu-restricted-addons というものはすでに入っていました。また libdvdread4 というのも入っています。VLCを入れたらなんとか動画再生してくれるのでは?と期待しつつ、VLCのインストールをやってみました。

ubuntuソフトウェアから「オーディオ&ビデオ」を選びます。

VLCが出てくるので、それを選択します。右下の赤枠です。

「インストール」ボタンをクリックします。

インストールが終わると起動と削除のボタンが表示されます。「起動」ボタンを押下してみたのですが起動せず。。

ubuntuソフトウェアを閉じてデスクトップのアプリケーションを確認するとVLCは入っていました。

設定の「デフォルトのアプリ」を見てみると、もともと音楽とビデオの項目が空だったのが(特に何もしていないけれど)VLCメディアプレイヤーと設定されていました。

インストールは出来ているようなのでデスクトップにあるVLCのアイコンをクリックして起動させました。こんな感じの画面です。

ところがDVDをセットして動画の再生を試みましたが再生されず。。どうやらVLCを入れただけではダメみたい。VLCで何が入ったか見てみました。

何かが足りないようなので追加でインストールをします。ここは勘でしかないですが libdvd-pkg を追加で入れてみることにしました。

実行したコマンド
$ sudo apt install libdvd-pkg

その時のインストールログです。


$ sudo apt install libdvd-pkg
[sudo] user のパスワード: 
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています                
状態情報を読み取っています... 完了
以下のパッケージが自動でインストールされましたが、もう必要とされていません:
  adobe-flash-properties-gtk
これを削除するには 'sudo apt autoremove' を利用してください。
以下の追加パッケージがインストールされます:
  autoconf automake autopoint autotools-dev debhelper dh-autoreconf dh-strip-nondeterminism libarchive-cpio-perl
  libfile-stripnondeterminism-perl libltdl-dev libmail-sendmail-perl libsigsegv2 libsys-hostname-long-perl libtool m4 po-debconf
提案パッケージ:
  autoconf-archive gnu-standards autoconf-doc dh-make dwz libtool-doc gfortran | fortran95-compiler gcj-jdk m4-doc libmail-box-perl
以下のパッケージが新たにインストールされます:
  autoconf automake autopoint autotools-dev debhelper dh-autoreconf dh-strip-nondeterminism libarchive-cpio-perl libdvd-pkg
  libfile-stripnondeterminism-perl libltdl-dev libmail-sendmail-perl libsigsegv2 libsys-hostname-long-perl libtool m4 po-debconf
アップグレード: 0 個、新規インストール: 17 個、削除: 0 個、保留: 4 個。
3,092 kB のアーカイブを取得する必要があります。
この操作後に追加で 9,068 kB のディスク容量が消費されます。
続行しますか? [Y/n] 
取得:1 http://jp.archive.ubuntu.com/ubuntu bionic/main amd64 libsigsegv2 amd64 2.12-1 [14.7 kB]
取得:2 http://jp.archive.ubuntu.com/ubuntu bionic/main amd64 m4 amd64 1.4.18-1 [197 kB]
取得:3 http://jp.archive.ubuntu.com/ubuntu bionic/main amd64 autoconf all 2.69-11 [322 kB]
取得:4 http://jp.archive.ubuntu.com/ubuntu bionic/main amd64 autotools-dev all 20180224.1 [39.6 kB]
取得:5 http://jp.archive.ubuntu.com/ubuntu bionic/main amd64 automake all 1:1.15.1-3ubuntu2 [509 kB]
取得:6 http://jp.archive.ubuntu.com/ubuntu bionic-updates/main amd64 autopoint all 0.19.8.1-6ubuntu0.3 [426 kB]
取得:7 http://jp.archive.ubuntu.com/ubuntu bionic/main amd64 libtool all 2.4.6-2 [194 kB]
取得:8 http://jp.archive.ubuntu.com/ubuntu bionic/main amd64 dh-autoreconf all 17 [15.8 kB]
取得:9 http://jp.archive.ubuntu.com/ubuntu bionic/main amd64 libfile-stripnondeterminism-perl all 0.040-1.1~build1 [13.8 kB]
取得:10 http://jp.archive.ubuntu.com/ubuntu bionic/main amd64 dh-strip-nondeterminism all 0.040-1.1~build1 [5,208 B]
取得:11 http://jp.archive.ubuntu.com/ubuntu bionic/main amd64 po-debconf all 1.0.20 [232 kB]
取得:12 http://jp.archive.ubuntu.com/ubuntu bionic-updates/main amd64 debhelper all 11.1.6ubuntu2 [902 kB]
取得:13 http://jp.archive.ubuntu.com/ubuntu bionic/main amd64 libarchive-cpio-perl all 0.10-1 [9,644 B]                                      
取得:14 http://jp.archive.ubuntu.com/ubuntu bionic/multiverse amd64 libdvd-pkg all 1.4.2-1-1 [14.9 kB]                                       
取得:15 http://jp.archive.ubuntu.com/ubuntu bionic/main amd64 libltdl-dev amd64 2.4.6-2 [162 kB]                                             
取得:16 http://jp.archive.ubuntu.com/ubuntu bionic/main amd64 libsys-hostname-long-perl all 1.5-1 [11.7 kB]                                  
取得:17 http://jp.archive.ubuntu.com/ubuntu bionic/main amd64 libmail-sendmail-perl all 0.80-1 [22.6 kB]                                     
3,092 kB を 6秒 で取得しました (500 kB/s)                                                                                                    
パッケージを事前設定しています ...
以前に未選択のパッケージ libsigsegv2:amd64 を選択しています。
(データベースを読み込んでいます ... 現在 170684 個のファイルとディレクトリがインストールされています。)
.../00-libsigsegv2_2.12-1_amd64.deb を展開する準備をしています ...
libsigsegv2:amd64 (2.12-1) を展開しています...
以前に未選択のパッケージ m4 を選択しています。
.../01-m4_1.4.18-1_amd64.deb を展開する準備をしています ...
m4 (1.4.18-1) を展開しています...
以前に未選択のパッケージ autoconf を選択しています。
.../02-autoconf_2.69-11_all.deb を展開する準備をしています ...
autoconf (2.69-11) を展開しています...
以前に未選択のパッケージ autotools-dev を選択しています。
.../03-autotools-dev_20180224.1_all.deb を展開する準備をしています ...
autotools-dev (20180224.1) を展開しています...
以前に未選択のパッケージ automake を選択しています。
.../04-automake_1%3a1.15.1-3ubuntu2_all.deb を展開する準備をしています ...
automake (1:1.15.1-3ubuntu2) を展開しています...
以前に未選択のパッケージ autopoint を選択しています。
.../05-autopoint_0.19.8.1-6ubuntu0.3_all.deb を展開する準備をしています ...
autopoint (0.19.8.1-6ubuntu0.3) を展開しています...
以前に未選択のパッケージ libtool を選択しています。
.../06-libtool_2.4.6-2_all.deb を展開する準備をしています ...
libtool (2.4.6-2) を展開しています...
以前に未選択のパッケージ dh-autoreconf を選択しています。
.../07-dh-autoreconf_17_all.deb を展開する準備をしています ...
dh-autoreconf (17) を展開しています...
以前に未選択のパッケージ libfile-stripnondeterminism-perl を選択しています。
.../08-libfile-stripnondeterminism-perl_0.040-1.1~build1_all.deb を展開する準備をしています ...
libfile-stripnondeterminism-perl (0.040-1.1~build1) を展開しています...
以前に未選択のパッケージ dh-strip-nondeterminism を選択しています。
.../09-dh-strip-nondeterminism_0.040-1.1~build1_all.deb を展開する準備をしています ...
dh-strip-nondeterminism (0.040-1.1~build1) を展開しています...
以前に未選択のパッケージ po-debconf を選択しています。
.../10-po-debconf_1.0.20_all.deb を展開する準備をしています ...
po-debconf (1.0.20) を展開しています...
以前に未選択のパッケージ debhelper を選択しています。
.../11-debhelper_11.1.6ubuntu2_all.deb を展開する準備をしています ...
debhelper (11.1.6ubuntu2) を展開しています...
以前に未選択のパッケージ libarchive-cpio-perl を選択しています。
.../12-libarchive-cpio-perl_0.10-1_all.deb を展開する準備をしています ...
libarchive-cpio-perl (0.10-1) を展開しています...
以前に未選択のパッケージ libdvd-pkg を選択しています。
.../13-libdvd-pkg_1.4.2-1-1_all.deb を展開する準備をしています ...
libdvd-pkg (1.4.2-1-1) を展開しています...
以前に未選択のパッケージ libltdl-dev:amd64 を選択しています。
.../14-libltdl-dev_2.4.6-2_amd64.deb を展開する準備をしています ...
libltdl-dev:amd64 (2.4.6-2) を展開しています...
以前に未選択のパッケージ libsys-hostname-long-perl を選択しています。
.../15-libsys-hostname-long-perl_1.5-1_all.deb を展開する準備をしています ...
libsys-hostname-long-perl (1.5-1) を展開しています...
以前に未選択のパッケージ libmail-sendmail-perl を選択しています。
.../16-libmail-sendmail-perl_0.80-1_all.deb を展開する準備をしています ...
libmail-sendmail-perl (0.80-1) を展開しています...
libltdl-dev:amd64 (2.4.6-2) を設定しています ...
po-debconf (1.0.20) を設定しています ...
libsigsegv2:amd64 (2.12-1) を設定しています ...
libarchive-cpio-perl (0.10-1) を設定しています ...
m4 (1.4.18-1) を設定しています ...
libsys-hostname-long-perl (1.5-1) を設定しています ...
libmail-sendmail-perl (0.80-1) を設定しています ...
autotools-dev (20180224.1) を設定しています ...
autopoint (0.19.8.1-6ubuntu0.3) を設定しています ...
libfile-stripnondeterminism-perl (0.040-1.1~build1) を設定しています ...
libtool (2.4.6-2) を設定しています ...
autoconf (2.69-11) を設定しています ...
automake (1:1.15.1-3ubuntu2) を設定しています ...
update-alternatives: /usr/bin/automake (automake) を提供するために自動モードで /usr/bin/automake-1.15 を使います
dh-autoreconf (17) を設定しています ...
debhelper (11.1.6ubuntu2) を設定しています ...
dh-strip-nondeterminism (0.040-1.1~build1) を設定しています ...
libdvd-pkg (1.4.2-1-1) を設定しています ...
libdvd-pkg: dpkg database is locked. You may need to use command "sudo dpkg-reconfigure libdvd-pkg".
libdvd-pkg: Building and installation of package(s) [libdvdcss2 libdvdcss-dev] postponed till after next APT operation.
install-info (6.5.0.dfsg.1-2) のトリガを処理しています ...
libc-bin (2.27-3ubuntu1.4) のトリガを処理しています ...
man-db (2.8.3-2ubuntu0.1) のトリガを処理しています ...

途中で以下のような画面が表示されたのでリターンキーを2回押下しています。

最初に表示された画面。いきなり出てきた。

次に表示された画面。

表示された画面の中で「dpkg-reconfigure libdvd-pkg」を催促しているように思われるので、これもやってみました。

実行したコマンド
$ sudo dpkg-reconfigure libdvd-pkg

その時のログです。


$ sudo dpkg-reconfigure libdvd-pkg
libdvd-pkg: Downloading orig source...
I: libdvdcss_1.4.2
/usr/bin/wget --tries=3 --timeout=40 --read-timeout=40 --continue -O libdvdcss_1.4.2.orig.tar.bz2 \
          http://download.videolan.org/pub/libdvdcss/1.4.2/libdvdcss-1.4.2.tar.bz2 \
        || /usr/bin/uscan --noconf --verbose --rename --destdir=/usr/src/libdvd-pkg --check-dirname-level=0 --force-download --download-current-version /usr/share/libdvd-pkg/debian
--2021-04-03 21:15:57--  http://download.videolan.org/pub/libdvdcss/1.4.2/libdvdcss-1.4.2.tar.bz2
download.videolan.org (download.videolan.org) をDNSに問いあわせています... 213.36.253.2
download.videolan.org (download.videolan.org)|213.36.253.2|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 366824 (358K) [application/octet-stream]
`libdvdcss_1.4.2.orig.tar.bz2' に保存中

libdvdcss_1.4.2.orig.tar.bz2        100%[=================================================================>] 358.23K   130KB/s    時間 2.8s  

2021-04-03 21:16:01 (130 KB/s) - `libdvdcss_1.4.2.orig.tar.bz2' へ保存完了 [366824/366824]

libdvd-pkg: Checking orig.tar integrity...
/usr/src/libdvd-pkg/libdvdcss_1.4.2.orig.tar.bz2: OK
libdvd-pkg: Unpacking and configuring...
libdvd-pkg: Building the package... (it may take a while)
libdvd-pkg: Build log will be saved to /usr/src/libdvd-pkg/libdvdcss2_1.4.2-1~local_amd64.build
Current: = cap_chown,cap_dac_override,cap_dac_read_search,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_linux_immutable,cap_net_bind_service,cap_net_broadcast,cap_net_admin,cap_net_raw,cap_ipc_lock,cap_ipc_owner,cap_sys_module,cap_sys_rawio,cap_sys_chroot,cap_sys_ptrace,cap_sys_pacct,cap_sys_admin,cap_sys_boot,cap_sys_nice,cap_sys_resource,cap_sys_time,cap_sys_tty_config,cap_mknod,cap_lease,cap_audit_write,cap_audit_control,cap_setfcap,cap_mac_override,cap_mac_admin,cap_syslog,cap_wake_alarm,cap_block_suspend,cap_audit_read+ep
Bounding set =cap_chown,cap_dac_override,cap_fowner,cap_wake_alarm,cap_block_suspend,cap_audit_read
Securebits: 024/0x14/5'b10100
 secure-noroot: no (unlocked)
 secure-no-suid-fixup: yes (unlocked)
 secure-keep-caps: yes (unlocked)
uid=0(root)
gid=0(root)
groups=0(root)
libdvd-pkg: Installing...
以前に未選択のパッケージ libdvdcss-dev:amd64 を選択しています。
(データベースを読み込んでいます ... 現在 171677 個のファイルとディレクトリがインストールされています。)
.../libdvdcss-dev_1.4.2-1~local_amd64.deb を展開する準備をしています ...
libdvdcss-dev:amd64 (1.4.2-1~local) を展開しています...
以前に未選択のパッケージ libdvdcss2:amd64 を選択しています。
.../libdvdcss2_1.4.2-1~local_amd64.deb を展開する準備をしています ...
libdvdcss2:amd64 (1.4.2-1~local) を展開しています...
libdvdcss2:amd64 (1.4.2-1~local) を設定しています ...
libdvdcss-dev:amd64 (1.4.2-1~local) を設定しています ...
libc-bin (2.27-3ubuntu1.4) のトリガを処理しています ...

このdpkg-reconfigureの途中でも以下の画面が表示されたので、リターンキーを押しています。download.videolan.org に接続してダウンロードをするみたいです。

dvdに関するパッケージが何か入ったようなので確認してみました。

libdvd-pkg、libdvdcss-dev、libdvdcss2が追加されたようです。

この状態でDVDを再生したみたところ、、、無事、再生できました!

ubuntu-restricted-extras は入れていませんが今のところ、大丈夫みたいです。また手元に動画ファイルがいくつかあったのでその再生をしてみたところ、wmvファイル、mp4ファイル、mpgファイル、m2tsファイルの再生はできました。他の動画ファイルも再生出来るのかもしれませんが、手元にないので未確認です。