To make the shutdown work, I created a systemd service that will run
whenever the halt.target or the shutdown.target is to be reached. Since
I need to unbind the EHCI drivers, I named the service, naturally,
'unbind-ehci-drivers'.

First, I created the '/usr/local/sbin/unbind-ehci-drivers' script, which
the service must execute:

-----</usr/local/sbin/unbind-ehci-drivers>-----
#!/bin/sh

DRIVER_DIRECTORY='/sys/bus/pci/drivers/ehci-pci'

cd "${DRIVER_DIRECTORY}"
find -mindepth 1 -maxdepth 1 -name '*:*:*.*' -type l -printf '%f\0' | xargs -I 
'{}' --null echo '{}' > unbind
-----<srevird-iche-dnibnu/nibs/lacol/rsu/>-----

Next, the '/etc/systemd/system/unbind-ehci-drivers.service' systemd
service file:

-----</etc/systemd/system/unbind-ehci-drivers.service>-----
[Unit]
Description=Unbind EHCI drivers upon system shutdown
DefaultDependencies=no
Before=shutdown.target halt.target

[Service]
Type=oneshot
ExecStart=/usr/local/sbin/unbind-ehci-drivers

[Install]
WantedBy=halt.target shutdown.target
-----<ecivres.srevird-iche-dnibnu/metsys/dmetsys/cte/>-----

With these files in place, the following command will enable the
service:

root@localhost# systemctl enable unbind-ehci-drivers

Optionally, verify if the service is now enabled:

root@localhost# systemctl is-enabled unbind-ehci-drivers

Two other commands that will show more details about the service:

root@localhost# systemctl --all list-units unbind-ehci-drivers.service
root@localhost# systemctl list-unit-files unbind-ehci-drivers.service

Shutdown works now.
Ref.: 
'http://askubuntu.com/questions/416299/execute-command-before-shutdown-reboot', 
entry "How to Do it with Systemd (it's easier)".

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1579542

Title:
  My computer reboots instead of shutdown

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1579542/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to