11

Sometimes invisible instances of Google Chrome accumulate and prevent me from starting the browser:

$ ps -ef | grep chrome
ak        4044     1  4 11:30 ?        00:00:01 /opt/google/chrome/google-chrome
ak        4047  4044  0 11:30 ?        00:00:00 /opt/google/chrome/google-chrome
ak        4049     1  0 11:30 ?        00:00:00 /opt/google/chrome/chrome --type=zygote
ak        4139  4044  0 11:30 ?        00:00:00 /opt/google/chrome/chrome --type=plugin --plugin-path=/home/ak/.config/google-chrome/Default/Extensions/cpngackimfmofbokmjmljamhdncknpmg/3.0.7_0/plugin/screen_capture_64.so --lang=en-US --plugin-data-dir=/home/ak/.config/google-chrome/Default --channel=4044.0x618d838.1464152706 --enable-crash-reporter=D8EC5832E6B1783FEA1F118FC4B1AAE0,Ubuntu 10.10
ak        4150     1  3 11:30 ?        00:00:00 /opt/google/chrome/google-chrome
ak        4153  4150  0 11:30 ?        00:00:00 /opt/google/chrome/google-chrome
ak        4155     1  0 11:30 ?        00:00:00 /opt/google/chrome/chrome --type=zygote
ak        4244  4150  0 11:30 ?        00:00:00 /opt/google/chrome/chrome --type=plugin --plugin-path=/home/ak/.config/google-chrome/Default/Extensions/cpngackimfmofbokmjmljamhdncknpmg/3.0.7_0/plugin/screen_capture_64.so --lang=en-US --plugin-data-dir=/home/ak/.config/google-chrome/Default --channel=4150.0x48c1e38.1952918361 --enable-crash-reporter=D8EC5832E6B1783FEA1F118FC4B1AAE0,Ubuntu 10.10
ak        4253     1  6 11:30 ?        00:00:01 /opt/google/chrome/google-chrome
ak        4256  4253  0 11:30 ?        00:00:00 /opt/google/chrome/google-chrome
ak        4258     1  0 11:30 ?        00:00:00 /opt/google/chrome/chrome --type=zygote
ak        4348  4253  0 11:30 ?        00:00:00 /opt/google/chrome/chrome --type=plugin --plugin-path=/home/ak/.config/google-chrome/Default/Extensions/cpngackimfmofbokmjmljamhdncknpmg/3.0.7_0/plugin/screen_capture_64.so --lang=en-US --plugin-data-dir=/home/ak/.config/google-chrome/Default --channel=4253.0x598ca38.734301885 --enable-crash-reporter=D8EC5832E6B1783FEA1F118FC4B1AAE0,Ubuntu 10.10
ak        4355     1  4 11:30 ?        00:00:00 /opt/google/chrome/google-chrome
ak        4358  4355  0 11:30 ?        00:00:00 /opt/google/chrome/google-chrome
ak        4360     1  0 11:30 ?        00:00:00 /opt/google/chrome/chrome --type=zygote
ak        4449  4355  0 11:30 ?        00:00:00 /opt/google/chrome/chrome --type=plugin --plugin-path=/home/ak/.config/google-chrome/Default/Extensions/cpngackimfmofbokmjmljamhdncknpmg/3.0.7_0/plugin/screen_capture_64.so --lang=en-US --plugin-data-dir=/home/ak/.config/google-chrome/Default --channel=4355.0x4bb6e38.554350998 --enable-crash-reporter=D8EC5832E6B1783FEA1F118FC4B1AAE0,Ubuntu 10.10
ak        4457     1  5 11:30 ?        00:00:00 /opt/google/chrome/google-chrome
ak        4460  4457  0 11:30 ?        00:00:00 /opt/google/chrome/google-chrome
ak        4462     1  0 11:30 ?        00:00:00 /opt/google/chrome/chrome --type=zygote
ak        4553  4457  0 11:30 ?        00:00:00 /opt/google/chrome/chrome --type=plugin --plugin-path=/home/ak/.config/google-chrome/Default/Extensions/cpngackimfmofbokmjmljamhdncknpmg/3.0.7_0/plugin/screen_capture_64.so --lang=en-US --plugin-data-dir=/home/ak/.config/google-chrome/Default --channel=4457.0x5338c38.1605325542 --enable-crash-reporter=D8EC5832E6B1783FEA1F118FC4B1AAE0,Ubuntu 10.10
ak        4559     1  8 11:30 ?        00:00:00 /opt/google/chrome/google-chrome
ak        4562  4559  0 11:30 ?        00:00:00 /opt/google/chrome/google-chrome
ak        4564     1  0 11:30 ?        00:00:00 /opt/google/chrome/chrome --type=zygote
ak        4653  4559  0 11:30 ?        00:00:00 /opt/google/chrome/chrome --type=plugin --plugin-path=/home/ak/.config/google-chrome/Default/Extensions/cpngackimfmofbokmjmljamhdncknpmg/3.0.7_0/plugin/screen_capture_64.so --lang=en-US --plugin-data-dir=/home/ak/.config/google-chrome/Default --channel=4559.0x60e6638.1319164624 --enable-crash-reporter=D8EC5832E6B1783FEA1F118FC4B1AAE0,Ubuntu 10.10
ak        4661  4020  0 11:30 pts/2    00:00:00 grep --color=auto chrome

If I try to start Chrome while these are present, the following error message is displayed:

Your profile could not be opened correctly.

Some features may be unavailable. Please check that the profile exists and you have permission to read and write its contents.

Short of logging out of Ubuntu, how can I get rid of these to allow Chrome to start again? My first guess didn't work as I expected:

$ killall google-chrome
google-chrome: no process found

Running kill on each process two times in a row gets the job done:

$ kill 4044 4047 4049 4139 4150 4153 4155 4244 4253 4256 4258 4348 4355 4358 4360 4449 4457 4460 4462 4553 4559 4562 4564 4653
$ !!
kill 4044 4047 4049 4139 4150 4153 4155 4244 4253 4256 4258 4348 4355 4358 4360 4449 4457 4460 4462 4553 4559 4562 4564 4653
bash: kill: (4139) - No such process
bash: kill: (4244) - No such process
bash: kill: (4348) - No such process
bash: kill: (4449) - No such process
bash: kill: (4553) - No such process
bash: kill: (4653) - No such process

but I would love to have a less cumbersome solution.

  • You don't have to kill the processes twice. According to your output, the processes don't exist when you execute the command a second time. – Nathan Osman Feb 22 '11 at 20:00
  • 1
    @George The six listed processes don't exist, but the rest are still present after the first kill command. – ændrük Feb 22 '11 at 21:40
  • Sorry, never mind then. – Nathan Osman Feb 23 '11 at 1:04
14

A grab-bag of chrome poisons:

pgrep chrome | xargs kill # this is basically "pkill chrome"

Same thing, but sleep for 1/3 of a second in between:

for i in `pgrep chrome` ; do kill $i ;  sleep .33 ; done

Keep on killing 'til the killing's done :

while pgrep chrome ; do pkill chrome ; done

Short and sweet (but won't exit until you exit manually) :

watch pkill chrome 

Might work? :

for i in `pgrep chrome` ; do kill $i && wait $i ;  sleep .33 ; done
2

If you don’t want to see “Google Chrome didn't shut down correctly. To repoen ...”, then it is important to signal only the root of the chrome process tree, like so:

pkill --oldest chrome

See full explanation.

1

Try this?

kill $(ps -C google-chrome -o pid=)
1

You can try:

pkill chrome

Seems like I need 5 extra characters...

1

I think that not all of those are processes, but are rather threads.

You tried killall -15 google-chrome chrome? That should kill all google-chrome processes and threads with a SIGTERM signal. If that doesnt work, you can always try killall -9 google-chrome chrome (HIGHLY NOT ADVISED Unless you ABSOLUTELY need to kill the processes without them saving data)

  • 2
    I actually took the kill -9 stuff out of my original, so I wouldn't be responsible for incidental breakage. (That being said, I've used it plenty of times....) – belacqua Mar 15 '11 at 6:18
  • 1
    Is there a difference between killall and killall -15? – ændrük Mar 15 '11 at 14:35
  • 1
    killall without any arguments automatically uses signal 15 which is SIGTERM, however i'm always in the habit of specifying which code the system should use to send to the process(es) – Thomas Ward Mar 15 '11 at 18:37
0
sudo killall chrome

Then go into Settings, pick Advanced, and near the bottom you will find a switch where you can set it to NOT allow background processes to run when the program exits.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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