New to Linux trying to get into debugging

mchief

New Member
Joined
Sep 4, 2017
Messages
1
Reaction score
0
Credits
0
Hello,

Just started delving into Linux.I understand basic traversal of the Linux filesystem, editing, and creating files.Now I want to learn how to do debugging in Linux.

For example:
Say a certain storage medium is not connecting. How would I go about debugging it and making sure that it connects.

Are there any recommendations such as youtube videos or websites for tutorials on this.I have been searching on my own but the material that I have come across seem a bit advanced.

I would highly appreciate any advice.
 
Last edited:


@mchief

Hello and welcome to linux.org :)

Sounds like you are already off to a good start.

For example:
Say a certain storage medium is not connecting. How would I go about debugging it and making sure that it connects.

... is a little bit like asking "how long is a piece of string?" and I am not being unkind, nor flippant.

Simple answer is "it depends..." or "there is no simple answer (until the question has been redefined)".

Linux is comprised, broadly speaking, of six (6) "Families", and they are:

  1. RPM-based eg Redhat, and SUSE were the originals
  2. Debian-based (Debian was the original, followed by Ubuntu, Linux Mint and the like)
  3. Slackware-based
  4. Gentoo-based (Gentoo was the original, I have Sabayon)
  5. Pacman-based (Arch is the archetypal example ... I could have helped that), Manjaro is well-liked and I use Bluestar Linux, but have recently downloaded Arch itself.
  6. and... Other
That is by no means a comprehensive breakdown, but I mention them for a reason.

Most of the Families share many of the same commands. You can see some if you visit Rob's video here https://www.linux.org/threads/video-getting-around-in-linux-command-line.12961/

BUT (isn't there always a but?) most of the Families also have many different commands for achieving effectively the same thing.

EXAMPLE - UPDATES AND UPGRADES
, performed at the CLI (Command Line Interface, aka Terminal)

OpenSUSE -
Code:
zypper up

Mageia -
Code:
urpmi -a

Debian, Ubuntu, Linux Mint -
Code:
apt update #or apt-get update
apt upgrade #or apt-get upgrade

Thus, if by debugging your non-connecting storage device you mean you are looking for a software fix, then it may involve Distro (Distribution) and/or Family-dependent protocols.

If you tell us whether you are currently using a specific Distro (or looking to use one), and some more details, we may be able to assist further.

Cheers

Wizard
 
Troubleshooting hardware issues is very similar to debugging software in many ways. It just requires you to be methodical in your approach when trying to determine the cause/s of the problem.

Whenever I experience a problem with a piece of hardware (or software) - I'm never vain enough to think that I'm the first, or only person to have experienced it. So the very first thing I do is a bit of duckduckgo-fu and search for web-pages/posts where people have had similar problems.

And 99.9% of the time there is already something out there that either:
A. Gives a definitive fix, or
B. Answers enough of the question that I can figure out the rest.

On rare occasions, I might have to do a bit of experimenting, or digging for more obscure solutions.

On even rarer occasions - I might have hit upon something completely new. In which case - I'll report a bug to developers, or open a thread somewhere asking for help.
But so far, I've only experienced this a handful of times and each time it's been a software related thing NEVER hardware related.

Regarding storage devices:
From personal experience - most storage devices use fairly standard, generic file-systems and protocols and do not typically require any additional drivers.

From the desktop/GUI, most of the time you just plug them in and they'll appear as a device in the file-manager, then you can double-click them to mount them and view their contents.

On the command-line, it's fairly trivial to manually mount them.

The few times I've had any problems connecting to a storage device, it's usually just been a case of needing to install some FUSE drivers (for NTFS or some other non-native file-system), or some additional tools to add desktop support for protocols like MTP (Media Transfer Protocol - for connecting to Android devices and certain media/MP3 players).

For MTP support on the desktop:
Depending on what desktop you are running, you might need to install the gvfs-backends package (for Gnome/Unity) or the KIO slave for MTP - not sure the exact package name offhand (for KDE/Plasma)

For interacting with MTP devices on the command-line you can also install the jmtpfs and mtp-tools packages.
 
Last edited:
As for steps when trouble-shooting something like a storage device, I usually check the following:
1. Is the USB cable broken?
Try a different cable

2. Is the USB port on the computer broken?
Try plugging in a device that you know works and verify that the port you are using isn't broken. If it is, try to find a port that isn't broken!

3. Is the device broken?
The device itself might seem OK, but if its USB port is broken/damaged, that wouldn't help with connecting to it!
Try plugging it in to another machine (your old system, a friend/relatives) to verify that the device is not broken/damaged/malfunctioning.

4. Does the device use any unusual protocols (e.g. MTP) or exotic file-systems?
This usually involves a little duckduckgo-fu. Try to find out a little about the device and whether you are able to use it with Linux.

Ensure you have the appropriate software/tools installed to be able to support these protocols/file-systems

After all of the above:
5. Is the device recognised by the kernel?
If you have verified that the device is working and that you have appropriate tools/software installed to be able to connect your system to the device, the kernel should be able to recognise the device when it is plugged in.

To verify, you can use:
Code:
sudo dmesg | tail
to see the last few messages from the kernel.
With any luck you should see some identifying information about your device.

In the case of mtp devices, you could also try using:
Code:
mtp-detect

If the device WAS recognised, but you are still unable to connect via your file-manager, it may be some quirk/bug with your file-manager.
In which case - as a last ditch solution, you could try manually mounting the device via the command-line. I won't go into how to manually mount a device here because this post is already well into TLDR; territory.

If the device was NOT recognised, then the chances are that the device requires a specific driver.

Some distros use slightly older versions of the Linux kernel. It could be that there is a driver for it in a newer version of the Linux kernel. Again, you'd have to do some keyboard kung-fu with your favourite search engine to research this.

If a driver is available in a newer version of the kernel, you can either install a newer version from your distros repos (if they have one) - or you could build and install it from source yourself.

However, if the device is extremely new, or very uncommon/obscure - it is possible that there are no drivers for it at all. But like I said previously, most storage devices use standard, generic protocols and file-systems and SHOULD be accessible/usable on Linux.
 

Members online


Latest posts

Top