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 Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1579542

Title:
  My computer reboots instead of shutdown

Status in linux package in Ubuntu:
  Incomplete

Bug description:
  Really basic operation - I go to drop-down system menu and choose
  "Shut down...". My computer goes poweroff but after two, maybe three
  seconds it starts booting process automatically.

  ProblemType: Bug
  DistroRelease: Ubuntu 16.04
  Package: linux-image-4.4.0-22-generic 4.4.0-22.39
  ProcVersionSignature: Ubuntu 4.4.0-22.39-generic 4.4.8
  Uname: Linux 4.4.0-22-generic x86_64
  NonfreeKernelModules: nvidia_uvm nvidia_drm nvidia_modeset nvidia
  ApportVersion: 2.20.1-0ubuntu2
  Architecture: amd64
  AudioDevicesInUse:
   USER        PID ACCESS COMMAND
   /dev/snd/controlC2:  corsseir   1818 F.... pulseaudio
   /dev/snd/pcmC0D0p:   corsseir   1818 F...m pulseaudio
   /dev/snd/controlC0:  corsseir   1818 F.... pulseaudio
   /dev/snd/controlC1:  corsseir   1818 F.... pulseaudio
  CurrentDesktop: Unity
  Date: Sun May  8 18:41:01 2016
  InstallationDate: Installed on 2016-04-21 (16 days ago)
  InstallationMedia: Ubuntu 16.04 LTS "Xenial Xerus" - Release amd64 
(20160420.1)
  IwConfig:
   enp0s25   no wireless extensions.
   
   lo        no wireless extensions.
  MachineType: To Be Filled By O.E.M. To Be Filled By O.E.M.
  ProcFB: 0 EFI VGA
  ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-4.4.0-22-generic.efi.signed 
root=UUID=ddb69d9b-bdbe-46a8-9071-81c3762158c2 ro quiet splash vt.handoff=7
  RelatedPackageVersions:
   linux-restricted-modules-4.4.0-22-generic N/A
   linux-backports-modules-4.4.0-22-generic  N/A
   linux-firmware                            1.157
  RfKill:
   
  SourcePackage: linux
  UpgradeStatus: No upgrade log present (probably fresh install)
  dmi.bios.date: 08/03/2015
  dmi.bios.vendor: American Megatrends Inc.
  dmi.bios.version: P2.20
  dmi.board.name: H87 Pro4
  dmi.board.vendor: ASRock
  dmi.chassis.asset.tag: To Be Filled By O.E.M.
  dmi.chassis.type: 3
  dmi.chassis.vendor: To Be Filled By O.E.M.
  dmi.chassis.version: To Be Filled By O.E.M.
  dmi.modalias: 
dmi:bvnAmericanMegatrendsInc.:bvrP2.20:bd08/03/2015:svnToBeFilledByO.E.M.:pnToBeFilledByO.E.M.:pvrToBeFilledByO.E.M.:rvnASRock:rnH87Pro4:rvr:cvnToBeFilledByO.E.M.:ct3:cvrToBeFilledByO.E.M.:
  dmi.product.name: To Be Filled By O.E.M.
  dmi.product.version: To Be Filled By O.E.M.
  dmi.sys.vendor: To Be Filled By O.E.M.

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

-- 
Mailing list: https://launchpad.net/~kernel-packages
Post to     : kernel-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to