Questions tagged [error-handling]

Use this tag for questions on how to handle errors generated in shell scripts.

10
votes
3answers
8k views

Best practice to use $? in bash?

When I read this answer about $? another question comes to mind. Is there any best practice for how to use $? in bash? Let's have a example: We have a linear script and I we would like to know that ...
0
votes
0answers
16 views

EDUP WIFI instllation in Reaspberry pi error

I need to install the Wifi dongle into my raspberry zero for connecting to my home wifi modem, based on solving my previous question vi this link: https://raspberrypi.stackexchange.com/questions/...
0
votes
2answers
2k views

Will this damage my PC? GRUB_CMDLINE_LINUX_DEFAULT=“quiet splash pci=noaer pci=nomsi”

When I tried to install my Ubuntu 16.04.2 I faced with no screen problem! and PCI_bus errors! after many searching and trying only this modifications on /etc/default/grub solved my problem: ...
25
votes
5answers
41k views

Trap, ERR, and echoing the error line

I'm trying to create some error reporting using a Trap to call a function on all errors: Trap "_func" ERR Is it possible to get what line the ERR signal was sent from? The shell is bash. If I do ...
1
vote
1answer
1k views

/sbin/ldconfig.real: /usr/local/lib is not a known library type

I was following this instruction on this site to installing tesseract: https://github.com/tesseract-ocr/tesseract/wiki/Compiling git clone https://github.com/tesseract-ocr/tesseract.git cd tesseract ....
-1
votes
1answer
31 views

Why is this bash script read line code giving me errors? [closed]

Why is this bash script read line code giving me errors? read -p "Does this require cropping? (y/n)? " answer case ${answer:0:1} in y|Y ) mkdir cropped; for i in *.mp4; do ffmpeg -i "$i" -filter:...
2
votes
1answer
1k views

fontconfig warning: “/etc/fonts/fonts.conf”, line 100: unknown “element blank”

Getting this error on my vps server: fontconfig warning: "/etc/fonts/fonts.conf", line 100: unknown element "blank" This is the file: https://pastebin.com/VqcSgJ9x How to fix it?
0
votes
0answers
10 views

Bluetooth file transfer PC-to-Android fails

on sending a file from a debian machine to an android device over bluetooth using the blueman-sendto command it finishes with an error: _on_properties_changed (usr/lib/python3/dist-packages/blueman/...
0
votes
1answer
91 views

Debian sources errors

When I try to update my packages on my Chromebook (with Linux installed on it) I do this: sudo apt-get update, and it gives me this error: Ign:1 https://deb.debian.org/debian stretch InRelease Ign:2 ...
0
votes
1answer
171 views

E: Unable to locate package nvidia-graphics-drivers-418

My OS is Deepin 15.10. My GPU is NVIDIA Quadro 3000M. I want to play games on Linux. Steam has a program called Proton which enables this. Proton requires nvidia-418 or higher to work properly, so I ...
0
votes
3answers
97 views

Handle specific error in bash

As a part of my script, I want to publish package to nuget feed: dotnet nuget push package.1.2.3.nupkg --source "mysource" --api-key "mykey" The command may print error: 409 already contains version ...
0
votes
1answer
147 views

Update Failed: Download failed. cURL error 6: Could not resolve host:

I am getting the error "Update Failed: Download failed. cURL error 6: Could not resolve host:"  on WordPress on my vps server...I have also noticed it in other applications as well. As a consequence, ...
0
votes
1answer
30 views

ls reports nonexistent files first, ignoring the specified order

$ ls -lU a.txt test.sh badtest ls: cannot access 'badtest': No such file or directory -rw-r--r-- 1 gqqnbig gqqnbig 11 Apr 15 17:17 a.txt -rw-r--r-- 1 gqqnbig gqqnbig 11 Apr 16 17:22 test.sh Although ...
0
votes
3answers
62 views

Linux/Debian dpkg & administrator errors

So today I ran into a bunch of errors while using the sudo command on my Chromebook with Linux installed. For example when I try to remove my Google Chrome beta application, I tried this: sudo apt-...
3
votes
1answer
351 views

What are these three extra chars and why do they cause such a strange error? [duplicate]

Look at these two files: File 1 File 2 They look to me entirely identical, but File 1 has 41 bytes and File 2 has 44 bytes. Now, I would not care about 3 extra chars, however, I think these chars ...
1
vote
1answer
104 views

Checking for invalid date in bash script

I am checking for a valid date scrpt.bash test 2019-05-03 date -d $2 2>: 1>:; c=$? If $c is 1 then the date is invalid. If I enter 2019-05-03 I will get a 0 which is correct. If i enter 2019-...
0
votes
1answer
2k views

json.cpp:474:23: fatal error: curl/curl.h: No such file or directory

I am trying to compile ChatScript but I get this error message: json.cpp:474:23: fatal error: curl/curl.h: No such file or directory When I try apt-get install curl it says: curl is already ...
1
vote
2answers
1k views

Halt the execution when something is written to stderr

I have trouble with error handling in bash scripts. None of the solutions I have seen for error handling in bash seem to work so far for this example script: #!/usr/bin/env bash set -euo pipefail ...
9
votes
3answers
63k views

blk_update_request: I/O error, dev fd0, sector 0

I recently started noticing some blk_update_request: I/O error, dev fd0, sector 0 errors on my second computer running Arch Linux that I use as a server. This began when I had to reboot the computer ...
0
votes
0answers
309 views

how to make a Input/Output Error example?

I'm working on a simple game console for raspberry pi, and I want to handle some common errors like segmentation fault, arithmetic exception and input/output error (since there maybe some guys using ...
2
votes
1answer
56 views

Why does trap ERR behaviour differ over bash versions 3 and 4?

Background Execute the following code in bash 3, 4 and 5 respectively, and you will get differing results. (function handle_error () { echo ERROR; }; trap handle_error ERR; (exit 1)) Imagine that (...
0
votes
1answer
7k views

Cant Start Hostapd because multiple Errors

I have multiple errors while trying to start Hostapd I will post the errors output which i got after i tried to start it and looked at the status: root@l0calh0st:~# service hostapd status ● ...
10
votes
4answers
987 views

Silent disk errors and reliability of Linux swap

My understanding is that hard drives and SSDs implement some basic error correction inside the drive, and most RAID configurations e.g. mdadm will depend on this to decide when a drive has failed to ...
0
votes
1answer
52 views

clang: error: no such file or directory: '_REENTRANT'

I am trying to install UDUNITS-2 package for the graphical visual browser: ncview. I need to understand the following error message: clang: error: no such file or directory: '_REENTRANT' A similar ...
31
votes
7answers
216k views

How to close X Server, to avoid errors while updating nVidia driver?

I tried to update my nVidia driver but I got an error when I ran the driver installation. See the error: ERROR: You appear to be running an X server; please exit X before ...
1
vote
1answer
4k views

Running R script via shell script. syntax error near unexpected token `('

I am currently trying to run an R script via a shell script. Here the R script: test = rnorm(1:100, 1000) write.csv(test, 'test.csv') And here the bash script which calls the R one: #!/bin/bash -l ...
1
vote
1answer
26 views

djvulibre-3.5.27 Build Error

I am currently on Linux Mint 18.3. I downloaded the package from the Djvulibre website. Here is my error: make[2]: Entering directory '/home/amucs/Downloads/djvulibre-3.5.27/desktopfiles' PNG ...
0
votes
0answers
20 views

How can i check for errors of the nemo file manager?

Are there any terminal commands one can use to check if the nemo file manager (linux mint 19.1 cinnamon) is working properly? Asking, since i tend to get some error messages every now and then, ...
2
votes
3answers
10k views

Shell script `rm -r`: Redirect write-protected prompt and answer “n”

I have a few lines in a shell script whose function is to iterate through directories, match some names, and delete them. Some areas of the file system are write protected and I would like to leave ...
16
votes
2answers
5k views

rsync: skip files for which I don't have permissions

I'm using rsync -rlptD to copy a directory from another user. There are a few files (I have no way of knowing these in advance) which I don't have permission to copy. Is there a way have rsync ignore ...
0
votes
1answer
325 views

How to run Ansible playbooks only if there are no problems in the playbook?

I have learned of the command ansible-playbook example.yml --check which can tell me if something in my playbook is problematic (as far as Ansible can recognize). I think I should combine this ...
6
votes
3answers
814 views

How can I output a command to a file, without getting a blank file on error?

I'm trying to run a command, write that to a file, and then I'm using that file for something else. The gist of what I need is: myAPICommand.exe parameters > myFile.txt The problem is that ...
3
votes
1answer
878 views

trap on command exit not working unless used in a function or sub-shell

Am experimenting a bit with trap on invalid command return code using a sample code #!/bin/bash # Exit on error trap 'echo 'exiting..';exit' ERR set -e h=1 b=$((h+)) # <----- command causing ...
2
votes
1answer
102 views

Failing on errors inside a function which is called on the left-hand-side of an && expression

I am working on a Bash script with several functions. I would like to exit the script if any commands return an nonzero exit code, unless in a context where that code is being explicitly handled (such ...
0
votes
2answers
748 views

Can't run the exe file [closed]

I have a code (.c file). And used the following command; #!/bin/bash # gcc file.c -o file.exe #./file.exe So when I try to run the .exe file (using Wine) I get an error which says "wine: Bad ...
1
vote
2answers
4k views

/usr/bin/install: cannot stat `run': No such file or directory

Im trying to build embeded software using this RSDK toolchain but after make menuconfig and make Im getting following error make[7]: Entering directory `/mnt/hgfs/A/rtl819x-toolchain/users/gdb/gdb-6....
0
votes
4answers
73 views

How to debug my script?

This script name is hello for i in $(ls $*);do x=$(echo $(basename $i".md")); pandoc $i -t "latex" -o $x.pdf; done When I write this $ ./hello *bye.md This error ls: cannot access 'test': ...
1
vote
0answers
452 views

Error adding symbols: DSO missing from command line while compiling Ogre Meshy

Yes I read many questions for ex. this and this and this and this but nothing works for me. So basicaly Im trying to compile Ogre Meshy but Im getting an error [100%] Linking CXX executable bin/...
11
votes
5answers
7k views

Disable cron emails unless there are errors?

How can I only receive emails from cron if there are errors? In the overwhelmingly vast majority of cases, the tasks will run just fine - and I truly do not care about the output. It is only in the ...
1
vote
0answers
806 views

Yum not found on Centos 7 “ No module named yum”

I recently installed CentOS 7 but have run into an issue with yum. I get the following error: There was a problem importing one of the Python modules required to run yum. The error leading to this ...
0
votes
1answer
1k views

Writing the output of a command to a file in a bash script

I am trying to write a simple bash script that executes the command tcprobe -i $1 where $1 is an mp4 file. Then, I want to write the output of this command, which should be a long string of ...
4
votes
2answers
36k views

how to view php and server error logs?

I am getting the WSOD now since editing settings.php; php.ini and .htaccess trying to update my site and I need to see error logs to find out what is happening. Also how do you clear cache in command ...
0
votes
3answers
14k views

How do I fix wget on an HTTP url not trusted errors in kali?

When I try to run the wget command on http urls I get this error message: ERROR: The certificate of `url' is not trusted. ERROR: The certificate of `url' hasn't got a known issuer.
0
votes
2answers
1k views

Skip catching errors in a shell script

I have a script which compile a program. This program first compiles the source code using configure && make commands, then runs some tests using make test. This script also uses set -e to ...
15
votes
7answers
2k views

How can I check if a file can be created or truncated/overwritten in bash?

The user calls my script with a file path that will be either be created or overwritten at some point in the script, like foo.sh file.txt or foo.sh dir/file.txt. The create-or-overwrite behavior is ...
-3
votes
1answer
2k views

Can not download from an HTTPS site (ssl) with wget?

I know my version of wget is very old, but I can't get a download to work with it, # wget https://github.com/radare/radare2/archive/master.zip --2018-11-05 00:07:51-- https://github.com/radare/...
2
votes
0answers
306 views

wget a zip file from GitHub, OpenSSL error [closed]

$ wget -O sindresorhus-is-online-master.zip https://github.com/sindresorhus/is-online/archive/master.zip --2018-11-03 13:48:20-- https://github.com/sindresorhus/is-online/archive/master.zip Resolving ...
1
vote
1answer
2k views

Error trying to restart ssh

I am using Linux Mint 18, the same distribution I have been using most of the semester for school. I was tasked with making certain adjustments to the sshd_config file, including chaning the listening ...
0
votes
1answer
67 views

get an error typeset: not found when i launch my script by crontab?

I use this portion of code to set default values in my config on my script.sh # Copyright (c) 2015 # Licence MIT ( http://choosealicense.com/licenses/mit/ ). #!/bin/sh typeset -A config # init ...
1
vote
1answer
78 views

Shell script error to extract file data

I have attempted to write a shell script and it is giving an error which I cannot understand. The script goes like this: #!/bin/bash while read id do cat demuxR1/$id.barcode.in.R1.R1.fastq demuxR2/$...