How to report errors in linux

From CECS wiki
Jump to navigation Jump to search

If you are having problems in linux and want to ask for help with them, this is a guide on how to effectively report the errors you are getting.

Screen shot[edit]

You can generate a screenshot with the screenprint key. This is better than nothing, but it's about the worst possible way to report errors because:

  • It may not capture the full error log and important items may be missing
  • It may be difficult for us to read the results, especially if your screen is extra high resolution
  • We can't cut and paste pieces of the error for searches and commenting

If you don't know what to report, a screenprint might capture enough for us to tell you what to do next.

It is much preferable if you can give us a filename of a log file on the server or cut and paste the text directly rather than turning it into an image.

Describe your environment[edit]

  • Is this a server (which one?) or your desktop or laptop?
  • If this is your system, what operating system (e.g., ubuntu 16) are you running on it?
  • If this is on a server, give the hostname of the server
  • If this is python, indicate which version of python you are using (version 2, version 3, system python, python from anaconda, python from a module, etc.)
  • If this is a problem with a job you ran on a server, include the full path you ran it from and the name of the script that started the job. If this is a slurm job, include the job number if possible.

Collecting the errors[edit]

  • When you report the error, please give enough context. Don't give a few words of the error line, include the entire line and if possible a few lines before and after the error and the command that generated the error.
  • Screen dumps are the least effective way to report errors (but still better than incomplete reports). If possible, copy and paste the complete text of the error into a text email rather than sending an image.
  • If you can generate a log file, this would be even more helpful.
  • If the person you are asking for help has access to the same server, instead of sending all the pieces, give the full path to the directory and list the files of concern in that directory.

Copy and paste text[edit]

Windows[edit]

In windows, you can copy and paste text in several ways.

If the error is in a dialog box, you can:

  • click in the dialog box, press ctrl-a to select the text in the box (sometimes this works but you can't tell)
  • ctrl-c to copy the selected text
  • click on the receving window (such as an editor or email editor) and ctrl-v to paste.

If this is a terminal window (such as power shell. command prompt, or cmd):

  • highlight the desired text with the left mouse button
  • copy it by either clicking the right mouse button once or pressing enter
  • Paste it somewhere (as above) with ctrl-v

To save the entire contents of Terminal window

  • right-click the tab you're working in
  • select Export Text
  • You can then choose where to save the TXT file.

linux[edit]

In linux, you can use the mouse to copy and paste text from most windows.

When reporting errors this way, make sure you give us as much of the log as you can and include the command line that generated it. If you give us just the first or last line or two, you are probably missing the thing that actually caused the error.

To copy text:

  1. Move the mouse to the start of the text you want to copy.
  2. Press and hold the left mouse button and drag to the end of the text you want to copy.
  3. Release the left button.
  4. Press and release the right mouse button and select COPY from the menu.

To paste text:

  1. Move to the window you wish to paste the copied text into
  2. Make sure the window is prepared to have the pasted text typed into it.
  3. Press and release the right mouse button and select PASTE from the menu.

Saving error output to a file[edit]

If you are running a command that generates more output than fits on the screen (for example, the make command), instead of using copy-paste to save the errors, save it to a file instead.

If you are using the bash shell (linux default), you can use the following syntax to save all output to a file:

% make  |& tee output.txt

Then the output.txt file can be sent.