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?
USB – Does Ubuntu Log When USB Devices Are Connected?
logmountusb
Related Solutions
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 syslog
file.
Some of the most common log files in that directory is :
In directory
apt
there is a filehistory.log
which 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.In directory
dist-upgrade
there is a fileapt.log
which logs the information during distribution upgradesIn directory
installer
the log files which are created during installation can be found.There is an
apport.log
file which saves information about crashes in your system and reporting them.The file
auth.log
includes information about the authentication activities such as when you authenticate as root user via sudo.The file
dpkg.log
saves the low level details of package installation and removal related withdpkg
. You might be aware that theapt
system depends ondpkg
for package installation and removal.boot.log
includes information of each booting.kern.log
saves kernel information such as warnings, errors etc.alternatives.log
includes the history of all the alternatives set by various packages and their removal viaupdate-alternatives
command.Another important log file is
Xorg.log
which 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 epoptes
package.
Changes after systemd
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 journalctl
utility.
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...
Best Answer
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 commanddmesg
(with optional-c
argument to clear the log) or graphically usingLog 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/syslog
while older records are pushed to compressed files named/var/log/syslog.1.gz
,syslog.2.gz
, ... in the same/var/log
directory.You can view the
/var/log
directory with rotated log files below: