User:Spot/Testing systemd

Environment
Fedora 15 i686 systemd-units-20-1.fc15.i686 Test package: ser2net (with fixed draft scriptlets).

ser2net.service
[Unit] Description=Proxy that allows tcp connections to serial ports After=syslog.target network.target

[Service] Type=forking ExecStart=/usr/sbin/ser2net

[Install] WantedBy=multi-user.target

Test packages
Initial package: http://spot.fedorapeople.org/ser2net-2.7-3.fc15.src.rpm  Upgrade package: http://spot.fedorapeople.org/ser2net-2.7-5.fc15.src.rpm (identical except for different Description wording in service) 

New install (not upgrade)
[spot@f15 ~]$ rpm -q ser2net package ser2net is not installed
 * 1) Check that package is not installed

[spot@f15 ~]$ chkconfig --list ser2net
 * 1) Make sure there are no legacy SysV scripts for ser2net

Note: This output shows SysV services only and does not include native systemd services. SysV configuration data might be overriden by native systemd configuration.

error reading information on service ser2net: No such file or directory

[spot@f15 ~]$ sudo systemctl -a | grep ser2net
 * 1) Confirm that systemctl doesn't know about ser2net

[spot@f15 ~]$ sudo rpm -ivh /home/spot/rpmbuild/RPMS/i686/ser2net-2.7-3.fc15.i686.rpm Preparing... ########################################### [100%]  1:ser2net                ########################################### [100%]
 * 1) Install ser2net package


 * 1) At this point, the .service file is in place, but no symlinks have been created.

[spot@f15 ~]$ sudo systemctl -a |grep ser2net [spot@f15 ~]$
 * 1) Accordingly, systemctl does not list ser2net as a service

[spot@f15 ~]$ ps ax |grep ser2net 20232 pts/0   S+     0:00 grep --color=auto ser2net
 * 1) Check to make sure that ser2net is not running

[spot@f15 ~]$ sudo systemctl start ser2net.service
 * 1) Manually start ser2net.service with systemctl

[spot@f15 ~]$ systemctl -a |grep ser2net ser2net.service          loaded active   running       Proxy that allows tcp co [spot@f15 ~]$ ps ax |grep ser2net 20241 ?       S      0:00 /usr/sbin/ser2net 20245 pts/0   S+     0:00 grep --color=auto ser2net
 * 1) Confirm successful startup

[spot@f15 ~]$ telnet localhost 3011 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. this is ser2net TCP port 3011 device /dev/ttyS0 second line third line Connection closed by foreign host.
 * 1) Try to connect to ser2net

[spot@f15 ~]$ sudo systemctl stop ser2net.service [spot@f15 ~]$
 * 1) Manually stop ser2net service with systemctl

[spot@f15 ~]$ sudo systemctl -a |grep ser2net ser2net.service          loaded inactive dead          Proxy that allows tcp co
 * 1) Confirm successful shutdown

[spot@f15 ~]$ telnet localhost 3011 Trying 127.0.0.1... telnet: connect to address 127.0.0.1: Connection refused
 * 1) Try to connect to ser2net

[spot@f15 ~]$ sudo shutdown -r now
 * 1) Reboot system


 * 1) Listen to some music. Wait for system to reboot.

[spot@f15 ~]$ sudo systemctl -a |grep ser2net [spot@f15 ~]$
 * 1) Check to see what systemctl sees

[spot@f15 ~]$ sudo systemctl start ser2net.service
 * 1) Okay, it is back to not seeing it at all. Try to start it again:

[spot@f15 ~]$ sudo systemctl -a |grep ser2net ser2net.service          loaded active   running       Proxy that allows tcp co
 * 1) Check to see if it reports as running

[spot@f15 ~]$ ps ax |grep ser2net 1256 ?       S      0:00 /usr/sbin/ser2net 1261 pts/0   S+     0:00 grep --color=auto ser2net
 * 1) Confirm that it is actually running

[spot@f15 ~]$ telnet localhost 3011 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. this is ser2net TCP port 3011 device /dev/ttyS0 second line third line Connection closed by foreign host.
 * 1) Try to connect to ser2net (expected success)

[spot@f15 ~]$ sudo shutdown -r now
 * 1) Reboot once more, it should not be running afterwards.


 * 1) Do a little dance. Wait for system to reboot.

[spot@f15 ~]$ sudo systemctl -a |grep ser2net [spot@f15 ~]$
 * 1) Check to see if it reports as running

[spot@f15 ~]$ ps ax |grep ser2net 1248 pts/0   S+     0:00 grep --color=auto ser2net
 * 1) Confirm that ser2net is not running

[spot@f15 ~]$ telnet localhost 3011 Trying 127.0.0.1... telnet: connect to address 127.0.0.1: Connection refused
 * 1) Try to connect to ser2net (expected fail)

Remove package
[spot@f15 ~]$ sudo rpm -e ser2net
 * 1) Remove ser2net package

[spot@f15 ~]$ ps ax |grep ser2net 20256 pts/0   S+     0:00 grep --color=auto ser2net
 * 1) Confirm service is no longer running

[spot@f15 ~]$ sudo systemctl -a |grep ser2net ser2net.service          error  inactive dead          ser2net.service
 * 1) Confirm that systemctl knows the service is disabled

[spot@f15 ~]$ telnet localhost 3011 Trying 127.0.0.1... telnet: connect to address 127.0.0.1: Connection refused
 * 1) Attempt to connect to ser2net (expected fail)

[spot@f15 ~]$ sudo systemctl start ser2net.service Failed to issue method call: Unit ser2net.service failed to load: No such file or directory. See system logs and 'systemctl status' for details.
 * 1) Attempt to start service


 * 1) Fails as expected. systemctl does not garbage collect dead entry on daemon-reload.
 * 2) ? Is there another way to force garbage collection?

[spot@f15 ~]$ sudo shutdown -r now
 * 1) Reboot system to see what systemd reports.

[spot@f15 ~]$ ps ax |grep ser2net 1262 pts/0   S+     0:00 grep --color=auto ser2net
 * 1) Wait for system to reboot, then confirm service is not running

[spot@f15 ~]$ telnet localhost 3011 Trying 127.0.0.1... telnet: connect to address 127.0.0.1: Connection refused
 * 1) Attempt to connect to ser2net (expected fail)

[spot@f15 ~]$ sudo systemctl -a |grep ser2net [spot@f15 ~]$
 * 1) systemctl has forgotten about the ser2net service

Upgrade
[spot@f15 ~]$ rpm -q ser2net package ser2net is not installed
 * 1) Check that package is not installed

[spot@f15 ~]$ chkconfig --list ser2net
 * 1) Make sure there are no legacy SysV scripts for ser2net

Note: This output shows SysV services only and does not include native systemd services. SysV configuration data might be overriden by native systemd configuration.

error reading information on service ser2net: No such file or directory

[spot@f15 ~]$ sudo systemctl -a | grep ser2net [spot@f15 ~]$
 * 1) Confirm that systemctl doesn't know about ser2net

[spot@f15 ~]$ sudo rpm -ivh /home/spot/rpmbuild/RPMS/i686/ser2net-2.7-3.fc15.i686.rpm Preparing... ########################################### [100%]  1:ser2net                ########################################### [100%]
 * 1) Install first ser2net package

[spot@f15 ~]$ sudo systemctl start ser2net.service
 * 1) Manually start ser2net service

[spot@f15 ~]$ sudo systemctl -a |grep ser2net ser2net.service          loaded active   running       Proxy that allows tcp co
 * 1) Check to see if it reports as running


 * 1) Note that this description starts with "Proxy..."

[spot@f15 ~]$ ps ax |grep ser2net 1294 ?       S      0:00 /usr/sbin/ser2net 1299 pts/0   S+     0:00 grep --color=auto ser2net
 * 1) Confirm that it is actually running


 * 1) Note that the PID of the process is 1294

[spot@f15 ~]$ telnet localhost 3011 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. this is ser2net TCP port 3011 device /dev/ttyS0 second line third line Connection closed by foreign host.
 * 1) Try to connect to ser2net (expected success)


 * 1) Now, update to newer package
 * 2) NOTE: Newer package has a different description in ser2net.service to show that systemd is operating on the new instance.
 * 3) This package is too simple for anything more complicated.

[spot@f15 ~]$ sudo rpm -Uvh /home/spot/rpmbuild/RPMS/i686/ser2net-2.7-5.fc15.i686.rpm Preparing... ########################################### [100%]  1:ser2net                ########################################### [100%]
 * 1) Upgrade package

[spot@f15 ~]$ sudo systemctl status ser2net.service ser2net.service - New proxy that allows tcp connections to serial ports Loaded: loaded (/lib/systemd/system/ser2net.service) Active: active (running) Process: 1332 ExecStart=/usr/sbin/ser2net (code=exited, status=0/SUCCESS) Main PID: 1334 (ser2net) CGroup: name=systemd:/system/ser2net.service └ 1334 /usr/sbin/ser2net
 * 1) Check to see if it reports as running


 * 1) It lives! (In earlier testing, it failed, but it seems not to be reproducible.)

New install (not upgrade)
[spot@f15 ~]$ rpm -q ser2net package ser2net is not installed
 * 1) Check that package is not installed

[spot@f15 ~]$ chkconfig --list ser2net
 * 1) Make sure there are no legacy SysV scripts for ser2net

Note: This output shows SysV services only and does not include native systemd services. SysV configuration data might be overriden by native systemd configuration.

error reading information on service ser2net: No such file or directory

[spot@f15 ~]$ sudo systemctl -a | grep ser2net
 * 1) Confirm that systemctl doesn't know about ser2net

[spot@f15 ~]$ sudo systemctl status ser2net.service ser2net.service Loaded: error Active: inactive (dead)
 * 1) Check systemctl status
 * 1) Note that it says this about any non-present service

[spot@f15 ~]$ sudo rpm -ivh /home/spot/rpmbuild/RPMS/i686/ser2net-2.7-6.fc15.i686.rpm Preparing... ########################################### [100%]  1:ser2net                ########################################### [100%]
 * 1) Install ser2net package


 * 1) At this point, the .service file is in place, and it has been enabled, so there should be symlinks.

[spot@f15 ~]$ sudo systemctl -a |grep ser2net ser2net.service          loaded inactive dead          Proxy that allows tcp connections to serial ports
 * 1) systemctl -a sees it

[spot@f15 ~]$ sudo systemctl status ser2net.service ser2net.service - Proxy that allows tcp connections to serial ports Loaded: loaded (/lib/systemd/system/ser2net.service) Active: inactive (dead) CGroup: name=systemd:/system/ser2net.service
 * 1) Check systemd status

[spot@f15 ~]$ ps ax |grep ser2net 1281 pts/0   S+     0:00 grep --color=auto ser2net
 * 1) Check to make sure that ser2net is not running

[spot@f15 ~]$ sudo systemctl start ser2net.service
 * 1) Manually start ser2net.service with systemctl

[spot@f15 ~]$ systemctl -a |grep ser2net ser2net.service          loaded active   running       Proxy that allows tcp connections to serial ports
 * 1) Confirm successful startup

[spot@f15 ~]$ sudo systemctl status ser2net.service ser2net.service - Proxy that allows tcp connections to serial ports Loaded: loaded (/lib/systemd/system/ser2net.service) Active: active (running) Process: 1285 ExecStart=/usr/sbin/ser2net (code=exited, status=0/SUCCESS) Main PID: 1287 (ser2net) CGroup: name=systemd:/system/ser2net.service └ 1287 /usr/sbin/ser2net

[spot@f15 ~]$ ps ax |grep ser2net 1287 ?       S      0:00 /usr/sbin/ser2net 1295 pts/0   S+     0:00 grep --color=auto ser2net

[spot@f15 ~]$ telnet localhost 3011 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. this is ser2net TCP port 3011 device /dev/ttyS0 second line third line Connection closed by foreign host.
 * 1) Try to connect to ser2net

[spot@f15 ~]$ sudo systemctl stop ser2net.service [spot@f15 ~]$
 * 1) Manually stop ser2net service with systemctl

[spot@f15 ~]$ sudo systemctl -a |grep ser2net ser2net.service          loaded inactive dead          Proxy that allows tcp connections to serial ports
 * 1) Confirm successful shutdown

[spot@f15 ~]$ sudo systemctl status ser2net.service ser2net.service - Proxy that allows tcp connections to serial ports Loaded: loaded (/lib/systemd/system/ser2net.service) Active: inactive (dead) Process: 1285 ExecStart=/usr/sbin/ser2net (code=exited, status=0/SUCCESS) Main PID: 1287 (code=killed, signal=TERM) CGroup: name=systemd:/system/ser2net.service

[spot@f15 ~]$ telnet localhost 3011 Trying 127.0.0.1... telnet: connect to address 127.0.0.1: Connection refused
 * 1) Try to connect to ser2net

[spot@f15 ~]$ sudo shutdown -r now
 * 1) Reboot system


 * 1) Listen to some music. Wait for system to reboot.

[spot@f15 ~]$ sudo systemctl -a |grep ser2net ser2net.service          loaded active   running       Proxy that allows tcp connections to serial ports
 * 1) Check to see what systemctl sees

[spot@f15 ~]$ sudo systemctl status ser2net.service ser2net.service - Proxy that allows tcp connections to serial ports Loaded: loaded (/lib/systemd/system/ser2net.service) Active: active (running) since Mon, 04 Apr 2011 18:17:06 -0400; 30s ago Process: 690 ExecStart=/usr/sbin/ser2net (code=exited, status=0/SUCCESS) Main PID: 696 (ser2net) CGroup: name=systemd:/system/ser2net.service └ 696 /usr/sbin/ser2net


 * 1) Okay, the symlinks survived the reboot and its running!

[spot@f15 ~]$ ps ax |grep ser2net 696 ?       S      0:00 /usr/sbin/ser2net 1273 pts/0   S+     0:00 grep --color=auto ser2net
 * 1) Confirm that it is actually running

[spot@f15 ~]$ telnet localhost 3011 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. this is ser2net TCP port 3011 device /dev/ttyS0 second line third line Connection closed by foreign host.
 * 1) Try to connect to ser2net (expected success)

Remove package
[spot@f15 ~]$ sudo rpm -e ser2net
 * 1) Remove ser2net package

[spot@f15 ~]$ ps ax |grep ser2net 1286 pts/0   S+     0:00 grep --color=auto ser2net
 * 1) Confirm service is no longer running

[spot@f15 ~]$ sudo systemctl -a |grep ser2net ser2net.service          error  inactive dead          ser2net.service
 * 1) Confirm that systemctl knows the service is disabled

[spot@f15 ~]$ sudo systemctl status ser2net.service ser2net.service Loaded: error Active: inactive (dead) since Mon, 04 Apr 2011 18:18:54 -0400; 19s ago Main PID: 696 (code=killed, signal=TERM)

[spot@f15 ~]$ telnet localhost 3011 Trying 127.0.0.1... telnet: connect to address 127.0.0.1: Connection refused
 * 1) Attempt to connect to ser2net (expected fail)

[spot@f15 ~]$ sudo systemctl start ser2net.service Failed to issue method call: Unit ser2net.service failed to load: No such file or directory. See system logs and 'systemctl status' for details.
 * 1) Attempt to start service


 * 1) Fails as expected. systemctl does not garbage collect dead entry on daemon-reload.

[spot@f15 ~]$ sudo shutdown -r now
 * 1) Reboot system to see what systemd reports.

[spot@f15 ~]$ ps ax |grep ser2net 1261 pts/0   S+     0:00 grep --color=auto ser2net
 * 1) Wait for system to reboot, then confirm service is not running

[spot@f15 ~]$ telnet localhost 3011 Trying 127.0.0.1... telnet: connect to address 127.0.0.1: Connection refused
 * 1) Attempt to connect to ser2net (expected fail)

[spot@f15 ~]$ sudo systemctl -a |grep ser2net [spot@f15 ~]$
 * 1) systemctl has forgotten about the ser2net service

[spot@f15 ~]$ sudo systemctl status ser2net.service ser2net.service Loaded: error Active: inactive (dead)

Upgrade
[spot@f15 ~]$ rpm -q ser2net package ser2net is not installed
 * 1) Check that package is not installed

[spot@f15 ~]$ chkconfig --list ser2net
 * 1) Make sure there are no legacy SysV scripts for ser2net

Note: This output shows SysV services only and does not include native systemd services. SysV configuration data might be overriden by native systemd configuration.

error reading information on service ser2net: No such file or directory

[spot@f15 ~]$ sudo systemctl -a | grep ser2net [spot@f15 ~]$
 * 1) Confirm that systemctl doesn't know about ser2net

[spot@f15 ~]$ sudo systemctl status ser2net.service ser2net.service Loaded: error Active: inactive (dead)

[spot@f15 ~]$ sudo rpm -ivh /home/spot/rpmbuild/RPMS/i686/ser2net-2.7-6.fc15.i686.rpm Preparing... ########################################### [100%]  1:ser2net                ########################################### [100%]
 * 1) Install first ser2net package

[spot@f15 ~]$ sudo systemctl start ser2net.service
 * 1) Manually start ser2net service (a reboot would also work here, since it is enabled by default)

[spot@f15 ~]$ sudo systemctl -a |grep ser2net ser2net.service          loaded active   running       Proxy that allows tcp connections to serial ports
 * 1) Check to see if it reports as running

[spot@f15 ~]$ sudo systemctl status ser2net.service ser2net.service - Proxy that allows tcp connections to serial ports Loaded: loaded (/lib/systemd/system/ser2net.service) Active: active (running) Process: 1351 ExecStart=/usr/sbin/ser2net (code=exited, status=0/SUCCESS) Main PID: 1353 (ser2net) CGroup: name=systemd:/system/ser2net.service └ 1353 /usr/sbin/ser2net


 * 1) Note that this description starts with "Proxy..."

[spot@f15 ~]$ ps ax |grep ser2net 1353 ?       S      0:00 /usr/sbin/ser2net 1360 pts/0   S+     0:00 grep --color=auto ser2net
 * 1) Confirm that it is actually running


 * 1) Note that the PID of the process is 1353

[spot@f15 ~]$ telnet localhost 3011 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. this is ser2net TCP port 3011 device /dev/ttyS0 second line third line Connection closed by foreign host.
 * 1) Try to connect to ser2net (expected success)


 * 1) Now, update to newer package
 * 2) NOTE: Newer package has a different description in ser2net.service to show that systemd is operating on the new instance.
 * 3) This package is too simple for anything more complicated.

[spot@f15 ~]$ sudo rpm -Uvh /home/spot/rpmbuild/RPMS/i686/ser2net-2.7-7.fc15.i686.rpm Preparing... ########################################### [100%]  1:ser2net                ########################################### [100%]
 * 1) Upgrade package

[spot@f15 ~]$ sudo systemctl status ser2net.service ser2net.service - New proxy that allows tcp connections to serial ports Loaded: loaded (/lib/systemd/system/ser2net.service) Active: active (running) Process: 1379 ExecStart=/usr/sbin/ser2net (code=exited, status=0/SUCCESS) Main PID: 1381 (ser2net) CGroup: name=systemd:/system/ser2net.service └ 1381 /usr/sbin/ser2net
 * 1) Check to see if it reports as running


 * 1) It lives! Note the new description indicating the upgrade.