fluent / fluent-package-builder

td-agent (Fluentd) Building and Packaging System
Apache License 2.0
22 stars 26 forks source link

migrate configuration files #489

Closed kenhys closed 1 year ago

kenhys commented 1 year ago

In the previous versions, there are some configuration files and log files are still kept under old path for compatibility. It is better migrating to /opt/fluent completely, but we need to consider upgrading from v4, too.

During upgrading from v4, seamless migration can be done by using environment variable to specify the actual path because there is no need to embed specific path to .service itself. It aims not to be confused which configuration file should be applied.

Before:

After:

kenhys commented 1 year ago

Clean install:

==============================================================================================================================================================
 Package                            アーキテクチャー           バージョン                        リポジトリー                                            容量
==============================================================================================================================================================
インストール中:
 fluent-package                     x86_64                     5.0.0-1.el7                       /fluent-package-5.0.0-1.el7.x86_64                      64 M

トランザクションの要約
==============================================================================================================================================================
インストール  1 パッケージ

合計容量: 64 M
インストール容量: 64 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  インストール中          : fluent-package-5.0.0-1.el7.x86_64                                                                                             1/1 
unknown
prelink detected. checking /etc/prelink.conf.d/ ...
  検証中                  : fluent-package-5.0.0-1.el7.x86_64                                                                                             1/1 

インストール:
  fluent-package.x86_64 0:5.0.0-1.el7                                                                                                                         

完了しました!
+ systemctl is-active td-agent
unknown
+ systemctl is-active fluentd
unknown
+ systemctl is-enabled td-agent
Failed to get unit file state for td-agent.service: No such file or directory
+ systemctl is-enabled fluentd
disabled
+ echo 'CHECK: fluentd/fluentd'
CHECK: fluentd/fluentd
+ id -u fluentd
997
+ id -g fluentd
994
+ ls -la /etc/td-agent
ls: /etc/td-agent にアクセスできません: そのようなファイルやディレクトリはありません
+ ls -la /etc/fluent
合計 16
drwxr-xr-x.  3 fluentd fluentd   40  5月 31 02:59 .
drwxr-xr-x. 80 root    root    8192  5月 31 02:59 ..
-rw-r--r--.  1 root    root    2371  5月 30 09:10 fluentd.conf
drwxr-xr-x.  2 fluentd fluentd    6  5月 30 09:13 plugin
+ ls -la /var/log/td-agent
ls: /var/log/td-agent にアクセスできません: そのようなファイルやディレクトリはありません
+ ls -la /var/log/fluent
合計 4
drwxr-xr-x.  3 fluentd fluentd   20  5月 31 02:59 .
drwxr-xr-x. 10 root    root    4096  5月 31 02:59 ..
drwxr-xr-x.  2 fluentd fluentd    6  5月 30 09:13 buffer

Upgrade from td-agent (not running service):

==============================================================================================================================================================
インストール中:
 fluent-package                     x86_64                     5.0.0-1.el7                       /fluent-package-5.0.0-1.el7.x86_64                      64 M
     td-agent.x86_64 4.5.0-1.el7 を入れ替えます

トランザクションの要約
==============================================================================================================================================================
インストール  1 パッケージ

合計容量: 64 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Migrate group td-agent to fluentd...
inactive
Migrate user td-agent to fluentd...
  インストール中          : fluent-package-5.0.0-1.el7.x86_64                                                                                             1/2 
Migrating from /etc/td-agent/td-agent.conf to /etc/fluent/td-agent.conf
Refer previous configuration td-agent.conf ...
inactive
prelink detected. checking /etc/prelink.conf.d/ ...
Removing prelink configuration for td-agent (/etc/prelink.conf.d/td-agent-ruby.conf) ...
Removed symlink /etc/systemd/system/multi-user.target.wants/td-agent.service.
  削除中                  : td-agent-4.5.0-1.el7.x86_64                                                                                                   2/2 
  検証中                  : fluent-package-5.0.0-1.el7.x86_64                                                                                             1/2 
  検証中                  : td-agent-4.5.0-1.el7.x86_64                                                                                                   2/2 

インストール:
  fluent-package.x86_64 0:5.0.0-1.el7                                                                                                                         

置換:
  td-agent.x86_64 0:4.5.0-1.el7                                                                                                                               

完了しました!
+ systemctl is-enabled td-agent
Failed to get unit file state for td-agent.service: No such file or directory
+ systemctl is-enabled fluentd
disabled
+ systemctl is-active td-agent
unknown
+ systemctl is-active fluentd
unknown
+ echo 'CHECK: fluentd/fluentd'
CHECK: fluentd/fluentd
+ id -u fluentd
997
+ id -g fluentd
994
+ ls -la /etc/td-agent
lrwxrwxrwx. 1 root root 11  5月 31 02:57 /etc/td-agent -> /etc/fluent
+ ls -la /etc/fluent
合計 20
drwxr-xr-x.  3 fluentd fluentd   61  5月 31 02:57 .
drwxr-xr-x. 80 root    root    8192  5月 31 02:57 ..
-rw-r--r--.  1 root    root    2371  5月 30 09:10 fluentd.conf
drwxr-xr-x.  2 fluentd fluentd    6  5月 30 09:13 plugin
-rw-r--r--.  1 root    root    2382  5月 31 02:57 td-agent.conf
+ ls -la /var/log/td-agent
lrwxrwxrwx. 1 root root 15  5月 31 02:57 /var/log/td-agent -> /var/log/fluent
+ ls -la /var/log/fluent
合計 4
drwxr-xr-x.  3 fluentd fluentd   20  5月 31 02:57 .
drwxr-xr-x. 10 root    root    4096  5月 31 02:57 ..
drwxr-xr-x.  2 fluentd fluentd    6  5月 30 09:13 buffer

Upgrade from v4 (running td-agent):

Transaction test succeeded
Running transaction
Migrate group td-agent to fluentd...
active
  インストール中          : fluent-package-5.0.0-1.el7.x86_64                                                                                             1/2 
警告: ユーザー fluentd は存在しません - root を使用します
警告: ユーザー fluentd は存在しません - root を使用します
警告: ユーザー fluentd は存在しません - root を使用します
警告: ユーザー fluentd は存在しません - root を使用します
警告: ユーザー fluentd は存在しません - root を使用します
Migrating from /etc/td-agent/td-agent.conf to /etc/fluent/td-agent.conf
Refer previous configuration td-agent.conf ...
Keep logging to td-agent.log ...
active
prelink detected. checking /etc/prelink.conf.d/ ...
Removing prelink configuration for td-agent (/etc/prelink.conf.d/td-agent-ruby.conf) ...
Removed symlink /etc/systemd/system/multi-user.target.wants/td-agent.service.
  削除中                  : td-agent-4.5.0-1.el7.x86_64                                                                                                   2/2 
  検証中                  : fluent-package-5.0.0-1.el7.x86_64                                                                                             1/2 
  検証中                  : td-agent-4.5.0-1.el7.x86_64                                                                                                   2/2 

インストール:
  fluent-package.x86_64 0:5.0.0-1.el7                                                                                                                         

置換:
  td-agent.x86_64 0:4.5.0-1.el7                                                                                                                               

完了しました!
+ systemctl is-enabled td-agent
Failed to get unit file state for td-agent.service: No such file or directory
+ systemctl is-enabled fluentd
disabled
+ systemctl is-active td-agent
unknown
+ systemctl is-active fluentd
active
+ echo 'CHECK: fluentd/fluentd'
CHECK: fluentd/fluentd
+ id -u fluentd
997
+ id -g fluentd
994
+ ls -la /etc/td-agent
lrwxrwxrwx. 1 root root 11  5月 31 03:06 /etc/td-agent -> /etc/fluent
+ ls -la /etc/fluent
合計 20
drwxr-xr-x.  3 root fluentd   61  5月 31 03:06 .
drwxr-xr-x. 80 root root    8192  5月 31 03:06 ..
-rw-r--r--.  1 root root    2371  5月 30 09:10 fluentd.conf
drwxr-xr-x.  2 root fluentd    6  5月 30 09:13 plugin
-rw-r--r--.  1 root root    2382  5月 31 03:06 td-agent.conf
+ ls -la /var/log/td-agent
合計 8
drwxr-xr-x.  2 fluentd fluentd   40  5月 31 03:06 .
drwxr-xr-x. 11 root    root    4096  5月 31 03:06 ..
lrwxrwxrwx.  1 root    root      15  5月 31 03:06 fluent -> /var/log/fluent
-rw-r--r--.  1 fluentd fluentd 2917  5月 31 03:06 td-agent.log
+ ls -la /var/log/fluent
合計 12
drwxr-xr-x.  3 root    fluentd   40  5月 31 03:06 .
drwxr-xr-x. 11 root    root    4096  5月 31 03:06 ..
drwxr-xr-x.  3 root    fluentd   16  5月 31 03:06 buffer
-rw-r--r--.  1 fluentd fluentd 4955  5月 31 03:06 td-agent.log
+ cat /etc/sysconfig/fluentd
TD_AGENT_OPTIONS=""
# The following environment variable will be modified via package maintainer's migration script
FLUENT_CONF=/etc/fluent/td-agent.conf
FLUENT_PLUGIN=/etc/fluent/plugin
TD_AGENT_LOG_FILE=/var/log/td-agent/td-agent.log
kenhys commented 1 year ago

Upgrade from v4 with running td-agent:

Migrate group td-agent to fluentd...
active
  インストール中          : fluent-package-5.0.0-1.el7.x86_64                                                                                             1/2 
警告: ユーザー fluentd は存在しません - root を使用します
警告: ユーザー fluentd は存在しません - root を使用します
警告: ユーザー fluentd は存在しません - root を使用します
警告: ユーザー fluentd は存在しません - root を使用します
警告: ユーザー fluentd は存在しません - root を使用します
Migrating from /etc/td-agent/td-agent.conf to /etc/fluent/td-agent.conf
Refer previous configuration td-agent.conf ...
active
Keep logging to td-agent.log ...
prelink detected. checking /etc/prelink.conf.d/ ...
Removing prelink configuration for td-agent (/etc/prelink.conf.d/td-agent-ruby.conf) ...
Removed symlink /etc/systemd/system/multi-user.target.wants/td-agent.service.
  削除中                  : td-agent-4.5.0-1.el7.x86_64                                                                                                   2/2 
Provides /usr/sbin/td-agent symlink for backward compatibility
Provides /usr/sbin/td-agent-gem symlink for backward compatibility
Provides /etc/td-agent symlink for backward compatibility
Provides /var/log/td-agent symlink for backward compatibility
  検証中                  : fluent-package-5.0.0-1.el7.x86_64                                                                                             1/2 
  検証中                  : td-agent-4.5.0-1.el7.x86_64                                                                                                   2/2 

インストール:
  fluent-package.x86_64 0:5.0.0-1.el7                                                                                                                         

置換:
  td-agent.x86_64 0:4.5.0-1.el7                                                                                                                               

完了しました!
+ systemctl is-enabled td-agent
Failed to get unit file state for td-agent.service: No such file or directory
+ systemctl is-enabled fluentd
disabled
+ systemctl is-active td-agent
unknown
+ systemctl is-active fluentd
active
+ echo 'CHECK: fluentd/fluentd'
CHECK: fluentd/fluentd
+ id -u fluentd
997
+ id -g fluentd
994
+ ls -la /etc/td-agent
lrwxrwxrwx. 1 root root 11  5月 31 07:23 /etc/td-agent -> /etc/fluent
+ ls -la /etc/fluent
合計 20
drwxr-xr-x.  3 root fluentd   61  5月 31 07:23 .
drwxr-xr-x. 80 root root    8192  5月 31 07:23 ..
-rw-r--r--.  1 root root    2371  5月 31 07:16 fluentd.conf
drwxr-xr-x.  2 root fluentd    6  5月 31 07:21 plugin
-rw-r--r--.  1 root root    2382  5月 31 07:23 td-agent.conf
+ ls -la /var/log/td-agent
lrwxrwxrwx. 1 root root 15  5月 31 07:23 /var/log/td-agent -> /var/log/fluent
+ ls -la /var/log/fluent
合計 12
drwxr-xr-x.  3 root    fluentd   40  5月 31 07:23 .
drwxr-xr-x. 10 root    root    4096  5月 31 07:23 ..
drwxr-xr-x.  3 root    fluentd   16  5月 31 07:23 buffer
-rw-r--r--.  1 fluentd fluentd 7872  5月 31 07:23 td-agent.log
+ cat /etc/sysconfig/fluentd
TD_AGENT_OPTIONS=""
# The following environment variable will be modified via package maintainer's migration script
FLUENT_CONF=/etc/fluent/td-agent.conf
FLUENT_PLUGIN=/etc/fluent/plugin
TD_AGENT_LOG_FILE=/var/log/td-agent/td-agent.log
kenhys commented 1 year ago

rerun failed jobs.

kenhys commented 1 year ago

conf and log migration will work on bullseye.

#
+ echo '# After install check...'
# After install check...
+ echo '#'
#
+ systemctl is-enabled td-agent
masked
+ systemctl is-enabled fluentd
enabled
+ systemctl is-active td-agent
inactive
+ systemctl is-active fluentd
activating
+ echo 'CHECK: _fluentd/_fluentd'
CHECK: _fluentd/_fluentd
+ id -u _fluentd
108
+ id -g _fluentd
117
+ dpkg-statoverride --list
+ grep -E 'td-agent|_fluentd'
_fluentd _fluentd 755 /var/log/td-agent
_fluentd _fluentd 755 /var/run/fluent
_fluentd _fluentd 755 /etc/td-agent
+ ls -la /etc/td-agent
lrwxrwxrwx 1 root root 11 Jun  7 08:56 /etc/td-agent -> /etc/fluent
+ ls -la /var/log/td-agent
lrwxrwxrwx 1 root root 15 Jun  7 08:56 /var/log/td-agent -> /var/log/fluent
kenhys commented 1 year ago

conf and log migration for centos will also work.

+ systemctl is-enabled td-agent
Failed to get unit file state for td-agent.service: No such file or directory
+ systemctl is-enabled fluentd
disabled
+ systemctl is-active td-agent
unknown
+ systemctl is-active fluentd
active
+ echo 'CHECK: fluentd/fluentd'
CHECK: fluentd/fluentd
+ id -u fluentd
997
+ id -g fluentd
994
+ ls -la /etc/td-agent
lrwxrwxrwx. 1 root root 11  6月  7 08:57 /etc/td-agent -> /etc/fluent
+ ls -la /etc/fluent
合計 20
drwxr-xr-x.  3 root fluentd   61  6月  7 08:57 .
drwxr-xr-x. 80 root root    8192  6月  7 08:57 ..
-rw-r--r--.  1 root root    2371  6月  7 07:16 fluentd.conf
drwxr-xr-x.  2 root fluentd    6  6月  7 07:20 plugin
-rw-r--r--.  1 root root    2382  6月  7 08:57 td-agent.conf
+ ls -la /var/log/td-agent
lrwxrwxrwx. 1 root root 15  6月  7 08:57 /var/log/td-agent -> /var/log/fluent
+ ls -la /var/log/fluent
合計 12
drwxr-xr-x.  3 root    fluentd   40  6月  7 08:57 .
drwxr-xr-x. 10 root    root    4096  6月  7 08:57 ..
drwxr-xr-x.  3 root    fluentd   16  6月  7 08:57 buffer
-rw-r--r--.  1 fluentd fluentd 7872  6月  7 08:57 td-agent.log
+ cat /etc/sysconfig/fluentd
TD_AGENT_OPTIONS=""
# The following environment variable will be modified via package maintainer's migration script
FLUENT_CONF=/etc/fluent/td-agent.conf
FLUENT_PLUGIN=/etc/fluent/plugin
TD_AGENT_LOG_FILE=/var/log/td-agent/td-agent.log
kenhys commented 1 year ago

macOS: failure...

 installer: Installing at base path /
installer: The install was successful.
+ sudo launchctl load /Library/LaunchDaemons/fluentd.plist
+ hdiutil detach /Volumes/fluent-package
daipom commented 1 year ago

macOS: failure...

 installer: Installing at base path /
installer: The install was successful.
+ sudo launchctl load /Library/LaunchDaemons/fluentd.plist
+ hdiutil detach /Volumes/fluent-package

I think this file needs to be fixed too.

https://github.com/fluent/fluent-package-builder/blob/master/fluent-package/templates/usr/sbin/fluentd.erb

kenhys commented 1 year ago

I think this file needs to be fixed too.

thanks!

daipom commented 1 year ago

It is because macOS uses sbin/fluentd.

https://github.com/fluent/fluent-package-builder/blob/3b37b65a56a5c319db6fcc8c1bbdf99d98e53574/fluent-package/Rakefile#L510-L528

https://github.com/fluent/fluent-package-builder/blob/3b37b65a56a5c319db6fcc8c1bbdf99d98e53574/fluent-package/templates/fluentd.plist.erb#L9-L15

kenhys commented 1 year ago

NOTE: about msi: migration process is out of scope, fix in another PR.

kenhys commented 1 year ago

TODO: migration process should be fixed in another follow-up PR for msi and dmg.

kenhys commented 1 year ago

commit message is already amended.

kenhys commented 1 year ago

Now rebased with master (because of #475 was merged)

kenhys commented 1 year ago

waiting CI again.

kenhys commented 1 year ago

checking owner via https://github.com/fluent/fluent-package-builder/pull/489/commits/01462e9d8b7b8eae67d341d930f63ac97a9144de

kenhys commented 1 year ago

As PR #496 was merged, rebased with it.

kenhys commented 1 year ago

TODO: fix inconsistent cosmetic style

daipom commented 1 year ago

I'm confirming the migration behavior on Ubuntu Focal.

Basically, Fluentd works well, but some migration processes seem to be failing.

Especially, the migration of /var/log/td-agent/td-agent.log doesn't work correctly. The old log file is completely disappeared.

$ curl -fsSL https://toolbelt.treasuredata.com/sh/install-ubuntu-focal-td-agent4.sh | sh
...
$ sudo apt install -y /vagrant/ubuntu/pool/focal/universe/*/*/*_amd64.deb
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'fluent-package' instead of '/vagrant/ubuntu/pool/focal/universe/f/fluent-package/fluent-package_5.0.0-1_amd64.deb'
The following packages will be REMOVED:
  td-agent
The following NEW packages will be installed:
  fluent-package
0 upgraded, 1 newly installed, 1 to remove and 171 not upgraded.
Need to get 0 B/12.5 MB of archives.
After this operation, 7,569 kB of additional disk space will be used.
Get:1 /vagrant/ubuntu/pool/focal/universe/f/fluent-package/fluent-package_5.0.0-1_amd64.deb fluent-package amd64 5.0.0-1 [12.5 MB]
(Reading database ... 49729 files and directories currently installed.)
Removing td-agent (4.5.0-1) ...
Selecting previously unselected package fluent-package.
(Reading database ... 41047 files and directories currently installed.)
Preparing to unpack .../fluent-package_5.0.0-1_amd64.deb ...
Unpacking fluent-package (5.0.0-1) ...
Setting up fluent-package (5.0.0-1) ...
Installing new version of config file /etc/logrotate.d/td-agent ...
Migrating from /etc/td-agent/td-agent.conf to /etc/fluent/td-agent.conf
Refer previous configuration td-agent.conf ...
mv: cannot stat 'td-agent.log': No such file or directory
Failed to preset unit: File /etc/systemd/system/td-agent.service already exists and is a symlink to /dev/null.
/usr/bin/deb-systemd-helper: error: systemctl preset failed on fluentd.service: No such file or directory
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.9) ...
daipom commented 1 year ago

I'm checking the behavior of this deb package with #497 test.

When updating from v4, we can use td-agent service alias with the following commands, right?

$ sudo systemctl unmask td-agent
$ sudo systemctl enable fluentd

This often works as expected, but sometimes, the service status becomes inactive.

In this case, the service is inactive, but the processes is still running. If restating the service, it will be active, but Found left-over process warning occurs.

$ sudo systemctl unmask td-agent
$ sudo systemctl enable fluentd
$ systemctl status fluentd
● fluentd.service - fluentd: Fluentd based data collector for Treasure Data
     Loaded: loaded (/lib/systemd/system/fluentd.service; enabled; vendor preset: enabled)
     Active: inactive (dead) since Mon 2023-06-12 10:16:57 UTC; 3min 49s ago
       Docs: https://docs.treasuredata.com/display/public/PD/About+Treasure+Data%27s+Server-Side+Agent
   Main PID: 18555
      Tasks: 9 (limit: 2274)
     Memory: 98.8M
     CGroup: /system.slice/fluentd.service
             ├─18932 /opt/fluent/bin/ruby /opt/fluent/bin/fluentd --log /var/log/fluent/fluentd.log --daemon /var/run/fluent/td-agent.pid
             └─18935 /opt/fluent/bin/ruby -Eascii-8bit:ascii-8bit /opt/fluent/bin/fluentd --log /var/log/fluent/fluentd.log --daemon /va>

Jun 12 10:17:00 vagrant systemd[1]: Starting fluentd: Fluentd based data collector for Treasure Data...
Jun 12 10:17:00 vagrant systemd[1]: Started fluentd: Fluentd based data collector for Treasure Data.
$ ps aux | grep fluent
_fluentd   18932  0.0  2.5 166564 51824 ?        Sl   10:16   0:00 /opt/fluent/bin/ruby /opt/fluent/bin/fluentd --log /var/log/fluent/fluentd.log --daemon /var/run/fluent/td-agent.pid
_fluentd   18935  0.1  3.0 170804 62348 ?        Sl   10:16   0:00 /opt/fluent/bin/ruby -Eascii-8bit:ascii-8bit /opt/fluent/bin/fluentd --log /var/log/fluent/fluentd.log --daemon /var/run/fluent/td-agent.pid --under-supervisor
$ sudo systemctl restart fluentd
$ systemctl status fluentd
● fluentd.service - fluentd: Fluentd based data collector for Treasure Data
     Loaded: loaded (/lib/systemd/system/fluentd.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2023-06-12 10:24:06 UTC; 3s ago
       Docs: https://docs.treasuredata.com/display/public/PD/About+Treasure+Data%27s+Server-Side+Agent
    Process: 19257 ExecStart=/opt/fluent/bin/fluentd --log $TD_AGENT_LOG_FILE --daemon /var/run/fluent/td-agent.pid $TD_AGENT_OPTIONS (c>
   Main PID: 19263 (fluentd)
      Tasks: 13 (limit: 2274)
     Memory: 146.2M
     CGroup: /system.slice/fluentd.service
             ├─18932 /opt/fluent/bin/ruby /opt/fluent/bin/fluentd --log /var/log/fluent/fluentd.log --daemon /var/run/fluent/td-agent.pid
             ├─18935 /opt/fluent/bin/ruby -Eascii-8bit:ascii-8bit /opt/fluent/bin/fluentd --log /var/log/fluent/fluentd.log --daemon /va>
             └─19263 /opt/fluent/bin/ruby /opt/fluent/bin/fluentd --log /var/log/fluent/fluentd.log --daemon /var/run/fluent/td-agent.pid

Jun 12 10:24:06 vagrant systemd[1]: fluentd.service: Found left-over process 18932 (fluentd) in control group while starting unit. Ignor>
Jun 12 10:24:06 vagrant systemd[1]: This usually indicates unclean termination of a previous run, or service implementation deficiencies.
Jun 12 10:24:06 vagrant systemd[1]: fluentd.service: Found left-over process 18935 (ruby) in control group while starting unit. Ignoring.
Jun 12 10:24:06 vagrant systemd[1]: This usually indicates unclean termination of a previous run, or service implementation deficiencies.
Jun 12 10:24:06 vagrant systemd[1]: Starting fluentd: Fluentd based data collector for Treasure Data...
Jun 12 10:24:06 vagrant systemd[1]: Started fluentd: Fluentd based data collector for Treasure Data.
daipom commented 1 year ago

Other points of concern about the deb package are as follows.

When updating from v4, there are some error logs.

Failed to preset unit: File /etc/systemd/system/td-agent.service already exists and is a symlink to /dev/null.
/usr/bin/deb-systemd-helper: error: systemctl preset failed on fluentd.service: No such file or directory

I think this error is unavoidable and makes us need to unmask to use the td-agent service alias, right?

All message:

$ sudo apt install /vagrant/ubuntu/pool/focal/universe/f/fluent-package/fluent-package_5.0.0-1_amd64.deb
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'fluent-package' instead of '/vagrant/ubuntu/pool/focal/universe/f/fluent-package/fluent-package_5.0.0-1_amd64.deb'
The following packages will be REMOVED:
  td-agent
The following NEW packages will be installed:
  fluent-package
0 upgraded, 1 newly installed, 1 to remove and 170 not upgraded.
Need to get 0 B/12.5 MB of archives.
After this operation, 7,570 kB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 /vagrant/ubuntu/pool/focal/universe/f/fluent-package/fluent-package_5.0.0-1_amd64.deb fluent-package amd64 5.0.0-1 [12.5 MB]
(Reading database ... 49738 files and directories currently installed.)
Removing td-agent (4.5.0-1) ...
Selecting previously unselected package fluent-package.
(Reading database ... 41056 files and directories currently installed.)
Preparing to unpack .../fluent-package_5.0.0-1_amd64.deb ...
Unpacking fluent-package (5.0.0-1) ...
Setting up fluent-package (5.0.0-1) ...
Installing new version of config file /etc/logrotate.d/td-agent ...
Migrating from /etc/td-agent/td-agent.conf to /etc/fluent/td-agent.conf
Refer previous configuration td-agent.conf ...
Failed to preset unit: File /etc/systemd/system/td-agent.service already exists and is a symlink to /dev/null.
/usr/bin/deb-systemd-helper: error: systemctl preset failed on fluentd.service: No such file or directory
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.9) ...
kenhys commented 1 year ago

As #497 was merged rebased with master.

kenhys commented 1 year ago

https://github.com/fluent/fluent-package-builder/pull/489#issuecomment-1587075397

It seems that it was reproduced.

old fluentd's content of PIDFILE= (/proc/pid/environ) indicates new fluentd's pid :thinking:

kenhys commented 1 year ago

Failed to preset unit: File /etc/systemd/system/td-agent.service already exists and is a symlink to /dev/null. /usr/bin/deb-systemd-helper: error: systemctl preset failed on fluentd.service: No such file or directory

It seems that it is similar to https://github.com/systemd/systemd/issues/1892 td-agent.service was removed during removing td-agent, Thus, it is not avoidable.

daipom commented 1 year ago

Failed to preset unit: File /etc/systemd/system/td-agent.service already exists and is a symlink to /dev/null. /usr/bin/deb-systemd-helper: error: systemctl preset failed on fluentd.service: No such file or directory

It seems that it is similar to systemd/systemd#1892 td-agent.service was removed during removing td-agent, Thus, it is not avoidable.

Thanks! Understood!

daipom commented 1 year ago

Are we going to uncomment these tests in this PR?

https://github.com/fluent/fluent-package-builder/blob/b1f113816f0a0eb1133ae8068976d70f85ad4afc/fluent-package/apt/systemd-test/update-from-v4.sh#L24-L38

kenhys commented 1 year ago

Except # Test: restoring td-agent service alias, intended to enable rest of test.

kenhys commented 1 year ago

Try to solve https://github.com/fluent/fluent-package-builder/pull/489#issuecomment-1587075397 issue in another PR.

daipom commented 1 year ago

Except # Test: restoring td-agent service alias, intended to enable rest of test.

Try to solve #489 (comment) issue in another PR.

I see!

kenhys commented 1 year ago

waiting CI...