Ubuntu – Can’t Shutdown after installing 13.10

shutdown

After installing Ubuntu 13.10 saucy, I can't shutdown. I have to lock the system and then shutdown from there. Please Help !

Best Answer

Do you mean that doing this

Shut Down

doesn't work? You can open a terminal and type sudo shutdown -h now (as mentioned above). That might work, not that this is the most convenient way to go...

Assuming that the ubuntu menu shut down really isn't working and that the shell command does, you can do the following to have a more natural seeming shut down situation.

  1. First open a terminal and change directory to /usr/local/bin:
    
    cd /usr/local/bin
    
  2. Next open your favorite text editor as root (lets say gedit) and create a file called shutdown.sh:
    
        sudo gedit shutdown.sh
    
    type the following in shutdown.sh:
    #! /bin/bash
        shutdown -h now
    Save and quit gedit
  3. Next make the script executable by doing sudo chmod 755 shutdown.sh
  4. Now in the terminal type sudo visudo This will open a text file in the terminal. Near the bottom of the document you will see the following
    
         # Allow members of group sudo to execute any command
         %sudo   ALL=(ALL:ALL) ALL
         
    Below this line add the line :
    
        yourUserName ALL=(ALL) NOPASSWD: /usr/local/bin/shutdown.sh
        
    where "yourUserName" should be replaced by your actual user name. This step tells sudo to execute shutdown.sh without requiring your password.
  5. Since you created shutdown.sh as root, root should be the owner of the file It is very important that this is the case , since we told sudo that running shutdown.sh does not require a password, anyone who could edit shutdown.sh could put any command they wanted in there, effectively gaining root privileges to your machine without needing your password. You can double check these settings by ls -l shutdown.sh You should see something like:
    
        -rwxr-xr-x 1 root root 28 Dec  1 17:57 shutdown.sh
    
    the first "root is the owner, the second is the group name. If for some reason yours doesn't match do :
    
        sudo chown root:root shutdown.sh
        
  6. Now we need to create a .desktop file to allow us to view shut down in the dashboard and launcher like all other apps. First we should cd to somewhere where you have write privileges lets say your home directory
     cd ~ 
    Put the following in a file called shutdown.desktop
    [Desktop Entry]
    Version=1.0
    Type=Application
    Name=Shut Down
    Comment=Turn the computer off
    Icon=/usr/share/icons/Humanity-Dark/actions/16/system-shutdown-panel-restart.svg
    Exec=sudo /usr/local/bin/shutdown.sh
    Terminal=false
    You can of course change the name and comment to anything you want. You can also pick whatever icon you want, I found this one in the /usr/share/icons directory and it seems ok. I'm pretty sure that your icon needs to be in .svg format though. Now change permissions on the file by
     sudo chmod 755 shutdown.desktop 
    If you put this file on your Desktop it will give you a little button to shut the computer down. If you put it in ~/.local/share/applications, unity will integrate it with the other applications in your launcher and dashboard. If you do both, you'll have both.
Related Question