When I use sudo init 0 to shutdown the system ,it always staying at      [ok] Stopped LVM2 metadata daemon     What can I do？
4309
How can I shut down or reboot Ubuntu using terminal commands?
69935
Before systemd, one used to be able to see a shutdown process in the list of processes (e.g. ps -ef | grep shutdown).  Now however, the most recent advice I can find is to use systemctl status, but I'm not having any luck:  root@m________a:~# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description:    Ubuntu 16.04.1 LTS Release:    16.04 Codename:   xenial root@m________a:~# shutdown -r 14:00 Shutdown scheduled for Mon 2016-10-10 14:00:00 BST, use 'shutdown -c' to cancel. root@m________a:~# ps -ef | grep "shutdown" root     10584 10508  0 13:44 pts/0    00:00:00 grep --color=auto shutdown root@m________a:~# systemctl status systemd-halt.service ● systemd-halt.service - Halt    Loaded: loaded (/lib/systemd/system/systemd-halt.service; static; vendor preset: enabled)    Active: inactive (dead)      Docs: man:systemd-halt.service(8) root@m________a:~# systemctl status systemd-reboot.service  ● systemd-reboot.service - Reboot    Loaded: loaded (/lib/systemd/system/systemd-reboot.service; static; vendor preset: enabled)    Active: inactive (dead)      Docs: man:systemd-halt.service(8) root@m________a:~# systemctl status systemd-poweroff.service  ● systemd-poweroff.service - Power-Off    Loaded: loaded (/lib/systemd/system/systemd-poweroff.service; static; vendor preset: enabled)    Active: inactive (dead)      Docs: man:systemd-halt.service(8)   I would be very grateful if anyone can explain how I can detect a pending scheduled shutdown and, indeed, why such a shutdown doesn't seem to show up using systemctl
43641
Everytime I try to sudo something at the terminal, I get a warning message:  alexandre@XPS-15Z $ sudo mount file.iso /mnt/ -o loop [sudo] password for alexandre:  no talloc stackframe at ../source3/param/loadparm.c:4864, leaking memory   It's just annoying to get that all the time. How do I solve that? I'm on Ubuntu 14.04 (upgraded from 13.10)
104974
I understand that clicking "shut down" from the menu that comes up on clicking the cogwheel triggers the following command to be executed:  dbus-send --system --print-reply --dest=org.freedesktop.Hal /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Shutdown   However, when I execute this command on a terminal, I get the following error:  Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.Hal was not provided by any .service files   Is it because 14.04 uses some other service for shutting down, or am I doing something wrong?    Note: This question is in follow-up of:
34674
I've been using gksudo nautilus and sudo nautilus through Alt+F2.   What's the difference? They look very similar!
86810
During the last month Ubuntu starts having some problems: it shuts down suddenly without any apparent reason.. I figured out that the problem is in the hard disk, if I run this command:  $ sudo badblocks -sv -b 512 /dev/sda   I get 24 bad blocks all in the Linux partition (I have Windows in another one and it does not have the same problem). The question is if there is a way (different from changing the disk) for avoiding this shutting down. Maybe isolating the bad blocks?
30556
I have set up an init-script to control the state of a VirtualBox VM:  #!/bin/sh #chkconfig: 35 99 5 #description: vTiger virtual machine  ### BEGIN INIT INFO # Provides: vtigervm # Required-Start: $local_fs # Requider-Stop: $stop_fs # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Short-Description: Manage vTiger virtual machine # Description: Utility to start and stop vTiger virtual machine on VirtualBox ### END INIT INFO  start() {     echo -n "Starting vTiger"     echo     su myuser -c '/usr/bin/VBoxManage startvm "vTiger" --type headless'     echo "Started virtual machine" &gt;&gt; /var/log/messages }  stop() {     echo -n "Shutting vTiger down..."     echo     su myuser-c '/usr/bin/VBoxManage controlvm "vTiger" acpipowerbutton'     while [ ! -z "`su - juhani -c '/usr/bin/VBoxManage list runningvms | grep vTiger'`" ]; do         echo -n "."         sleep 1     done     echo "Done."     echo "Stopped virtual machine" &gt;&gt; /var/log/messages }  status() {     echo -n "Running VMs: "     su myuser -c '/usr/bin/VBoxManage list runningvms'     echo     if [ -z "`su - juhani -c '/usr/bin/VBoxManage list runningvms | grep vTiger'`" ]; then         RETVAL=3         else         RETVAL=0     fi     echo "Queried virtual machine status" &gt;&gt; /var/log/messages }  echo "Called virtual machine management script with: $1" &gt;&gt; /var/log/messages case "$1" in   start)         start    ;;    stop)         stop    ;;    restart|try-restart|condrestart|reload)         stop         start    ;;    status)         status    ;;    *)         echo $"Usage: $0 {start|stop|restart|status}"         exit 1    ;; esac  exit $RETVAL   The system is CentOS 6.5. If I manually run service [start|stop|status] vtigervm, it works as I expect it to. If the VM is running, $? after the service vtigervm status returns 0, and 3 if it is stopped. I installed it with chkconfig and it created among a few others rc5.d/S99vtigervm and rc0.d/K05vtigervm.  The problem  When I start the system it starts the "service", but on shutdown it does not even run the scripts.  grep "virtual machine" /var/log/messages shows:  *[machine starting]* Called virtual machine management script with: start Started virtual machine *[shutdown -h now]* *[machine stopped]*   What I expect:  *[machine starting]* Called virtual machine management script with: start Started virtual machine  *[shutdown -h now]* Called virtual machine management script with: status Queried virtual machine status Called virtual machine management script with: stop Stopped virtual machine *[machine stopped]*   File permissions &amp; etc:  # ls -lah /etc/rc0.d/ lrwxrwxrwx. 1 root root 13 7.2. 17:49 /etc/rc0.d/K05atd -&gt; ../initd.d/atd lrwxrwxrwx. 1 root root 18 9.2. 00:06 /etc/rc0.d/K05vtigervm -&gt; ../initd.d/vtigervm
65241
After running this command - sudo chown -R $(whoami) usr/{lib/node_modules,bin,share} I am not able to run sudo anymore: sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set. How do I fixed that?  I read  but I am not sure what advice to follow and if it's applicable to my case.
12622
After two days of installation, strangely my Ubuntu machine is restarting instead of shutdown from both desktop GUI and command line.  sudo shutdown -h now sudo halt  # (doesn't shutdown, instead freezes on boot screen Plymouth)   I had force shutdown by powering off the machine.  This is not happening all the times.  I have been using Ubuntu for 6 months and never experienced this kind of problem.
114684
I'm trying to setup a Linux system that runs from an LVM-formatted image file. After some tinkering with the initramfs and boot options I managed to make it up and running by mounting the host file system to /run/initramfs/host, losetuping the image to /dev/loop0 and making sure the kernel and udev detect the LVM (and the root LV) in there. So far so good.  The problem is that when shutting down (or rebooting, or …) the system neither the  root file system nor the host are unmounted properly, because of a chicken-and-egg scenario: the root (or /oldroot, as it's referred to by the shutdown script) cannot be unmounted, because /oldroot/run/initramfs/host is still mounted, and the host cannot be unmounted, because doing so would make /oldroot inaccessible.  Unclean shutdowns aren't the end of the world, because both file systems are journaled, so during the next boot fsck simply replays the journals, but obviously clean shutdowns would be better.  So the question is: is it somehow possible to arrange the shutdown sequence (I can modify the shutdown script), or the bootup sequence (perhaps by moving the host mount point to a different place) so that both file systems can be cleanly unmounted?
72754
Is this a correct way for passing an environment variable in sudo ?  sudo -u www-data -b env FOOBAR="foobar" /home/user/folder/daemon
4064
I tried to use  sudo service networking restart   and  sudo /etc/init.d/network restart   but they both crash the window manager and I can no longer use my keyboard for input into X.  when I use the /etc/init.d/ method it complains saying that I should use the service utility  e.g. service networking restart   but it crashes just the same.  Is there a GUI method of restarting networking?
15467
I have a Non Root User abc and want to give the user sudo rights only to restart, start or stop - mysqld service. i.e sudo service mysqld restart. How can I do it so?     I would like to do the same to usergroup too!!
46038
I just bought a new laptop with ubuntu installed on it. When i first turned on the laptop ubuntu started with an error and restarted. Then when it turned on again i only had the guest session option. I've tried, but i can't use sudo in the terminal: Sudo: unable to change to root gid: operation not permitted Sudo: unable to initialize policy plugin I tried the recovery path too, but i don't have a username and can't do anything. I can only go in guest session. Please help, sorry if this is something obvious to do, it's my first time opening ubuntu.
6485
I have a simple shutdown script which i want to run as root  shutdown -h +30; echo "succesfull";   I have followed these answer, to make my script root.  first I run this command  sudo chown root.root $HOME/test/test.sh sudo chmod 4755 $HOME/test/test.sh   and then made changes in sudoers  sudo visudo   added this command after this line %sudo   ALL=(ALL:ALL) ALL  eka ALL=(ALL) NOPASSWD: $HOME/test/test.sh   But when i executed my script its showing this error  shutdown: Need to be root succesfull
5662
is anything else supposed to be here? I am using Ubuntu gnome and my keyboard is unresponsive for encryption password. Do I need any more modules, and if so where do I add them.  # List of modules that you want to include in your initramfs. # They will be loaded at boot time in the order below. # # Syntax:  module_name [args ...] # # You must run update-initramfs(8) to effect this change. # # Examples: # # raid1 # sd_mod
99640
I'm running a private game server on a headless linux box. Because I'm not an idiot, said server is running as its own unprivileged user with the bare minimum access rights it needs to download updates and modify the world database.  I also created a systemd unit file to properly start, stop and restart the server when needed (for said updates, for example).   However, in order to actually call systemctl or service &lt;game&gt; start/stop/restart I still need to log in as either root or a sudo capable user.   Is there a way to tell systemd that for the &lt;game&gt; service, unprivileged user gamesrv is permitted to run the start/stop/restart commands?