Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How do I restart the GPU from command line?

Using a HP DV6 laptop with Ubuntu 12.04-64 and an ATI mobile GPU. Installed the standard ATI propriety drivers suggested by Ubuntu. When I close the lid, the computer goes down to suspend mode. When open the lid, everything but the screen resumes again. Just black. I'll guess I have to put a GPU reset script in /etc/pm/sleep.d. But how do I restart/reset the GPU?

share|improve this question
    
Your best bet would be using the scripts that control sleep and resume. You could do it theoretically by unloading the kernel module for fglrx and then loading it again (using rmmod and modprobe), but it would be kind of impossible with nothing on the screen (unless you ssh in) ;) –  RolandiXor Jun 22 '13 at 18:29

2 Answers 2

Run one of the next commands in terminal or, better, in TTY# using Ctrl+Alt+F#, where # is a number from 1 to 6:

sudo /etc/init.d/lightdm restart

or

sudo service lightdm restart

This will restart the graphics environment.

I don't know yet from what reason, but these commands worked for me only in TTY. Anyway, if you are stuck in a black screen after you are running one of these commands in terminal, just go in TTY and run next command:

sudo service lightdm start

From http://en.wikipedia.org/wiki/LightDM:

LightDM is the default display manager for Ubuntu, Edubuntu, Xubuntu and Mythbuntu since 11.10 release, for Lubuntu since 12.04 release, and for Kubuntu beginning with 12.10.

So, restarting LightDM entail restarting the GDM without rebooting the machine

share|improve this answer
1  
Isn't lightdm only responsible for the login screen? –  papukaija Jun 22 '13 at 20:23
1  
@papukaija Not only/really; see en.wikipedia.org/wiki/LightDM –  Radu Rădeanu Jun 22 '13 at 21:24
    
Thank you for your reply, Radu. But restarting the lightdm seems to reset the whole desktop and all programs and open windows are lost. I was thinking about a way just to reset the GPU after the laptop lid was opened and the computer comes out of sleep mode. How would I do that? –  LapBuntu Jun 23 '13 at 9:49
    
@LapBuntu If the answer was useful, you shoul accept it. –  Radu Rădeanu Jun 23 '13 at 9:53
    
@LapBuntu You will not find another way to restart GDM. Anyway, by restarting GPU is not the good way to fix your problem. Maybe this answer will provide you a good solution for your problem. –  Radu Rădeanu Jun 23 '13 at 10:16

Try if switching back and forth from the graphic screen to a virtual tty works. I mean, when you have the black screen, try to press Ctrl-Alt-F1 and, if and when you have the login screen, Alt-F7. If the graphic screen doesn't come back, stop reading...

If the screen comes back you can try to add this to your sleep scripts (kudos to the forum entry http://ubuntuforums.org/showthread.php?t=1978290:)

#!/bin/sh
# 

case "${1}" in
        hibernate|suspend)

        chvt 1 
        ;;
        resume|thaw)

        chvt 7
        ;;
esac

Put this script in a file in your /etc/pm/sleep.d/ directory, for example 99_vthack, and make it executable:

sudo chmod 755 /etc/pm/sleep.d/99_vthack 

The 99_ means that this script is run at the end of the resume sequence.

This hack seems to work in a series of AMD-based laptops. YMMV...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.