You are not logged in.

#1 2016-06-28 01:42:10

Jean3799
Member
Registered: 2013-06-21
Posts: 31

How did you learn to debug linux?

A lot of you seem to know just what to do and what logs to look at when something is wrong.
Not to mention what commands to use to debug errors.

Honestly I don't even know where to start. With Windows when a problem arises, its just google, install some exe or change some settings with a gui and poof.
With Linux, I really don't know where to start. Google> Read about 10 threads> Problem solved(sometimes or maybe its still a bug inside xx application).

So where do I start to learn how to debug linux? What logs to read and how to understand the logs, what commands to run, etc.
Are there any resources anyone can link?
How did you get to where you are now with linux in terms of problem solving?

Offline

#2 2016-06-28 02:04:23

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: How did you learn to debug linux?

You are fortunate insofar as systemd has excellent logging capabilities: journalctl and systemctl status will generally provide sufficient information to identify your issue. See the systemd wiki page for details on querying the journal.
Many of the wiki pages (eg., pacman) also have their own troubleshooting sections.

Half the battle is guessing what is responsible for your issue, and then drilling down from there. For example, for display related issues, xorg.log is the first port of call. For hardware or lower-level issues, dmesg.


Most of the old timers learned their debugging skills when Allan was at the peak of his powers, regularly breaking things. Sadly, those days are past and we have to resort to breaking things ourselves in order to learn how they work. This is not nearly as much fun, nor as instructive, but we do it without complaint.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2016-06-28 04:11:22

Texbrew
Member
From: The Lone Star State
Registered: 2016-02-09
Posts: 580

Re: How did you learn to debug linux?

Good answer, Jason. @Jean, I'd like to encourage you to stick with it and don't give up if you don't find your solution right away. The Arch Linux Wiki is an excellent source of information (IMHO), and so is this forum.

Though I have been using linux for a while, I'm relatively new to Arch Linux, and I struggle with things now and then. I'm reluctant to ask what I think may turn out to be a stupid question on the forum, but I think that's as it should be. I'm supposed to do all I can to find answers on my own with web & forum searches before I ask a question that may have already been answered, or is poorly formed. Then, I ask a question.

Be patient with yourself, ask questions when you know your stuck, then be patient while waiting for an answer.
I sometimes read questions of a technical nature and have no idea how to help. Recently, I answered a post with a solution I found, hoping it would help that person or someone else who is stuck with the same issue.

When you find the solution to whatever problem you're having (if you posted about it), let the forum know with a follow up post.

I have much respect for the admins and regular users on this forum for being so tech-savvy, especially regarding Arch Linux.

tex

Offline

#4 2016-06-28 04:47:25

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: How did you learn to debug linux?

Texbrew wrote:

I'm supposed to do all I can to find answers on my own with web & forum searches before I ask a question that may have already been answered, or is poorly formed. Then, I ask a question.

^This. If you want to learn, try to solve the problem yourself. If nothing you try works, then you should seek help.

As for how I learnt to debug Linux, call it a mix of bad luck and the urge to tinker with stuff. Because of my bad luck, I have seen all sorts of problems, both hardware and software, and many a times coming across Heisenbugs tongue

Offline

#5 2016-06-28 06:25:29

bstaletic
Member
Registered: 2014-02-02
Posts: 658

Re: How did you learn to debug linux?

So everyone is telling to try fixing a problem on one's own, which is fine, but no-one mentioned man pages. I think man pages are an excelent source of information once you know what to look for.

How have I learnt linux as much as I have? Mostly it was me thinking to my self "Let's see how this weird thing work", or "Why would I need all this fancy stuff invented in the past 20 years? I'm going tomake my pc run without (initramfs|dbus|.dev)". In other words - tinkering for the sake of it.

x33a,

So that's what you call them.

Offline

#6 2016-06-28 14:43:16

Texbrew
Member
From: The Lone Star State
Registered: 2016-02-09
Posts: 580

Re: How did you learn to debug linux?

bstaletic wrote:

So everyone is telling to try fixing a problem on one's own, which is fine, but no-one mentioned man pages. I think man pages are an excelent source of information once you know what to look for.

That's certainly true. Admittedly, I forgot to mention the man pages.

At the beginning of my linux experience, man pages seemed so cryptic to me they were like a roadmap to nowhere. I had to seek answers elsewhere (web and forum searches). Man pages still hold a lot of mystery for me, but I'm learning. And I think I'm learning more about linux by using Arch Linux.

tex

Offline

#7 2016-06-28 15:06:17

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,740

Re: How did you learn to debug linux?

I think of it like this.   When one starts using Linux, one is issued a dunce cap.   As we learn and discover things, we are awarded with stickers -- a crescent moon, a star, whatever.  We affix those stickers to our caps.  After a while, we just look like wizards


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#8 2016-06-28 19:46:09

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: How did you learn to debug linux?

While reading threads,i often asked myself :

Why

do they ask for zyx log
are those lines in the log quoted and not those other lines


I did my best to understand the thought processes that lead to a solution.

@ewaller :
look like wizards seems the correct description.
can i get some lightning symbols for my dunce cap ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#9 2016-06-28 20:32:43

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: How did you learn to debug linux?

Dunce cap, huh?
Never heard it put that way before, but I like! big_smile

I'd just like to point out that my bathrobe has plenty of beautiful open space for affixing stickers as well.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#10 2016-06-28 20:53:02

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,740

Re: How did you learn to debug linux?

Eschwartz wrote:

I'd just like to point out that my bathrobe has plenty of beautiful open space for affixing stickers as well.

smile


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#11 2016-06-28 20:55:14

Awebb
Member
Registered: 2010-05-06
Posts: 6,275

Re: How did you learn to debug linux?

x33a wrote:

If you want to learn, try to solve the problem yourself. If nothing you try works, then you should seek help.

I find myself sliding from one self sustained community full of self sustained people to the next. Before the end of the day, we will have started to tell people to git gud, if they fail to exhibit effort and thoroughness.

Offline

#12 2016-06-28 22:33:06

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,448
Website

Re: How did you learn to debug linux?

Pretend to be Sherlock Holmes - but not until you realize, that despite the common phrasing to the contrary, deduction was not Holmes primary means of reasoning.  In contrast, Holmes primarily used adbuctive reasoning.

When you see a symptom, imagine the possible explanations that might account for the symptom.  Then figure out what other symptoms might be caused by each explanation and check for those until - in Holmsian style - you have elimanated the impossible and are left with the truth.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#13 2016-06-29 02:01:57

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,365
Website

Re: How did you learn to debug linux?

How did I learn to debug....   Stuff broke (entirely not my fault!) and I fixed it.

Offline

#14 2016-06-29 02:50:01

Rethil
Member
Registered: 2014-08-21
Posts: 83

Re: How did you learn to debug linux?

Ricing. Just tweak the hell out of you OS, break it, fix it, then fix your fixes because you will likely break something else, then if everything works you will notice that you could have choose other file system, other boot loader, other DE. Scrap it and start over and then break it. Eventually you will learn how things work and your intuition will start to point you the right way. That was my case anyway.

Last edited by Rethil (2016-06-29 02:51:22)

Offline

#15 2016-06-29 06:21:56

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: How did you learn to debug linux?

Eschwartz wrote:

Dunce cap, huh?
Never heard it put that way before, but I like! big_smile

I find your avatar very relevant to the discussion. Wizard of Tux tongue

Offline

#16 2016-06-29 13:40:15

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: How did you learn to debug linux?

Oooooh, I actually ran into a Linux software issue last night! I'll tell you my thought process. smile

Someone recently released a map application with offline map support (yippee!) for my phone, a Jolla mobile (Linux). It's called OSM Scout.

The developer left a comment explaining that, to configure offline map support, I'll need to following the instructions for downloading and converting maps found here and copy them to "~/Documents/Maps".

Downloading the map file from Open Street Maps wasn't too difficult.

Next, the instructions say to use the libosmscout "Import" tool to convert a map. I didn't know where that file was, so I looked on my phone using the find command: "find / | grep -i osmscout". I didn't see it. I then realized that it was part of the "libosmscout" library (because I used Google to learn a little about libosmscout, and how it's actually a backend library used for OSM apps), and that I didn't even need it on my phone. Instead, I could just convert the map on my Arch Linux computer and then copy the files to my phone.

I checked the Arch Linux repositories and the AUR for "libosmscout", but sadly there wasn't a PKGBUILD for it. (I even checked the old AUR3 for one!) So, I grabbed a copy of the code from here (I knew how to do that because Sourceforge tells me the exact git command to use on the webpage for the source code).

I saw that the library included a "Makefile", so I knew I could use the "make" command to build it. I typed "make"... and it failed miserably. big_smile So, I looked in the directory again and saw a "README" file. I read it (that's why it's there!) wink and it simple said to see further build instructions on the internet here.

I learned from the online build instructions that I actually need to use the command "make full" (not just "make"). (I briefly read through the build dependencies, but I didn't really bother checking for them because I have a TON of packages already installed on my computer... most likely I already have what I'll need.) And then, it started building!

...But! It finished with what kind of looked like an error message. sad

The error message said something about how a shell variable might not be set correctly. So, this time I went back to the build instructions and actually read them. wink It explains that some variables need to be set before compiling, and that a special script has been included, called "setupAutoconf.sh", to do that automatically.

I ran the script then ran "make full" again, but it failed again. So I checked the variable ("echo $PKG_CONFIG_PATH") and discovered that it hadn't actually been set. (Whatever.) So I simply copied and pasted the contents of the script into my terminal window, ran those commands, checked that the variable had been properly set (it was), and then ran "make full", which compiled everything cleanly. Yay! I now had the software needed to convert the OSM map into a usable form on my phone.

I ran the map converter and... it sorta failed.. maybe? I don't know. It was strange. I copied the output to my phone, started the map applications, and it promptly crashed. Well, that's no good!

Next, I did an internet search for the final output from the converter. I found someone that had a similar problem, and it was caused by running out of RAM. This makes sense to me, because the message had something to do with "malloc failing". The person's solution was to create a 16 GB swap space, and then it worked fine.

So! I went to the Arch Linux wiki page for creating swap files, followed the simple instructions to create a 16 GB swap file, ran the converter, and it worked quickly and cleanly. I copied the files to my phone and the map application worked perfectly too. (I disable wifi on my phone to make sure I was actually using my new offline maps.) I then cleanly removed my temporary swap file.

In conclusion, fixing my problem in Linux was a combination of using Google, reading output logs, reading the instructions that were provided to me, and my personal experience. I can't emphasize enough how important it is to actually read the logs and instructions, because if you ask for help on something when the information has already been given to you, well... that's when Arch Linux forum users get frustrated. wink

And you know, it's Ok to ask questions online when you're really stumped. It's better than banging your head against the computer unsuccessfully for hours (or days!). Note that there were TWO TIMES during my endeavors on this little project that I WOULD NOT have had the information I needed if someone hadn't aleady asked the question online and gotten an answer. smile

Last edited by drcouzelis (2016-06-30 11:59:43)

Offline

#17 2016-06-30 08:14:50

Texbrew
Member
From: The Lone Star State
Registered: 2016-02-09
Posts: 580

Re: How did you learn to debug linux?

@drcouzelis

Whoa, Nellie! That's what I call TENACITY. You have laid out in painstaking terms what it (sometimes) takes to solve a problem in linux. I read every word and punctuation mark of your post, only to get a firm grasp. Well said, Sir!

And I thought I had jumped through hoops trying to get a bluetooth speaker to stay connected using bluetoothctl, pacmd and pavucontrol on my Arch Linux SSD drive install. Haven't succeeded yet, but I ain't giving up. As many Arch Linux users know, it's a "get in there and get your hands dirty" kind of distro. I ain't complainin' either, I love Arch Linux!

Confession Time: This reply is being posted via debian-on-a-usb-stick, but ONLY so I can listen to George Jones on youtube https://www.youtube.com/watch?v=MPnRswZ … 1&index=15 and the aforementioned bluetooth speaker.

I will go back to the Arch Linux bluetooth speaker problem tomorrow if SWMBO allows it. It's 3:14am /etc/localtime and I've had enough debugging for one day.

RIP, George Jones... I hope my grandchildren get you.

Thanks to all of you who do your part to make Arch Linux the coolest linux flavor on the planet!

tex

Offline

Board footer

Powered by FluxBB