When attempting to update the snap-store
on Ubuntu systems when using the terminal, administrators or developers may encounter a specific error message indicating that the operation cannot proceed.
This typically occurs during the execution of the sudo snap refresh snap-store
or a general sudo snap refresh
command.
The precise error displayed is:
error: cannot refresh "snap-store": snap "snap-store" has running apps
(ubuntu-software)
This article explains the reason behind this error and provides clear methods to resolve it, allowing the successful refresh of the snap-store
package.
Understanding the Cause
The core issue stems from the operational design of the Snap package management system. Snap enforces a rule that prevents a package from being updated or refreshed while any of its associated applications or processes are actively running.
In this specific scenario:
- The package being targeted for refresh is
snap-store
. - The error message explicitly identifies
ubuntu-software
as the running application linked to thesnap-store
package.
Therefore, the refresh operation fails because the Ubuntu Software application (or a related background process) is active, preventing the Snap system from modifying the underlying snap-store
package.
Read: How to display your sound card details using the terminal on Ubuntu 22.04
Solutions to Refresh Snap Store
To successfully refresh the snap-store
, the conflicting process must first be terminated. Several command-line approaches can achieve this.
Solution 1: Identify and Terminate the Specific Process
This method involves finding the specific Process ID (PID) of the running snap-store
(or ubuntu-software
) process and then terminating it directly.
- Find the process ID using
ps
andgrep
:ps -e | grep snap-store
This command lists running processes (
ps -e
) and filters the output (| grep
) to show lines containing “snap-store”. Note the numeric process ID (PID) listed, typically in the first column. - Terminate the process using its PID (replace #
with the actual ID found):
kill #
- Retry the snap refresh command:
sudo snap refresh snap-store
Alternatively, a general refresh might also work if other snaps don’t have running processes:
sudo snap refresh
This approach precisely targets the identified blocking process.
Read: How to Display Your Graphics Card Information on Ubuntu 24.04
Solution 2: Terminate All Instances Using ‘killall’ or ‘pkill’
A more direct approach uses commands designed to terminate processes by name, which can be useful if multiple instances are running or to simplify the process.
- Use
killall
to terminate all processes namedsnap-store
. Administrative privileges (sudo
) are often required:sudo killall snap-store
An alternative command that achieves a similar outcome is
pkill
:sudo pkill snap-store
- Once the process(es) are terminated, proceed with the refresh:
sudo snap refresh snap-store
These commands provide a convenient way to stop all relevant processes without needing to identify individual PIDs.
Solution 3: Terminating Without ‘sudo’ (Context Dependent)
In some cases, it might be possible to terminate the snap-store
process without using sudo
, particularly if the current user owns the process.
- Attempt to terminate the process without elevated privileges:
killall snap-store
- Proceed with the refresh. Note that the
snap refresh
command itself typically still requiressudo
:snap refresh
If this fails due to permissions, you will likely need to use
sudo snap refresh
.
While using sudo
for termination commands like killall
is common practice to ensure effectiveness, omitting it might work depending on process ownership.
Read: How to fix Bluetooth connection issues on Ubuntu 22.04
Verification
After applying one of the solutions, you can verify the fix:
- Re-run the command
sudo snap refresh snap-store
. It should now complete without the “has running apps” error. - Open the Ubuntu Software application (Snap Store). It should function normally, and any previous update notifications related to this issue should be gone. The system may take a few moments to fully handle the re-refresh in the background.
Conclusion
The error `cannot refresh “snap-store”: snap “snap-store” has running apps (ubuntu-software)` is a direct consequence of the Snap system’s safety mechanism preventing updates to active applications.
By ensuring the associated ubuntu-software
process is not running, typically by terminating it using commands like kill
, killall
, or pkill
, the snap refresh
command can execute successfully, allowing the snap-store
package to be updated as intended.
If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.