Learn through the super-clean Baeldung Pro experience:
>> Membership and Baeldung Pro.
No ads, dark-mode and 6 months free of IntelliJ Idea Ultimate to start with.
Last updated: January 23, 2024
Linux, a popular and powerful operating system, offers many features and advantages:
However, Linux applications may crash or encounter errors. Thus, Apport is a tool that helps us report and fix bugs in Linux applications.
In this tutorial, we’ll learn what Apport is, how it works, and how to enable and disable it on a Linux system.
Basically, Apport is a software package that performs the following actions when an application crashes:
Further, Apport aims to improve the quality and stability of Linux applications by providing useful feedback to developers and users.
Notably, Apport was originally developed for Ubuntu but it has been adopted by other Linux distributions as well. As stated, its main purpose is to facilitate the reporting and fixing of bugs in Linux applications.
In particular, Apport works by intercepting the signals sent when an application crashes. Then, it collects diagnostic information from the crashed application:
Apport also checks if the crash is a known issue and if a fix or workaround is available.
Finally, Apport can submit the error report to a central server, such as Launchpad, where developers and administrators can analyze and process it.
Before enabling or disabling, we should check the current status of Apport on the system.
In practice, we can run the systemctl command with root permission to verify whether Apport is running:
$ sudo systemctl status apport.service
● apport.service - LSB: automatic crash report generation
Loaded: loaded (/etc/init.d/apport; generated)
Active: active (exited) since Wed 2023-12-20 00:44:55 WAT; 23min left
Docs: man:systemd-sysv-generator(8)
Process: 779 ExecStart=/etc/init.d/apport start (code=exited, status=0/SUCC>
CPU: 26ms
Dec 20 00:44:54 abdulhameed-E5470 systemd[1]: Starting LSB: automatic crash rep>
Dec 20 00:44:54 abdulhameed-E5470 apport[779]: * Starting automatic crash repo>
Dec 20 00:44:55 abdulhameed-E5470 apport[779]: ...done.
Dec 20 00:44:55 abdulhameed-E5470 systemd[1]: Started LSB: automatic crash rep
The output shows that the Apport service is loaded and active. Further, this means that Apport is currently enabled on the system.
Enabling Apport can have several benefits:
However, the use of Apport can also have some drawbacks:
Therefore, users should decide whether to enable Apport according to their needs and preferences. If Apport isn’t enabled on the system, we can enable it by using the command line or via graphical tools.
Firstly, we can temporarily enable the Apport service with the service command:
$ sudo service apport start force_start=1
This will be in effect just for the current login session. Thus, Apport is automatically disabled the next time we log in to the system.
We can also enable it permanently by removing the force_start option.
We can also enable Apport permanently by editing the apport file in the /etc/default/ directory using the nano command:
$ sudo nano /etc/default/apport
Let’s display the typical content of this apport file using the cat command:
$ cat /etc/default/apport
# set this to 0 to disable apport, or to 1 to enable it
# you can temporarily override this with
# sudo service apport start force_start=1
enabled=0
Then, we can change the value of the enabled variable to 1 to enable Apport permanently.
Alternatively, we can enable Apport by using the system settings. For instance, on Ubuntu, we can go to Settings > Privacy > Diagnostics, and select Automatic in the drop-down menu.
After enabling the Apport service, we can check the Apport status to ensure it’s enabled.
To disable Apport on Linux, we can also use the service command, edit the configuration file, or remove the Apport package.
We can disable Apport using the service command:
$ sudo service apport stop
As a result, the Apport service will be stopped and the system won’t detect application crashes again.
In this case, we edit the file /etc/default/apport and change the value of the enabled variable from 1 to 0, as we saw in the previous section.
Additionally, we can edit the file /etc/apport/crashdb.conf to disable crash reporting. Notably, the crashdb.conf file defines the crash databases that Apport can use to submit and retrieve error reports. It also specifies the implementation, the options, and the problem types for each database.
Let’s look at the typical content of the crashdb.conf configuration file:
$ cat /etc/apport/crashdb.conf
# map crash database names to CrashDatabase implementations and URLs
default = 'ubuntu'
...
databases = {
'ubuntu': {
'impl': 'launchpad',
'bug_pattern_url': 'http://people.canonical.com/~ubuntu-archive/bugpatterns/bugpatterns.xml',
'dupdb_url': 'http://people.canonical.com/~ubuntu-archive/apport-duplicates',
'distro': 'ubuntu',
# 'problem_types': ['Bug', 'Package'],
'escalation_tag': 'bugpattern-needed',
'escalated_tag': 'bugpattern-written',
},
'canonical-oem': {
'impl': 'launchpad',
'bug_pattern_url': 'http://people.canonical.com/~ubuntu-archive/bugpatterns/bugpatterns.xml',
'project': get_oem_project(),
},
'debug': {
# for debugging
'impl': 'memory',
'bug_pattern_url': '/tmp/bugpatterns.xml',
'distro': 'debug'
},
}
Thus, removing the hash symbol in front of the line that contains the problem_type variable prevents Apport from reporting any type of problem.
We can also use a package manager like apt to remove Apport packages from the system:
$ sudo apt purge apport apport-gtk apport-retrace apport-symptoms
Let’s understand the package names specified in the command:
Importantly, the purge option removes not only the package but also its configuration files, essentially wiping out all traces of Apport.
Apport is a useful tool for users and developers of Linux applications to detect bugs and errors. However, Apport may also cause some issues, such as privacy concerns and performance issues. Therefore, users may want to enable or disable Apport on a Linux system.
In this article, we learned what Apport is, how it works, and how to enable and disable it on a Linux system using the command line, graphical tools, and a configuration file.