When I connect a USB drive to an Ubuntu OS, would there be a text file which contains details of that connection and if so, where is that file located ? What is the name of that file?
Ubuntu – Does Ubuntu log when USB devices are connected
All log files are located in
/var/log directory. In that directory, there are specific files for each type of logs. For example, system logs, such as kernel activities are logged in
Some of the most common log files in that directory is :
aptthere is a file
history.logwhich saves all the package installation and removal information even the initial system build as Live CD. You can open this file to see this very interesting file.
dist-upgradethere is a file
apt.logwhich logs the information during distribution upgrades
installerthe log files which are created during installation can be found.
There is an
apport.logfile which saves information about crashes in your system and reporting them.
auth.logincludes information about the authentication activities such as when you authenticate as root user via sudo.
dpkg.logsaves the low level details of package installation and removal related with
dpkg. You might be aware that the
aptsystem depends on
dpkgfor package installation and removal.
boot.logincludes information of each booting.
kern.logsaves kernel information such as warnings, errors etc.
alternatives.logincludes the history of all the alternatives set by various packages and their removal via
Another important log file is
Xorg.logwhich include information about the graphics driver, its failures, warnings etc.
Some other types of Log files may be there depending on your installed packages. For example, My system also includes a log files
epoptes.log which will only be there if you install
With the advent of
systemd, logging is mostly handled by
journalctl utility and store the logs in binary format in
/var/lib/systemd/catalog/database file. This file enumerates all logs including kernel, boot and application logs and provides required logs via
Here is a good article on
journalctl on how you can use it to fetch required log info.
I've found 3 workarounds:
- attached to bug https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/792085 there is an advice to uncheck "Mount removable drives when hot-plugged" setting: https://launchpadlibrarian.net/191200111/Thunar_uncheck_setting.png
- edit the BIOS settings: a) set xHCI mode to manual and b) disable the "xHCI pre-boot driver". It seems to solve the problem and supposedly leaves the USB 3.0 mode switched on. I've applied this method but, sorry, haven't tested it thoroughly yet.
- a hard and violent workaround: just disable USB 3.0 mode in the BIOS settings - disable the xHCI interface, which is essential to USB 3.0. It helps... Although slows down the USB...
Does Ubuntu log when USB devices are connected?
Yes, Ubuntu logs when a USB device is connected. The file is
/var/log/syslog. You can also view it by issuing the command
-cargument to clear the log) or graphically using
Log file viewer.
Is this file deleted upon shutdown?
No, This log does not get wiped upon shutdown. After a size limit is reached the logs are rotated, meaning new logs are continually written to
/var/log/syslogwhile older records are pushed to compressed files named
syslog.2.gz, ... in the same
You can view the
/var/logdirectory with rotated log files below: