date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,542,262,746,000 |
I have two files:
File1.txt:
510806153|1||||33245|65|6236067806|25001|7746250
510806153|1||||33245|65|6968349321|25001|8956584
File2.txt
510806153|||||
When I do join -t \| -j 1 file1.txt file2.txt,
I get this output:
|||||6153|1||||33245|65|6236067806|25001|7746250
|||||6153|1||||33245|65|6968349321|25001|8956584
But when I do join -t \| -j 1 file2.txt file1.txt,
I get the correct join:
510806153||||||1||||33245|65|6236067806|25001|7746250
510806153||||||1||||33245|65|6968349321|25001|8956584
Why is join adding vertical bars to the first command?
|
It looks like file1.txt has CRLF line endings.
| Bash Join command inserting delimiter characters into first element |
1,542,262,746,000 |
I have ansbile inv
# cat inv
[all]
vm1
vm2
I want to extract them in a comma delimited list using Jinja template
so I add jinja template
# cat comb_list.j2
{{ groups['all'] | map('extract', hostvars, ['item']) | join(',') }}"
but I guess item is not a hostvars, so throws error
I want end file to look like this
# cat comb_list
vm1,vm2
|
The template
shell> cat comb_list.j2
{{ groups.all|join(',') }}
and the playbook
shell> cat playbook.yml
- hosts: all
gather_facts: false
tasks:
- template:
src: comb_list.j2
dest: comb_list
delegate_to: localhost
run_once: true
gives
shell> ansible-playbook -i inv playbook.yml
...
shell> cat comb_list
vm1,vm2
| how to join inventory items in a comma delimited list? |
1,542,262,746,000 |
I would like to merge two files, which share some common data. File 1 includes more than file 2. I want to merge the files based on their shared column following the order of file 1 and I want to add 0 to column 5 (AN1) when the variable is not present in file 2.
My files look like this:
File 1
CHR BP SNP CM base
20 61098 rs6078030 -0.00024510777 1
20 61795 rs4814683 0 1
20 63231 rs6076506 0.0005026053 1
20 63244 rs6139074 0.00050714752 1
File 2
CHR BP SNP CM AN1
20 9836704 rs221007 0 1
20 9817032 rs221011 0 1
20 9764069 rs2206484 0 1
20 9639395 rs4816159 0 1
I want to match them based on column 3 (SNP). I want to keep all the other columns for now.
My desired output would look like this (0 when rsX is not present):
File 3
CHR BP SNP CM base AN1
20 61098 rs6078030 -0.00024510777 1 1
20 61795 rs4814683 0 1 1
20 63231 rs6076506 0.0005026053 1 1
20 63244 rs6139074 0.00050714752 1 1
I figured that I need to do this in more than 1 step. I tried to use awk to to the first step but it only creates empty files.
awk -F' ' 'NR==FNR{e[$1$2]=1;next};e[$1$2]' file1 file 2 > file 3
awk -F' ' 'NR==FNR{e[$1$2]=1;next};e[1$2]' file2 file 1 > file 3
I guess the last step will be join file1 file 2 > file 3.
|
awk 'NR==FNR{ snp[$3]; next }
{ $6=($3 in snp)?(FNR==1?"AN1":"1"):"0" }1' file2 file1
| merging two files according to a common column and add 0 to those which are not present in file 2 |
1,542,262,746,000 |
var $abc contains:
abc jkl
def mno
ghi pqr
var $def contains:
stu
vwx
yz
Expected output:
abc jkl stu
def mno vwx
ghi pqr yz
heemayl's solution:
I tried paste <(echo "$abc") <(echo "$def") but it is giving output as below
ASFSFGFGGRRFDFFFFFH 33566
AHSHDFFBORDASHFYEHFYUCH 33568
FASFSSFHJUYRT 33371
FASIFIDFGGGDDDDD 33364
AFDDDGGGGGDER 33371
FDGGGGHJJK 16225
AISJFKDJFKDDKFJKDJFF 33568
KDFJKDJFKDJFKDFJK 33567
How to align the second column correctly?
Solution:
paste <(echo "$abc") <(echo "$def") | column -t
|
Using paste, with help from process substitution to get two file descriptors for paste to operate on:
paste <(echo "$abc") <(echo "$def")
Be careful with the quoting of the variables.
Example:
$ echo "$abc"
abc jkl
def mno
ghi pqr
$ echo "$def"
stu
vwx
yz
$ paste <(echo "$abc") <(echo "$def")
abc jkl stu
def mno vwx
ghi pqr yz
| Join multiple columns from multiple variables? [duplicate] |
1,542,262,746,000 |
With the following two simple files:
a.txt
1 a
2 b
5 c
b.txt
2 x
4 y
5 z
The following command does not behave like expected:
$ join -a 1 -a 2 -e 0 a.txt b.txt
1 a
2 b x
4 y
5 c z
I would expect the option -e 0 to fill up missing values with zeroes. However, the following does work:
$ join -a 1 -a 2 -e 0 -o auto a.txt b.txt
1 a 0
2 b x
4 0 y
5 c z
Reading documentation from $ man join, I see no connection between -o and -e that would make the above behaviour meaningful.
Instead, I find it misleading that a useless -o auto needs to be inserted into my command for -e 0 to work..
Is there an explanation? Or should I file this as a bug to coreutils?
|
Well, this has been filed as a formal report there. The answer is that there is a connection between -e and -o, which is explained in the info join page. A patch has been released to also clarify it in the man info page.
| Why do I need to specify `-o auto` for join's `-e` option to work? |
1,542,262,746,000 |
I have a tab-delimited file like shown below, and would like to merge the rows based on matches in any of the columns. The number of columns are usually 2, but could vary in some cases and be 3.
input:
AMAZON NILE
ALASKA NILE
HELLO MY
MANGROVE AMAZON
MY NAME
IS NAME
desired output:
AMAZON NILE ALASKA MANGROVE
HELLO MY NAME IS
How could one go about this with awk?
Will this work for the below file also?
input:
apple_bin2file strawberry_24files
mango2files strawberry_39files
apple_bin8file strawberry_39files
dastool_bin6files strawberry_40files
apple_bin6file strawberry_40files
orange_bin004file dastool_bin004files
orange_bin005file dastool_bin005files
apple_bin3file dastool_bin3files
apple_bin5file dastool_bin5files
apple_bin6file dastool_bin6files
apple_bin7file dastool_bin7files
apple_bin8file mango2files
expected output in tab-delimited format:
apple_bin2file strawberry_24files
mango2files strawberry_39files apple_bin8file
dastool_bin6files strawberry_40files apple_bin6file
orange_bin004file dastool_bin004files
orange_bin005file dastool_bin005files
apple_bin3file dastool_bin3files
apple_bin5file dastool_bin5files
apple_bin7file dastool_bin7files
Sorry to those who answered, I updated the input files!
|
Using GNU awk
gawk '
{
grp = 0
# see if any of these words already have a group
for (i=1; i<=NF; i++) {
if (group[$i]) {
grp = group[$i]
break
}
}
# no words have been seen before: new group
if (!grp) {
grp = ++n
}
# if we have not seen this word, add it to the output
for (i=1; i<=NF; i++) {
if (!group[$i]) {
line[grp] = line[grp] $i OFS
}
group[$i] = grp
}
}
END {
PROCINFO["sorted_in"] = "@ind_num_asc"
for (n in line) {
print line[n]
}
}
' input.file
With the first input:
AMAZON NILE ALASKA MANGROVE
HELLO MY NAME IS
With the second input (piping the output to column -t):
apple_bin2file strawberry_24files
mango2files strawberry_39files apple_bin8file
dastool_bin6files strawberry_40files apple_bin6file
orange_bin004file dastool_bin004files
orange_bin005file dastool_bin005files
apple_bin3file dastool_bin3files
apple_bin5file dastool_bin5files
apple_bin7file dastool_bin7files
| Merge rows using common values in any column |
1,542,262,746,000 |
I have multiple text files like below:
file1.txt:
# Program:featureCounts v1.6.0; Command:"featureCounts" "-a" "/documents/gencode_Release27_GRCh38.p10_PRI/gencode.v27.primary_assembly.annotation_nochr.gtf" "-F" "GTF" "-p" "-s" "2" "-T" "8" "-o" "/read_counts/S100A.txt" "/documents/S100A.sorted.bam"
Geneid Chr Start End Strand Length /path/to/documents/S100A.sorted.bam
ENSG00000223972.5 1;1;1;1;1;1;1;1;1 11869;12010;12179;12613;12613;12975;13221;13221;13453 12227;12057;12227;12721;12697;13052;13374;14409;13670 +;+;+;+;+;+;+;+;+ 1735 0
ENSG00000227232.5 1;1;1;1;1;1;1;1;1;1;1 14404;15005;15796;16607;16858;17233;17606;17915;18268;24738;29534 14501;15038;15947;16765;17055;17368;17742;18061;18366;24891;29570 -;-;-;-;-;-;-;-;-;-;- 1351 0
ENSG00000278267.1 1 17369 17436 - 68 0
ENSG00000243485.5 1;1;1;1;1 29554;30267;30564;30976;30976 30039;30667;30667;31109;31097 +;+;+;+;+ 1021 0
ENSG00000284332.1 1 30366 30503 + 138 0
ENSG00000237613.2 1;1;1;1;1 34554;35245;35277;35721;35721 35174;35481;35481;36073;36081 -;-;-;-;- 1219 0
file2.txt:
# Program:featureCounts v1.6.0; Command:"featureCounts" "-a" "/documents/gencode_Release27_GRCh38.p10_PRI/gencode.v27.primary_assembly.annotation_nochr.gtf" "-F" "GTF" "-p" "-s" "2" "-T" "8" "-o" "/read_counts/S106.txt" "/documents/S106.sorted.bam"
Geneid Chr Start End Strand Length /path/to/documents/S106.sorted.bam
ENSG00000223972.5 1;1;1;1;1;1;1;1;1 11869;12010;12179;12613;12613;12975;13221;13221;13453 12227;12057;12227;12721;12697;13052;13374;14409;13670 +;+;+;+;+;+;+;+;+ 1735 0
ENSG00000227232.5 1;1;1;1;1;1;1;1;1;1;1 14404;15005;15796;16607;16858;17233;17606;17915;18268;24738;29534 14501;15038;15947;16765;17055;17368;17742;18061;18366;24891;29570 -;-;-;-;-;-;-;-;-;-;- 1351 42
ENSG00000278267.1 1 17369 17436 - 68 12
ENSG00000243485.5 1;1;1;1;1 29554;30267;30564;30976;30976 30039;30667;30667;31109;31097 +;+;+;+;+ 1021 0
ENSG00000284332.1 1 30366 30503 + 138 0
ENSG00000237613.2 1;1;1;1;1 34554;35245;35277;35721;35721 35174;35481;35481;36073;36081 -;-;-;-;- 1219 1
Like above I have more than 100 text files. I want to combine them into single text file which should look like below.
Output should look like:
Geneid S100A S106
ENSG00000223972.5 0 0
ENSG00000227232.5 0 42
ENSG00000278267.1 0 12
ENSG00000243485.5 0 0
ENSG00000284332.1 0 0
ENSG00000237613.2 0 1
For removing the first line in the text file I used this tail -n +2 S100A.txt. But I have to do this on every file individually. How to get the desired output with a code in linux.
|
Awk solution:
awk 'BEGIN{ head = "Geneid" }
FNR == 2{
gsub(/^.+documents\/|\.sorted\.bam$/, "", $NF);
head = head "\t" $NF
}
FNR > 2{
genes[$1] = genes[$1] "\t" $NF;
order[FNR-2] = $1
}
END{
print head;
for (i = 1; i <= FNR-2; i++) print order[i] genes[order[i]]
}' file*.txt
FNR - record number being read
$NF - the last field value (NF itself points to the total number of fields)
genes - array containing accumulated sequence of last field values per gene id; the array is indexed by gene ids
order - auxiliary array indexed with record numbers to keep the initial order of gene ids
| How to join text files based on a column and removing the first line in linux? |
1,542,262,746,000 |
file1 :
HOUSAM1189870 3 0.00 0 -2450.00 11
HOUSAM1213135 3 0.00 0 -2620.00 2
HOCANM245675 3 0.00 0 0.00 0
HOUSAM1239242 3 0.00 0 -3113.00 8
file2 :
AY840F3001138842 20050301
AY840F3001140253 20060101
HOCANM245675 34409887
HOUSAM1239242 34444444
I want to join file1 and file2 based on common rows of their first column. therefore the output should be:
file3:
HOCANM245675 3 0.00 0 0.00 0 34409887
HOUSAM1239242 3 0.00 0 -3113.00 8 34444444
any suggestion, please ?
|
(note: this answer was written before the question was updated with the join command and the error messages)
the command is called join.
from the man page:
join - join lines of two files on a common field
since your input files are not sorted you need to sort them first
join <(sort file1) <(sort file2)
the <(...) things are called process substitution and is supported by bash and some other shells. if you have a shell that does not support process substitution then you have to work with intermediate files.
join is part of the gnu coreutils so it should be installed on most common gnu/linux systems.
| How to join 2 files based on common rows of first columns? |
1,542,262,746,000 |
I'm writing a bash script and part of the process requires to piece csv files together whilst preserving the integrity of the columns; for example I have two files in the following format:
F1
ID,MD,L1,L2,L3,GD,L4
12,OB,AA,PP,AA,TT,AA
15,OB,PP,PP,PP,TT,AA
F2
ID,MD,L7,L8,L9,L10,GD
13,OB,PP,AA,AA,AA,AA
15,OB,PP,PP,PP,AA,AA
The output would look as detailed below, in which the unmatched ID returns the value NM and the repeated column -in this case "GD"- is displayed according to the value per file:
ID,MD,L1,L2,L3,GD,L4,L7,L8,L9,L10,GD
12,OB,AA,PP,AA,TT,AA,NM,NM,NM,NM,NM
13,NM,NM,NM,NM,NM,NM,PP,AA,AA,AA,AA
15,OB,PP,PP,PP,TT,AA,PP,PP,PP,AA,AA
I've been trying to make join work as it seemed promising i.e.
join -t, -eNM -a1 -a2 -o 0,1.2,1.3,1.4,1.5,1.6,1.7,1.8,2.3,... F1 F2
but I'm running through some problems.
If I use the -o option it presumes I know the exact number of columns per file, which instead vary independently.
Errors leaked into result:
join: REPORT_2|15-10-2019|15:39:25.csv:5: is not sorted: 04181646
if there are other alternatives instead of join I am open to suggestions. thnks.
|
You could use a shell script to create the necessary -o options for you and to sort the data of your input files.
This assumes that the second field MD is present in both input files and only printed once in the output (skipped in the options for the second file).
#!/bin/bash
opts="0,"
# file1: get number of columms - 1 from the first line
numcols=$(awk -F',' '(NR==1) {print NF-1}' "$1")
# file1: add options
for i in $(seq "$numcols"); do
opts+=$(printf '1.%s,' "$((i+1))")
done
# file2: get number of columms - 2 from the first line
numcols=$(awk -F',' '(NR==1) {print NF-2}' "$2")
# file2: add options
for i in $(seq "$numcols"); do
opts+=$(printf '2.%s,' "$((i+2))")
done
opts=${opts:0:-1} # remove the last `,`
join -t, --header -eNM -a1 -a2 -o "$opts"\
<(head -n1 "$1"; tail -n+2 "$1" | sort -nk1,1)\
<(head -n1 "$2"; tail -n+2 "$2" | sort -nk1,1)
I added option --header to treat the first line as header line. The <(head -n1 "$1"; tail -n+2 "$1" | sort -nk1,1) is used to print the header line and sort the remaining lines by the first field numerically.
Make the script executable
chmod +x join.sh
and run it as
./join.sh file1 file2
| Merge CSV Files based on ID even when Unmatched IDS and Indefinite Number of Columns |
1,542,262,746,000 |
I have a text file like this
sp|QBWMM1-2|PDCI_Mouse(741-770) 8864=mil (25/2.20/2.50)
sp|Pm345|Hisf_Mouse(613-640) 776=mil (25/2.20/2.50)
sp|P0065-2|Hila_Mouse(344-393)6543=mil (25/2.20/2.50)
sp|Q90081|Rira_Mouse(47-72) 7365=mil (25/2.20/2.50)
sp|QQQQQ1|Ubs_Mouse(162-190) 22=mil (25/2.20/2.50)
I have another text file like this
sp|QBWMM1-2|PDCI_Mouse complex subunit alpha OS=Mouse OX=90009 PE=1 SV=1
sp|Pm345|Hisf_Mouse Heat shock 70 kDa protein 1A OS=Mouse OX=90009 PE=1 SV=1
sp|O15012|SCCC_Mouse Protein transport protein Sec16A OS=MOUSE OX=90009 PE=1 SV=4
sp|P0065-2|Hila_Mouse Filamin-A OS=MOUSE OX=90009 PE=1 SV=4
sp|Q90081|Rira_Mouse Alpha-actin OS=Mouse OX=90009 PE=1 SV=2
sp|QQQQQ1|Ubs_Mouse Tubulin alpha8 chain OS=Mouse OX=90009 PE=1 SV=1
sp|QQQQQ2|Ubs_Mouse Plasta-3 OS=Mouse OX=90009 PE=1 SV=4
I want to merge them together keep the similar part and put the rest together. So for example, in text 1 and text 2, the following are similar:
sp|QBWMM1-2|PDCI_Mouse(741-770) 8864=mil (25/2.20/2.50)
sp|QBWMM1-2|PDCI_Mouse complex subunit alpha OS=Mouse OX=90009 PE=1 SV=1
the first part is the most important. they are considered similar because they have similar strings sp|QBWMM1-2|PDCI_Mouse
then I want to put them togther and it becomes
sp|QBWMM1-2|PDCI_Mouse complex subunit alpha OS=Mouse OX=90009 PE=1 SV=1 (741-770) 8864=mil (25/2.20/2.50)
So the output could be like this:
sp|QBWMM1-2|PDCI_Mouse complex subunit alpha OS=Mouse OX=90009 PE=1 SV=1 (741-770) 8864=mil (25/2.20/2.50)
sp|Pm345|Hisf_Mouse Heat shock 70 kDa protein 1A OS=Mouse OX=90009 PE=1 SV=1 (613-640) 776=mil (25/2.20/2.50))
sp|O15012|SCCC_Mouse Protein transport protein Sec16A OS=MOUSE OX=90009 PE=1 SV=4
sp|P0065-2|Hila_Mouse Filamin-A OS=MOUSE OX=90009 PE=1 SV=4 (344-393)6543=mil (25/2.20/2.50)
sp|Q90081|Rira_Mouse Alpha-actin OS=Mouse OX=90009 PE=1 SV=2 47-72) 7365=mil (25/2.20/2.50)
sp|QQQQQ1|Ubs_Mouse Tubulin alpha8 chain OS=Mouse OX=90009 PE=1 SV=1 (162-190) 22=mil (25/2.20/2.50)
sp|QQQQQ2|Ubs_Mouse Plasta-3 OS=Mouse OX=90009 PE=1 SV=4
|
If file1 is your first text file, and file2 is your second text file, this should work in Bash:
join -a 1 <(sort -k1,1 file2) <(sed -E -e 's/([^\s])\(/\1 (/' file1 | sort -k1,1)
Join is called with two files as arguments, which two files (anonymous pipes or FIFOs actually) are the result of two process substitutions that take the form <(...)in the above command.
The second argument file contains a modified version of file1, having a space inserted before the first ( on each line so as to create a proper space-delimited join field; this modification is done by sed. The contents of both argument files are sorted based on the join field (i.e. field 1), as required by join. The -a 1 option ensures that non-pairable lines in file2 (i.e. the first argument file) are also output.
| how can I merge two text files together |
1,542,262,746,000 |
I have 70 directories that have files like below:
STAN002
|______ STAN002_sasions.tsv
PTAN044
|______ PTAN044_sasions.tsv
STAN005
|______ STAN005_sasions.tsv
STAN050
|______ STAN050_sasions.tsv
QRED034
|______ QRED034_sasions.tsv
.
.
.
PREC098
|______ PREC098_sasions.tsv
Each of the .tsv file which are in above directories have same number of columns (30 columns) and look like below in the picture:
The 1st and 2nd columns in the .tsv files are like below:
#gene1 gene2
VAV1 THAP4
ZNF75A ZNF263
KRCC1 POLR1A
H2AFV TANC1
B3GALT6 RP3-340N1.5
SH3BP1 CTD-2013M15.1(192243),EMB(3603711)
PTPRO VASN
Now, on linux using awk or any bash script I want to create a new column in all the .tsv files in the directories. The newly created column will be the 31st column in the files.
It should be like combining 1st and 2nd columns where the names are separated by --. The 31st column should look like below:
gene1--gene2
VAV1--THAP4
ZNF75A--ZNF263
KRCC1--POLR1A
H2AFV--TANC1
B3GALT6--RP3-340N1.5
SH3BP1--CTD-2013M15.1(192243),EMB(3603711)
PTPRO--VASN
I tried this way, but got wrong:
awk '{print $0, $1 "-" $NF}' STAN002_sasions.tsv
How to do that on linux in a single script on all the files? Any help is appreciated.
|
Your script is failing because you aren't specifying FS or OFS and you're using $NF instead of $2 to identify the 2nd field (and using "-" when you wanted "--" but that's nbd).
You were close though, try this:
$ awk 'BEGIN{FS=OFS="\t"} {print $0, $1 "--" $2}' STAN002_sasions.tsv
#gene1 gene2 #gene1--gene2
VAV1 THAP4 VAV1--THAP4
ZNF75A ZNF263 ZNF75A--ZNF263
KRCC1 POLR1A KRCC1--POLR1A
H2AFV TANC1 H2AFV--TANC1
B3GALT6 RP3-340N1.5 B3GALT6--RP3-340N1.5
SH3BP1 CTD-2013M15.1(192243),EMB(3603711) SH3BP1--CTD-2013M15.1(192243),EMB(3603711)
PTPRO VASN PTPRO--VASN
or if, as shown in your sample input/output, the first field on the first line of your input file can really start with a # which has to be removed when creating the new column header then:
$ awk 'BEGIN{FS=OFS="\t"} {g=$1} NR==1{sub(/^#/,"",g)} {print $0, g "--" $2}' STAN002_sasions.tsv
#gene1 gene2 gene1--gene2
VAV1 THAP4 VAV1--THAP4
ZNF75A ZNF263 ZNF75A--ZNF263
KRCC1 POLR1A KRCC1--POLR1A
H2AFV TANC1 H2AFV--TANC1
B3GALT6 RP3-340N1.5 B3GALT6--RP3-340N1.5
SH3BP1 CTD-2013M15.1(192243),EMB(3603711) SH3BP1--CTD-2013M15.1(192243),EMB(3603711)
PTPRO VASN PTPRO--VASN
If you have or can install GNU awk for "inplace" editing and want to update all files at once it'd be (obviously replace the string script with whichever of the above 2 scripts you decide to use):
awk -i inplace 'script' */*_sasions.tsv
Otherwise this will just take longer to run:
tmp=$(mktemp) || exit
for file in */*_sasions.tsv; do
awk 'script' "$file" > "$tmp" &&
mv -- "$tmp" "$file"
done
| How to create a new column in tsv files by combining two other columns on linux? |
1,542,262,746,000 |
I would like to merge two tables like this
Table_1
Chr1 5
Chr1 10
Chr1 20
Chr2 10
Chr2 30
Table_2
Chr1 10 value value2
Chr1 20 value value2
Chr2 30 value value2
Desired output
Chr1 5
Chr1 10 value value2
Chr1 20 value value2
Chr2 10
Chr2 30 value value2
I have found scripts in awk to merge tables conserving only rows that match by two columns in the two tables. But here, I would like all the rows of Table_1 but add the values for Table_2 if they match. Could you please tell me how to achieve this?
|
$ awk '{ key = $1 FS $2 };
NR == FNR { t[key] = $0; next };
key in t { print t[key]; next };
1' table2.txt table1.txt
Chr1 5
Chr1 10 value value2
Chr1 20 value value2
Chr2 10
Chr2 30 value value2
On every input line read (for both files read), the variable key is set to the first two fields ($1 and $2), with the field separator (FS) between them. FS is used because it's the only character guaranteed not to be in either field), so is the only character that is guaranteed to generate unique keys. This key is used as the index for an associative array called t.
While it reads table2.txt (which must be listed as the first filename arg on the command line), each input line is stored in an element of the t array.
If table2.txt contains duplicate entries - i.e. multiple lines with the same first two fields - it will only remember the last one seen. If you want it to remember all such duplicates (in the order that they were seen), change the second line of the awk script to:
NR == FNR { if (key in t) { t[key] = t[key] "\n" $0 } else { t[key] = $0 }; next };
When it has finished reading the first file, it reads in table1.txt (the second filename arg) and prints the corresponding entry from the table2 array if it exists, otherwise it prints the current line.
The 1 on the last line of the awk script is idiomatic awk shorthand for {print} - the value 1 evaluates as true, and the default action when something evaluates as true is to print the current line.
NOTE: if table2.txt is huge, this will use a lot of RAM. This is unlikely to be a problem on any modern system with gigabytes of RAM.
| Join two tables based on two columns in common and add NA or empty values if does not match |
1,542,262,746,000 |
I know there are some posts to join multiple files but it took so much time. I have multiple files in which the first columns are for the patients' IDs, then I want to join multiple files, based on the ID numbers in the first column.
The codes as below still work, but it took so much time. Thus, does anybody know more efficient way of doing this process?
for PHENO in A B C D E F G H I J K L M
do
join -a1 -a2 -e 1 -o auto chr2_${PHENO} chr3_${PHENO} >${PHENO}
done
for PHENO in A B C D E F G H I J K L M
do
for file in chr5_${PHENO} chr11_${PHENO} chr14_${PHENO} chr20_${PHENO} \
chr21_${PHENO} chr22_${PHENO} chr6_${PHENO} chr9_${PHENO} chr13_${PHENO} \
chr18-1_${PHENO} chr18-2_${PHENO} chr1-1_${PHENO} chr1-2_${PHENO} \
chr1-3_${PHENO} chr8-1_${PHENO} chr8-2_${PHENO} chr17-1_${PHENO} \
chr17-2_${PHENO} chr19-1_${PHENO} chr19-2_${PHENO} chr19-3_${PHENO} \
chr19-4_${PHENO} chr4-1_${PHENO} chr4-2_${PHENO} chr4-3_${PHENO} \
chr4-4_${PHENO} chr7-1_${PHENO} chr7-2_${PHENO} chr7-3_${PHENO} \
chr10-1_${PHENO} chr10-2_${PHENO} chr10-3_${PHENO} chr10-4_${PHENO} \
chr12-1_${PHENO} chr12-2_${PHENO} chr12-3_${PHENO} chr12-4_${PHENO} \
chr15-1_${PHENO} chr15-2_${PHENO} chr15-3_${PHENO} chr16-1_${PHENO} \
chr16-2_${PHENO} chr16-3_${PHENO}; do
join -a1 -a2 -e 1 -o auto ${PHENO} "$file" >${PHENO}.1
mv ${PHENO}.1 ${PHENO}
done
done
All the files as as below. 150001 patients, showing whether they have a disease or not as 0 or 1.
For example, chr2_${PHENO}
ID Disease
1 0
2 1
3 0
4 1
5 1
....
150000 0
150001 1
For example, chr3_${PHENO}
ID Disease
1 1
2 1
3 1
4 0
5 0
....
150000 0
150001 0
Thank you in advance!
|
OK. This is not an answer per se, but a post to perhaps clarify things.
Incorporate what you need into your question.
(And sorry, know it is not how things are normally done, but ...)
Does this resemble your files and needed result?
Here are two sample scripts. The first to generate dummy files:
chr1_A to chr6_A
chr1_B to chr6_B
chr1_C to chr6_C
Sorted by using LC_ALL=C sort -k 1b,1
#! /bin/bash
for p in A B C; do
for i in $(seq 1 6); do
f="chr${i}_$p"
printf 'ID %s\n' "$i.$p" >"$f"
paste <(shuf -n 24 -i 1-222) <(shuf -n 24 -i 0-1 -r) | \
LC_ALL=C sort -k 1b,1 >>"$f"
done
done
Giving a sample group like: paste chr* | column -t
ID 1.A ID 1.B ID 1.C ID 2.A ID 2.B ID 2.C ...
116 1 107 1 101 0 110 1 105 1 111 0 ...
126 1 11 1 105 0 111 1 106 1 117 1 ...
131 1 111 0 106 0 121 0 113 0 121 0 ...
141 0 133 0 110 0 124 0 147 0 145 0 ...
167 1 135 1 113 1 135 0 154 0 146 1 ...
...
Not sure if this is correct, you decide.
Second script is a modified version of yours (e.g. using dash for missing so that it is distinguishable from real data):
#! /bin/bash
for PHENO in A B C; do
join -a1 -a2 -e - -o auto chr1_${PHENO} chr2_${PHENO} >${PHENO}
done
for PHENO in A B C; do
for n in 3 4 5 6; do
file="chr${n}_$PHENO"
join -a1 -a2 -e - -o auto ${PHENO} "$file" >${PHENO}.1
mv ${PHENO}.1 ${PHENO}
done
done
Resulting in three files A, B and C:
$ paste A B C | column -t
ID 1.A 2.A 3.A 4.A 5.A 6.A ID 1.B 2.B 3.B 4.B 5.B 6.B ID 1.C 2.C 3.C 4.C 5.C 6.C
10 - - 1 1 - - 101 - - 1 - - 1 101 0 - 0 - - 1
100 - - - 0 - - 102 - - - - - 0 103 - - - - - 0
102 - - 1 - 0 - 105 - 1 0 - 0 - 105 0 - - - - -
108 - - 0 - - - 106 - 1 - - - 1 106 0 - - - 1 -
109 - - - - - 1 107 1 - - - - - 107 - - - - - 0
110 - 1 - - - - 109 - - - - - 0 108 - - - - - 0
111 - 1 - - - - 11 1 - - - - - 109 - - - 1 0 -
116 1 - - - - - 111 0 - - - - - 110 0 - - - - -
117 - - - - 1 - 113 - 0 - - - - 111 - 0 - - - -
...
# or
# paste <(sort -n A) <(sort -n B) <(sort -n C) | column -t
| join multiple files efficiently |
1,542,262,746,000 |
Is it possible to send the values as stored in variables instead of file2 file1. Kindly let me know how to pass the variables in the above-mentioned query. I tried to pass the variables into the query, but the variables store the value as a single row and I couldn't get the required output.
Thanks for the response. Consider the above-mentioned values in file1 &file2 are command outputs and I stored it in variables, and I want to know-how to pass those variables in this query. Hope this is clear.
[p001 ~]$ cat file1
30042020
29042020
28042020
27042020
26042020
25042020
24042020
[p001 ~]$ cat file2
303 30042020
259 29042020
288 28042020
402 27042020
75 26042020
207 25042020
[p9147724_local@dotenprlpbas001 ~]$ var1=$(cat file1)
[p9147724_local@dotenprlpbas001 ~]$ var2=$(cat file2)
[p001 ~]$ awk 'NR == FNR{ a[$2] = $1; next } { print $1, a[$1]+0 }' "$var2" "$var1"
awk: fatal: cannot open file `303 30042020 259 29042020 288 28042020 402 27042020 75 26042020 207 25042020' for reading (No such file or directory)
expected output:
30042020 303
29042020 259
28042020 288
27042020 402
26042020 75
25042020 207
24042020 0
|
You just need to change a[$1] = $2 to a[$2] = $1, so:
awk 'NR == FNR{ a[$2] = $1; next }; { print $1, $1 in a?a[$1]: "0" }' file2 file1
However that can be shortened to just:
awk 'NR == FNR{ a[$2] = $1; next } { print $1, a[$1]+0 }' file2 file1
Update: To reading the inputs from output of commands cmdX & cmdY.
awk 'NR == FNR{ a[$2] = $1; next } { print $1, a[$1]+0 }' <(cmdY) <(cmdX)
if the shell you are using doesn't support Process-Substitution: you can do as following:
( cmdY | ( cmdX | (
awk '
NR == FNR{ a[$2] = $1; next } { print $1, a[$1]+0 }
' /dev/fd/3 /dev/fd/4 ) 4<&0 ) 3<&0 )
| vlookup function in unix with columns changed |
1,542,262,746,000 |
For some reason my output of join is strange and scrambled; here is the command I use:
join -t, -j 1 -o1.1,2.2,1.2 f1 f2
Where f1:
1,87
and f2:
1,337
The output is:
,8737
and I am at loss as to why the output of join is not as expected. I have checked my locale already, with no luck.
Any ideas?
|
Your data file are DOS text files. Each line has a trailing carriage return character.
The output that you expect is
1,337,87
but since there is a carriage return after the 7 in 337 (from the DOS line-ending in the second file), the cursor moves back to the start of the line before printing ,87, overwriting 1,33 there.
Run dos2unix on the data files to convert them to Unix text files, or instruct whatever program that creates them to create Unix text files.
| join scrambles output |
1,542,262,746,000 |
I have two files:
File1
212 21 24.8 13.8354303 15.2841303
258 21 22.2 15.8507278 17.2994278
270 21 27.8 13.0482192 14.4969192
204 21 22.4 13.9465939 15.3952939
248 21 16.6 9.2714745 11.6494745
279 21 22.8 12.9151566 15.2931566
File2
212 21 24.8 1.03 2.8954
258 21 22.2 1.03 2.8954
270 21 27.8 1.05 2.9154
204 21 22.4 1.21 3.0754
248 21 16.6 1.29 3.1554
279 21 22.8 1.47 3.3354
and I must to join both in this way:
212 21 24.8 13.8354303 15.2841303 1.03 2.8954
258 21 22.2 15.8507278 17.2994278 1.03 2.8954
270 21 27.8 13.0482192 14.4969192 1.05 2.9154
204 21 22.4 13.9465939 15.3952939 1.21 3.0754
248 21 16.6 9.2714745 11.6494745 1.29 3.1554
279 21 22.8 12.9151566 15.2931566 1.47 3.3354
but, I used this awk command:
awk 'NR==FNR{a[$1]=$4 FS $5;next}$1 in a{print $1,$2,$3,$4,$5,a[$1]}' File2 File1 > output
and I got this file:
output
212 21 24.8 13.8354303 15.2841303
1.03 2.8954
258 21 22.2 15.8507278 17.2994278
1.03 2.8954
270 21 27.8 13.0482192 14.4969192
1.05 2.9154
204 21 22.4 13.9465939 15.3952939
1.21 3.0754
248 21 16.6 9.2714745 11.6494745
1.29 3.1554
279 21 22.8 12.9151566 15.2931566
1.47 3.3354
I don't know what I did wrong, my files have about 400 rows.
|
Assuming the data is sorted, for the type of situation I would use the join command
join -o 1.1 1.2 1.3 1.4 1.5 2.4 2.5 file1.txt file2.txt
212 21 24.8 13.8354303 15.2841303 1.03 2.8954
258 21 22.2 15.8507278 17.2994278 1.03 2.8954
270 21 27.8 13.0482192 14.4969192 1.05 2.9154
204 21 22.4 13.9465939 15.3952939 1.21 3.0754
248 21 16.6 9.2714745 11.6494745 1.29 3.1554
279 21 22.8 12.9151566 15.2931566 1.47 3.3354
You use -o to set the format in a x.y style where x is the file and y is the field.
| Error in awk for merge files |
1,542,262,746,000 |
I have two files. file1 has 6 columns, file2 has 2 columns. I want to replace the values in the 6th column of file1 by the values in column 2 of file2, based on matching ID variables (column 1 in both files).
Note: file2 contains more subjects than file1. Therefore the command below did not work unfortunately:
awk 'NR==FNR{tmp[$1]=$2;next}{print $0,tmp[$1]}' file2 file1
file1 looks like:
HG00096 HG00096 0 0 0 -9
HG00097 HG00097 0 0 0 -9
HG00099 HG00099 0 0 0 -9
HG00100 HG00100 0 0 0 -9
HG00102 HG00102 0 0 0 -9
file2 looks like:
HG00096 2
HG00097 5
HG00098 5
HG00099 3
HG00100 3
HG00101 5
HG00102 3
I would like the resulting file to look as follows:
HG00096 HG00096 0 0 0 2
HG00097 HG00097 0 0 0 5
HG00099 HG00099 0 0 0 3
HG00101 HG00100 0 0 0 5
HG00102 HG00102 0 0 0 3
|
You almost make it.
awk 'NR==FNR{tmp[$1]=$2;next};{$6=tmp[$1] ; print }' file2.txt file1.txt
Where:
$6 = tmp[$1] will replace 6th field.
| Replace values on the basis of matching ID variable |
1,542,262,746,000 |
Have two files which need to compare the first two columns.
Sample input file1:
|CID|SID|order|orderdate|confirmdate
|151244127820|7177638911583| 2|2015-02-04 07:14:44|2015-02-04 07:15:32
|151244127820|7177638922976| 4|2015-02-04 07:16:19|2015-02-04 07:19:47
|151244127824|7177638920385| 2|2015-02-04 07:14:22|2015-02-04 07:18:48
|151244127824|7177638924073| 3|2015-02-04 07:18:40|2015-02-04 07:20:11
|151244127825|7177638921040| 1|2015-02-04 07:12:58|2015-02-04 07:19:02
|151244127827|7177638917056| 2|2015-02-04 07:14:17|2015-02-04 07:17:31
|151244127827|7177638968972| 3|2015-02-04 07:17:36|2015-02-04 07:36:22
input file2:
|cID|SID|order|orderdate|confirmdate
|151244127820|7177638911583| 2|2015-02-04 07:14:44|2015-02-04 07:15:32
|151244127820|7177638922976| 4|2015-02-04 07:16:19|2015-02-04 07:19:47
|151244127834|7177638920385| 2|2015-02-04 07:14:22|2015-02-04 07:18:48
|151244127834|7177638924073| 3|2015-02-04 07:18:40|2015-02-04 07:20:11
|151244126585|7177638921040| 1|2015-02-04 07:12:58|2015-02-04 07:19:02
|151244126585|7177638917056| 2|2015-02-04 07:14:17|2015-02-04 07:17:31
|151244127827|7177638968970| 3|2015-02-04 07:17:36|2015-02-04 07:36:22
If the CID in the input file2 is not found in file1 then write the complete row in a new file. And if the CID in input file2 is found in file1, but the SID is not found, then write the complete row in a new file.
|
awk -F'|' 'FNR==NR{a[$2]=$2;b[$3]=$3;next};{if($2 in a){print $0 > "new_file_1"};if(($2 in a )&& !($3 in b)){print $0 > "new_file_2"}} file1 file2
details
...
{if($2 in a){print $0 > "new_file_1"} : if SID in file2 matches SID in file1 redirect to a file called new_file_1
..
if(($2 in a )&& !($3 in b)){print $0 > "new_file_2"} :if SID in file2 matches SID in file1 but CIDs does not match, redirect to a file called new_file_2
| Split the file comparing two fields in the files |
1,542,262,746,000 |
I have four csv files, and I want to update a set of three, based on the values in the fourth file.
file_1 contains names.
file_2 their numerical ids.
file_3 contains ids from file_1 and file_2, and values corresponding to each pair of id combinations.
file_4 contains values from some new name combinations.
What I need to do is append file_4's new names to file_1 and file_2, and auto-incrementally create ids for them. Then insert the values in file_3 according to the new id combinations. The problem is quite simple as explained by the example below, what complicates it a little bit is the presence of comma delimited sub-fields like "1,2,3" in some of the csvs.
I need to use a script to achieve this, though I realize it may be easier to use sql.
file_1
nid,vname
1,name1
2,name2
3,name3
file_2
did,dname
1,"s1,s2,s3"
2,s4
3,"s5,s6"
file_3
nid,did,value
1,1,aa
1,2,gg
1,3,tt
2,1,aa
2,2,ag
2,3,at
3,1,aa
3,2,tt
file_4
new_name,new_dataset,value
name1,"s7,s8",aa
name2,"s9,s10",gg
name8,"s1,s2,s3",aa
So the three updated files should look like:
file_1_updated
nid,vname
1,name1
2,name2
3,name3
4,name8
file_2_updated
did,dname
1,"s1,s2,s3"
2,s4
3,"s5,s6"
4,"s7,s8"
5,"s9,s10"
file_3_updated
nid,did,value
1,1,aa
1,2,gg
1,3,tt
1,4,aa
2,1,aa
2,2,ag
2,3,at
2,5,gg
3,1,aa
3,2,tt
4,1,aa
|
Here's what you could do in plain bash, assuming the data is exactly as you posted. (Warning: modifies the files in-place. Be careful to take backups before testing.)
A couple of functions to manage the first two files:
next_id() {
file="$1"
# assumes file is sorted by id
echo $(( $(tail -n 1 $file|cut -d, -f1) + 1 ))
}
Assuming file1 and file2 are sorted on the id column, this takes the first part of the last line and increments it by one, generating the next id.
find_or_create_id() {
file="$1"
item="$2"
# check if we already have that item
id=$(grep -m 1 ",$item$" "$file" 2> /dev/null)
if [[ $? -ne 0 ]] ; then
# generate the next id, append
id=$(next_id "$file")
echo "$id,$item" >> "$file"
else
# got it already
id=${id/,*}
fi
echo "$id"
}
This looks for an item (vname or dname) in one of the first two files. If it is found, return the existing id. If not, generate the next id and store it back into the file.
The main part is pretty simple once you've got the substrings right:
while read line ; do
col1=${line/,*} # everything up to first ,
col3=${line//*,} # everything after last ,
col2=${line%,*} # everything after first ,
col2=${col2#*,} # everything before last ,
id1=$(find_or_create_id file1 "$col1")
id2=$(find_or_create_id file2 "$col2")
# don't insert duplicates
if ! grep -m 1 -q "^$id1,$id2," file3 ; then
echo "$id1,$id2,$col3" >> file3
fi
done < <(tail -n +2 file4)
This will not insert into the last file in order, you'll get the new rows appended at the end.
That being said, if any of these files is non-trivial in size, a database would be appropriate. Look into SQLite if you don't want a database server.
Assuming you don't care about sequential ids (just that they're distinct), and you've put integer primary key autoincrement ids for table 1 and table 2 (plus unique keys on vname and dname), the update would look like (there are most likely more subtle ways than the insert or ignore approach):
insert or ignore into tab1(vname) select distinct vname from tab4;
insert or ignore into tab2(dname) select distinct dname from tab4;
insert or ignore into tab3(id1,id2,value)
select tab1.id, tab2.id, tab4.value
from tab4
left join tab1 on tab1.vname = tab4.vname
left join tab2 on tab2.dname = tab4.dname;
SQLite can deal with the " in your file just fine.
.separator ,
.import fileX tabX
does the Right Thing™, at least with the samples you have there.
Simple schema:
create table tab1 (id integer primary key autoincrement, vname text);
create unique index tab1_vname on tab1(vname);
create table tab2 (id integer primary key autoincrement, dname text);
create unique index tab2_dname on tab2(dname);
create table tab3 (id1 int, id2 int, value text,
constraint tab3_pk primary key(id1, id2));
create table tab4 (vname text, dname text, value text);
| How to update three CSV files based on a fourth file |
1,542,262,746,000 |
Say the directory contained 3 csv files:
The first csv:
Name, John
Age, 18
The second csv:
Name, Jim
Age, 21
The third csv:
Name, Amy
Age, 22
I would want the result to be:
Name, John, Jim, Amy
Age, 18, 21, 22
It's important to know the directory could have n many csvs
I have both bash and posix shell available
Edit:
This feels like it should work but still has an issue with regards to order:
awk -F, -v OFS="," '{a[FNR]=a[FNR]?a[FNR]FS$2:$1FS$2}END{for(x in a)print x,a[x]}' *.csv > results.csv
Which makes no sense as FNR 1 should be first in the array but it is printed last?
|
Your attempt was very close. Here are some modifications to make it work as required:
awk -F, -v OFS="," '{
a[FNR] = (FNR==NR ? $0 : a[FNR] OFS $2)
}
END {
for(i=1;i<=FNR;i++) print a[i]
}' *.csv
for (x in a) does not guarantee the array access order, so in order to keep the order, we run a numeric index into the for loop. We could also use for (i=1;i<=length(a);i++), but it's good to know that passing an array as an argument to length() is not standard for all awks, you can see this into the GNU awk manual.
See also: Scanning an Array
Also we use the conditional FNR==NR which is an idiom for "when parsing the first file", and want to save the whole line $0, for the next files we just append the second field.
| Merge all csv files in directory column wise |
1,542,262,746,000 |
This post may be looked upon as a followup to a previous post.
This is input file:
module ABC
x(a,b,c)
module DEFG
y(d,e,f,
g,h,i)
module HIJKL
z(j,k,l)
And output file should be:
module ABC x(a,b,c)
module DEFG y(d,e,f,
g,h,i)
module HIJKL z(j,k,l)
I tried using asterisk as a wildcard character in the solutions provided in the referenced post but it did not work as expected.
Addendum
Upon closer examination I found out that indeed the solutions provided earlier work for me as well (as pointed out by @steeldriver). The problem was that the file originated from a DOS/Windows platform and there was an unexpected ^M character that got inserted into the output, which was messing up down-the-line processing for me. I have now run dos2unix on the input file and the problem has gone away (i.e. the previous solutions work for me as well).
I am recommending that this post be closed as duplicate.
|
Here is a solution using awk :
awk '{if ($0 ~ /^module/) {ORS=""} else {ORS="\r\n"} ; print}'
| How to selectively join lines starting with a pattern [duplicate] |
1,542,262,746,000 |
I have around 250 .gtf files. Here I'm showing 3 .gtf files. All the .gtf files have three columns that look like below:
TUSCC120A.gtf
TUSCC36.gtf
TUSCC89B.gtf
TUSCC120A.gtf looks like below:
transcript MSTRG.6968.1 0.000000
transcript MSTRG.6968.2 1.000000
transcript MSTRG.6975.2 0.000000
transcript ENST00000446 3.000000
transcript ENST00000432 0.000000
TUSCC36.gtf looks like below:
transcript ENST00000446 3.456000
transcript MSTRG.6968.2 1.342000
transcript MSTRG.6968.1 0.000000
transcript MSTRG.6975.2 4.000000
transcript ENST00000432 5.000000
TUSCC89B.gtf looks like below:
transcript MSTRG.6975.2 2.213000
transcript MSTRG.6968.2 4.342000
transcript ENST00000432 2.000000
transcript ENST00000446 0.000000
transcript MSTRG.6968.1 3.000000
As you see the second column, has names that are in a different order in all 3 .gtf files. I'm trying to merge all three gtf files. I tried with paste
paste TUSCC120A.gtf TUSCC36.gtf TUSCC89B.gtf > output.txt
output.txt looks like:
transcript MSTRG.6968.1 0.000000 transcript ENST00000446 3.456000 transcript MSTRG.6975.2 2.213000
transcript MSTRG.6968.2 0.000000 transcript MSTRG.6968.2 1.342000 transcript MSTRG.6968.2 4.342000
transcript MSTRG.6975.2 0.000000 transcript MSTRG.6968.1 0.000000 transcript ENST00000432 2.000000
transcript ENST00000446 0.000000 transcript MSTRG.6975.2 4.000000 transcript ENST00000446 0.000000
transcript ENST00000432 0.000000 transcript ENST00000432 5.000000 transcript MSTRG.6968.1 3.000000
I want the output to be looked like below:
ID target_Ids TUSCC120A TUSCC36 TUSCC89B
transcript MSTRG.6968.1 0.000000 0.000000 3.000000
transcript MSTRG.6968.2 1.000000 1.342000 4.342000
transcript MSTRG.6975.2 0.000000 4.000000 2.213000
transcript ENST00000446 3.000000 3.456000 0.000000
transcript ENST00000432 0.000000 5.000000 2.000000
|
$ cat -f tst.awk
BEGIN {
header = "id" FS "target_id"
}
FNR == 1 {
f = FILENAME
sub(/\.gtf/,"",f)
header = header FS f
}
{
row[$2] = (FNR==NR ? $0 : row[$2] FS $3)
}
END {
print header
for (x in row) print row[x]
}
Usage:
$ awk -f tst.awk *.gtf
id target_id TUSCC120A TUSCC36 TUSCC89B
transcript MSTRG.6968.1 0.000000 0.000000 3.000000
transcript MSTRG.6975.2 0.000000 4.000000 2.213000
transcript MSTRG.6968.2 1.000000 1.342000 4.342000
transcript ENST00000446 3.000000 3.456000 0.000000
transcript ENST00000432 0.000000 5.000000 2.000000
| How to merge multiple files which are not in order and assign the name of file to a specific column in linux? |
1,587,369,408,000 |
I have an issue joining the two files linked below using join -t $'\t' -a1 file_1 file_2. I'm aware that one has to use specific flags when sorting in order to make join work, as explained in this and this post. Specifically, I have sorted both file_1 and file_2 using the following syntax: cat file_1 | LANG=en_EN sort k1b,1.
The error I get is this:
https://drive.google.com/open?id=1vlh9NqD1Nlm6dQi33Qt0gevsLfYxRURN
This is problematic. For example, entry "S2_005_008G1__bin.1" fails to be joined despite being present in both file_1 and file_2.
Sorry that I cannot give a simple toy example, but I've been unable to regenerate this error using hand-made files. I really at a loss as what might cause this issue.
file_1, file_2
|
You need to use matching options and locale settings for join and sort. If you tell join to use tab-separated fields, you also need to tell sort to use tab-separated fields (the default is whitespace-separated).
Setting the LANG environment variable may or may not set the LC_COLLATE locale setting: if the environment LC_COLLATE is set, it takes precedence over LANG, and if the environment variable LC_ALL is set, it sets all locale settings. See set LC_* but not LC_ALL
Unless you need to have the files sorted in a particular “human-friendly” way, use the C collation locale, which simply uses byte order. And unless you need some other locale setting to be different, set LC_ALL to be sure to override any setting inherited from the rest of the script or from a parent process. In any case, make sure to use the same locale settings for join and sort.
LC_ALL=C sort -t $'\t' -k 1b,1 file_1 >file_1.sorted
LC_ALL=C sort -t $'\t' -k 1b,1 file_2 >file_2.sorted
LC_ALL=C join -t $'\t' -a1 file_1.sorted file_2.sorted
| specific case where sort and join are not working |
1,587,369,408,000 |
I have two host file list like this:
file1.hosts
0.0.0.0 site1.com
0.0.0.0 site2.com
file2.hosts
0.0.0.0 site1.com
0.0.0.0 site3.com
Now I want one list that looks like this:
hosts.hosts
0.0.0.0 site1.com
0.0.0.0 site2.com
0.0.0.0 site3.com
What is the best way to get this?
I tried it with join but I don't get it to work.
|
You could use sort instead. The -u-Option supressed duplicates in the output:
$ sort -u file*.hosts | tee hosts.hosts
0.0.0.0 site1.com
0.0.0.0 site2.com
0.0.0.0 site3.com
Note that I'm using tee so that we get to see the output while creating the file.
You could just as well just use redirection instead:
$ sort -u file*.hosts > hosts.hosts
| Pair two file / Remove duplicate entries |
1,587,369,408,000 |
I have tried various solutions given in this site for this kind of problem and none of these are helping me out.
I have two files (space-separated, contains columns). Both the files contain the same number of records as given in my examples below.
Let me call the columns as A, B, C ... (These are the column headers.)
File 1:
A B C D
-----------
a1 b1 c1 d1
a2 b2 c2 d2
a3 b3 c3 d3
a4 b4 c4 d4
a5 b5 c5 d5
File 2:
E B A F
---------
1 b5 a5 f
2 b2 a2 f
1 a1 b1 f
1 a3 b3 f
2 a4 b4 f
I want to produce the merged file:
A B C D E
-------------
a1 b1 c1 d1 1
a2 b2 c2 d2 2
a3 b3 c3 d3 1
a4 b4 c4 d4 2
a5 b5 c5 d5 1
|
Does this come close to what you need (some formatting still to be done...)?
awk 'NR == FNR {T[$2,$3] = T[$3,$2] = $1; next} {print $0, T[$1,$2]}' file2 file1
A B C D E
-----------
a1 b1 c1 d1 1
a2 b2 c2 d2 2
a3 b3 c3 d3 1
a4 b4 c4 d4 2
a5 b5 c5 d5 1
| Joining two space-separated files based on matching values in two different columns |
1,587,369,408,000 |
I was trying to figure out how to see if there were any matches between column 2 of file1 and column 6 of file2. If so, I wanted that match printed along with the respective string in column 14 of file2, saved onto a different file, file3.
file1:
1 ENSCAFT00000037911
1 ENSCAFT00000046425
1 ENSC
1 ENSCAFT00000009252
1 ENSCAFT00000049028
1 ENSC
2 AFT00000000014
2 ENSCAFT00000042968
2 ENSCAFT000000
file2:
1 13336837 13358107 -1 SERPINB7 AFT00000000014 ENSCAFG00000023436 34.51 13.70 16.30 7.80 18.85 10.21 0.50
1 14028702 14130819 -1 PHLPP1 ENSCAFT00000000123 ENSCAFG00000000070 1531.81 1090.63 518.08 559.90 581.70 1126.21 0.41
1 14702158 14789303 1 PIGN ENSCAFT00000000137 ENSCAFG00000000083 979.07 882.88 296.70 272.97 369.74 877.13 0.31
1 17154193 17210961 -1 ZNF532 ENSCAFT00000049028 ENSCAFG00000000103 31.62 58.98 13.83 23.80 27.50 15.38 0.42
1 17154246 17210961 -1 NA ENSCAFT00000000164 ENSCAFG00000000103 31.62 58.98 13.83 23.80 27.50 15.38 0.42
1 17491358 17563171 1 ALPK2 ENSCAFT00000000169 ENSCAFG00000000107 12.18 10.55 39.99 31.41 210.85 15.82 3.14
1 18214832 18277601 1 ATP8B1 ENSCAFT00000000203 ENSCAFG00000000123 751.98 827.35 373.91 394.89 571.98 711.16 0.49
Desired Output:
ENSCAFT00000049028 0.42
AFT00000000014 0.50
The order does not matter.
|
Simple with join:
join -1 2 -2 6 -o 1.2,2.14 <(sort -k2 file1) <(sort -k6 file2 )
-1 2 defines that in file1 field 2 is the join field.
-2 6 defines that in file2 field 6 is the join field.
-o 1.2,2.14 is the output format file1 field 2 followed by file2 field 14.
<(sort ...) the two files must be sorted at the join field -k for join to work properly.
Or with awk (doesn't need a sorted input):
awk 'FNR==NR{a[$2]=$0} FNR!=NR&&a[$6]{print $6,$14}' file1 file2
FNR==NR applies to the first file file1:
a[$2]=$0 fills the a array with the 2nd field $2 as index.
FNR!=NR applies to the second file file2:
a[$6] if the 6th field $6 is present in the array a.
print $6,$14 print the two values.
| Finding Matches between two columns of different files and printing it out a different column |
1,587,369,408,000 |
I would like to merge two files, which share some common data. File 1 includes more than file 2. I want to merge the files based on their shared column (3) following the order of file 1 and I want to add 0 to column 5 (AN1) when the variable is not present in file 2, and if present, add the original value of AN1 (either 0 or 1).
My files look like this: File 1
CHR BP SNP CM base
20 61098 rs6078030 -0.00024510777 1
20 61795 rs4814683 0 1
20 63231 rs6076506 0.0005026053 1
20 63244 rs6139074 0.00050714752 1
File 2
CHR BP SNP CM AN1
20 9836704 rs221007 0 1
20 9817032 rs221011 0 0
20 9764069 rs2206484 0 0
20 9639395 rs4816159 0 1
I want to match them based on column 3 (SNP). I want to keep all the other columns for now.
My desired output would look like this (0 when rsX is not present, or when the original value of AN1 was 0):
File 3
CHR BP SNP CM base AN1
20 61098 rs6078030 -0.00024510777 1 1
20 61795 rs4814683 0 1 0
20 63231 rs6076506 0.0005026053 1 0
20 63244 rs6139074 0.00050714752 1 1
I need to modify this code according to the new conditions:
awk 'NR==FNR{ snp[$3]; next }
{ $6=($3 in snp)?(FNR==1?"AN1":"1"):"0" }1' file2 file1
Here I print 1 when rsX is present in file 1. I would like to print the original value of AN1 instead (0 or 1)
|
awk 'NR==FNR{ snp[$3]=$NF; next }
{ $6=($3 in snp)?(FNR==1?"AN1":snp[$3]):"0" }1' file2 file1
Things in awk:
NR: The total number of input records seen so far.
FNR: The input record number in the current input file and will reset to 1 for the next input file.
So condition NR==FNR will always true for the first input file only and the following block NR==FNR { ... } will execute when it's true and we do save last column value $NF into an awk array snp with column $3 as the keys.
next statement cause awk to skip executing the rest of the code and start over and if NF==FNR was still true it will repeat processing that block until all records/line of first input file read.
then in next block we add/update the value of column $6 with below conditions:
if column#3 in file1 was set in snp array from file2 then do:
if it's first line, set its value to AN1
if not first line, set its value to the value read from the snp[$3] array.
else set to 0.
the awk idom 1 used to print the result after all.
| Merging two files based on a common column; add 0 for variants not present in file 2, and keep the original value in those which are present |
1,587,369,408,000 |
I want to join two files on a Linux machine. I want to join the lines only included in the first file.
First file is unzipped file (no header, only one column).
1_4
3_4
4_63
6_2
Second file is gz file (with header, 16 columns).
CHR POS rsid SNPID Allele1 Allele2 AC_Allele2 AF_Allele2 imputationInfo N BETA SE Tstat p.value p.value.NA Is.SPA.converge
1 4 78 42 850 284 102 478 199 3777 485 2.5 2.4 23 35 336
8 3 74 24 0 2485 21 48 9 77 85 0.5 5.4 42 4312 335
many more lines
I tried as below.
join -11 -21 <(cat file1 | sort -k1,1) <(zcat file2.gz | sed 1,1d | awk 'NR>1{print $1"_"$2,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16}' | sort -k1,1) | awk '{print $1,$2,$3,$6,$5,$9+$10,$8,$11,$12,$7}' > outfile
The output file includes not only the lines included in the first file. Does anybody know what is wrong?
Thanks in advance!
|
You have one error that means you will miss the first line from file2. You have both sed 1,1d which will delete the first line, the header, but also NR>1 in the awk which will again skip the first line. You probably wanted this instead:
join -11 -21 <(cat file1 | sort -k1,1) \
<(zcat file2.gz | awk 'NR>1{print $1"_"$2,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16}' | sort -k1,1) |
awk '{print $1,$2,$3,$6,$5,$9+$10,$8,$11,$12,$7}'
That said, everything else should work as you describe. I tested using these example files:
$ cat file1
1_4
3_4
4_63
6_2
and
$ zcat file2
CHR POS rsid SNPID Allele1 Allele2 AC_Allele2 AF_Allele2 imputationInfo N BETA SE Tstat p.value p.value.NA Is.SPA.converge
1 4 78 42 850 284 102 478 199 3777 485 2.5 2.4 23 35 336
1 8 78 42 850 284 102 478 199 3777 485 2.5 2.4 23 35 336
And, as expected, I only got one line of output, for 1_4:
$ join -11 -21 <(cat file1 | sort -k1,1) \
<(zcat file2.gz | awk 'NR>1{print $1"_"$2,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16}' |
sort -k1,1) |
awk '{print $1,$2,$3,$6,$5,$9+$10,$8,$11,$12,$7}'
1_4 1 4 850 42 677 102 3777 485 284
If this is not what you are seeing, please edit your question and include an example we can actually use to reproduce the error.
| How to join two files in linux? |
1,587,369,408,000 |
I have a file named file1 with information like below:
TCONS_00000011 XLOC_000003 - u q1:MSTRG.39|MSTRG.39.9|4|0.000000|0.000000|0.000000|7468
TCONS_00000012 XLOC_000004 - u q1:MSTRG.41|MSTRG.41.1|2|0.000000|0.000000|0.000000|1270
TCONS_00000013 XLOC_000003 - u q1:MSTRG.39|MSTRG.39.10|2|0.000000|0.000000|0.000000|6835
TCONS_00000014 XLOC_000003 - u q1:MSTRG.39|MSTRG.39.11|2|0.000000|0.000000|0.000000|880
TCONS_00000015 XLOC_000003 - u q1:MSTRG.39|MSTRG.39.12|3|0.000000|0.000000|0.000000|377
TCONS_00000016 XLOC_000005 - u q1:MSTRG.2|MSTRG.2.1|1|0.000000|0.000000|0.000000|709
TCONS_00000017 XLOC_000006 - u q1:MSTRG.4|MSTRG.4.1|1|0.000000|0.000000|0.000000|343
TCONS_00000018 XLOC_000007 - u q1:MSTRG.40|MSTRG.40.1|7|0.000000|0.000000|0.000000|12112
TCONS_00000019 XLOC_000007 - u q1:MSTRG.40|MSTRG.40.2|2|0.000000|0.000000|0.000000|310
TCONS_00000020 XLOC_000007 - u q1:MSTRG.40|MSTRG.40.3|3|0.000000|0.000000|0.000000|538
TCONS_00000021 XLOC_000008 - u q1:MSTRG.42|MSTRG.42.1|9|0.000000|0.000000|0.000000|6331
TCONS_00000022 XLOC_000008 - u q1:MSTRG.42|MSTRG.42.2|5|0.000000|0.000000|0.000000|1311
TCONS_00000023 XLOC_000008 - u q1:MSTRG.42|MSTRG.42.3|5|0.000000|0.000000|0.000000|923
TCONS_00000024 XLOC_000008 - u q1:MSTRG.42|MSTRG.42.4|2|0.000000|0.000000|0.000000|455
TCONS_00000025 XLOC_000009 - u q1:MSTRG.7|MSTRG.7.1|1|0.000000|0.000000|0.000000|232
TCONS_00000026 XLOC_000010 - u q1:MSTRG.6|MSTRG.6.1|1|0.000000|0.000000|0.000000|483
TCONS_00000027 XLOC_000011 - u q1:MSTRG.12|MSTRG.12.1|2|0.000000|0.000000|0.000000|2489
TCONS_00000028 XLOC_000012 - u q1:MSTRG.14|MSTRG.14.1|1|0.000000|0.000000|0.000000|7604
TCONS_00000029 XLOC_000013 - u q1:MSTRG.55|MSTRG.55.1|4|0.000000|0.000000|0.000000|1511
And file2 is like below:
XLOC_000005
XLOC_000007
XLOC_000009
XLOC_000010
XLOC_000012
Based on information from file2 if it matches with second column in file1 I want to extract all information from file1. And the output should look like below:
TCONS_00000016 XLOC_000005 - u q1:MSTRG.2|MSTRG.2.1|1|0.000000|0.000000|0.000000|709
TCONS_00000018 XLOC_000007 - u q1:MSTRG.40|MSTRG.40.1|7|0.000000|0.000000|0.000000|12112
TCONS_00000019 XLOC_000007 - u q1:MSTRG.40|MSTRG.40.2|2|0.000000|0.000000|0.000000|310
TCONS_00000020 XLOC_000007 - u q1:MSTRG.40|MSTRG.40.3|3|0.000000|0.000000|0.000000|538
TCONS_00000025 XLOC_000009 - u q1:MSTRG.7|MSTRG.7.1|1|0.000000|0.000000|0.000000|232
TCONS_00000026 XLOC_000010 - u q1:MSTRG.6|MSTRG.6.1|1|0.000000|0.000000|0.000000|483
TCONS_00000028 XLOC_000012 - u q1:MSTRG.14|MSTRG.14.1|1|0.000000|0.000000|0.000000|7604
How can I do this linux?
|
This is probably what you want:
awk 'NR==FNR{a[$1]; next} $2 in a' file2 file1
| How to get all the matches from a file based on names in another file? [duplicate] |
1,587,369,408,000 |
I have 2 csv files. The first file is big (>400 fields and many rows > 1 mil) and needs to have another field appended to it, via a matched join.
I want to join on a field $170
I have tried
gawk 'BEGIN {OFS=FS=","} NR==FNR{b[$1]=$2; next}
$170 in b {print $0,b[$170]}
' b a
This works ok but struggles when file size increases, according to
Why isn't this awk command doing a full outer join? (see answer by @cuonglm)
I have not tested this, but want to know the 'best' method as file sizes increase.
@cuonglm suggests using join, but this re-arranges the columns to put the joined field first.
I cannot easily write a long output format for the join command using the -o argument because this would be very long:
join -1 170 -2 1 -o1.1 1.2 1.3 1.4......1.300.... file1 file2
Is there a way to get join to do this more easily?
Or should I just stick with gawk, as the file size issue (max 5 mil rows in both files a and b, both with about 500 columns, for example)?
|
I carried out a full-scale gawk test. I made a CSV of 5 million lines by 500 columns (20 GB), and a side file of 5 million lines by 2 columns. The key fields are unique (I had five million prime numbers hanging around) and were in column 170 of the big file and column 1 of the side file. Both the files contained the keys in independent random orders. All the other fields contained random choices from about 14000 words (ripped from man pages).
The awk script ran for almost 20 minutes and used about 0.8 GB of memory throughout. That's on a 4 GB Laptop and a 5400 rpm HDD. This log shows the times and file sizes, and the number of columns.
Paul--) time ./datMerge
real 18m31.740s
user 10m21.632s
sys 1m48.316s
Paul--) wc -lc *max*
5061456 20045559105 FileA.max.csv
5061456 85634275 FileB.max.csv
5061456 20085640276 FileC.max.csv
15184368 40216833656 total
Paul--) for f in F*max*; do
> awk '-F,' '{ printf ("%8d %s\n", NF, FILENAME); }' "${f}"
> done | uniq -c
5061456 500 FileA.max.csv
5061456 2 FileB.max.csv
5061456 501 FileC.max.csv
Paul--) ls -l F*max*
-rw-r--r-- 1 paul paul 20045559105 Feb 8 19:49 FileA.max.csv
-rw-r--r-- 1 paul paul 85634275 Feb 8 19:49 FileB.max.csv
-rw-r--r-- 1 paul paul 20085640276 Feb 8 20:24 FileC.max.csv
Paul--)
I made a mini version of the files to show what it does, six lines of six columns with the key in col 4.
Paul--) head F*mini*
==> FileA.mini.csv <==
rather,complies,finite,99999847,AM,Or
elapsed,plied,nearperfect,99999989,pr,WinChip
phiopt,reflects,bottom,99999959,128N,careful
fpackstructn,realworld,msingleexit,99999931,0xffff,maxmimum
simplified,mpopcntb,FrontCover,99999971,523x,requisite
cede,fdumprtlbtl2,atmega649a,99999941,LC_MESSAGES,errno
==> FileB.mini.csv <==
99999847,symbols
99999931,fdumprtldbr
99999959,ambiguous
99999971,crc
99999989,munsafedma
==> FileC.mini.csv <==
rather,complies,finite,99999847,AM,Or,symbols
elapsed,plied,nearperfect,99999989,pr,WinChip,munsafedma
phiopt,reflects,bottom,99999959,128N,careful,ambiguous
fpackstructn,realworld,msingleexit,99999931,0xffff,maxmimum,fdumprtldbr
simplified,mpopcntb,FrontCover,99999971,523x,requisite,crc
cede,fdumprtlbtl2,atmega649a,99999941,LC_MESSAGES,errno,Default
Paul--)
This is the merge script. I can post the data creation script if that would be informative.
Paul--) cat datMerge
#! /bin/bash
#: datMerge
LC_ALL="C"
function Merge {
local AWK='''
BEGIN { FS = ","; OFS = ","; K = 170; Null = "Default"; }
NR == FNR { htMap[$1] = $2; next; }
{ printf ("%s%s%s\n", $0, OFS, ($(K) in htMap) ? htMap[$(K)] : Null); }
'''
awk "${AWK}" "${@}"
}
Merge "FileB.max.csv" "FileA.max.csv" > "FileC.max.csv"
Paul--)
| join csv with many fields without disturbing order |
1,587,369,408,000 |
I have two files and I want to merge them in a way when some specific columns are the same, export those lines with all fields except one column, which to be the subtraction of the two files in that specific column.
For example, I have two files as follows and I want to output the lines where columns 1 to 3 are the same, and with column 4 equal to the subtraction of the two values in the files' column 4(File1 - File2).
File 1:
10 20 30 50
100 200 300 850
150 250 350 900
.....
FIle2:
100 200 300 840
15 25 35 55
150 250 350 880
....
output:
100 200 300 10
150 250 350 20
....
|
Using Awk:
$ awk '{k = $1 FS $2 FS $3} NR==FNR {a[k] = $4; next} k in a {print k, a[k]-$4}' File1 File2
100 200 300 10
150 250 350 20
| How to merge two files with common fields in specific columns |
1,587,369,408,000 |
I have 2 file:
file1
SC 65.696 618
SC 61.92 625
KN 82.546 1037
KN 82.946 1032
KN 82.849 1032
CN 70.55 618
and
file2
SC SC7 SCARE 588 2 75702
KN KN4 Kines 1033 2 1 3635
CN CNGC Prote 703 2 3880
need to join, according to column 1 and with repeated rows
file3
SC 65.696 618 SC SC7 SCARE 588 2 75702
SC 61.92 625 SC SC8 SCARE 588 2 75703
KN 82.546 1037 KN KN4 Kines 1033 2 1 3635
KN 82.946 1032 KN KN5 Kines 1033 2 1 3636
KN 82.849 1032 KN KN6 Kines 1033 2 1 3637
CN 70.55 618 CN CNGC Prote 703 2 3880
Thank you in advance,
|
This is the default behavior of join:
$ join <(sort file1) <(sort file2)
CN 70.55 618 CNGC Prote 703 2 3880
KN 82.546 1037 KN4 Kines 1033 2 1 3635
KN 82.849 1032 KN4 Kines 1033 2 1 3635
KN 82.946 1032 KN4 Kines 1033 2 1 3635
SC 61.92 625 SC7 SCARE 588 2 75702
SC 65.696 618 SC7 SCARE 588 2 75702
| How to merge/join two file based on common field with repeated rows [duplicate] |
1,587,369,408,000 |
I am trying to join two files with different rows but one element in common.
FILE1:
1/temperature
2/rainfall
3/snowfall
4/windspeed
5/winddirection
FILE2:
2008-10-01/1/68
2008-10-02/2/6
2008-10-03/3/4
2008-10-04/4/25
2008-10-05/5/120
2008-10-01/1/89
2008-10-01/4/35
2008-11-01/5/360
2008-10-01/1/45
2008-12-01/1/61
2008-10-10/1/32
I am trying to join both files using the following command
join -t/ -1 1 -2 2 FILE1 FILE2
I expect the following output:
1/temperature/2008-10-01/68
1/temperature/2008-10-01/89
1/temperature/2008-10-01/45
1/temperature/2008-12-01/61
1/temperature/2008-10-10/32
2/rainfall/2008-10-02/6
3/snowfall/2008-10-03/4
4/windspeed/2008-10-04/25
4/windspeed/2008-10-01/35
5/winddirection/2008-10-05/120
5/winddirection/2008-11-01/360
but I am having the first 5 rows in this way:
1/temperature/2008-10-01/68
2/rainfall/2008-10-02/6
3/snowfall/2008-10-03/4
4/windspeed/2008-10-04/25
5/winddirection/2008-10-05/120
Please your help what I am doing wrong
|
join expects its inputs to be sorted (on the fields that are to be joined). In this case (making use of the bash shell's process substitution):
$ join -t/ -1 1 -2 2 FILE1 <(sort -t/ -k2 FILE2)
1/temperature/2008-10-10/32
1/temperature/2008-10-01/45
1/temperature/2008-12-01/61
1/temperature/2008-10-01/68
1/temperature/2008-10-01/89
2/rainfall/2008-10-02/6
3/snowfall/2008-10-03/4
4/windspeed/2008-10-04/25
4/windspeed/2008-10-01/35
5/winddirection/2008-10-05/120
5/winddirection/2008-11-01/360
Note that the required sorting is lexical rather than numeric - if the first column values in FILE1 exceed 9, then you will likely need to pre-sort that as well.
| Join command is not working as expected |
1,587,369,408,000 |
I have 2 files that contain numbers_ID, status, descrpation I want to join both files based on the numbers as
number_123, status1, status2
My file 1:
number_123,this car is under maintenance
number_345,this car checked is done
number_356,this car is under main
My file 2:
number_123,hold
number_345,done
I need to join only the existing number in both files as :
number_123,hold,this car is under maintenance
number_345,done,this car checked is done
I used comm file1 file2 to find the common numbers but the file look like:
number_123,this car is under maintenance
number_123,hold
number_345,this car checked is done
number_345,done
How Can I print it in one line as
number_123,hold,this car is under maintenance
number_345,done,this car checked is done
|
The comm utility is used to compare whole lines between files. What you want to do is to join on a particular field.
$ join -t, file2 file1
number_123,hold,this car is under maintenance
number_345,done,this car checked is done
This assumes that both files are sorted on the join field (the first comma-delimited column in each file).
If the files are not sorted, you may pre-sort them using
sort -t, -k1,1 -o file1 file1
sort -t, -k1,1 -o file2 file2
In ksh93, bash or zsh, you may also do the sort "on the fly":
join -t, <( sort -t, -k1,1 file2 ) <( sort -t, -k1,1 file1 )
| Printing in one line the common text using comm cmd? |
1,587,369,408,000 |
I have 2 txt files, in one i have alias lists and the other is the servers name. So what im trying to do is to loop from the alias txt file line by line and where it will find the name that is on the other txt file ( servers name ) will be echo or writhe in other file. For example:
In this alias.txt file we have something like this
alias server1='ssh [email protected]'
alias server2='ssh [email protected]'
alias server3='ssh [email protected]'
alias l='ls -CF'
alias la='ls -A'
alias ll='ls -alF'
alias ls='ls --color=auto'
and in the other file we have just:
server1
server2
server3
Now when i list the alias.txt i like to compear the other txt files with the alias names and to gave me just the alias value. If he find server1 write to file or echo ssh [email protected] ...
The main point is I have many alias that are like server1 ( ssh connections ) but i like some servers not all of them and i need just specific ones ( in this example the ones that i have in the server.txt file )
Any hints ? :)
|
Would this work for you?:
$ grep -F -f serverlist.txt alias.txt
alias server1='ssh [email protected]'
alias server2='ssh [email protected]'
alias server3='ssh [email protected]'
It uses the lines of the serverlist.txt as patterns to match for showing lines form alias.txt. Depending on the names of your servers, it may need to be a little more complicated to not give wrong matches, like if a server is named just server.
It would be much more safe to first convert the plain server names to patterns only matching the left side of the alias definition:
$ sed "s/\(.*\)/^alias \1='/" serverlist.txt
^alias server1='
^alias server2='
^alias server3='
We can use -f - to read the patterns from stdin, just like we did directly from the file before:
$ sed "s/\(.*\)/^alias \1='/" serverlist.txt | grep -f - alias.txt
alias server1='ssh [email protected]'
alias server2='ssh [email protected]'
alias server3='ssh [email protected]'
| Compare strings |
1,587,369,408,000 |
I have two different files which some rows of the two data measures a same thing. I want to have a merged output such that the rows of File1 will be the output row where the rows measures same thing (second row of file1 and first line of file2 measures same thing. I want to have the file1 first line when column1 and column2 of the files are similar.)
...
File1:
1257, OBM , 47, 106, 1330
1257, IRK , 52, 104, 467
....
File2:
1257, IRK , 50, 100, 400
1000, CTK , 47, 106, 1330
....
output:
1257, OBM , 47, 106, 1330
1257, IRK , 52, 104, 467
1000, CTK , 47, 106, 1330
....
|
Use awk:
awk -F',' '!seen[$1,$2]++' file1 file2
Explanation:
In the beginning, the array item with key being fields $1,$2 is unassigned, thus false.
If it's false, !seen is true, so we increment it (make it true) and do the default action which is print.
If it's true (second time we see the same fields) !seen is false and awk will skip that line.
| Merge two texts with comparison of the rows and select one text's rows if some columns are similar |
1,587,369,408,000 |
I have two files I would like to join based on the bakery store number.
[File 1] bakedGoods.txt
1:Chocolate Cookies:111
2:Banana Muffins:222
3:Apple Pie:333
4:Strawberry Cheesecake:444
5:Pineapple Turnover:555
Where column 1 is the number of the item, column 2 is the item name, and column 3 is the store number.
[File 2] bakeryStores.txt
111:Cookies Cookies Cookies
222:Bellas Desserts Co.
333:Apples N' Sweets
444:Cheesecake Emporium
777:Estrellas Bakery
888:Suzy's Baked Goods
Where column 1 is the bakery store number and column 2 is the name of the bakery.
My goal is to join the information that has the same bakery store number by using the join command (I assume that is the best way). This means column 3 for file 1 and column 1 for file 2. As well as display a message "Not in store" for the empty fields that are not pair-able. (Which I assume using the option -e"Not in store" is the best way to go. The below is what I am trying to achieve.
111:Chocolate Cookies:Cookies Cookies Cookies
222:Banana Muffins:Bellas Desserts Co.
333:Apple Pie:Apples N' Sweets
444:Strawberry Cheesecake:Cheesecake Emporium
Not in store
Not in store
I try to join the two files by store number, I am also using the -e option (for the message), but nothing changes. I see no output either.
I tried join -1 3 -2 1 -e "Not in store" bakedGoods.txt bakeryStores.txt I understand what I want to do and how to do it, just not sure why it is not displaying anything. Usually, when I join or combine files, without appending, I can see the result right away. I appended but the two files remain the same.
|
Answer these two questions, and you will solve your problem.
What is the default field delimiter (for join)? How do you change it?
| Join two files based on shared key |
1,587,369,408,000 |
I am combining .jpg images which are correctly positioned in their jpg files.
So I think this position could be passed to an view format like pdf.
So I am doing now the following but it gives pictures in quite randomly positioned
pdfjoin *.jpg
|
The exif data did not help here, neither pdfjoin.
LaTeX is the right tool for the task in the thread How to rotate image 90 if height overful?
The case where both figure dimensions are greater than the page size is not solved.
I think you cannot solve the case by exiftool and pdfjoin directly because you have to related pictures to each other such that they are nicely orientated in the page.
| How to orientate many pictures well when pdfjoin *.jpg? [duplicate] |
1,587,369,408,000 |
I would like to run following command on 31 separated file name chr1.txt ... chr31.txt , and get 31 outputs only by one run.
this is command :
cat input.txt | sed 's/.\{5\}/& /g' > output.txt
any sugesstion please?
|
A simple loop will do the trick:
for((i=1;i<32;i++));do cat chr$i.txt | sed 's/.\{5\}/& /g' > output$i.txt; done
| how to run a command in many files by running the command only one time? |
1,587,369,408,000 |
join in coreutils reminds me of equijoin in SQL.
join writes to standard output a line for each pair of input lines that have identical join fields.
I am not very clear about what join does from the coreutile's manual. Could you explain what join does in terms of equijoin in SQL or operations in relational algebra?
Which fields are required to have identical values?
What differences are between join and equijoin?
Thanks.
|
The join utility, by default, does what's called an "inner join" in SQL, resulting in the combined records of those entries whose join field is identical in both files. Yes, this is an "equi-join" since it's using equality for the test between the fields.
The join utility can do inner joins (default), as well as left, right and outer joins (using -a1, -a2 and -a1 -a2 respectively). All these joins are "equi-joins" with join since equality is used for the comparison.
The join field is by default the first whitespace-separated field in each file, but this may be changed using the -1 and -2 command line options (for selecting the join field in the first and second file, respectively), and the delimiter may be changed to another single character using -t.
The default behaviour of join is similar to
SELECT * FROM table1 JOIN table2 ON (table1.firstfield = table2.firstfield);
except that you would only get one copy of the join field (firstfield here).
| What does `join` do in terms of equijoin in SQL or operations in relational algebra? |
1,587,369,408,000 |
I want to join two files, and I must use the command join.
This is first file
file1.txt
SUBJID SEX DTHHRDY
GTEX-1117F 2 4
GTEX-111CU 1 0
GTEX-111FC 1 1
GTEX-1122O 2 4
This is the second file
file2.txt
GTEX-1117F-003-a
GTEX-1117F-003-b
GTEX-111CU-0011-a
GTEX-111FC-0011
GTEX-1122O-0045-a
GTEX-1122O-0045-b
As you can see file 1 match with file 2 in column 1. Besides, I have to join these two fields filtering column 2 and 3 in file 1. For column 2 I have to take all values 2, for column 3 all values that are 4.
Output required
Sample SEX DTHHRDY
GTEX-1117F-003-a 2 4
GTEX-1117F-003-b 2 4
GTEX-1122O-0045-a 2 4
GTEX-1122O-0045-b 2 4
GTEX-1117F is related with GTEX-1117F-003-a because the two first lines are the same, the difference is -003-a but you can cut this and you will see that they are related. I tried join -1 1 -1 1 file1.txt file2.txt,
but I got this message "join: incompatible join fields 1, 2". Furthermore, I created two new files with this awk '{if ($2 == "2") print $1,2,3}' , so I have 12 data, but now I don't know how to join with file2.txt. Also, I must use join command
|
head -n 1 file1.txt
join <(paste -d" " <(cut -d- -f1-2 file2.txt) file2.txt | sort) \
<(tail -n +2 file1.txt | sort) \
| cut -d" " -f2- \
| awk '$2 == 2 && $3 == 4' \
| column -t
SUBJID SEX DTHHRDY
GTEX-1117F-003-a 2 4
GTEX-1117F-003-b 2 4
GTEX-1122O-0045-a 2 4
GTEX-1122O-0045-b 2 4
| How to join two files |
1,587,369,408,000 |
I need to merge two files based on the 1st and 2nd columns. I need to add the difference between 3rd and 4th columns and add TOTAL rows per type of 2nd column. Here are the two input files:
File 1:
VALIDATION_DATA_DBF DELETE 226 6.4
TXT_DBF DELETE 80 0.15
DEFAULT_PROFILE SELECT 45 1.2
TRAINING_DBF SELECT 130 5.25
TESTING_DBF SELECT 5 0.001
WARNING_DBF UPDATE 8 0.055
WARNING_DBF INSERT 5 2.4
File 2:
VALIDATION_DATA_DBF DELETE 200 7.4
TXT_DBF DELETE 70 1.15
DEFAULT_PROFILE SELECT 40 0.2
TRAINING_DBF SELECT 135 7.25
TESTING_DBF SELECT 7 0.009
PERF_DBF SELECT 10 0.004
WARNING_DBF UPDATE 2 1.055
The merged output file should be as shown below:
TABLE TYPE COUNT1 COUNT2 DIFF_COUNT TIME1 TIME2 DIFF_TIME
VALIDATION_DATA_DBF DELETE 226 200 26 6.4 7.4 -1
TXT_DBF DELETE 80 70 10 0.15 1.15 -1
TOTAL DELETE 306 270 36 6.55 8.55 -2
DEFAULT_PROFILE SELECT 45 40 5 1.2 0.2 1
TRAINING_DBF SELECT 130 135 -5 5.25 7.25 -2
TESTING_DBF SELECT 5 7 -2 0.001 0.009 -0.008
PERF_DBF SELECT 0 10 -10 0 0.004 -0.004
TOTAL SELECT 180 192 -12 6.451 7.463 -1.012
WARNING_DBF UPDATE 8 2 6 0.055 1.055 -1
TOTAL UPDATE 8 2 6 0.055 1.055 -1
WARNING_DBF INSERT 5 0 5 2.4 0 2.4
TOTAL INSERT 5 0 5 2.4 0 2.4
|
Using GNU awk for arrays of arrays and ARGIND:
awk '
{
counts[$2][$1][ARGIND] = $3
times[$2][$1][ARGIND] = $4
}
END {
print "TABLE", "TYPE", \
"COUNT1", "COUNT2", "DIFF_COUNT", \
"TIME1", "TIME2", "DIFF_TIME"
for ( type in counts ) {
delete totCounts
delete totTimes
for ( table in counts[type] ) {
print table, type, \
counts[type][table][1]+0, \
counts[type][table][2]+0, \
counts[type][table][1] - counts[type][table][2], \
times[type][table][1]+0, \
times[type][table][2]+0, \
times[type][table][1] - times[type][table][2]
totCounts[1] += counts[type][table][1]
totCounts[2] += counts[type][table][2]
totTimes[1] += times[type][table][1]
totTimes[2] += times[type][table][2]
}
print "TOTAL", type, \
totCounts[1], totCounts[2], totCounts[1] - totCounts[2], \
totTimes[1], totTimes[2], totTimes[1] - totTimes[2]
}
}
' file1 file2 | column -t
TABLE TYPE COUNT1 COUNT2 DIFF_COUNT TIME1 TIME2 DIFF_TIME
VALIDATION_DATA_DBF DELETE 226 200 26 6.4 7.4 -1
TXT_DBF DELETE 80 70 10 0.15 1.15 -1
TOTAL DELETE 306 270 36 6.55 8.55 -2
WARNING_DBF UPDATE 8 2 6 0.055 1.055 -1
TOTAL UPDATE 8 2 6 0.055 1.055 -1
WARNING_DBF INSERT 5 0 5 2.4 0 2.4
TOTAL INSERT 5 0 5 2.4 0 2.4
PERF_DBF SELECT 0 10 -10 0 0.004 -0.004
TESTING_DBF SELECT 5 7 -2 0.001 0.009 -0.008
TRAINING_DBF SELECT 130 135 -5 5.25 7.25 -2
DEFAULT_PROFILE SELECT 45 40 5 1.2 0.2 1
TOTAL SELECT 180 192 -12 6.451 7.463 -1.012
| how to merge and amend columns of two files |
1,361,905,344,000 |
Is it possible to cause a kernel panic with a single command line?
What would be the most straightforward such command for a sudoing user and what would it be for a regular user, if any?
Scenarios that suggest downloading something as a part of the command do not count.
|
FreeBSD:
sysctl debug.kdb.panic=1
Linux (more info in the kernel documentation):
echo c > /proc/sysrq-trigger
| How to cause kernel panic with a single command? |
1,361,905,344,000 |
I know what a kernel panic is, but I've also seen the term "kernel oops". I'd always thought they were the same, but maybe not. So:
What is a kernel oops, and how is it different from a kernel panic?
|
An "oops" is a Linux kernel problem bad enough that it may affect system reliability.
Some "oops"es are bad enough that the kernel decides to stop running immediately, lest there be data loss or other damage. These are called kernel panics.
The latter term is primordial, going back to the very earliest versions of Linux's Unix forebears, which also print a "panic" message on the console when they happen. The original AT&T Unix kernel function that handles such conditions is called panic(). You can trace it back through the public source code releases of AT&T Unix to its very first releases:
The OpenSolaris version of panic() was released by Sun in 2005. It is fairly elaborate, and its header comments explain a lot about what happens in a panic situation.
The Unix V4 implementation of panic() was released in 1973. It basically just prints the core state of the kernel to the console and stops the processor.
That function is substantially unchanged in Unix V3 according to Amit Singh, who famously dissected an older version of Mac OS X and explained it. That first link takes you to a lovely article explaining macOS's approach to the implementation of panic(), which starts off with a relevant historical discussion.
The "unix-jun72" project to resurrect Unix V1 from scanned source code printouts shows a very early PDP-11 assembly version of this function, written sometime before June 1972, before Unix was fully rewritten in C. By this point, its implementation is whittled down to a 6-instruction routine that does little more than restart the PDP-11.
| What's the difference between a kernel oops and a kernel panic? |
1,361,905,344,000 |
I'm running an Ubuntu 12.04 derivative (amd64) and I've been having really strange issues recently. Out of the blue, seemingly, X will freeze completely for a while (1-3 minutes?) and then the system will reboot. This system is overclocked, but very stable as verified in Windows, which leads me to believe I'm having a kernel panic or an issue with one of my modules. Even in Linux, I can run LINPACK and won't see a crash despite putting ridiculous load on the CPU. Crashes seem to happen at random times, even when the machine is sitting idle.
How can I debug what's crashing the system?
On a hunch that it might be the proprietary NVIDIA driver, I reverted all the way down to the stable version of the driver, version 304 and I still experience the crash.
Can anyone walk me through a good debugging procedure for after a crash? I'd be more than happy to boot into a thumb drive and post all of my post-crash configuration files, I'm just not sure what they would be. How can I find out what's crashing my system?
Here are a bunch of logs, the usual culprits.
.xsession-errors: http://pastebin.com/EEDtVkVm
/var/log/Xorg.0.log: http://pastebin.com/ftsG5VAn
/var/log/kern.log: http://pastebin.com/Hsy7jcHZ
/var/log/syslog: http://pastebin.com/9Fkp3FMz
I can't even seem to find a record of the crash at all.
Triggering the crash is not so simple, it seem to happen when the GPU is trying to draw multiple things at once. If I put on a YouTube video in full screen and let it repeat for a while or scroll through a ton of GIFs and a Skype notification pops up, sometimes it'll crash. Totally scratching my head on this one.
The CPU is overclocked to 4.8GHz, but it's completely stable and has survived huge LINPACK runs and 9 hours of Prime95 yesterday without a single crash.
Update
I've installed kdump, crash, and linux-crashdump, as well as the kernel debug symbols for my kernel version 3.2.0-35. When I run apport-unpack on the crashed kernel file and then crash on the VmCore crash dump, here's what I see:
KERNEL: /usr/lib/debug/boot/vmlinux-3.2.0-35-generic
DUMPFILE: Downloads/crash/VmCore
CPUS: 8
DATE: Thu Jan 10 16:05:55 2013
UPTIME: 00:26:04
LOAD AVERAGE: 2.20, 0.84, 0.49
TASKS: 614
NODENAME: mightymoose
RELEASE: 3.2.0-35-generic
VERSION: #55-Ubuntu SMP Wed Dec 5 17:42:16 UTC 2012
MACHINE: x86_64 (3499 Mhz)
MEMORY: 8 GB
PANIC: "[ 1561.519960] Kernel panic - not syncing: Fatal Machine check"
PID: 0
COMMAND: "swapper/5"
TASK: ffff880211251700 (1 of 8) [THREAD_INFO: ffff880211260000]
CPU: 5
STATE: TASK_RUNNING (PANIC)
When I run log from the crash utility, I see this at the bottom of the log:
[ 1561.519943] [Hardware Error]: CPU 4: Machine Check Exception: 5 Bank 3: be00000000800400
[ 1561.519946] [Hardware Error]: RIP !INEXACT! 33:<00007fe99ae93e54>
[ 1561.519948] [Hardware Error]: TSC 539b174dead ADDR 3fe98d264ebd MISC 1
[ 1561.519950] [Hardware Error]: PROCESSOR 0:206a7 TIME 1357862746 SOCKET 0 APIC 1 microcode 28
[ 1561.519951] [Hardware Error]: Run the above through 'mcelog --ascii'
[ 1561.519953] [Hardware Error]: CPU 0: Machine Check Exception: 4 Bank 3: be00000000800400
[ 1561.519955] [Hardware Error]: TSC 539b174de9d ADDR 3fe98d264ebd MISC 1
[ 1561.519957] [Hardware Error]: PROCESSOR 0:206a7 TIME 1357862746 SOCKET 0 APIC 0 microcode 28
[ 1561.519958] [Hardware Error]: Run the above through 'mcelog --ascii'
[ 1561.519959] [Hardware Error]: Machine check: Processor context corrupt
[ 1561.519960] Kernel panic - not syncing: Fatal Machine check
[ 1561.519962] Pid: 0, comm: swapper/5 Tainted: P M C O 3.2.0-35-generic #55-Ubuntu
[ 1561.519963] Call Trace:
[ 1561.519964] <#MC> [<ffffffff81644340>] panic+0x91/0x1a4
[ 1561.519971] [<ffffffff8102abeb>] mce_panic.part.14+0x18b/0x1c0
[ 1561.519973] [<ffffffff8102ac80>] mce_panic+0x60/0xb0
[ 1561.519975] [<ffffffff8102aec4>] mce_reign+0x1f4/0x200
[ 1561.519977] [<ffffffff8102b175>] mce_end+0xf5/0x100
[ 1561.519979] [<ffffffff8102b92c>] do_machine_check+0x3fc/0x600
[ 1561.519982] [<ffffffff8136d48f>] ? intel_idle+0xbf/0x150
[ 1561.519984] [<ffffffff8165d78c>] machine_check+0x1c/0x30
[ 1561.519986] [<ffffffff8136d48f>] ? intel_idle+0xbf/0x150
[ 1561.519987] <<EOE>> [<ffffffff81509697>] ? menu_select+0xe7/0x2c0
[ 1561.519991] [<ffffffff815082d1>] cpuidle_idle_call+0xc1/0x280
[ 1561.519994] [<ffffffff8101322a>] cpu_idle+0xca/0x120
[ 1561.519996] [<ffffffff8163aa9a>] start_secondary+0xd9/0xdb
bt outputs the backtrace:
PID: 0 TASK: ffff880211251700 CPU: 5 COMMAND: "swapper/5"
#0 [ffff88021ed4aba0] machine_kexec at ffffffff8103947a
#1 [ffff88021ed4ac10] crash_kexec at ffffffff810b52c8
#2 [ffff88021ed4ace0] panic at ffffffff81644347
#3 [ffff88021ed4ad60] mce_panic.part.14 at ffffffff8102abeb
#4 [ffff88021ed4adb0] mce_panic at ffffffff8102ac80
#5 [ffff88021ed4ade0] mce_reign at ffffffff8102aec4
#6 [ffff88021ed4ae40] mce_end at ffffffff8102b175
#7 [ffff88021ed4ae70] do_machine_check at ffffffff8102b92c
#8 [ffff88021ed4af50] machine_check at ffffffff8165d78c
[exception RIP: intel_idle+191]
RIP: ffffffff8136d48f RSP: ffff880211261e38 RFLAGS: 00000046
RAX: 0000000000000020 RBX: 0000000000000008 RCX: 0000000000000001
RDX: 0000000000000000 RSI: ffff880211261fd8 RDI: ffffffff81c12f00
RBP: ffff880211261e98 R8: 00000000fffffffc R9: 0000000000000f9f
R10: 0000000000001e95 R11: 0000000000000000 R12: 0000000000000003
R13: ffff88021ed5ac70 R14: 0000000000000020 R15: 12d818fb42cfe42b
ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018
--- <MCE exception stack> ---
#9 [ffff880211261e38] intel_idle at ffffffff8136d48f
#10 [ffff880211261ea0] cpuidle_idle_call at ffffffff815082d1
#11 [ffff880211261f00] cpu_idle at ffffffff8101322a
Any ideas?
|
I have two suggestions to start.
The first you're not going to like. No matter how stable you think your overclocked system is, it would be my first suspect. And any developer you report the problem to will say the same thing. Your stable test workload isn't necessarily using the same instructions, stressing the memory subsystem as much, whatever. Stop overclocking. If you want people to believe the problem's not overclocking, then make it happen when not overclocking so you can get a clean bug report. This will make a huge difference in how much effort other people will invest in solving this problem. Having bug-free software is a point of pride, but reports from people with particularly questionable hardware setups are frustrating time-sinks that probably don't involve a real bug at all.
The second is to get the oops data, which, as you've noticed,
doesn't go to any of the places you've mentioned.
If the crash happens only while running X11, I think local console is pretty much out (it's a pain anyway), so you need to do this over a serial console, over the network, or by saving to a local disk
(which is trickier than it may sound, because you don't want an untrustworthy kernel to corrupt your filesystem).
Here are some ways to do this:
use netdump to save to a server over the network. I haven't done this in years, so I'm not sure this software is still around and working with modern kernels, but it's easy enough that it's worth a shot.
boot using a serial console (archived version, current version); you'll need a serial port free on both machines (whether an old-school one or a USB serial adapter) and a null modem cable; you'd configure the other machine to save the output.
kdump seems to be what the cool kids use nowadays, and seems quite flexible, although it wouldn't be my preference because it looks complex to set up. In short, it involves booting a different kernel that can do anything and inspect the former kernel's memory contents, but you have to essentially build the whole process and I don't see a lot of canned options out there.
Update: There are some nice distro things, actually;
on Ubuntu, linux-crashdump
(archived version, current version).
Once you get the debug info, there's a tool called ksymoops (archived version, current version (with ads))
that you can use to turn the addresses into symbol names
and start getting an idea how your kernel crashed.
And if the symbolized dump doesn't mean anything to you,
at least this is something helpful to report here
or perhaps on your Linux distribution's mailing list / bug tracker.
From crash on your crashdump,
you can try typing log and bt to get a bit more information
(things logged during the panic and a stack back trace).
Your Fatal Machine check seems to be coming from here, though. From skimming the code, your processor has reported a Machine Check Exception – a hardware problem.
Again, my first bet would be due to overclocking. It seems like there might be a more specific message in the log output which could tell you more.
Also from that code, it looks like if you boot with the mce=3 kernel parameter, it will stop crashing... but I wouldn't really recommend this except as a diagnostic step. If the Linux kernel thinks this error is worth crashing over, it's probably right.
| Determining cause of Linux kernel panic |
1,361,905,344,000 |
What does it mean when your computer has a "kernel panic"?
Does it equate to the windows BsoD?
Also, what methods, tips, tricks are available to the user when a kernel panic strikes?
|
Kernel panic is the same as BSOD and is non-rescuable IIRC. However smaller failure is OOPS which denotes some error in kernel.
You can use kexec which switches to new kernel on panic (you can threat it as fast reboot) - possibly getting meaningful dump of system to debug the problem
You can use panic parameter which reboots kernel after n seconds. You can instruct GRUB to switch to fallback kernel in such case
Use Magic SysRQ keys to print stack traces etc.
| What is a "kernel panic"? |
1,361,905,344,000 |
My Arch machine sometimes hangs, suddenly not responding in any way to the mouse or the keyboard. The cursor is frozen. Ctrl-Alt-Backsp won't stop X11, and ctrl-alt-del does exactly nothing. The cpu, network, and disk activity plots in conky and icewm stop updating. In a few minutes the fan turns on. The only way to make the computer do anything at all is to turn off power.
When it boots up, the CPU temperature monitors show 70 to 80C. Before the hang, I was usually doing low-intensity activity like web surfing getting around 50C.
The logs show nothing special compared to a normal shutdown. Memory checker runs fine with zero defects.
How can I investigate why it hung up? Is there extra information I can find for a clue? Is there anything less drastic than power-off to get some kind of action, if only some limited shell or just beeps, but might give a clue?
The machine is a Gateway P6860 17" laptop (bulky but powerful) and it's running Arch 64bit, up to date (as of March 2011). I had Arch for a long time w/o this problem, switched to Ubuntu for about a week then retreated back to a fresh install of Arch. That's when the hangings started.
UPDATE: Yeah, for sure it's overheating. At one temperature, the mouse and keyboard stop working, sometimes becoming functional after several minutes of cooling off. At a higher temperature, worse things happen, like total nonresponsiveness including ignoring SysRq. This condition is shortly followed by a sudden power-off. I have solved the problem by buying a new computer 8D
|
Frederik's answer involving magic SysRq and kernel dumps will work if the kernel is still running, and not truly hung. The kernel might just be busy-looping for some reason.
The fact that it doesn't respond to Ctrl-Alt-Del tells me that probably isn't the case, and that the machine is locking up hard. That means hardware failure, or something closely related, like a bad driver.
Your memory check test is good, if you let it run long enough. You should also try other things to try and stress the system, like StressLinux. Long-running benchmarks are good, too.
Another thing to try is booting the system with an Ubuntu live CD and trying to use the system as normal. If returning to Ubuntu temporarily like that doesn't cause the problem to recur, there's a good chance it's not actually broken hardware, but one of the related things like a bad driver or incorrectly configured kernel. It is quite possible that a more popular distribution like Ubuntu could have a more stable kernel configuration than one like Arch, simply due to the greater number of machines it's been tried on during the distro's test phase.
| How to investigate cause of total hang? |
1,361,905,344,000 |
You can put "panic=N" on the kernel command line to make the system reboot N seconds after a panic.
But is there a config option to specify this (other than the default kernel command line option) before even boot loader comes into a play? Some kernel option may be?
|
There does not seem to be such a config option. The default timeout is 0 which according to http://www.mjmwired.net/kernel/Documentation/kernel-parameters.txt#1898 is "wait forever".
The option is defined in kernel/panic.c, you can write a patch that sets the initial value to something different.
To hardcode a reboot after 3 seconds, change:
int panic_timeout;
to:
int panic_timeout = 3;
| How to early configure Linux kernel to reboot on panic? |
1,361,905,344,000 |
While tinkering with a Linux VM I regularly get kernel panics, that push up all the helpful output with stuff I don't understand and that is probably not helpful to me.
The panics mostly occur during the initramfs phase. I'm using VirtualBox.
The normal Shift+Pg Up does not work (in my case).
Is there another way to scroll back up and look at the output of whatever came before?
|
Serial port
The serial port is an old and reliable communication protocol hardware that the Linux kernel supports and most emulators emulate.
You can stream the kernel messages to a host file or console through it:
VirtualBox: How does one Capture the Entire Kernel Panic on Boot | Stack Overflow
QEMU:
to console: How to switch to qemu monitor console when running with "-curses" | Stack Overflow
to file: Write QEMU booting virtual machine output to a file | Super User
Here's a minimal setup to reproduce the problem: https://github.com/cirosantilli/linux-kernel-module-cheat/blob/b366bac0c5410ceef7f2b97f96d93d722c4d9ea6/kernel_module/panic.c
real hardware: the serial port is not exposed on most modern laptops, which is a shame... but on desktops it looks like this:
Source.
And on the Raspberry Pi:
More details at: What is the difference between ttys0, ttyUSB0 and ttyAMA0 in Linux?
Serial alternatives
There are even fancier methods mentioned at: Determining cause of Linux kernel panic | Unix & Linux Stack Exchange
netdump: sends trace over network.
Supposes panic didn't break networking, which is more likely than the serial.
The advantages over serial are:
works for systems that don't have serial exposed such as modern laptops
serial cables have quite limited maximum wire lengths, which is problematic if you want to have all the boards of your company on a remote room to share resources across developers.
There are however serial connectors with an Ethernet server which I would recommend instead if your target exposes serial, e.g. this one:
kdump: boots a secondary Linux kernel that inspects the panicked kernel. What could possibly go wrong?
Those methods are more flexible, but less reliable.
See also: Scrolling up the failed screen with kernel panic | Super User
| How to scroll up after a kernel panic? |
1,361,905,344,000 |
I'm trying to add Qemu to my continuous integration pipeline to test various initrd artifacts. I've already discovered that I can run Qemu like this:
qemu-system-x86_64 \
-machine q35 \
-drive if=pflash,format=raw,file=OVMF_CODE.fd,readonly \
-drive if=pflash,format=raw,file=OVMF_VARS.fd \
-kernel vmlinuz-4.4.0-121-generic \
-initrd my-initramfs.cpio.xz \
-nographic
...and cause qemu-system-x86_64 to exit with status 0 if I do this in my init script:
# poweroff -f
This is works because the init script doesn't exit -- it invokes poweroff -f and sleeps "forever" or until Qemu does a "Power Down":
ACPI: Preparing to enter system sleep state S5
reboot: Power down
I would like to be able to detect problems in the init script by forcing an exit on error via set -eu. Exiting the init script (correctly) causes a kernel panic but the qemu-system-x86_64 process hangs forever.
How can I keep it from hanging forever? How do I get the Qemu host to detect a kernel panic in the Qemu guest?
Further clarification:
The nature of my application is security-sensitive; i.e., configuring/compiling the linux kernel is "allowed", but passing kernel parameters is not. To put a fine point on it, CMDLINE_OVERRIDE is enabled.
|
I've got something that's working:
Configure (and build) the kernel with CONFIG_PVPANIC=y; this produces a kernel with compiled-in support for the pvpanic device.
Invoke qemu-system-x86_64 with the -device pvpanic option; this instructs Qemu to catch (and exit on) a kernel panic.
A kernel panic causes qemu-system-x86_64 to exit successfully (return status 0), but at least it's not hanging anymore.
Many thanks to @dsstorefile1 for pointing me in the right direction.
References:
https://cateee.net/lkddb/web-lkddb/PVPANIC.html
https://github.com/qemu/qemu/blob/master/docs/specs/pvpanic.txt
| Can I make Qemu exit with failure on kernel panic? |
1,361,905,344,000 |
It' hard to isolate the CPU, I know, but the errors I'm seeing suggest that's the issue.
This is definitely not a malfunctioning/broken hardware problem. I've been running Windows 10 all day for the past several days and this thing is flippin' fast! No crashing. More importantly, I ran Windows memory checker. Memory is all good.
machine specs
The machine is a brand new Lenovo Yoga 710 15"
x64
Intel i7-6500 CPU @ 2.50 GHz, 2601 Mhz, 2 Cores, 4 Logical Processors
SMBIOS Version 2.8
BIOS Mode UEFI
16.0 GB DDR4 Ram
256 MB SSD
isolating to linux kernel (?)
I've seen the same problems on both
archlinux-2016.08.01-dual.iso
ubuntu-gnome-16.04.1-desktop-amd64.iso
For Arch -- the problem was only appearing intermittently at boot from the USB stick. I managed to get Arch installed on a 100GB ext4 partition on the drive. That install has the same issue intermittently (like 90% of the time) during boot. If I get passed the boot, then the issue appears at random after the first couple of terminal commands I execute, eventually causing a complete deadlock.
For Ubuntu -- the USB stick doesn't even boot. I get stopped by these same errors immediately. Deadlock...
So many errors...
The journal is stuffed with memory-related errors whenever this happens, but the key errors I'm seeing are:
General protection fault 0000[#1] PREEMPT SMP
RIP kmem_cache_alloc
RIP kmem_cache_alloc_trace
I've seen some of the same stack traces several times for these errors:
rbt_memtype_copy_nth_element
on_each_cpu
flusH_tbl_kernel_range
__purge_umap_area_lazy
um_unmam_aliases
change_page_attr_set_clr
set_memory_ro
frob_text.isra
module_enable_ro
kobject_create
kobject_create_and_add
load_module
__symbol_put
kernel_read
sys_finit_module
entry_SYSCALL_64_fastpath
kmem_cache_alloc_trace
allocate_cgrp_cset_links
...
sys_write
entry_SYSCALL-64_fastpath
Linux also keeps promising that it's fixing the problem
Fixing recursive fault but reboot is needed!
I wish..
intel ucode
I also tried installing the intel-ucode package in my Arch install. I saw in the dmesg logs that the microcodes were updated, but that unfortunately did not solve my problem.
What could be the issue? How can fix it?
EDIT
Additional note.
The general protection fault messages and "lock up detected"-type messages typically reference a CPU. I've seen CPU0, CPU1 , CPU2 and CPU3 in these messages. It seems like something is causing the CPU's to not get along, like they're all in a deadlock trying to clear out cache memory or something.
EDIT2
BIOS mentioned in error
I see this bit of information in some errors:
LENOVO 80U01LENOVO YOGA710-1 BIOS OGCN20WW(v1.04) 6/30/2016
Not sure if that is helpful to a pro in understanding the issue...
EDIT3
maxcpus=1
I was looking for debugging options in the kernel params documentation and found maxcpus
If I set max cpu's to 1, then the problem goes away. So it would seem that the problem is some kind of shared cache memory violation.
EDIT3
maxcpus=1 + Gnome = broken again
Although maxcpus=1 seemed to make the system work with just the 1 CPU, I installed gnome and then ran systemctl enable gdm.service
Now, when I reboot, I get all of my errors back again, but this time they're all happening on CPU0
So it seems that something is still causing a memory violation even with the 1 CPU.
EDIT4
nolapic
So using nolapic seems to get everything "working"
BUT by using nolapic, I effectively disable my other CPU and all multithreading in the 1 working CPU.
I'm trying to use this for OpenMP, and after booting with nolapic, OpenMP and the linux kernel can only find 1 thread, 1 CPU. That sucks!
I also tried intel_idle.max_cstate=0 and 1,2, etc. But this does not fix the boot problem.
What else could cause the kernel to fail to utilize my multi-core machine?
|
Turns out the issue was i2c_hid
This seems to be some kind of touchpad driver. For some reason, when I disable it, I can still use my touchpad. It could be that the touch screen on the laptop was using this driver, too, because that doesn't work.
I don't like to mung up my laptop screen with fingerprints, anyway... So bye bye i2c_hid!
I fixed it by adding this to the kernel params:
modprobe.blacklist=i2c_hid
Although nolapic also worked, it disabled all but 1 core in processors.
I'd highly recommend to anyone else out there to not use apci=off or nolapic for this reason.
Using these options is a nuclear weapon that might make your machine work, but you will lose a lot of performance and/or i/o devices as collateral damage. It's a good starting point to get booted, and then you can pour throught journalctl like I did to analyse the boots that fail.
Good luck to those who find this.
| Why can't linux kernel boot on my new Intel i7-6500U CPU? |
1,361,905,344,000 |
I was playing a game on Steam and all a sudden I got a kernel panic. I manually shut down the computer and booted back into Linux Mint 17.1 (Cinnamon) 64-bit, and went to go check through my log files in /var/log/, but I couldn't find any references or any kind of messages relating to the kernel panic that happened.
It's strange why it never dumped the core or even made any note of it into the log files. How can I make sure that a core is always dumped in case a kernel panic happens again? Doesn't make any sense why nothing was logged when a kernel panic happened. Looking around on Google, people suggest to read through /var/log/dmesg, /var/log/syslog, /var/log/kern.log, /var/log/Xorg.log etc… but nothing. Not even in .Xsession-errors file either.
Here are some photographs of the screen:
I could always take a photo of the screen when and if it happens again, but I just want to make sure that I can get it to dump the core and create a log file on a kernel panic.
|
To be sure that your machine generates a "core" file when a kernel failure occurs, you should confirm the "sysctl" settings of your machine.
IMO, following should be the settings (minimal) in /etc/sysctl.conf:
kernel.core_pattern = /var/crash/core.%t.%p
kernel.panic=10
kernel.unknown_nmi_panic=1
Execute sysctl -p after making changes in the /etc/sysctl.conf file.
You should probably also mkdir /var/crash if it doesn’t already exist.
You can test the above by generating a manual dump
using the SysRq key (the key combination to dump core
is Alt+SysRq+C).
| Kernel Panic dumps no log files |
1,361,905,344,000 |
one of my RAM sticks causes a Kernel Panic on my Ubuntu 10.10 (something like "not syncing" with a lot of memory adresses shown on screen). It's definitely this one RAM stick and not its socket because when I put one of the other sticks into the slot of the one RAM stick, everything is ok.
How does it come that memtest doesn't find any errors after several cycles but Ubuntu is not able to boot while using this one special RAM stick? Does anybody have an explanation for that?
|
What is "several" passes? What memtest tests have you run? I know I have seen memtest86+ take up to 6 or 7 passes to find an error with RAM sticks. Also, make sure you run the full battery of tests.
It certainly does sound like the RAM is bad. I too have had not syncing panics because of bad RAM.
| Kernel Panic because of RAM stick? |
1,361,905,344,000 |
I always have /proc/sys/kernel/panic set up to 0. Looking at description of this option in kernel.org we can see:
panic:
The value in this file represents the number of seconds the kernel
waits before rebooting on a panic. When you use the software watchdog,
the recommended setting is 60.
From here one can conclude that 0 is 0 seconds waiting before reboot - immediate reboot.
But proc MAN page states the following:
/proc/sys/kernel/panic
This file gives read/write access to the kernel variable
panic_timeout. If this is zero, the kernel will loop on a
panic; if nonzero, it indicates that the kernel should autore‐
boot after this number of seconds. When you use the software
watchdog device driver, the recommended setting is 60.
Here 0 means antipodal thing - never reboot.
So why such a trusted source gives such a misleading info? Or maybe the MAN page is inaccurate?
P.S. just from a hint in panic_on_oops section (if you happen to read this) you can guess that MAN page is right. Or if you are technically skilled enough to investigate something in kernel source code.
|
The authoritative source is the implementation in the kernel, so let’s look at that first.
The panic entry in sysctl corresponds to a kernel variable called panic_timeout. This is a signed integer, used to control behaviour on panic as follows:
if panic_timeout is strictly positive, the kernel waits after a panic, for panic_timeout seconds;
if panic_timeout is non-zero, the kernel reboots after a panic (after waiting, if appropriate);
if the kernel hasn’t rebooted, it prints a message and loops forever.
So the manpage is correct, and the kernel’s own documentation was incomplete; but sysctl/kernel.rst now documents panic in more detail. This was fixed in version 5.7-rc1 of the kernel.
| Linux Kernel.org misleading about kernel panic /proc/sys/kernel/panic |
1,361,905,344,000 |
My kernel keeps panicking when connected to a certain wireless network. I'd like to send a bug report but my kernel is apparently tainted. From /var/log/messages:
Apr 17 21:28:22 Eiger kernel: [13330.442453] Pid: 4095, comm: kworker/u:1 Tainted: G O 3.8.4-102.fc17.x86_64 #1
and
[root@Eiger ~]# cat /proc/sys/kernel/tainted
4096
I've not been able to find documentation for what the 4096 bitmask means, but the G flag means that an external GPL module is loaded into the kernel. How do I find out which module is tainting the kernel?
I've grepped for [Tt]aint in /var/log/messages or dmesg and don't find anything corresponding to when a module is loaded. My kernel is the latest kernel from Fedora 17: 3.8.4-102.fc17.x86_64.
UPDATE: It may be due to the rts5139 module. It shows up in lsmod but modinfo rts5139 produces ERROR: Module rts5139 not found. When booting the previous kernel, 3.8.3-103.fc17.x86_64, this module is not listed by lsmod and the kernel is not tainted (/proc/sys/kernel/taint is 0).
I've tried blacklisting this module
echo 'blacklist rts5139' >> /etc/modprobe.d/blacklist.conf
but rebooting still shows the kernel as tainted.
|
Well I don't believe a standard Fedora kernel package will include any modules which would trigger this taint so the question is, what other kernel modules have you installed?
Common candidates would be graphics drivers (though I think those will mostly set the "proprietary" bit) and wireless drivers.
If you can find anything in the lsmod output that you think may be a candidate then run modinfo <module-name> and see if the output includes intree: Y as any module without that will trigger the taint you are seeing.
UPDATE: The rts5139 module that you're seeing in lsmod but which doesn't seem to be on your system is probably in the initrd and is being loaded from there early in the boot process before the main filesystem is mounted.
That also explains why blacklisting won't work as you would have to rebuild the initrd with the updated blacklist. Rebuilding the initrd with dracut will cause the module to go away anyway though.
| How to determine which module taints the kernel? |
1,361,905,344,000 |
My laptop restarts randomly about twice a day. It shows the following error log before the restart.
.
Unfortunately I don't have an idea how to decode the Machine Check Exception (MCE). mcelog --ascii outputs nothing. Is there a chance that this is a software problem?
The laptop is Samsung NP900X3C with the Intel Core i5-3317U processor. I use Arch Linux with the 3.13.5 kernel.
|
This issue has to do with a hardware failure, specifically it looks like the memory in bank 4, (DIMM 4 - I would assume), is faulty. The MCE facility (Machine Check Events) is not widely known about but I"ve answered several questions on the site related to it.
Does kernel: EDAC MC0: UE page 0x0 point to bad memory, a driver, or something else?
OS errors : kernel: EDAC k8 MC0: extended error code: ECC chipkill x4 [duplicate]
Additionally you can write your own rules for MCE in this U&L Q&A titled:
Writing triggers for mcelog.
Also if you go through the MCE's FAQ, item #6 shows you how to make use of the mcelog --ascii command, titled: How do I "run through mcelog --ascii"?. Basically you're suppose to save the panic message in a text file and then run it through the mcelog command like so:
$ mcelog --ascii < file
How can I fix this?
Option #1
You essentially have 3 options. I won't go into describing the first, which is to replace the RAM DIMM in slot 4.
Option #2
The second option would be to further diagnose the issue and confirm that it's actually a faulty DIMM. You can use memtest86+ to do this. Along with performing this test, I would also take a minute and re-seat the DIMMS to make sure they're making a good contact within their slots on your motherboard, if you feel comfortable doing such a thing. It's actually quite trivial to do this.
Option #3
The third option would be to attempt to blacklist the location, assuming it's isolated to a specific couple of addresses within the DIMM. Believe it or not you can actually blacklist specific memory addresses. I've also explained how to do this on this site as well, titled: How to blacklist a correct bad RAM sector according to MemTest86+ error indication?.
| Random restarts caused by a machine check exception |
1,361,905,344,000 |
Update 2019-05-21 19:37 EST: My motherboard is on the latest BIOS available, released 2019-03-06, but still has the install problems described below.
Update: I burned the Arch ISO to a CD then tried booting from it, both in UEFI and legacy. Same type of result:
Original question: I used dd to put this Arch ISO (Version 2019.05.02) on a USB stick, then attempted to boot from it on my desktop computer. When the Arch menu comes up, I choose "Boot Arch Linux (x86_64)." But what follows is a bunch of error messages, then the process just hangs there doing nothing. Here's a pic:
The messages start off as "AMD-Vi: Completion-Wait loop timed out"
The messages include "kernel panic."
My motherboard is an MSI B450 Tomahawk with a Ryzen 5 2600 CPU. I've tried booting via UEFI and legacy with the same result.
How do I install Arch Linux?
|
Linux Kernel With MSI B450
The kernel fail in this case because of the support of the iommu feature; you can use some specific kernel adjustment (parameter) to fix your booting issue, this video demonstrate how to edit/apply the kernel parameters; here are some possibles solutions, try the different proposed parameters and choose the one that match best your needs. also you may turn off SVE in the bios.
Possible Solutions: Kernel Parameters
iommu=off
iommu=off and amd_iommu=fullflush
amd_iommu=off
mem_encrypt=off
amdgpu.runpm=0
pci=noats
Involved Technology Definition
Kernel Parameters: (aka Boot Options) Kernel command line parameters are parameters that you pass on to the kernel during the boot process to adjust its features or capabilities.
IOMMU: is a memory management unit that basically increase performance and security; additional details can be found here
IOMMU State: on, off or fullflush (detail on the linked article)
mem_encrypt: Add support for Secure Memory Encryption (SME). and defines the memory encryption mask that will be used in subsequent patches to mark pages as encrypted.
amdgpu.runpm=0: disable the graphical power management in the linux kernel (it will be then handled at the hardware/firmware/bios level)
pci=noats: disable PCI Address Translation Services
Note
After the install you will need to be very careful on kernel updates
Advanced technical users may build their own kernel with this or that patch
Arch Boot Disk:
To apply the parameters to the boot disk, on the boot menu, push "tab" to edit the boot command, hit space (to add a space) then write the parameter for instance "iommu=off" without quotes then hit enter to boot
Sources:
launchpad,
freedesktop,
freedesktop,
freedesktop,
askubuntu,
wikipedia,
artofcode,
archlinux,
linuxfoundation,
fclose,
youtube,
youtube
| AMD-VI: completion wait loop after a failed install of Arch Linux on a blank SSD |
1,361,905,344,000 |
I am trying to install Ubuntu server but it always get stuck at the last stage while updating grub.I cancelled the process and rebooted my system, it took me to the grub command prompt grub> .
I tried a manual boot from prompt:
root=(hd1,gpt5) # Ubuntu root partition
linux /boot/vmlinuz-something- root=/dev/sda5
initrd /boot/initramfs-something-
boot
<enter>
After some boot message scrolling, it dropped me in the
Busybox v1.27.2 (Ubuntu 1:1.27.2-2ubuntu3) built-in. shell (ash)
with the initramfs> prompt.
From here I did an exit
And it showed me the kernel panic! with the following two hints.
mount: mounting/says on /root/says failed : No such file or directory
mount: mounting /process on /root/process failed: No such file or directory
|
Not a solution but a couple of Workarounds.
Apparently, that's a bug in os-prober .
I personally tried the second one and it works!
To quote from the link:
Workaround 1: (proaction)
When you are reaching
the “Install the GRUB boot loader to the master boot record?” prompt,
(in my case, no such prompt appeared but i figured out timing of the grub-install)
switch to a console (ctrl+alt+[f2-f6]), and remove this file:
rm /target/etc/grub.d/30_os-prober
This will prevent update-grub from running os-prober, which should avoid
running into this issue. Of course, other operating systems won't be
listed, but at least that should prevent the installation process from
getting entirely stuck. I've tested this successfully in a VM with
guided (unencrypted) LVM, and standard plus ssh tasks (which is how I
initially reproduced your issue).
Workaround 2: (reaction)
Otherwise, once the process is stuck, locate the process identifier
(PID) on the first column of the ps output:
ps | grep 'dmsetup create'
then kill this dmsetup process. With your output above, that'd be:
kill 19676
(Tested successfully in a VM with the same setup/choices as above.)
KiBi
| Ubuntu 18.04 server installation gets stuck at 66% while running'update-grub' |
1,361,905,344,000 |
Can a user shove the cause of a kernel panic to the screen?
|
Linux does dump panics to the screen...depending on your definition of the screen.
What Linux actually does is dump to the system console. Often this is the screen, but can be the serial console (or elsewhere) instead.
However, most people are running X on their desktops. Which means that the console is not on the screen, the frame buffer is. You would need to have Linux dump to the frame buffer in this case and I suspect that this is really what you're seeking.
Lucky for you, there's a project working on this over at Ubuntu. I don't know how far along the project is, but it looks promising and that's where you should start.
| Is there a way to shove kernel-panic to the screen? |
1,361,905,344,000 |
I have a Lenovo Thinkpad L440.
Core i7
4GB RAM
1TB HDD
Windows 7 64 bits installed though right now it has Windows 10.
I made space in disk to install Linux Mint. Left:
20~ GB for /
8~ GB for swap
and almost 195~ GB for /home folder.
Installed Linux Mint 17 (64bits) with Cinnamon as desktop environment and everything was quite smooth... Until I started noticing how the boot process was taking too much time.
Mint was always up to date so I do the usual stuff to accelerate boot time.
First Kernel Panic
One day, it took too long to boot and a kernel panic message appeared.
Tried to fix it using boot-repair but it didn't work. 'Googling', I found some commands to mount /dev/sdax partition but none of them worked for me. Finally, I gave up on everything, cleaned the partition from Windows and reinstalled Linux OS but this time it was Linux Mint 17.2 (64bits).
Second Kernel Panic
This time it took less time to occur. Just a few days later, a kernel panic message appeared again. It followed the same patron as in the same kernel panic. Boot time took so long and then some day the kernel panic message.
Again, boot-repair nor any command issued as root (from a live cd) could help me.
Cleaned the partition again from Windows and installed Ubuntu 14.04 (32 bit)
Third Kernel Panic
Ubuntu booted normally but it took hours! for the kernel panic message to appear.
Again, cleaned the disk partition and as I had no more OS available, used Linux Mint 17 again.
This is the Kernel Panic message I got every time.
--
From this point now, I started to think it could be due to a hardware incompatibility so, looked for a BIOS update for my computer. Fortunately, I found an update for my Thinkpad and updated the BIOS.
Linux Mint was running good until recently I started noticing the boot time issue.
A few weeks ago I had a booting issue, however, the recovery mode let me fix the linux mount and partition and everything was fine.
I really don't know what to do or what could be the cause of all this whole thing in my computer.
What could I do to try to fix this?
What could be causing this problem with several Linux versions?
Could it be a hardware incompatibility with my pc?
Thanks a lot!
UPDATE: 03/10/2015
After a long time using Linux Mint again, a new problem appeared.
One of the messages in the error screen that got my attention is:
EXT4-fs error (device sda6): __ext4_get_inode_loc:3910 inode #1193206: block 4719759: comm fsck.ext4: unable to read itable block Superbloque last write time is in the future. (by less than a day, probably due to the hardware clock being incorrectly set).
Later, a prompt asked to correct some errors and after long hours the machine would boot again into Linux Mint but now X Server wouldn't start.
Fifth Kernel Panic
Tried to install Linux Mint 17 without making partitions /, /swap and /home but with the default installation where it auto-allocates the space needed.
It took seconds for the installation process to finished when the machine immediately showed me a Kernel Panic error (very similar to picture above).
Sixth Kernel Panic
Tried this time with Elementary OS Freya, the installation seemed to be completed but when booting the pc went straight to Windows 10. Tried to fixed the GRUB with Boot-Repair but nothing happened (Boot-repair wouldn't give me the option to actually repair anything). Tried the command mount /dev/sda6 /mnt but didn't work because a Can't read superblock which I've seen before as well.
|
All this was about a bad hard drive. Don't know how or when but it got bad. Asked Lenovo support for a replacement, got it and it's been working since.
| Too many Kernel Panic (6) and Linux installations problems in same computer |
1,361,905,344,000 |
I've just updated packages:
2013-05-23 11:15:34 startup archives unpack
2013-05-23 11:15:35 upgrade locales:all 2.13-38 2.17-3
2013-05-23 11:15:35 status half-configured locales:all 2.13-38
2013-05-23 11:15:35 status unpacked locales:all 2.13-38
2013-05-23 11:15:35 status half-installed locales:all 2.13-38
2013-05-23 11:15:35 status triggers-pending man-db:amd64 2.6.3-3
2013-05-23 11:15:35 status half-installed locales:all 2.13-38
2013-05-23 11:15:38 status half-installed locales:all 2.13-38
2013-05-23 11:15:38 status unpacked locales:all 2.17-3
2013-05-23 11:15:39 status unpacked locales:all 2.17-3
2013-05-23 11:15:39 upgrade libc6:i386 2.13-38 2.17-3
2013-05-23 11:15:39 status half-configured libc6:i386 2.13-38
2013-05-23 11:15:40 status unpacked libc6:i386 2.13-38
2013-05-23 11:15:40 status half-configured libc6:amd64 2.13-38
2013-05-23 11:15:40 status half-installed libc6:i386 2.13-38
2013-05-23 11:15:47 status half-installed libc6:i386 2.13-38
2013-05-23 11:15:47 status unpacked libc6:i386 2.17-3
2013-05-23 11:15:48 status unpacked libc6:i386 2.17-3
2013-05-23 11:15:48 upgrade libc6:amd64 2.13-38 2.17-3
2013-05-23 11:15:48 status half-configured libc6:amd64 2.13-38
2013-05-23 11:15:48 status unpacked libc6:amd64 2.13-38
2013-05-23 11:15:48 status half-installed libc6:amd64 2.13-38
2013-05-23 11:15:53 status half-installed libc6:amd64 2.13-38
2013-05-23 11:15:53 status unpacked libc6:amd64 2.17-3
2013-05-23 11:15:54 status unpacked libc6:amd64 2.17-3
2013-05-23 11:15:54 trigproc man-db:amd64 2.6.3-3 2.6.3-3
2013-05-23 11:15:54 status half-configured man-db:amd64 2.6.3-3
2013-05-23 11:16:00 status installed man-db:amd64 2.6.3-3
2013-05-23 11:16:01 startup packages configure
2013-05-23 11:16:01 configure libc6:amd64 2.17-3 <none>
2013-05-23 11:16:01 status unpacked libc6:amd64 2.17-3
2013-05-23 11:16:02 status unpacked libc6:amd64 2.17-3
2013-05-23 11:16:02 status half-configured libc6:amd64 2.17-3
2013-05-23 11:16:57 status installed libc6:amd64 2.17-3
2013-05-23 11:16:57 configure libc6:i386 2.17-3 <none>
2013-05-23 11:16:57 status unpacked libc6:i386 2.17-3
2013-05-23 11:16:57 status unpacked libc6:i386 2.17-3
2013-05-23 11:16:57 status half-configured libc6:i386 2.17-3
2013-05-23 11:16:57 configure locales:all 2.17-3 <none>
2013-05-23 11:16:57 status unpacked locales:all 2.17-3
2013-05-23 11:16:57 status unpacked locales:all 2.17-3
2013-05-23 11:16:57 status half-configured locales:all 2.17-3
Debian GNU/Linux jessie/sid \n \l
and since that my computer gives me kernel panic. :/
To be more exact something like this:
init1 segfault at 3f ip .. [i don't remeber rest of message]
kernel panic not syncing. Attempted to kill init.
Init not taited..
How can I deal with it?
I've found something like this:
http://forums.debian.net/viewtopic.php?f=10&t=96879
As far as I remeber (or maybe I'm wrong) some kind of libc was updated..
I tried to solved according to comment 21 but I have no:
/lib/libc.so.6
file.
Added pic when booting stops.
added logs from /var/log/apt/term.log:
Log started: 2013-05-23 09:57:05
Selecting previously unselected package less.
(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 320906 files and directories currently installed.)
Unpacking less (from .../archives/less_458-1_amd64.deb) ...
Processing triggers for mime-support ...
Processing triggers for man-db ...
Setting up less (458-1) ...
Log ended: 2013-05-23 09:57:16
Log started: 2013-05-23 11:15:33
(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 320928 files and directories currently installed.)
Preparing to replace locales 2.13-38 (using .../locales_2.17-3_all.deb) ...
Unpacking replacement locales ...
Preparing to replace libc6:i386 2.13-38 (using .../archives/libc6_2.17-3_i386.deb) ...
De-configuring libc6:amd64 ...
Checking for services that may need to be restarted...
Checking init scripts...
Unpacking replacement libc6:i386 ...
Preparing to replace libc6:amd64 2.13-38 (using .../libc6_2.17-3_amd64.deb) ...
Checking for services that may need to be restarted...
Checking init scripts...
Unpacking replacement libc6:amd64 ...
Processing triggers for man-db ...
Setting up libc6:amd64 (2.17-3) ...
Checking for services that may need to be restarted...
Checking init scripts...
Restarting services possibly affected by the upgrade:
samba: restarting...done.
mysql: restarting...done.
cron: restarting...done.
atd: restarting...done.
apache2: restarting...done.
Services restarted successfully.
Setting up libc6:i386 (2.17-3) ...
dpkg: error processing libc6:i386 (--configure):
subprocess installed post-installation script was killed by signal (Segmentation fault)
Setting up locales (2.17-3) ...
Installing new version of config file /etc/locale.alias ...
dpkg: error processing locales (--configure):
subprocess installed post-installation script was killed by signal (Segmentation fault)
Errors were encountered while processing:
libc6:i386
locales
Log ended: 2013-05-23 11:16:59
|
I did as schaiba said, so:
backup your sensitive stuff (for me only /home dir)
reinstall operating system
| How to repair system if kernel panic? |
1,361,905,344,000 |
After: Fixing recursive fault but reboot is needed on x3850 x6 SLES12
Q: I was thinking that if I get a kernel panic on a linux server, how can I debug, what driver causes the kernel-panic?
In my case, it seems to have been due to an emulex driver issue, in that since updating that driver, kernel panics have no longer occurred.
Can someone elaborate the step-by-step recommended procedure for investigating the cause of a kernel panic? Please include where to save/how the coredump from a kernel panic, ex.: if a liveCD paniced until where I can see what driver did the crash.
|
In regards to your previous issue, I would add debug to your kernel cmdline to see more verbose output.
As far as recovering from a kernel crash, I usually boot into a livecd and check the logs. A simple way to troubleshoot drivers is to blacklist the ones you think may be causing the crash, working backwards until the system boots again (or at all), and then enabling each one individually until you get your system to crash again.
Here are some other resources for debugging the linux kernel:
RedHat Linux: Kernel Crash Dump Guide
Ubuntu Wiki: Kernel Debugging Tricks
| How to debug what driver causes a kernel-panic? |
1,361,905,344,000 |
I just installed a new fresh Ubuntu 12.04.5 on a Dell laptop, I had 14.04 but as I really love 12.04 stability I decided to get back to it.
I have a Windows installed alongside which I just keep to have a way to preserve laptop warranty somehow.
So, I had used 14.04 with out any problem, but now I just installed on first boot I can see this right after the Ubuntu start screen appears:
So how could I solve this? Something strange I can notice is that I can't see any GRUB screen on start but it goes right to this purple Ubuntu start splash screen, and then that black screen with error log will appear.
This is the lshw output:
PCI (sysfs)
ubuntu
description: Portable Computer
product: Inspiron 5548 (Inspiron 5548)
vendor: Winbond Electronics
version: A03
serial: 9G6XX32
width: 64 bits
capabilities: smbios-2.7 dmi-2.7 ldt16 vsyscall32
configuration: administrator_password=disabled boot=normal chassis=portable sku=Inspiron 5548 uuid=44454C4C-4700-1036-8058-B9C04F583332
*-core
description: Motherboard
product: 079JDM
vendor: Winbond Electronics
physical id: 0
version: A00
serial: .9G6XX32.CN1296654T012D.
slot: Type2 - Board Chassis Location
*-firmware
description: BIOS
vendor: Winbond Electronics
physical id: 0
version: A03
date: 01/23/2015
size: 128KiB
capacity: 6080KiB
capabilities: pci pnp upgrade shadowing cdboot bootselect edd int13floppynec int13floppytoshiba int13floppy360 int13floppy1200 int13floppy720 int13floppy2880 int5printscreen int9keyboard int14serial int17printer int10video acpi usb smartbattery biosbootspecification
*-cpu
description: CPU
product: Intel(R) Core(TM) i7-5500U CPU @ 2.40GHz
vendor: Intel Corp.
physical id: 4
bus info: cpu@0
version: Intel(R) Core(TM) i7-5500U CPU @ 2.40GHz
serial: To Be Filled By O.E.M.
slot: U3E1
size: 500MHz
capacity: 3GHz
width: 64 bits
clock: 100MHz
capabilities: x86-64 fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap cpufreq
configuration: cores=2 enabledcores=2 threads=4
*-cache:0
description: L1 cache
physical id: 6
slot: L1 Cache
size: 32KiB
capacity: 32KiB
capabilities: synchronous internal write-back instruction
*-cache:1
description: L2 cache
physical id: 7
slot: L2 Cache
size: 256KiB
capacity: 256KiB
capabilities: synchronous internal write-back unified
*-cache:2
description: L3 cache
physical id: 8
slot: L3 Cache
size: 4MiB
capacity: 4MiB
capabilities: synchronous internal write-back unified
*-cache
description: L1 cache
physical id: 5
slot: L1 Cache
size: 32KiB
capacity: 32KiB
capabilities: synchronous internal write-back data
*-memory
description: System Memory
physical id: 1f
slot: System board or motherboard
size: 8GiB
*-bank:0
description: SODIMM DDR3 Synchronous 1600 MHz (0.6 ns)
product: 8KTF51264HZ-1G6N1
vendor: Micron
physical id: 0
serial: 14577691
slot: ChannelA-DIMM0
size: 4GiB
width: 64 bits
clock: 1600MHz (0.6ns)
*-bank:1
description: SODIMM DDR3 Synchronous 1600 MHz (0.6 ns)
product: 8KTF51264HZ-1G6N1
vendor: Micron
physical id: 1
serial: 14577705
slot: ChannelB-DIMM0
size: 4GiB
width: 64 bits
clock: 1600MHz (0.6ns)
*-pci
description: Host bridge
product: Intel Corporation
vendor: Intel Corporation
physical id: 100
bus info: pci@0000:00:00.0
version: 09
width: 32 bits
clock: 33MHz
*-display
description: VGA compatible controller
product: Intel Corporation
vendor: Intel Corporation
physical id: 2
bus info: pci@0000:00:02.0
version: 09
width: 64 bits
clock: 33MHz
capabilities: msi pm vga_controller bus_master cap_list rom
configuration: driver=i915 latency=0
resources: irq:68 memory:d0000000-d0ffffff memory:c0000000-cfffffff ioport:5000(size=64)
*-multimedia:0
description: Audio device
product: Intel Corporation
vendor: Intel Corporation
physical id: 3
bus info: pci@0000:00:03.0
version: 09
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list
configuration: driver=snd_hda_intel latency=0
resources: irq:16 memory:d2310000-d2313fff
*-usb:0
description: USB controller
product: Intel Corporation
vendor: Intel Corporation
physical id: 14
bus info: pci@0000:00:14.0
version: 03
width: 64 bits
clock: 33MHz
capabilities: pm msi xhci bus_master cap_list
configuration: driver=xhci_hcd latency=0
resources: irq:62 memory:d2300000-d230ffff
*-communication
description: Communication controller
product: Intel Corporation
vendor: Intel Corporation
physical id: 16
bus info: pci@0000:00:16.0
version: 03
width: 64 bits
clock: 33MHz
capabilities: pm msi bus_master cap_list
configuration: driver=mei_me latency=0
resources: irq:65 memory:d231b000-d231b01f
*-multimedia:1
description: Audio device
product: Intel Corporation
vendor: Intel Corporation
physical id: 1b
bus info: pci@0000:00:1b.0
version: 03
width: 64 bits
clock: 33MHz
capabilities: pm msi bus_master cap_list
configuration: driver=snd_hda_intel latency=64
resources: irq:67 memory:d2314000-d2317fff
*-pci:0
description: PCI bridge
product: Intel Corporation
vendor: Intel Corporation
physical id: 1c
bus info: pci@0000:00:1c.0
version: e3
width: 32 bits
clock: 33MHz
capabilities: pci pciexpress msi pm normal_decode bus_master cap_list
configuration: driver=pcieport
resources: irq:58
*-pci:1
description: PCI bridge
product: Intel Corporation
vendor: Intel Corporation
physical id: 1c.2
bus info: pci@0000:00:1c.2
version: e3
width: 32 bits
clock: 33MHz
capabilities: pci pciexpress msi pm normal_decode bus_master cap_list
configuration: driver=pcieport
resources: irq:59 ioport:4000(size=4096) memory:d2200000-d22fffff ioport:d2000000(size=1048576)
*-network
description: Ethernet interface
product: RTL8101E/RTL8102E PCI Express Fast Ethernet controller
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0
bus info: pci@0000:02:00.0
logical name: eth0
version: 07
serial: 44:a8:42:e5:56:7c
size: 10Mbit/s
capacity: 100Mbit/s
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=half latency=0 link=no multicast=yes port=MII speed=10Mbit/s
resources: irq:64 ioport:4000(size=256) memory:d2200000-d2200fff memory:d2000000-d2003fff
*-pci:2
description: PCI bridge
product: Intel Corporation
vendor: Intel Corporation
physical id: 1c.3
bus info: pci@0000:00:1c.3
version: e3
width: 32 bits
clock: 33MHz
capabilities: pci pciexpress msi pm normal_decode bus_master cap_list
configuration: driver=pcieport
resources: irq:60 memory:d2100000-d21fffff
*-network
description: Wireless interface
product: Wireless 3160
vendor: Intel Corporation
physical id: 0
bus info: pci@0000:03:00.0
logical name: wlan0
version: 83
serial: f4:06:69:8b:a8:df
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=iwlwifi driverversion=3.13.0-32-generic firmware=22.24.8.0 ip=192.168.1.100 latency=0 link=yes multicast=yes wireless=IEEE 802.11abgn
resources: irq:66 memory:d2100000-d2101fff
*-pci:3
description: PCI bridge
product: Intel Corporation
vendor: Intel Corporation
physical id: 1c.4
bus info: pci@0000:00:1c.4
version: e3
width: 32 bits
clock: 33MHz
capabilities: pci pciexpress msi pm normal_decode bus_master cap_list
configuration: driver=pcieport
resources: irq:61 ioport:3000(size=4096) memory:d1000000-d1ffffff ioport:b0000000(size=268435456)
*-display UNCLAIMED
description: Display controller
product: Advanced Micro Devices, Inc. [AMD/ATI]
vendor: Hynix Semiconductor (Hyundai Electronics)
physical id: 0
bus info: pci@0000:04:00.0
version: 00
width: 64 bits
clock: 33MHz
capabilities: pm pciexpress msi cap_list
configuration: latency=0
resources: memory:b0000000-bfffffff memory:d1000000-d103ffff ioport:3000(size=256) memory:d1040000-d105ffff
*-usb:1
description: USB controller
product: Intel Corporation
vendor: Intel Corporation
physical id: 1d
bus info: pci@0000:00:1d.0
version: 03
width: 32 bits
clock: 33MHz
capabilities: pm debug ehci bus_master cap_list
configuration: driver=ehci-pci latency=0
resources: irq:23 memory:d2319000-d23193ff
*-isa
description: ISA bridge
product: Intel Corporation
vendor: Intel Corporation
physical id: 1f
bus info: pci@0000:00:1f.0
version: 03
width: 32 bits
clock: 33MHz
capabilities: isa bus_master cap_list
configuration: driver=lpc_ich latency=0
resources: irq:0
*-storage
description: SATA controller
product: Intel Corporation
vendor: Intel Corporation
physical id: 1f.2
bus info: pci@0000:00:1f.2
version: 03
width: 32 bits
clock: 66MHz
capabilities: storage msi pm ahci_1.0 bus_master cap_list
configuration: driver=ahci latency=0
resources: irq:63 ioport:5088(size=8) ioport:5094(size=4) ioport:5080(size=8) ioport:5090(size=4) ioport:5060(size=32) memory:d2318000-d23187ff
*-serial UNCLAIMED
description: SMBus
product: Intel Corporation
vendor: Intel Corporation
physical id: 1f.3
bus info: pci@0000:00:1f.3
version: 03
width: 64 bits
clock: 33MHz
configuration: latency=0
resources: memory:d231a000-d231a0ff ioport:5040(size=32)
*-scsi:0
physical id: 1
logical name: scsi0
capabilities: emulated
*-disk
description: ATA Disk
product: ST1000LM014-1EJ1
vendor: Seagate
physical id: 0.0.0
bus info: scsi@0:0.0.0
logical name: /dev/sda
version: DEMB
serial: W382ZY1K
size: 931GiB (1TB)
capabilities: gpt-1.00 partitioned partitioned:gpt
configuration: ansiversion=5 guid=43f7b361-e7dd-4c94-b8a4-87a1fb57f286
*-volume:0
description: Windows FAT volume
vendor: MSDOS5.0
physical id: 1
bus info: scsi@0:0.0.0,1
logical name: /dev/sda1
version: FAT32
serial: ce75-a3e7
size: 495MiB
capacity: 499MiB
capabilities: boot fat initialized
configuration: FATs=2 filesystem=fat name=EFI system partition
*-volume:1
description: Windows FAT volume
vendor: MSDOS5.0
physical id: 2
bus info: scsi@0:0.0.0,2
logical name: /dev/sda2
version: FAT32
serial: 90e8-52e3
size: 15MiB
capacity: 39MiB
capabilities: precious readonly hidden nomount fat initialized
configuration: FATs=2 filesystem=fat name=Basic data partition
*-volume:2
description: Windows reserved partition
physical id: 3
bus info: scsi@0:0.0.0,3
logical name: /dev/sda3
serial: 2fcd06b3-9aee-4e34-918e-a4b012138316
capacity: 127MiB
capabilities: nofs
configuration: name=Microsoft reserved partition
*-volume:3
description: Windows NTFS volume
physical id: 4
bus info: scsi@0:0.0.0,4
logical name: /dev/sda4
version: 3.1
serial: aceb-6180
size: 720MiB
capacity: 749MiB
capabilities: precious readonly hidden nomount ntfs initialized
configuration: clustersize=4096 created=2015-04-29 18:18:40 filesystem=ntfs label=WINRETOOLS modified_by_chkdsk=true mounted_on_nt4=true name=Basic data partition resize_log_file=true state=dirty upgrade_on_mount=true
*-volume:4
description: Windows NTFS volume
physical id: 5
bus info: scsi@0:0.0.0,5
logical name: /dev/sda5
version: 3.1
serial: 162ec8d8-0675-6d46-a725-d70f394493d1
size: 466GiB
capacity: 466GiB
capabilities: ntfs initialized
configuration: clustersize=4096 created=2015-04-29 18:18:49 filesystem=ntfs label=OS name=Basic data partition state=clean
*-volume:5
description: EXT4 volume
vendor: Linux
physical id: 6
bus info: scsi@0:0.0.0,6
logical name: /dev/sda6
version: 1.0
serial: 74fa39ea-06d3-4539-a96c-9946e3a4b80f
size: 146GiB
capabilities: journaled extended_attributes large_files huge_files dir_nlink extents ext4 ext2 initialized
configuration: created=2015-08-17 05:02:33 filesystem=ext4 lastmountpoint=/ modified=2015-08-17 05:18:18 mounted=2015-08-17 05:26:37 name=Basic data partition state=clean
*-volume:6
description: Windows NTFS volume
physical id: 7
bus info: scsi@0:0.0.0,7
logical name: /dev/sda7
version: 3.1
serial: 94751caa-e0ab-8746-8cfe-a0d8bc72dc76
size: 309GiB
capacity: 309GiB
capabilities: ntfs initialized
configuration: clustersize=4096 created=2015-07-24 10:54:38 filesystem=ntfs label=DATA modified_by_chkdsk=true mounted_on_nt4=true name=Basic data partition resize_log_file=true state=dirty upgrade_on_mount=true
*-volume:7
description: Windows NTFS volume
physical id: 8
bus info: scsi@0:0.0.0,8
logical name: /dev/sda8
version: 3.1
serial: 7457-ed72
size: 7836MiB
capacity: 7844MiB
capabilities: precious readonly hidden nomount ntfs initialized
configuration: clustersize=4096 created=2015-04-29 20:09:04 filesystem=ntfs label=PBR Image modified_by_chkdsk=true mounted_on_nt4=true name=Microsoft recovery partition resize_log_file=true state=dirty upgrade_on_mount=true
*-scsi:1
physical id: 2
bus info: usb@2:1
logical name: scsi3
capabilities: emulated scsi-host
configuration: driver=usb-storage
*-disk
description: SCSI Disk
physical id: 0.0.0
bus info: scsi@3:0.0.0
logical name: /dev/sdb
size: 14GiB (15GB)
capabilities: partitioned partitioned:dos
configuration: signature=d1b1ac36
*-volume
description: Windows FAT volume
vendor: SYSLINUX
physical id: 1
bus info: scsi@3:0.0.0,1
logical name: /dev/sdb1
logical name: /cdrom
version: FAT32
serial: d47c-f2ce
size: 14GiB
capacity: 14GiB
capabilities: primary bootable fat initialized
configuration: FATs=2 filesystem=fat mount.fstype=vfat mount.options=ro,noatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro state=mounted
*-scsi:2
physical id: 3
bus info: usb@2:7
logical name: scsi4
capabilities: emulated scsi-host
configuration: driver=rts5139
*-disk
description: SCSI Disk
product: xD/SD/M.S.
vendor: Generic-
physical id: 0.0.0
bus info: scsi@4:0.0.0
logical name: /dev/sdc
version: 1.00
serial: 3
capabilities: removable
*-medium
physical id: 0
logical name: /dev/sdc
*-battery
product: DELL VVMKC53K
vendor: SDI
physical id: 1
slot: Sys. Battery Bay
capacity: 39000mWh
configuration: voltage=11.4V
*-power UNCLAIMED
description: OEM Define 1
product: OEM Define 5
vendor: OEM Define 2
physical id: 2
version: OEM Define 6
serial: OEM Define 3
capacity: 75mWh
|
Try to fully turn off your Intel Rapid Start and Secure Boot, and try it from BIOS, if you have a pre-installed 64-bit Windows 8 with UEFI, since it is pre-installed, and you also need 64-bit ubuntu, try this
https://askubuntu.com/questions/221835/installing-ubuntu-on-a-pre-installed-windows-8-64-bit-system-uefi-supported
| How to solve this kernel bug on OS start? |
1,361,905,344,000 |
I'm using Linux in embedded systems, and want to configure the system to automatically reboot after a kernel panic. However, when the system comes back up, it's important for me to detect and log the fact that the kernel panicked (rather than, say, the user toggling the power switch).
I could configure a kernel core dump on panic, and check for the dump on restart, but that seems like it could cause trouble if the file system isn't A-OK (plus I've been trying to set up kernel core dumping and have yet to succeed).
Any suggestions?
|
If you run customized kernels for your embedded hw and have some hw register/bit available you may be able to customize the kernel crash code to set a flag in that hw location which you'd check after reboot.
If not AFAIK you're only chance is to configure your kernel core dumping facility. Indeed, it's risky to write to a 'live' filesystem, but you can use a swap partition or a small dedicated partition instead.
| How do I detect that my system has auto-rebooted after a kernel panic? |
1,361,905,344,000 |
Given the limited fixed size of kernel stack, my guess is that although theoretically we might have a recursive function if its recursion doesn't go too deep, pragmatism would suggest to do away with recursive functions all together, to be on a safer side. After all, too much of recursion can result in wiping off the *thread_info_t* struct and a resultant kernel panic
|
Yes!
Maybe some of the recurive calls are either documented or part of function names? Then, a find/grep should reveal them. Here is a command to do it:
find /usr/src/linux/ -name "*.c" -exec grep recursive {} ";" -ls
Piping this through | wc -l gives me 270, which is, since -ls prints one additional line per file, at least 135 files+functions.
Let's have a look at the first match:
/usr/src/linux/fs/jfs/jfs_dmap.c
The match is a comment:
if the adjustment of the dmap control page, itself, causes its
root to change, this change will be bubbled up to the next dmap
control level by a recursive call to this routine, specifying
the new root value and the next dmap control page level to
be adjusted.
in front of the method
static int
dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level)
and in fact, line 2486 and neighbours are:
if (dcp->stree[ROOT] != oldroot) {
/* are we below the top level of the map. if so,
* bubble the root up to the next higher level.
*/
if (level < bmp->db_maxlevel) {
/* bubble up the new root of this dmap control page to
* the next level.
*/
if ((rc =
dbAdjCtl(bmp, blkno, dcp->stree[ROOT], alloc,
level + 1))) {
/* something went wrong in bubbling up the new
* root value, so backout the changes to the
* current dmap control page.
*/
Since the question was, whether there is any recursive function, we don't have to visit the next 135 or more matches or search for not explicitly mentioned recursions. The answer is
Yes!
| Does the linux kernel (specifically 2.6 onwards) have any recursive function? |
1,361,905,344,000 |
I have created a image file with this commands:
dd if=/dev/zero of=linux.img bs=16M count=1024
cfdisk linux.img
mkfs.ext4 linux.img
and installed a linux system following the instructions from the book Linux From Scratch 11.3. I have access to this system via chroot, but when I try run it with this command:
qemu-system-x86_64 -hda linux.img -vga std -m 4G
the initialization of the system is interrupted by the error described in the title of this question. my file /boot/grub/grub.cfg looks like this:
# Begin /boot/grub/grub.cfg
set default=0
set timeout=5
insmod ext4
#set root=(hd0,2)
menuentry "GNU/Linux, Linux 6.1.11-lfs-11.3" {
linux /boot/vmlinuz-6.1.11-lfs-11.3 root=/dev/hda1 ro
what I have tried:
uncommenting the line set root=(hd0,2)' and trying the values hd0,0orhd0,1(the system not even initialize with this, and I got the errorhd0,X not found` after the grub start screen.
changing the root value in the line started with linux in the menuentry option to /dev/loopXX (I got the same error).
changing the root value in the line started with linux in the menuentry option to /dev/sda1 (in this case, same message, but with the block as (8,1)).
Anyone can tell me what I can do to fix this issue?
|
The error message hd0,X not found comes from GRUB, and indicates GRUB configuration file has an error, pointing to a partition that either does not exist or is not readable by GRUB.
The titular error message Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) means you got through GRUB and into the Linux kernel, but the kernel cannot find the device specified for the root filesystem, i.e. either you are missing a driver that should have been included into your kernel (or initramfs, if you used that... but LFS doesn't), or your root=/dev/... kernel boot option is not correct.
More specifically, unknown-block(0,0) means the kernel has no clue what block device your root filesystem is supposed to be on; unknown-block(8,1) indicates you specified /dev/sda1 and the kernel understood that but has not been able to find such a partition. The numbers refer to the major & minor numbers of the device node:
ls -l /dev/sda1
brw-rw---- 1 root disk 8, 1 May 4 07:56 /dev/sda1
^^^^^
The first mistake would be here:
cfdisk linux.img
mkfs.ext4 linux.img
This suggests you first created a partition table (with an unspecified number of partitions of unknown types) and then overwrote the partition table by initializing the entire image as a single ext4 filesystem.
As a result, there will be no partitions at all: in GRUB terminology, there will be no (hd0,0) nor (hd0,1) nor (hd0,2), only just (hd0).
There also won't be any unallocated space between the MBR partition table and the beginning of the first partition to embed the core image of GRUB into, so you may have seen some warnings when installing GRUB. It is possible that the installer could have adapted to the situation by falling back to an old installation style that is now seriously discouraged.
For creating a whole-disk image, I would recommended the following procedure instead:
dd if=/dev/zero of=linux.img bs=16M count=1024
cfdisk linux.img
losetup -P /dev/loop0 linux.img
ls /dev/loop0* #you should see loop0 and the first partition as loop0p1
mkfs.ext4 /dev/loop0pX # replace X with partition number
mkswap /dev/loop0pY # if you created a swap partition, use this for it and replace Y
... # LFS 11.3 chapter 2.6 and the 1st command of chapter 2.7
mount -v -t ext4 /dev/loop0pX $LFS # the 2nd command of LFS 11.3 chapter 2.7
... # continue according to the book
Now, in the grub.cfg file, the set root= entry should be of the form (hd0,<X-1>) because Linux starts counting partitions from 1, but GRUB counts them starting from 0. So if you used /dev/loop0p1 for your ext4 partition, use set root=(hd0,0) for GRUB.
Also, on the linux line, the root=/dev/hda1 refers to the old deprecated non-libata drivers for the archaic PATA disk controllers. Most modern Linux disk controller drivers now use the /dev/sdXN style names. So even though you may have used /dev/loop0p1 to create the ext4 filesystem of your LFS image, once that image is presented as a virtual hard disk within the QEMU VM, the kernel will name it /dev/sda1 unless you made some strange choices in kernel configuration and used different QEMU options. So the last line of your grub.cfg should be:
linux /boot/vmlinuz-6.1.11-lfs-11.3 root=/dev/sda1 ro
(For your current, mis-prepared linux.img, you could try root=/dev/sda instead, just for fun; it might or might not work.)
| Kernel panic - not syncing: VFS: Unable to mount root fs on unknown block(0,0) |
1,361,905,344,000 |
I'm trying to install xubuntu on a usb flash drive following this quide. The command I'm running is
qemu-system-x86_64 -drive file=/dev/sdc,media=disk,index=0,format=raw -cdrom ./xubuntu-15.10-desktop-amd64.iso -boot menu=on
/dev/sdc is my usb drive formatted as ext4. It starts to boot from xubuntu*.iso, as I can see this screen
But then I get kernel panic
I was able to boot this image with virtualbox, though. Which partition is it tring to mount? This must have nothing to do with /dev/sdc, or not? What am I doing wrong? Any clues?
|
It seems this obscure error is due to the ramdisk of the kernel image having grown so much these days that it no longer fits in the default size for ram memory of the qemu virtual machine (which is quite low at 128 MiB). Simply add a memory option like:
-m 512M
| qemu: boot from cdrom |
1,361,905,344,000 |
After recent Fedora 27 update, my KVM VM guest ended up in the kernel panic during boot process.
The system was updated to libvirt-3.7.0-4.fc27.x86_64 (and many other packages during this update) and rebooted. Before the VM guest running Kubuntu 16.04 had no problem. Previous kernel on the hypervisor doesn't help.
The host CPU is AMD Athlon(tm) X4 750.
What's the cause of this sudden issue?
|
The culprit is really the system update (most probably the libvirt).
Before the VM guest was running with cpu mode=host-model more than one year. However now it was necessary to edit VM guest XML deffinition file - virsh edit <domain>. The cpu mode entry must have been changed to cpu mode=host-passthrough:
<cpu mode='host-passthrough' check='partial'/>
After this change, the VM guest with Kubuntu booted up without any problem.
According to libvirt documentation, the host-model can cause CPU detection problems to VM guest OS. The host-passthrough avoids this issues as provides exactly the same type of CPU (and it's features). However makes difficulties with migration to different VM host. The other VM host must be exactly of the same type of CPU.
Interesting thing is that another VM guest with CentOS was still able to boot without any problem...
| Kernel panic in KVM guest after Fedora 27 - libvirt update |
1,361,905,344,000 |
From here: http://fedoraproject.org/wiki/Common_kernel_problems#Can.27t_find_root_filesystem_.2F_error_mounting_.2Fdev.2Froot
A lot of these bugs end up being a broken initrd due to bugs in
mkinitrd.
Get the user to attach their initrd for their kernel to the
bz, and also their /etc/modprobe.conf, or have them examine the
contents themselves if they are capable of that.
Picking apart the initrd of a working and failing kernel and doing a diff of the init script can reveal clues. To take apart an initrd, do the following ..
mkdir initrd
cd initrd/
gzip -dc /boot/initrd-2.6.23-0.104.rc3.fc8.img | cpio -id
I wish to understand what exactly is being done here.
What has initrd to do with anything?
Where are we supposed to create the directory initrd?
|
An initrd (short for “initial RAM drive”) is a filesystem that's mounted when the Linux kernel boots, before the “real” root filesystem. This filesystem is loaded into memory by the bootloader, and remains in memory until the real boot. The kernel executes the program /linuxrc on the initrd; its job is to mount the real root, and when /linuxrc terminates the kernel runs /sbin/init.
A bug somewhere in the initrd can explain why the system doesn't boot. So the document you link to recommends that you compare your initrd with an official one if you have trouble booting.
In the provided instructions, initrd is just some temporary directory, you can call it anisha_initrd or fred if you like. The initrd is stored in the file /boot/initrd-SOMETHING.img as a gzipped cpio archive; the instructions unpack that archive in the temporary directory you created. After unpacking, you can compare it with an official initrd (unpack the official initrd and run a command like diff -ru /path/to/official_initrd /path/to/anisha_initrd).
| Kernel Panic - Can't find root filesystem / error mounting /dev/root |
1,361,905,344,000 |
nc -l -u 6666 on the receiving machine gets no messages from netconsole.
tested by doing "echo test > /dev/kmsg"
i am able to connect with netcat by doing "nc -u 10.0.0.192 6666" on the netconsole machine
"sudo tcpdump -i wlp170s0 -n -e port 6666" outputs nothing on the listening machine
netconsole options:
modprobe netconsole [email protected]/enp8s0,[email protected]/54:14:f3:52:82:94 oops_only=0
ifconfig on netconsole machine:
enp8s0 Link encap:Ethernet HWaddr 70:85:C2:D7:65:F3
inet addr:10.0.0.42 Bcast:10.0.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1032 errors:0 dropped:0 overruns:0 frame:0
TX packets:791 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:95338 TX bytes:230456
lo Link encap:Local Loopback
inet addr:127.0.0.1 Bcast:0.0.0.0 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 TX bytes:0
ifconfig on listening machine:
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MULTICAST MTU:65536 Metric:1
RX packets:400 errors:0 dropped:0 overruns:0 frame:0
TX packets:400 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:46289 TX bytes:46289
nfs Link encap:(hwtype unknown)
inet addr:10.8.0.3 P-t-P:10.8.0.3 Mask:255.255.255.0
UP POINTOPOINT RUNNING NOARP MTU:1420 Metric:1
RX packets:7418 errors:0 dropped:0 overruns:0 frame:0
TX packets:22098 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1806372 TX bytes:26188072
wlp170s0 Link encap:Ethernet HWaddr 54:14:F3:52:82:94
inet addr:10.0.0.192 Bcast:10.0.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2771549 errors:0 dropped:54 overruns:0 frame:0
TX packets:1029444 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3024953926 TX bytes:153598327
|
Turns out you have to increase the verbosity with dmesg -n 8
| Unable to get output from netconsole |
1,361,905,344,000 |
After upgrading my CentOS 7 kernel from 3.10.0 to 4.8.7, while rebooting the system I will get the following lines:
[ 0.641455] cpufreq: cpufreq_online: Failed to initialize policy for cpu: 0 (-19)
[ 0.641734] cpufreq: cpufreq_online: Failed to initialize policy for cpu: 1 (-19)
[ 0.641873] cpufreq: cpufreq_online: Failed to initialize policy for cpu: 2 (-19)
[ 0.641956] cpufreq: cpufreq_online: Failed to initialize policy for cpu: 3 (-19)
[ 0.642048] cpufreq: cpufreq_online: Failed to initialize policy for cpu: 4 (-19)
[ 0.642048] cpufreq: cpufreq_online: Failed to initialize policy for cpu: 5 (-19)
[ 0.984906] sd 0:0:0:0: [sda] Assuming drive cache: write through
What is the failed policies and how should I fix it?
|
Are you using virtual machines or a hypervisor? If yes so, you should update your hypervisor host to the latest version so it can support the kernel version.
CPUFreq stands for CPU frequency scaling which enables the operating system to scale the CPU frequency up or down in order to save power.
I'm not sure why you're getting this error since there may be many possible reasons, but if you're using a hypervisor host - such as ESXi - and your OSes are working fine after the boot and you're only getting this error whilst the boot time, you need to update your Hypervisor host since it does not fully support the newly upgraded kernel version.
If you're getting the same error on the latest version of hypervisors, or if you're not using virtual machines and it's happening on your primary OS, you need to check if your hardware is working fine or not. But this is not CentOS or RHEL problem.
| Kernel 4.8.7 failure on cpufreq - CentOS 7 |
1,361,905,344,000 |
I wanted to update my system (Slackware current) which was in multilib. Before updating, I tried to remove all packages (compat32 and multilib). Big mistake !!! This have broken some crucial symlinks and give me now a kernel panic when i trie to boot it.
I have tried several methods, including this one But it does not work since I no longer have the original disc
Can someone tell me what is the proper way to recover the installation in this situation?
|
since you can't boot your system, you need some other medium - cd or usb. there is no other magic way to boot unbootable system.
basically what you have to do is:
boot your machine (slackware installer).
mount your partitions and chroot to system / dir.
install packages you removed (download them from some slackware mirror and copy, ie on usb drive).
in details:
boot from slackware install disc or usb drive.
make some directory for your broken system (mount point), ie:
mkdir /mnt
mount root partition (let's say it's sda2) to created directory, ie:
mount /dev/sda2 /mnt
if your system is spread on many partitions (/boot, /var etc directory on separate partition) - mount them too! let's say your /boot is on sda1 and /var on sda3:
mount /dev/sda1 /mnt/boot
mount /dev/sda3 /mnt/var
copy (ie on usb drive) packages you removed in some accessible place on your system partition, ie /mnt/root.
"switch" to your system partition:
chroot /mnt
install packages, now they are in /root
it is done :)
next, to clean up:
exit chroot environment (Ctrl+D or logout).
umount partitions you mounted in 4. and then(!) 3, ie:
umount /mnt/var
umount /mnt/boot
umount /mnt
reboot to your hopefully rescued slackware os :)
| Linux Slackware ( Broken - kernel panic ) |
1,435,751,574,000 |
We asked our server provider to increase ram (from 4gb to 6gb) on our server. After they increased and restarted server, it started giving these messages:
Message from syslogd@www at Jul 1 14:39:04 ...
kernel:[ 30.426516] Oops: 0002 [#1] SMP
Message from syslogd@www at Jul 1 14:39:04 ...
kernel:[ 30.426677] last sysfs file: /sys/devices/virtual/net/lo/operstate
Message from syslogd@www at Jul 1 14:39:04 ...
kernel:[ 30.431797] Stack:
Message from syslogd@www at Jul 1 14:39:04 ...
kernel:[ 30.432892] Call Trace:
Message from syslogd@www at Jul 1 14:39:04 ...
kernel:[ 30.433380] Code: 00 00 55 53 49 8b 6c 24 08 48 89 fb 4c 39 e5 48 0f 44 e8 48 85 ed 74 3d 48 83 bf 00 02 00 00 00 75 09 83 3d 4e 3f 27 00 00 74 2a <80> 0c 25 5c 00 00 00 01 ff 45 54 ff 83 54 05 00 00 48 83 bb 00
Message from syslogd@www at Jul 1 14:39:04 ...
kernel:[ 30.436159] CR2: 000000000000005c
And our ERP (Odoo) stopped working after this. Our provider says it is Odoo fault for not working, not because they increased RAM, but everything was running fine before RAM was increased.
Also don't know if it is related, but on that server postgresql was optimized and kernel shared memory was increased (before ram upgrade) -
http://www.postgresql.org/docs/9.1/static/kernel-resources.html
Does it look like ram related problem? To me it looks like that, but our server provider can't seem to be able to fix it..
P.S. server is Linux debian squeeze. Kernel info: 2.6.32-5-amd64. And server is run on VM
Update
also syslog shows this (fragment of the log):
Jul 1 15:20:56 www snmpd[1288]: /etc/snmp/snmpd.conf: line 146: Error: unknown payload OID
Jul 1 15:20:56 www snmpd[1288]: Unknown payload OID: fileName
Jul 1 15:20:56 www snmpd[1288]: /etc/snmp/snmpd.conf: line 146: Error: Unknown payload OID
Jul 1 15:20:56 www snmpd[1288]: payload OID: fileErrorMsg
Jul 1 15:20:56 www snmpd[1288]: /etc/snmp/snmpd.conf: line 146: Error: unknown payload OID
Jul 1 15:20:56 www snmpd[1288]: Unknown payload OID: fileErrorMsg
Jul 1 15:20:56 www snmpd[1288]: /etc/snmp/snmpd.conf: line 146: Error: Unknown payload OID
Jul 1 15:20:56 www snmpd[1288]: trigger OID: fileErrorFlag
Jul 1 15:20:56 www snmpd[1288]: /etc/snmp/snmpd.conf: line 146: Error: unknown monitor OID
Jul 1 15:20:56 www snmpd[1288]: payload OID: snmperrErrMessage
Jul 1 15:20:56 www snmpd[1288]: /etc/snmp/snmpd.conf: line 146: Error: unknown payload OID
Jul 1 15:20:56 www snmpd[1288]: Unknown payload OID: snmperrErrMessage
Jul 1 15:20:56 www snmpd[1288]: /etc/snmp/snmpd.conf: line 146: Error: Unknown payload OID
Jul 1 15:20:56 www snmpd[1288]: trigger OID: snmperrErrorFlag
Jul 1 15:20:56 www snmpd[1288]: /etc/snmp/snmpd.conf: line 146: Error: unknown monitor OID
Jul 1 15:20:56 www snmpd[1288]: net-snmp: 33 error(s) in config file(s)
Update2
Also it shows this bug. This might be the root cause, but wonder why it happened and how to fix it.
Jul 1 15:57:50 www kernel: [ 866.578614] BUG: unable to handle kernel NULL pointer dereference at 000000000000005c
Jul 1 15:57:50 www kernel: [ 866.578788] IP: [<ffffffff8128c528>] tcp_send_fin+0x37/0x1ab
Jul 1 15:57:50 www kernel: [ 866.578894] PGD 1bcee6067 PUD 1bd558067 PMD 0
Jul 1 15:57:50 www kernel: [ 866.579027] Oops: 0002 [#15] SMP
Jul 1 15:57:50 www kernel: [ 866.579129] last sysfs file: /sys/devices/virtual/net/lo/operstate
Jul 1 15:57:50 www kernel: [ 866.579211] CPU 0
Jul 1 15:57:50 www kernel: [ 866.579281] Modules linked in: iptable_filter iptable_mangle ip_tables x_tables loop evdev snd_pcm snd_timer snd soundcore snd_page_alloc pcspkr parport_pc parport psmouse serio_raw container shpchp pci_hotplug processor i2c_piix4 button ac i2c_core ext3 jbd mbcache dm_mod vmw_pvscsi vmxnet3 sg sd_mod sr_mod cdrom ata_generic crc_t10dif ata_piix libata floppy mptspi mptscsih mptbase e1000 scsi_transport_spi scsi_mod thermal thermal_sys [last unloaded: scsi_wait_scan]
Jul 1 15:57:50 www kernel: [ 866.581127] Pid: 2639, comm: python Tainted: G D 2.6.32-5-amd64 #1 VMware Virtual Platform
Jul 1 15:57:50 www kernel: [ 866.581248] RIP: 0010:[<ffffffff8128c528>] [<ffffffff8128c528>] tcp_send_fin+0x37/0x1ab
Jul 1 15:57:50 www kernel: [ 866.581386] RSP: 0018:ffff8801bc937f08 EFLAGS: 00010286
Jul 1 15:57:50 www kernel: [ 866.581463] RAX: 0000000000000000 RBX: ffff8801bcf9d480 RCX: ffff8801bdfac901
Jul 1 15:57:50 www kernel: [ 866.581555] RDX: ffff880006e189d8 RSI: 0000000000000004 RDI: ffff8801bcf9d480
Jul 1 15:57:50 www kernel: [ 866.581648] RBP: ffff8801bae70000 R08: ffff8801badcd030 R09: 0000000000000002
Jul 1 15:57:50 www kernel: [ 866.581740] R10: 0000000000000002 R11: ffff8801bcf9d480 R12: ffff8801bcf9d548
Jul 1 15:57:50 www kernel: [ 866.581832] R13: ffff8801bdd6a3c0 R14: 00000000ffffffff R15: 00000000ffffffff
Jul 1 15:57:50 www kernel: [ 866.581924] FS: 00007fca17123700(0000) GS:ffff880006e00000(0000) knlGS:0000000000000000
Jul 1 15:57:50 www kernel: [ 866.582037] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Jul 1 15:57:50 www kernel: [ 866.582124] CR2: 000000000000005c CR3: 00000001bd570000 CR4: 00000000000406f0
Jul 1 15:57:50 www kernel: [ 866.582234] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
Jul 1 15:57:50 www kernel: [ 866.582329] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Jul 1 15:57:50 www kernel: [ 866.582421] Process python (pid: 2639, threadinfo ffff8801bc936000, task ffff8801bd510e20)
Jul 1 15:57:50 www kernel: [ 866.582537] Stack:
Jul 1 15:57:50 www kernel: [ 866.582588] ffff8801bcf9d480 0000000000000000 0000000000000002 ffffffff8129b6af
Jul 1 15:57:50 www kernel: [ 866.582757] <0> 000000000000002c ffff8801bdd6a3c0 0000000000000001 0000000000000001
Jul 1 15:57:50 www kernel: [ 866.583032] <0> 00007fca33f36829 ffffffff812423e7 00007fca171236a8 00007fca246bbc20
Jul 1 15:57:50 www kernel: [ 866.583291] Call Trace:
Jul 1 15:57:50 www kernel: [ 866.583350] [<ffffffff8129b6af>] ? inet_shutdown+0x97/0xdd
Jul 1 15:57:50 www kernel: [ 866.583431] [<ffffffff812423e7>] ? sys_shutdown+0x3d/0x5d
Jul 1 15:57:50 www kernel: [ 866.583512] [<ffffffff81010b22>] ? system_call_fastpath+0x16/0x1b
Jul 1 15:57:50 www kernel: [ 866.583596] Code: 00 00 55 53 49 8b 6c 24 08 48 89 fb 4c 39 e5 48 0f 44 e8 48 85 ed 74 3d 48 83 bf 00 02 00 00 00 75 09 83 3d 4e 3f 27 00 00 74 2a <80> 0c 25 5c 00 00 00 01 ff 45 54 ff 83 54 05 00 00 48 83 bb 00
Jul 1 15:57:50 www kernel: [ 866.585279] RIP [<ffffffff8128c528>] tcp_send_fin+0x37/0x1ab
Jul 1 15:57:50 www kernel: [ 866.585400] RSP <ffff8801bc937f08>
Jul 1 15:57:50 www kernel: [ 866.585468] CR2: 000000000000005c
Jul 1 15:57:50 www kernel: [ 866.585716] ---[ end trace 29537c3dcdc7a93f ]---
|
That's a kernel bug, Debian bug #789037 aka upstream bug #99161. It was introduced in a recent kernel update, and you probably saw it after the reboot (to install RAM) because you're now running that kernel.
The fix is already available; you need to install it (and reboot).
(BTW: I saw this on some of our servers after an unplanned reboot due to a circuit breaker blowing... The key part to Google was "tcp_send_fin+0x37".)
| Kernel panic? After ram increase |
1,435,751,574,000 |
I recently added a 2nd HDD to a system and then proceeded to do a clean install on to this 2nd HDD of CentOS 6.5. The original system was CentOS 5.9. My plan was to leave the original HDD in place so that I could pull data off of it as needed as we migrated several KVMs from HDD #1 to HDD #2.
All this went uneventfully, and I didn't even bother to remove HDD #1, figuring we'd "get around to it".
So fast forward to today and I actually attempted to remove HDD #1 and lo and behold I can't. Booting CentOS 6.5 off of HDD #2 seems to "know" about the original HDD and kernel panics when HDD #1 is removed.
The setup of this box is vanilla CentOS 6.5 with the "Virtualization*" YUM groups installed. There is no reference to HDD #1 in HDD #2's /etc/fstab. The only area where I would consider digging deeper is with LVM, since CentOS installs (all Red Hat distros for that matter) make use of LVM when setting up their HDDs.
Here's the stanza from /etc/grub.conf in case that might be helpful:
title CentOS (2.6.32-431.17.1.el6.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.32-431.17.1.el6.x86_64 ro root=/dev/mapper/vg_catbus-lv_root rd_NO_LUKS rd_LVM_LV=vg_catbus/lv_root LANG=en_US.UTF-8 rd_LV
M_LV=vg_catbus/lv_swap rd_NO_MD quiet SYSFONT=latarcyrheb-sun16 rhgb crashkernel=auto rd_LVM_LV=VolGroup00/LogVol01 KEYBOARDTYPE=pc KEYTABLE=us rd_NO
_DM
initrd /initramfs-2.6.32-431.17.1.el6.x86_64.img
Here too is the LVM setup:
$ sudo vgs
VG #PV #LV #SN Attr VSize VFree
VolGroup00 1 3 0 wz--n- 465.66g 0
vg_catbus 1 3 0 wz--n- 1.82t 0
$ sudo lvs
LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert
LogVol00 VolGroup00 -wi-a----- 442.19g
LogVol01 VolGroup00 -wi-ao---- 13.69g
LogVol02 VolGroup00 -wi-a----- 9.78g
lv_home vg_catbus -wi-ao---- 1.76t
lv_root vg_catbus -wi-ao---- 50.00g
lv_swap vg_catbus -wi-ao---- 13.77g
$ sudo pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 vg_catbus lvm2 a-- 1.82t 0
/dev/sdb2 VolGroup00 lvm2 a-- 465.66g 0
Key points
System crashes when I shutdown down the system, physically disconnect HDD #1, and then power the system back up.
The 500GB HDD is what I'm calling HDD #1, the 2TB HDD is what I'm calling HDD #2.
With HDD #1 connected, I can boot the system just fine.
|
The key item to notice in the output of /etc/grub.conf are these types of arguments being passed to the kernel:
rd_LVM_LV=VolGroup00/LogVol01
Removing this argument from GRUB's linux .. line resolved the issue. These are remnants of HDD #1's LVM. These were added automatically by the install to assist you, but in this case, it's caused this pseudo dependency on HDD #1 even when there isn't actually a "real" one.
Simply removing this line from /etc/grub.conf resolves it.
title CentOS (2.6.32-431.17.1.el6.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.32-431.17.1.el6.x86_64 ro root=/dev/mapper/vg_catbus-lv_root rd_NO_LUKS rd_LVM_LV=vg_catbus/lv_root LANG=en_US.UTF-8 rd_LV
M_LV=vg_catbus/lv_swap rd_NO_MD quiet SYSFONT=latarcyrheb-sun16 rhgb crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO
_DM
initrd /initramfs-2.6.32-431.17.1.el6.x86_64.img
Take care when making these edits and also be sure to remove them from any of the other title entries you may have in your /etc/grub.conf too.
| Removal of HDD causes kernel panic |
1,435,751,574,000 |
Sometimes (very rarely actually) I have a problem that when I try to shut down my desktop, it will freeze with the following screen and I can only shut it down by pressing the power button for 8 seconds:
Does anyone know why this error occurs? I am guessing it is because of the proprietary fglrx-driver. How I could get more diagnostic information if it reoccurs? I guess there would be a lot more information than I can capture with a simply photo, but as soon as the screen appears it is impossible to do anything.
The problem is, it occurs very rarely (maybe once a month) so it is not really a big hassle and I can not willingly recreate it.
I would just like to know what exactly is causing it.
Edit: After stumbling over this bug - this seems to be the reason for it: the fglrx driver seems to be buggy.
|
Such rarely occurring crashes are very hard to debug. It can be a hardware problem, driver (flgrx, as you've noticed) issue or even a kernel bug.
The easiest thing to do in your case is to change the video driver - of course that will only prevent further crashes only in case the driver was the problem source. Unfortunatelly, the right direction to go is not obvious: sometimes upgrading the driver can help, sometimes it can be better to rollback to a previous stable version.
You will have the highest chance of ruling out driver bug cause by switching to the open source alternative driver for ATI cards: either radeon or radeonhd.
Otherwise, if you really want to dig into the root of the problem and potentially help kernel/driver developers, you'll need some kernel debugging instrumentation. Have a look at LKCD, described in this article.
| Linux Mint does not shut down |
1,435,751,574,000 |
I downloaded pcap source compiled it and got a lib ending in libsomething.so.1.21.1. I tried to find how to install a lib online and in my impatience did the following
sudo .install-sh /lib libsomething.1.21.1
The output was the following
install-sh :250:chmod not found
install-sh : 1: rm :not found
After this I could not launch any program or shell command at the prompt in the terminal(I could use cd but not ls or others). Now when I try to boot into Ubuntu I get a kernel panic after the following line:
run-init:/sbin/init: No such file or directory.
.install-sh is in the pcap folder, source was taken directly from the website.
I don't have a clue as to what the script did, I would be very thankful if somebody could give me any pointers on how to proceed.
|
Ok, what I think happened is that the script moved /lib to libsomething.1.21.1 (in the directory where you were when you ran the script). After that, pretty much nothing worked. Every dynamically linked executable relies on the dynamic loader, which lives in /lib: move that and you're in trouble.
It is possible to recover from moving /lib, but your system is now unbootable. You need to repair it from some other bootable media (a live CD or DVD).
Repairing should be simple, because moving away /lib means there was no opportunity for further damage. Just find which directory you were in and move back /path/to/libsomething.1.21.1 to /lib.
In unix circles, the source almost always comes before the destination, when copying or moving stuff.
For future reference, don't install home-built binaries in /lib. Files in /bin, /lib, /sbin and /usr (except /usr/local) are managed by your distribution. The directory /usr/local is for your own stuff; install your non-packaged libraries in /usr/local/lib, your non-packaged executables in /usr/local/bin and so on.
| Ubuntu 10.04 can't boot, kernel panic |
1,435,751,574,000 |
Is there any way to cause a kernel panic under Linux? I've heard of
echo c > /proc/sysrq-trigger
but it seems to just freeze, and I'm not sure it's a kernel panic. Is there any C program I can run as root to cause a kernel panic?
|
using kill
I think you could try the following:
$ kill -6 1
This sends signal # 6 to process #1 (the init process). If you read up in the signals man page: "man 7 signals":
Signal Value Action Comment
-------------------------------------------------------------------------
SIGHUP 1 Term Hangup detected on controlling terminal
or death of controlling process
SIGINT 2 Term Interrupt from keyboard
SIGQUIT 3 Core Quit from keyboard
SIGILL 4 Core Illegal Instruction
SIGABRT 6 Core Abort signal from abort(3)
You can find out how a process wants to handle the various signals (cat /proc/$PID/status). See this U&L Q&A for more info: How can I check what signals a process is listening to?.
overflowing memory
Another method is to overflow memory to induce a kernel panic. First you'll need to disable swap.
$ swapon -s
Filename Type Size Used Priority
/dev/mapper/VolGroup00-LogVol01 partition 14352376 3177812 -1
$ swapoff /dev/mapper/VolGroup00-LogVol01
Now to consume all the memory:
$ for r in /dev/ram*; do cat /dev/zero > $r; done
References
How to force a Linux kernel panic
How can I check what signals a process is listening to?
| Intentional kernel panic under Linux? |
1,435,751,574,000 |
Im getting kernel oops because ppp driver is trying to access to unaligned address (there is a pointer pointing to unaligned address). Im not sure about the meaning of unaligned address. It means not multiple or 4 or out of RAM scope? If my system has a bus 32-bits wide, given an address how can i know if its aligned or unaligned?
|
In short an unaligned address is one of a simple type (e.g., integer or floating point variable) that is bigger than (usually) a byte and not evenly divisible by the size of the data type one tries to read.
Address % Size != 0
Say you have this memory range and read 4 bytes:
+---------- 8 % 4 = 0, OK
|
______+______
| |
... 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ...
--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+--
* | @ | @ | @ | @ | * | * | * | * | @ | @ | @ | @ | * | * | *
--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+--
|_______.______|
|
+--- 10 % 4 = 2, Unaligned
More on the matter in Documentation/unaligned-memory-access.txt.
| Know when a memory address is aligned or unaligned |
1,435,751,574,000 |
I'm trying to debug a prototype CPU that throws unhandled signal 11s and signal 7s in the startup process.
Here is what the kernel prints out. I have added extra print statements to the kernel to debug exactly which userspace processes are exhibiting the error.
[ 0.880000] Execing: /usr/bin/readlink
[ 0.884000] readlink[85]: unhandled signal 7 code 0x1 at 0x00000020000b8f60 in libc-2.26.so[2000049000+13e000]
[ 0.884000] CPU: 0 PID: 85 Comm: readlink Not tainted 4.15.0-rc6-31580-g9c3074b5c2cd-dirty #20
[ 0.884000] sepc: 00000020000b8f60 ra : 00000020000b8d2c sp : 0000003ffffd9a60
[ 0.884000] gp : 00000000001028a8 tp : 0000002000192710 t0 : 0000000000000458
[ 0.884000] t1 : 00000020000aae98 t2 : ffffffffffffffff s0 : 000000200018d468
[ 0.884000] s1 : 000000200018e7d0 a0 : 000000200018e810 a1 : 000000200018c768
[ 0.884000] a2 : fffffffffbad2884 a3 : 0000000000008000 a4 : 000000200018ef38
[ 0.884000] a5 : 0000000000000001 a6 : 0000000000000000 a7 : 0000000000000040
[ 0.884000] s2 : 0000000000000001 s3 : 0000002000192010 s4 : 000000200018c4b0
[ 0.884000] s5 : 0000000000000001 s6 : 000000200018dd58 s7 : 0000000000000000
[ 0.884000] s8 : 00000000000e3388 s9 : 0000000000000040 s10: 000000000009c000
[ 0.884000] s11: 0000000000000048 t3 : 0000000000061e98 t4 : 0000000000000002
[ 0.884000] t5 : 000000200004bb64 t6 : 0000000000000000
[ 0.884000] sstatus: 8000000200006020 sbadaddr: 0000000006200893 scause: 0000000000000006
[ 0.888000] Execing: /bin/rm
Here I see an unhandled signal 7 in readlink, which is executing some libc function. My question is, how do I determine which instruction in libc is causing this? The machine status printout does not include the instruction, only the sepc. Since libc is dynamically linked, I'm not sure how to find its reference in libc's code.
|
If I'm reading the kernel's source correctly, this line:
readlink[85]: unhandled signal 7 code 0x1 at 0x00000020000b8f60 in libc-2.26.so[2000049000+13e000]
Tells you what you need to know. libc is loaded at hexadecimal 0x2000049000, and is 0x13e000 bytes long. The address that the signal happened at is 0x00000020000b8f60. In order to figure out where relative to libc the error happens, compute 0x00000020000b8f60 - 0x2000049000.
I get 0x6ff60, so look for that location in objdump -d libc... or nm -g libc....
| Interpreting the unhandled signal exception in Linux |
1,435,751,574,000 |
I have an iMac mid 2011 running OSX and I am trying to install Arch Linux following this guide. I successfully set up a dual boot last year following a similar procedure but now I can't even start since I get a kernel panic while booting from the live usb installation of archiso: right before the login prompt. I'm 100% sure the image is not corrupted (I checked the signature and booted it on another pc).
Since last year it worked I tried every old release and I isolated the one that introduced the problem: it's 2015-05-01 kernel 4.0.1.
Older versions boot fine and I can complete the installation but after a restart I get the kernel panic anyway.
I don't know what to do because I can't change any setting on the archiso image and the stack trace goes so fast I can't even record it: in a glimpse I have noticed "null pointer dereference", "scheduling while atomic" and "fixing recursive fault but reboot is needed”.
How can I debug it? And, possibly, how do I solve this issue?
|
I installed the linux-lts package as suggested by @mikeserv from chroot and I set it as the default boot option from the grub configuration.
This way I could boot nicely into linux 3.14 and complete the installation process. The vanilla linux kernel is installed alongside with the LTS version so using the "advanced options" from the grub menu I could still boot with linux 4.0 and see the system crash.
I then tried using Kdump to make a memory dump of the machine during the kernel panic but for some reason I still don't know kexec won't start on the kernel I recompiled with debug options.
Eventually I manage to read the kernel panic log the hard way: by recording it with a high-frame rate camera and I was able to identify the driver that caused the crash: radeon_audio_detect. The bug has been reported several times and it seems to affect all macs with a radeon gpu and other systems as well.
A patch for it as already been added to the kernel in 4.2rc5
| How to debug a kernel panic on boot with archiso? |
1,435,751,574,000 |
I'm using an embedded board ARM9 SAM9G25. I want to boot from SD card.
When I build a linux kernel with a built-in rootfs (initramfs) then it boots.
I want to separate the kernel from rootfs and I generated a rootfs.squashfs.
The kernel command line is:
console=ttyAT0,115200 root=/dev/mmcblk0 ro rootfstype=squashfs
When I then boot my system the following kernel panic occurs:
VFS: Cannot open root device "mmcblk0" or unknown-block(0,0) Please
append a correct "root=" boot option; here are the available
partitions: Kernel panic - not syncing: VFS: Unable to mount root fs
on unknown-block(0,0)
Regression
I believe that partitioning doesn't lead to the solution, since booting with the same settings but with an initramfs is possible.
When booting with the initramfs image $ ls /dev doesn't list mmcblk or sdb.
$ dmesg
mmc0: clock 0Hz busmode 1 powermode 0 cs 0 Vdd 0 width 0 timing 0
atmel_mci atmel_mci.0: Atmel MCI controller at 0xf0008000 irq 12, 1 slots
mmc_host mmc0: card is not present
mmc1: clock 0Hz busmode 1 powermode 0 cs 0 Vdd 0 width 0 timing 0
atmel_mci atmel_mci.1: Atmel MCI controller at 0xf000c000 irq 26, 1 slots
mmc_host mmc1: card is not present
(Yes the card is in the slot ;)
So what I think happens now is, that U-Boot can read the SD device but the kernel doesn't. Since an initramfs is bootable, a single kernel can be loaded too but the rootfs, opened from kernel, cannot be found. In make linux menuconfig I already enabled
Device Drivers
<*> MMC/SD/SDIO card support
<*> MMC block device driver
<*> MMC host test driver
<*> Atmel SD/MMC Driver (Atmel Multimedia Card Interface support)
[ * ] Atmel MCI DMA support (Exp.)
Secure Digital Host Controller Interface support
but still with this setting it seems that he's not able to use the SD device.
I'm a bit clueless at this point, can someone give me a hint?
|
I found out the driver uses different pins (in the board header file, of the device drivers) than the actual hardware for the SD device. Thank you for your help, I thought it was a more generic error
| Why does boot from SD card with my custom kernel result in "VFS: Cannot open root device"? |
1,435,751,574,000 |
Background
I have a debian system on which I have something like the following in the fstab file.
/dev/sda1 / ext3 defaults,noatime,errors=panic 0 0
The option I wish to focus on is the errors=panic. According to the man page, it states the following.
Define the behaviour when an error is encountered. (Either ignore
errors and just mark the file system erroneous and continue, or
remount the file system read‐only, or panic and halt the system.) The
default is set in the filesystem superblock, and can be changed using
tune2fs(8).
Based on my understanding, an error when mounting would cause a kernel panic, which is fine. What I want to know is what happens when the kernel encounters an error when using the filesystem? Does it cause a kernel panic as specified by the mount option or does it use the option specified in the superblock as shown by tune2fs (or is that option overridden by the mount command) or does it do something else? If it does something else, what does it do and what can I look for for extra reading?
|
This behaviour can partially be depending on the implementation in the file system. Since in your case you appear to use Ext3, I'm talking about Ext3 here:
Regarding the first question, it will cause a panic whenever an error is encountered. This means if your disk is mounted and running and gets corrupted while already being mounted, once the error is encountered by the file system implementation the kernel will panic.
The value that's specified in the super block is used as default, if you explicitly specify another value in the mount parameter it overrides the value from the super block.
kernel Ext3 documentation
| Behavior of filesystem when mount option has been specified as error=panic |
1,435,751,574,000 |
When I installed Fedora, it did not have the Schrödinger's cat boot option, but then I installed a bunch of updates and now it is there. What is even more annoying is that it is the default boot option. Here is the log I get on the screen during boot:
Is there any way to fix this without reinstalling? If anyone wants boot log text file let me know and I will clear it and reboot and give you the output.
Edit:
I added the line to the /etc/yum.conf file and here is the new stack:
|
I found this thread over on AskFedora, titled: kernel panic Fedora 19. This doesn't solve the issue but works around it for the tim being:
I just blacklisted the buggy kernels in the /etc/yum.conf file. Stick
with the last one which works for now. Here's the line which you can
add to the YUM config.
exclude=kernel3.10.6-200.fc19.x86_64 kernel3.10.7-200.fc19.x86_64
| Fedora 19 (Schrödinger's cat) gets stuck on boot |
1,435,751,574,000 |
I was following http://fedoraproject.org/wiki/How_to_use_kdump_to_debug_kernel_crashes and in step 2 I need to add the line to grub.cfg, but grub.cfg is a shell I do not know how to edit it, most available resources tell you only the method to rearrange menu items, can anyone tell me what should be added to the file. I use 64-bit Fedora 18.
|
The kernel line in grub should looks like:
kernel /vmlinuz-3.1.4-1.fc16.x86_64 ro root=/dev/VolGroup00/LogVol00 rhgb LANG=en_US.UTF-8 crashkernel=128M
There's a note in the instructions:
(...) An example command line might look like this (for grub2, "kernel" is replaced by "linux"):
So, the one you are looking for is how to replace the kernel boot parameters. This is easily achievable modifying the GRUB_CMDLINE_LINUX_DEFAULT in the /etc/default/grub file. Then running su -c 'grub2-mkconfig -o /boot/grub2/grub.cfg' to update the script.
Open with an editor /etc/default/grub
Look for the GRUB_CMDLINE_LINUX_DEFAULT, add it if it's not present.
Append the crashkernel=128M to the line, like this:
GRUB_CMDLINE_LINUX_DEFAULT="quiet crashkernel=128M"
Save the file.
Run su -c 'grub2-mkconfig -o /boot/grub2/grub.cfg'
Check the grub.cfg file, that contains the lines correctly:
grep -i quiet /boot/grub/grub.cfg
linux /vmlinuz-3.12-1-amd64 root=UUID=cead26d6-08f4-4894-ac78-a9a4ce59f773 ro initrd=/install/initrd.gz quiet crashkernel=128M
linux /vmlinuz-3.12-1-amd64 root=UUID=cead26d6-08f4-4894-ac78-a9a4ce59f773 ro initrd=/install/initrd.gz quiet crashkernel=128M
Restart and done.
| How to edit grub2 to use kdump? |
1,435,751,574,000 |
My OS got kernel panic ( it looks like triggered another kernel to dump, kdump ? )
[ 124.674715] core: Uncorrected hardware memory error in user-access at xxxxxxx
[ 124.684140] BUG: scheduling while atomic: einj_mem_uc/5151/0xxxxxxxxx
[ 124.684310] {1}[Hardware Error]: Hardware error from APEI Generic Hardware Error Source: 0
r = 0xxxxxxxxxxx[ 124.691839] Memory failure: 0x25eae3: Killing einj_mem_uc:6161 due to hardware memory corruption
[ 124.700827] {1}[Hardware Error]: event severity: recoverable
[ 124.700828] {1}[Hardware Error]: Error 0, type: recoverable
00 paddr = xxxxx[ 124.700829] {1}[Hardware Error]: fru_text: Card01, ChnE, DIMM0
[ 124.700830] {1}[Hardware Error]: section_type: memory error
[ 124.700835] {1}[Hardware Error]: error_status: 0x0000000000000400
[ 124.712309] Memory failure: 0x25eae3: recovery action for dirty LRU page: Recovered
[ 124.718713] {1}[Hardware Error]: physical_address: 0x000000015ace3400
[ 124.718715] {1}[Hardware Error]: node: 0 card: 4 module: 0 rank: 0 bank: 21 device: 0 row: 10455 column: 1408
[ 124.718716] {1}[Hardware Error]: error_type: 4, single-symbol chipkill ECC
[ 124.718718] {1}[Hardware Error]: DIMM location: _Node0_Channel4_Dimm0 CPU0_E0
[ 124.791089] Memory failure: 0x25eae3: already hardware poisoned
3 116
400
[ 0.000000] Linux version 4.18.0-348.el8.x86_64
I checked the source code:
https://elixir.bootlin.com/linux/v4.18/source/kernel/sched/core.c#L3287
OS should only panic when panic_on_warn == 1, but I checked my OS:
sudo sysctl -a | grep -i panic_on
...
kernel.panic_on_warn = 0
|
OK then, only in order to confirm my comments here-above thanks to the supplemental information you provided :
The kernel does not panic because of BUG: scheduling while atomic (being, as intended with kernel.panic_on_warn = 0, not a valid reason for panicing) but more obviously because of repeated hardware memory failures detected by the MCE interrupt handler and possibly source of some fatal problem in that handler.
| Why kernel panic when panic_on_warn==0 |
1,435,751,574,000 |
Few hours later after this issue occurred, out of nowhere i got a some sort of a kernel panic for the first time !
lines were flying all the way up i couldn't read it properly, so i unplugged the laptop and restarted it , check my syslog and i've found this weird spam
Oct 9 23:19:03 www tracker-miner-f[4463]: Could not execute sparql: UNIQUE constraint failed: nie:DataObject.nie:url (strerror of errno (not necessarily related): No such file or directory)
Oct 9 23:19:03 www tracker-miner-f[4463]: (Sparql buffer) Error in task 16 (file:///home/rahman/Downloads/reaver-1.3/reaver-1.3/src/utils/common.c) of the array-update: UNIQUE constraint failed: nie:DataObject.nie:url (strerror of errno (not necessarily related): No such file or directory)
Oct 9 23:19:03 www tracker-miner-f[4463]: Could not execute sparql: UNIQUE constraint failed: nie:DataObject.nie:url (strerror of errno (not necessarily related): No such file or directory)
Oct 9 23:19:03 www tracker-miner-f[4463]: (Sparql buffer) Error in task 17 (file:///home/rahman/Downloads/reaver-1.3/reaver-1.3/src/utils/os_none.c) of the array-update: UNIQUE constraint failed: nie:DataObject.nie:url (strerror of errno (not necessarily related): No such file or directory)
Oct 9 23:19:03 www tracker-miner-f[4463]: Could not execute sparql: UNIQUE constraint failed: nie:DataObject.nie:url (strerror of errno (not necessarily related): No such file or directory)
Oct 9 23:19:03 www tracker-miner-f[4463]: (Sparql buffer) Error in task 18 (file:///home/rahman/Downloads/reaver-1.3/reaver-1.3/src/utils/eloop_none.c) of the array-update: UNIQUE constraint failed: nie:DataObject.nie:url (strerror of errno (not necessarily related): No such file or directory)
Oct 9 23:19:03 www tracker-miner-f[4463]: Could not execute sparql: UNIQUE constraint failed: nie:DataObject.nie:url (strerror of errno (not necessarily related): No such file or directory)
Oct 9 23:19:03 www tracker-miner-f[4463]: (Sparql buffer) Error in task 19 (file:///home/rahman/Downloads/reaver-1.3/reaver-1.3/src/utils/ip_addr.h) of the array-update: UNIQUE constraint failed: nie:DataObject.nie:url (strerror of errno (not necessarily related): No such file or directory)
Oct 9 23:19:03 www tracker-miner-f[4463]: Could not execute sparql: UNIQUE constraint failed: nie:DataObject.nie:url (strerror of errno (not necessarily related): No such file or directory)
Oct 9 23:19:03 www tracker-miner-f[4463]: (Sparql buffer) Error in task 20 (file:///home/rahman/Downloads/reaver-1.3/reaver-1.3/src/utils/trace.h) of the array-update: UNIQUE constraint failed: nie:DataObject.nie:url (strerror of errno (not necessarily related): No such file or directory)
Oct 9 23:19:03 www tracker-miner-f[4463]: Could not execute sparql: UNIQUE constraint failed: nie:DataObject.nie:url (strerror of errno (not necessarily related): No such file or directory)
Oct 9 23:19:03 www tracker-miner-f[4463]: (Sparql buffer) Error in task 21 (file:///home/rahman/Downloads/reaver-1.3/reaver-1.3/src/utils/eloop.c) of the array-update: UNIQUE constraint failed: nie:DataObject.nie:url (strerror of errno (not necessarily related): No such file or directory)
Oct 9 23:19:03 www tracker-miner-f[4463]: Could not execute sparql: UNIQUE constraint failed: nie:DataObject.nie:url (strerror of errno (not necessarily related): No such file or directory)
Oct 9 23:19:03 www tracker-miner-f[4463]: (Sparql buffer) Error in task 22 (file:///home/rahman/Downloads/reaver-1.3/reaver-1.3/src/utils/base64.c) of the array-update: UNIQUE constraint failed: nie:DataObject.nie:url (strerror of errno (not necessarily related): No such file or directory)
Oct 9 23:19:03 www tracker-miner-f[4463]: Could not execute sparql: UNIQUE constraint failed: nie:DataObject.nie:url (strerror of errno (not necessarily related): No such file or directory)
Oct 9 23:19:03 www tracker-miner-f[4463]: (Sparql buffer) Error in task 23 (file:///home/rahman/Downloads/reaver-1.3/reaver-1.3/src/utils/common.h) of the array-update: UNIQUE constraint failed: nie:DataObject.nie:url (strerror of errno (not necessarily related): No such file or directory)
Oct 9 23:19:03 www tracker-miner-f[4463]: Could not execute sparql: UNIQUE constraint failed: nie:DataObject.nie:url (strerror of errno (not necessarily related): No such file or directory)
Oct 9 23:19:03 www tracker-miner-f[4463]: (Sparql buffer) Error in task 24 (file:///home/rahman/Downloads/reaver-1.3/reaver-1.3/src/utils/pcsc_funcs.h) of the array-update: UNIQUE constraint failed: nie:DataObject.nie:url (strerror of errno (not necessarily related): No such file or directory)
Oct 9 23:19:03 www tracker-miner-f[4463]: Could not execute sparql: UNIQUE constraint failed: nie:DataObject.nie:url (strerror of errno (not necessarily related): No such file or directory)
Oct 9 23:19:03 www tracker-miner-f[4463]: (Sparql buffer) Error in task 25 (file:///home/rahman/Downloads/reaver-1.3/reaver-1.3/src/utils/includes.h) of the array-update: UNIQUE constraint failed: nie:DataObject.nie:url (strerror of errno (not necessarily related): No such file or directory)
it's not just those it keeps printing that all over the syslog
i scanned the directory with clamav hoping there is a malware or something that caused all that but it's clean
my uname -a output
Linux www 4.9.0-4-amd64 #1 SMP Debian 4.9.51-1 (2017-09-28) x86_64 GNU/Linux
what was that ?
PS: sorry, i don't know where to get the kernel panic message so i took a picture of just the last bunch of lines before i unplugged it
Update : Now it completely frozen up and I had to unplug it.
|
Problem resolved, I noticed that the problems started to occur the day after installing kernel 4.9.0-4, So I used kernel 4.9.0-3 and the problem disappeared, then reinstalled the kernel 4.9.0-4 and found an error I didn't notice last time
Error! Bad return status for module build on kernel: 4.9.0-4 (x86_64)
Consult /var/lib/dkms/bcmwl/6.30.223.248+bdcom/build/make.log for more information.
so I purged bcmwl-kernel-source and reinstalled the kernel again and the error disappeared and everything is now working fine, no kernel panics no freezings.
and yes: tracker-miner-f is irrelevant.
| kernel panic then a spam from tracker-miner-f in syslog [closed] |
1,435,751,574,000 |
I'm trying to boot the 4.13.0-rc2 mainline kernel on the Beaglebone Black (rev C) with omap2plus_defconfig over NFS. I've enabled CONFIG_NFS_ROOT along with the following options:
CONFIG_NFS_FS=y
CONFIG_NFS_V2=y
CONFIG_NFS_V3=y
CONFIG_NFS_V3_ACL=y
CONFIG_NFS_V4=y
CONFIG_NFS_SWAP=y
CONFIG_NFS_V4_1=y
CONFIG_NFS_V4_2=y
CONFIG_PNFS_FILE_LAYOUT=y
CONFIG_PNFS_FLEXFILE_LAYOUT=m
CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org"
CONFIG_NFS_V4_1_MIGRATION=y
CONFIG_NFS_V4_SECURITY_LABEL=y
CONFIG_ROOT_NFS=y
# CONFIG_NFS_USE_LEGACY_DNS is not set
CONFIG_NFS_USE_KERNEL_DNS=y
# CONFIG_NFSD is not set
I'm using nfs-kernel-server with this /etc/exports. Here is an excerpt from the boot log and my u-Boot session. I've enabled nfsrootdebug in the kernel command line but it doesn't look like it has any effect. journalctl -xe on the NFS server side does indicate attempts to access the directory but the boot log doesn't print anything at all.
What could be causing this? How can I get more debug information to zero in on the cause?
|
For some reason a lot of boards with u-Boot based bootloader don't like NFSv4. If you add v3 option to nfs it should work well. Of course, this needs to be investigated further, but due to lack of time I was not able to find the reason for that.
| Kernel Boot over NFS |
1,435,751,574,000 |
I recently finally finished my build of LinuxFromScratch version 7.9-SYSTEMD. There is one change I had to make from the book. I needed to aquire a patch for the package inettools that caused PATH_PROCNET_DEV to be undefined. Besdides that, my LFS build is on a second hard drive and will be booting independently from the host system. I am running Ubuntu 16.06 in VMWare and the LFS target machine is also ion VMWare. After the kernel starts to load it goes into a panic state saying:
[ 10.063526] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
I have already check whether or not the fs type and hard disk type are enabled in the kernel, rebuilt, and still to no avail. Is there anything I have missed in trying to fix this?
EDIT: Changing the hard disk type from SCSI to SATA did not work, nor did changing it to IDE
EDIT: This is my current grub.cfg file:
set default=0
set timeout=5
insmod ext2
set root=(hd0,gpt2)
menuentry "LinuxFromScratch-7.9-SYSTEMD" {
linux /boot/vmlinuz-current-lfs-7.9-systemd root=/dev/sda2 ro
}
EDIT: Running update-grub on the host successfully found the installation, but it still fails to boot with the same Kernel Panic error. I will try rebuilding my kernel to see if there's something I missed in its copnfiguration
|
I know it's been awhile, but in recently rebuilding the LFS project, it is, by default, incompatible with VM booting. The LFS has to be booted as the host lb a physical machine. If anyone can prove me wrong, please do.
| LFS Kernel Panic on first boot |
1,435,751,574,000 |
Getting this message attempting to boot CentOS 7
BUG: unable to handle kernel NULL pointer dereference at 000000000000009B
And then a kernel panic
Happens when trying to boot from the OS HDD or from the CentOS 7 CD in rescue mode.
Kernel Version: 3.10-123
I would like to recover this installation if I can instead of completely reinstalling/configuring this server again. Everything was working fine last night, and this morning, KA-BOOM!
I'll be happy to provide whatever information I can. unfortunately log entries are not available since I can't even get the system booted.
Update: I have tried booting into different runlevels. All result with the same kernel panic.
|
For those of you interested. Turns out there was some kind of corruption of the LVM. My guess is due to me resizing the LVM partitions. Managed to get a Live CD of CentOS 7 booting and every time I try to mount the partition I need, I receive the Kernel Panic. So my tip to anyone. If you have resized your LVM partitions this is likely the cause for the panic.
| CentOS 7 Crash on boot |
1,435,751,574,000 |
Is the name kernel panic being used outside of Linux-based systems?
|
The original v1 version of Unix had a label in the source code (assembly language) called panic:. If something went wrong elsewhere, code would jump to there and the system would reboot (that's an assumption given a comment in the code, in contradiction to the Van Vleck quote). The string "kernel panic" does not appear there, but this would appear to be the origin of kernel panic in Unix.
The term has continued to be used throughout the lifetime of Unix and its derivatives.
| Where is 'kernel panic' used? |
1,435,751,574,000 |
The following Kernel Panic occurred on my embedded board.
I am using 3.10 Kernel.
I am analyzing the cause of the Kernel Panic.
The Kernel Panic message shows the PID(735).
Feb 22 19:40:28 TEST kenel: CPU: 0 `PID: 735` Comm: cat Not tainted 3.10.73 #2
Feb 22 19:40:28 TEST kernel: Process cat `(pid: 735`, stack limit = 0xee46c238)
Does the PID mean the killer of the Kernel Panic?
Below is my entire Kernel Panic message.
Kernel Panic seems to be a really hard friend.... :(
Feb 22 19:40:28 TEST kernel: Unable to handle kernel NULL pointer dereference at virtual address 0000000c
Feb 22 19:40:28 TEST kernel: pgd = c0004000
Feb 22 19:40:28 TEST kernel: [0000000c] *pgd=00000000
Feb 22 19:40:28 TEST kernel: Internal error: Oops: 17 [#1] PREEMPT SMP ARM
Feb 22 19:40:28 TEST kernel: Modules linked in: m2i_trn g_m2i libcomposite iptable_filter ip_tables smsc95xx usbnet mousedev rh_special_switches pn5xx_i2c mram tsc2007 spicc buzzer cover backlight device_info [last unloaded: spi_fieldbus]
Feb 22 19:40:28 TEST kernel: CPU: 0 PID: 735 Comm: cat Not tainted 3.10.73 #2
Feb 22 19:40:28 TEST kernel: task: ee404000 ti: ee46c000 task.ti: ee46c000
Feb 22 19:40:28 TEST kernel: PC is at set_page_dirty+0x20/0x68
Feb 22 19:40:28 TEST kernel: LR is at set_page_dirty+0xc/0x68
Feb 22 19:40:28 TEST kernel: pc : [<c00a3c50>] lr : [<c00a3c3c>] psr: a0000013
Feb 22 19:40:28 TEST kernel: sp : ee46de48 ip : 0002f9f9 fp : b6ffa000
Feb 22 19:40:28 TEST kernel: r10: ee46dee0 r9 : ee46de84 r8 : b6ffc000
Feb 22 19:40:28 TEST kernel: r7 : c0fd3860 r6 : 00000000 r5 : c0fd3860 r4 : ee3d87ec
Feb 22 19:40:28 TEST kernel: r3 : 00000000 r2 : 40080068 r1 : c0fd3860 r0 : 00000012
Feb 22 19:40:28 TEST kernel: Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
Feb 22 19:40:28 TEST kernel: Control: 10c5387d Table: 2eb3c04a DAC: 00000015
Feb 22 19:40:28 TEST kernel:
Feb 22 19:40:28 TEST kernel: PC: 0xc00a3bd0:
Feb 22 19:40:28 TEST kernel: 3bd0 e2505000 1a000001 e1a00005 e8bd8038 e375001c e2841048 03a0001a 13a00019
Feb 22 19:40:28 TEST kernel: 3bf0 eb0456e6 eafffff7 e92d4010 e1a04000 eb002f48 e590304c e5933010 e3130c02
Feb 22 19:40:28 TEST kernel: 3c10 08bd8010 e5943000 e3130a02 08bd8010 e1a00004 e3a0100d e8bd4010 eaffdee6
Feb 22 19:40:28 TEST kernel: 3c30 e92d4038 e1a05000 eb002f3a e3500000 0a00000a e5903044 e1a01005 e3a00012
Feb 22 19:40:28 TEST kernel: 3c50 e593400c eb044d0a e59f3034 e1a00005 e3540000 01a04003 e12fff34 e8bd8038
Feb 22 19:40:28 TEST kernel: 3c70 e5953000 e3130010 18bd8038 e1a01005 e3a00004 eb045711 e2700001 33a00000
Feb 22 19:40:28 TEST kernel: 3c90 e8bd8038 c00fd924 e92d4030 e1a04000 e24dd00c eb002f1f e5943000 e1a05000
Feb 22 19:40:28 TEST kernel: 3cb0 e3130001 0a00002b e3500000 0a000003 e590304c e5933010 e3130001 0a000004
Feb 22 19:40:28 TEST kernel:
Feb 22 19:40:28 TEST kernel: LR: 0xc00a3bbc:
Feb 22 19:40:28 TEST kernel: 3bbc e92d4038 e1a04002 e5923044 e5933000 e12fff33 e2505000 1a000001 e1a00005
Feb 22 19:40:28 TEST kernel: 3bdc e8bd8038 e375001c e2841048 03a0001a 13a00019 eb0456e6 eafffff7 e92d4010
Feb 22 19:40:28 TEST kernel: 3bfc e1a04000 eb002f48 e590304c e5933010 e3130c02 08bd8010 e5943000 e3130a02
Feb 22 19:40:28 TEST kernel: 3c1c 08bd8010 e1a00004 e3a0100d e8bd4010 eaffdee6 e92d4038 e1a05000 eb002f3a
Feb 22 19:40:28 TEST kernel: 3c3c e3500000 0a00000a e5903044 e1a01005 e3a00012 e593400c eb044d0a e59f3034
Feb 22 19:40:28 TEST kernel: 3c5c e1a00005 e3540000 01a04003 e12fff34 e8bd8038 e5953000 e3130010 18bd8038
Feb 22 19:40:28 TEST kernel: 3c7c e1a01005 e3a00004 eb045711 e2700001 33a00000 e8bd8038 c00fd924 e92d4030
Feb 22 19:40:28 TEST kernel: 3c9c e1a04000 e24dd00c eb002f1f e5943000 e1a05000 e3130001 0a00002b e3500000
Feb 22 19:40:28 TEST kernel:
Feb 22 19:40:28 TEST kernel: SP: 0xee46ddc8:
Feb 22 19:40:28 TEST kernel: ddc8 000000a8 0000006d b6f6a000 c105ace0 00000000 ffffffff 0000006d c06c8f40
Feb 22 19:40:28 TEST kernel: dde8 c00a3c50 a0000013 ffffffff ee46de34 b6ffc000 c000dd98 00000012 c0fd3860
Feb 22 19:40:28 TEST kernel: de08 40080068 00000000 ee3d87ec c0fd3860 00000000 c0fd3860 b6ffc000 ee46de84
Feb 22 19:40:28 TEST kernel: de28 ee46dee0 b6ffa000 0002f9f9 ee46de48 c00a3c3c c00a3c50 a0000013 ffffffff
Feb 22 19:40:28 TEST kernel: de48 326c375f ee3d87ec ee3d87e8 c00b8db0 ee46de58 ee785c00 c0f51b1c edef6f60
Feb 22 19:40:28 TEST kernel: de68 ee93edb8 326c375f ee46c000 ee93edb8 b6ffc000 b6ffbfff 60000013 00000000
Feb 22 19:40:28 TEST kernel: de88 fffffffe 00000000 ee46c000 edef6f60 ffffffff ee46dee0 00000000 00000000
Feb 22 19:40:28 TEST kernel: dea8 ee46c000 ee785c40 00000000 c00b98c0 00000000 ee46c000 edef6c60 ee46df08
Feb 22 19:40:28 TEST kernel:
Feb 22 19:40:28 TEST kernel: R1: 0xc0fd37e0:
Feb 22 19:40:28 TEST kernel: 37e0 40080068 ee913501 000010ea 00000000 00000001 c0fd37d4 c0fd3a34 00000000
Feb 22 19:40:28 TEST kernel: 3800 40080068 ee913501 000010e2 00000000 00000001 c0f94cf4 c0fd3754 00000000
Feb 22 19:40:28 TEST kernel: 3820 40080068 ee913501 000010da 00000000 00000001 c0fd3694 c0fd3734 00000000
Feb 22 19:40:28 TEST kernel: 3840 4002002c ef074d64 00000038 ffffffff 00000001 c0f92af4 c0f8ed94 00000000
Feb 22 19:40:28 TEST kernel: 3860 40080068 ee97a400 000b6ffa 00000000 00000001 c0fbbeb4 c0f91674 00000000
Feb 22 19:40:28 TEST kernel: 3880 4002002c ef074d64 00000033 ffffffff 00000001 c0fa6034 c0f94574 00000000
Feb 22 19:40:28 TEST kernel: 38a0 40000000 00000000 00000002 ffffffff 00000000 c0fc8a14 c0f91514 00000000
Feb 22 19:40:28 TEST kernel: 38c0 40080068 ee913501 00001146 00000000 00000001 c0fd8d54 c0f92d34 00000000
Feb 22 19:40:28 TEST kernel:
Feb 22 19:40:28 TEST kernel: R4: 0xee3d876c:
Feb 22 19:40:28 TEST kernel: 876c 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Feb 22 19:40:28 TEST kernel: 878c 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Feb 22 19:40:28 TEST kernel: 87ac 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Feb 22 19:40:28 TEST kernel: 87cc 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Feb 22 19:40:28 TEST kernel: 87ec 305b375f 00000000 31af57df 305d375f 00000000 00000000 00000000 00000000
Feb 22 19:40:28 TEST kernel: 880c 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Feb 22 19:40:28 TEST kernel: 882c 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Feb 22 19:40:28 TEST kernel: 884c 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Feb 22 19:40:28 TEST kernel:
Feb 22 19:40:28 TEST kernel: R5: 0xc0fd37e0:
Feb 22 19:40:28 TEST kernel: 37e0 40080068 ee913501 000010ea 00000000 00000001 c0fd37d4 c0fd3a34 00000000
Feb 22 19:40:28 TEST kernel: 3800 40080068 ee913501 000010e2 00000000 00000001 c0f94cf4 c0fd3754 00000000
Feb 22 19:40:28 TEST kernel: 3820 40080068 ee913501 000010da 00000000 00000001 c0fd3694 c0fd3734 00000000
Feb 22 19:40:28 TEST kernel: 3840 4002002c ef074d64 00000038 ffffffff 00000001 c0f92af4 c0f8ed94 00000000
Feb 22 19:40:28 TEST kernel: 3860 40080068 ee97a400 000b6ffa 00000000 00000001 c0fbbeb4 c0f91674 00000000
Feb 22 19:40:28 TEST kernel: 3880 4002002c ef074d64 00000033 ffffffff 00000001 c0fa6034 c0f94574 00000000
Feb 22 19:40:28 TEST kernel: 38a0 40000000 00000000 00000002 ffffffff 00000000 c0fc8a14 c0f91514 00000000
Feb 22 19:40:28 TEST kernel: 38c0 40080068 ee913501 00001146 00000000 00000001 c0fd8d54 c0f92d34 00000000
Feb 22 19:40:28 TEST kernel:
Feb 22 19:40:28 TEST kernel: R7: 0xc0fd37e0:
Feb 22 19:40:28 TEST kernel: 37e0 40080068 ee913501 000010ea 00000000 00000001 c0fd37d4 c0fd3a34 00000000
Feb 22 19:40:28 TEST kernel: 3800 40080068 ee913501 000010e2 00000000 00000001 c0f94cf4 c0fd3754 00000000
Feb 22 19:40:28 TEST kernel: 3820 40080068 ee913501 000010da 00000000 00000001 c0fd3694 c0fd3734 00000000
Feb 22 19:40:28 TEST kernel: 3840 4002002c ef074d64 00000038 ffffffff 00000001 c0f92af4 c0f8ed94 00000000
Feb 22 19:40:28 TEST kernel: 3860 40080068 ee97a400 000b6ffa 00000000 00000001 c0fbbeb4 c0f91674 00000000
Feb 22 19:40:28 TEST kernel: 3880 4002002c ef074d64 00000033 ffffffff 00000001 c0fa6034 c0f94574 00000000
Feb 22 19:40:28 TEST kernel: 38a0 40000000 00000000 00000002 ffffffff 00000000 c0fc8a14 c0f91514 00000000
Feb 22 19:40:28 TEST kernel: 38c0 40080068 ee913501 00001146 00000000 00000001 c0fd8d54 c0f92d34 00000000
Feb 22 19:40:28 TEST kernel:
Feb 22 19:40:28 TEST kernel: R9: 0xee46de04:
Feb 22 19:40:28 TEST kernel: de04 c0fd3860 40080068 00000000 ee3d87ec c0fd3860 00000000 c0fd3860 b6ffc000
Feb 22 19:40:28 TEST kernel: de24 ee46de84 ee46dee0 b6ffa000 0002f9f9 ee46de48 c00a3c3c c00a3c50 a0000013
Feb 22 19:40:28 TEST kernel: de44 ffffffff 326c375f ee3d87ec ee3d87e8 c00b8db0 ee46de58 ee785c00 c0f51b1c
Feb 22 19:40:28 TEST kernel: de64 edef6f60 ee93edb8 326c375f ee46c000 ee93edb8 b6ffc000 b6ffbfff 60000013
Feb 22 19:40:28 TEST kernel: de84 00000000 fffffffe 00000000 ee46c000 edef6f60 ffffffff ee46dee0 00000000
Feb 22 19:40:28 TEST kernel: dea4 00000000 ee46c000 ee785c40 00000000 c00b98c0 00000000 ee46c000 edef6c60
Feb 22 19:40:28 TEST kernel: dec4 ee46df08 ee785c00 ee785c00 ee46c000 c00bf4ec c0f696e0 0025ceb0 ee785c00
Feb 22 19:40:28 TEST kernel: dee4 00000001 00000000 00000000 ffffffff c045ec74 00000000 00000072 00000400
Feb 22 19:40:28 TEST kernel:
Feb 22 19:40:28 TEST kernel: R10: 0xee46de60:
Feb 22 19:40:28 TEST kernel: de60 c0f51b1c edef6f60 ee93edb8 326c375f ee46c000 ee93edb8 b6ffc000 b6ffbfff
Feb 22 19:40:28 TEST kernel: de80 60000013 00000000 fffffffe 00000000 ee46c000 edef6f60 ffffffff ee46dee0
Feb 22 19:40:28 TEST kernel: dea0 00000000 00000000 ee46c000 ee785c40 00000000 c00b98c0 00000000 ee46c000
Feb 22 19:40:28 TEST kernel: dec0 edef6c60 ee46df08 ee785c00 ee785c00 ee46c000 c00bf4ec c0f696e0 0025ceb0
Feb 22 19:40:28 TEST kernel: dee0 ee785c00 00000001 00000000 00000000 ffffffff c045ec74 00000000 00000072
Feb 22 19:40:28 TEST kernel: df00 00000400 ee912000 00000000 c045ec74 00000000 c045e9dc 00000001 c045e7f8
Feb 22 19:40:28 TEST kernel: df20 00000000 c045ec74 ee785c30 ee785c00 00000000 ee404000 ee785c00 c0029360
Feb 22 19:40:28 TEST kernel: df40 ee4042fc c00302a0 00000020 00000001 c0680eb4 00000000 00060006 c004fa88
Feb 22 19:40:28 TEST kernel: Process cat (pid: 735, stack limit = 0xee46c238)
Feb 22 19:40:28 TEST kernel: Stack: (0xee46de48 to 0xee46e000)
Feb 22 19:40:28 TEST kernel: de40: 326c375f ee3d87ec ee3d87e8 c00b8db0 ee46de58 ee785c00
Feb 22 19:40:28 TEST kernel: de60: c0f51b1c edef6f60 ee93edb8 326c375f ee46c000 ee93edb8 b6ffc000 b6ffbfff
Feb 22 19:40:28 TEST kernel: de80: 60000013 00000000 fffffffe 00000000 ee46c000 edef6f60 ffffffff ee46dee0
Feb 22 19:40:28 TEST kernel: dea0: 00000000 00000000 ee46c000 ee785c40 00000000 c00b98c0 00000000 ee46c000
Feb 22 19:40:28 TEST kernel: dec0: edef6c60 ee46df08 ee785c00 ee785c00 ee46c000 c00bf4ec c0f696e0 0025ceb0
Feb 22 19:40:28 TEST kernel: dee0: ee785c00 00000001 00000000 00000000 ffffffff c045ec74 00000000 00000072
Feb 22 19:40:28 TEST kernel: df00: 00000400 ee912000 00000000 c045ec74 00000000 c045e9dc 00000001 c045e7f8
Feb 22 19:40:28 TEST kernel: df20: 00000000 c045ec74 ee785c30 ee785c00 00000000 ee404000 ee785c00 c0029360
Feb 22 19:40:28 TEST kernel: df40: ee4042fc c00302a0 00000020 00000001 c0680eb4 00000000 00060006 c004fa88
Feb 22 19:40:28 TEST kernel: df60: c0680eb4 ef391d40 00000000 ee46c000 000000f8 c000e3e8 ee46c000 00000000
Feb 22 19:40:28 TEST kernel: df80: 00000000 c0030a20 00000000 000700de b6fd9760 b6fd9760 000000f8 c0030aa4
Feb 22 19:40:28 TEST kernel: dfa0: 00000000 c000e240 000700de b6fd9760 00000000 000700ca b6ff84c0 00000000
Feb 22 19:40:28 TEST kernel: dfc0: 000700de b6fd9760 b6fd9760 000000f8 00000002 00000000 00010000 00000000
Feb 22 19:40:28 TEST kernel: dfe0: 000000f8 be8b5474 b6f6afc3 b6f14276 60000030 00000000 00000000 00000000
Feb 22 19:40:28 TEST kernel: [<c00a3c50>] (set_page_dirty+0x20/0x68) from [<c00b8db0>] (unmap_single_vma+0x4d0/0x63c)
Feb 22 19:40:28 TEST kernel: [<c00b8db0>] (unmap_single_vma+0x4d0/0x63c) from [<c00b98c0>] (unmap_vmas+0x54/0x68)
Feb 22 19:40:28 TEST kernel: [<c00b98c0>] (unmap_vmas+0x54/0x68) from [<c00bf4ec>] (exit_mmap+0xd8/0x1f8)
Feb 22 19:40:28 TEST kernel: [<c00bf4ec>] (exit_mmap+0xd8/0x1f8) from [<c0029360>] (mmput+0x48/0xf4)
Feb 22 19:40:28 TEST kernel: [<c0029360>] (mmput+0x48/0xf4) from [<c00302a0>] (do_exit+0x244/0x878)
Feb 22 19:40:28 TEST kernel: [<c00302a0>] (do_exit+0x244/0x878) from [<c0030a20>] (do_group_exit+0x3c/0xb0)
Feb 22 19:40:28 TEST kernel: [<c0030a20>] (do_group_exit+0x3c/0xb0) from [<c0030aa4>] (__wake_up_parent+0x0/0x18)
Feb 22 19:40:28 TEST kernel: Code: 0a00000a e5903044 e1a01005 e3a00012 (e593400c)
Feb 22 19:40:28 TEST kernel: ---[ end trace 28aa0afec355b4f9 ]---
Feb 22 19:40:28 TEST kernel: Fixing recursive fault but reboot is needed!
|
The cat program was running with a PID of 735 when the panic occurred, i.e. the fault happened in the context of the process with PID 735. This does not mean that the cat program did something wrong. The fault is in the kernel, a panic is something that should not happen under any circumstances (unless you really try with root privileges). The bug causing the panic can be in a device driver that is invoked when the cat program reads or writes from/to some device. Or it could be caused by a totally unrelated interrupt; all interrupt handlers are run in the context of the currently running process, even if they don't serve the process in any way.
As you have noticed, debugging a kernel panic is not an easy task.
| Is the [PID] of Kernel Panic the killer of Kernel Panic? |
1,435,751,574,000 |
I have an old laptop. The newer kernels that ship with the latest versions of the most popular Linux distributions crash from time to time. I want to use a new Linux distribution to get the latest packages and therefore I think that I need an old kernel. (correct me if there is some other solution please)
How can I find the most suitable Linux kernel that doesn't break on my machine? Is there an alternative to try kernels one by one? Maybe some guidance or basic rules somewhere, a software that do this for you?
I'm searching for a general answer if possible, not specific instructions. Anyway specific answers can be useful to somebody else so they are also welcomed.
|
Bios
To maximize you chances, make sure you have the latest BIOS installed for your system(always do such updating with AC properly secured and being motionless). Compare the settings with the defaults(which you should have done if you reloaded setup defaults after flashing - take notes of your settings prior settings beforehand!) and make sure you have no exotic setup before installing.
Quick lspci inquiry with the HCL site
For a supported architecture, I would presume Linux is going to work unless there is a real showstopper and not the opposite. Linux works and developers think about legacy too. The Hardware compatibility List link provided in the comments is a very simple way to make a partial inquiry into any major issue. I have this older PC circa 2009. Let's see(if you don't have access to the site, just issue lspci and do specific research based on the output):
PCI ID Works? Vendor Device Driver Kernel
808629e0 Yes Intel Corporation 82X38/X48 Express DRAM Controller x38_edac v2.6.29-
808629e9 Intel Corporation 82X38/X48 Express Host-Secondary PCI Express Bridge
80862937 Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #4
80862938 Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #5
80862939 Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #6
8086293c Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #2
8086293e Yes Intel Corporation 82801I (ICH9 Family) HD Audio Controller snd-hda-intel v3.1.0-
80862940 Intel Corporation 82801I (ICH9 Family) PCI Express Port 1
80862944 Intel Corporation 82801I (ICH9 Family) PCI Express Port 3
80862934 Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #1
80862935 Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #2
80862936 Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #3
8086293a Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #1
8086244e Yes Intel Corporation 82801 PCI Bridge i810_rng
80862916 Yes Intel Corporation 82801IR (ICH9R) LPC Interface Controller iTCO_wdt v2.6.25-
80862922 Yes Intel Corporation 82801IR/IO/IH (ICH9R/DO/DH) 6 port SATA Controller [AHCI mode] ahci v2.6.25-
80862930 Yes Intel Corporation 82801I (ICH9 Family) SMBus Controller i2c-i801 v2.6.25-
10de104a NVIDIA Corporation GF119 [GeForce GT 610]
10de0e08 NVIDIA Corporation GF119 HDMI Audio Controller
11ab4364 Yes Marvell Technology Group Ltd. 88E8056 PCI-E Gigabit Ethernet Controller sky2 v2.6.25-
In a connected world most of the time you'll want to identify the make and model of your ethernet/wifi component(s) and the presence or absence of a driver(acknowledging the limitations of the tool detailed on the site). A second common consideration is the graphics adapter. If there are any red flags about the hardware, it is essential to look at the documentation from the distribution itself on the distribution's site or its official wiki.
Current, stable
If you can't rapidly identify a documented issue, why not just install the stable version of the distribution you like and see if you actually have any issue with it. The maintainers strive to release a stable packaged version of the kernel according to their philosophy and the rules pertaining to their distribution model. And needless to say lots of work has gone into the Linux kernel itself and more so every day. I take this means that there are more features and compatibility is certainly a feature. In my opinion laptop OEMs have always been unoriginal and their hardware is no rocket science. It has never occured to me to install anything but the latest stable kernel from the distribution I'm using whatever the hardware may be and so far so good.
| How to find a Linux kernel that works ok on my PC? |
1,582,051,348,000 |
I am trying to debug my kernel module.
When I run it I get the following kernel warnings, but it seems that there is no informative message like other warnings I've seen. Is it possible to get any useful info out of this?
Some more info:
The module is called firewall, it diverts tcp packets to a proxy server in user space, and the proxy then sends the tcp data it receives to the intended destination.
This happens when processing an http response by simply receiving all the data on one socket and calling sendall on another.
The warning doesn't happen when all the response comes in one packet, but does when the http payload data is segmented into several tcp packets.
The proxy is written in python. It seems strange to me that in the warning it says "python tainted". Can userspace applications cause kernel warnings?
I tried only receiving a large file in the proxy but not sending it and did not get any errors, and the system didn't freeze at any point. The problem happens only on calling socket.sendall/socket.send
reducing the read buffer size and then sending smaller chunks causes the system to lockup faster.
Turning off both gso, tso with ethtool prevents the error messages, but the system still locks up after the same amount of time, making me wonder if the warnings are even tied to the lockup
[16795.153478] ------------[ cut here ]------------
[16795.153489] WARNING: at /build/buildd/linux-3.2.0/net/core/dev.c:1970 skb_gso_segment+0x2e9/0x360()
[16795.153492] Hardware name: VirtualBox
[16795.153495] e1000: caps=(0x40014b89, 0x401b4b89) len=2948 data_len=0 ip_summed=0
[16795.153497] Modules linked in: firewall(O) vesafb vboxsf(O) snd_intel8x0 snd_ac97_codec ac97_bus snd_pcm snd_seq_midi snd_rawmidi snd_seq_midi_event snd_seq snd_timer snd_seq_device joydev psmouse snd soundcore serio_raw i2c_piix4 snd_page_alloc vboxguest(O) video bnep mac_hid rfcomm bluetooth parport_pc ppdev lp parport usbhid hid e1000 [last unloaded: firewall]
[16795.153529] Pid: 7644, comm: python Tainted: G W O 3.2.0-37-generic-pae #58-Ubuntu
[16795.153532] Call Trace:
[16795.153540] [<c105a822>] warn_slowpath_common+0x72/0xa0
[16795.153544] [<c14ad2b9>] ? skb_gso_segment+0x2e9/0x360
[16795.153548] [<c14ad2b9>] ? skb_gso_segment+0x2e9/0x360
[16795.153551] [<c105a8f3>] warn_slowpath_fmt+0x33/0x40
[16795.153555] [<c14ad2b9>] skb_gso_segment+0x2e9/0x360
[16795.153561] [<c14b01ce>] dev_hard_start_xmit+0xae/0x4c0
[16795.153568] [<f9a6f2fd>] ? divertPacket+0x7d/0xe0 [firewall]
[16795.153574] [<c14c8151>] sch_direct_xmit+0xb1/0x180
[16795.153578] [<f9a6f941>] ? hook_localout+0x71/0xe0 [firewall]
[16795.153582] [<c14b06d6>] dev_queue_xmit+0xf6/0x370
[16795.153586] [<c14c6459>] ? eth_header+0x29/0xc0
[16795.153590] [<c14b73f0>] neigh_resolve_output+0x100/0x1c0
[16795.153594] [<c14c6430>] ? eth_rebuild_header+0x80/0x80
[16795.153598] [<c14dec62>] ip_finish_output+0x152/0x2e0
[16795.153602] [<c14df75f>] ip_output+0xaf/0xc0
[16795.153605] [<c14dd340>] ? ip_forward_options+0x1d0/0x1d0
[16795.153609] [<c14deec0>] ip_local_out+0x20/0x30
[16795.153612] [<c14defee>] ip_queue_xmit+0x11e/0x3c0
[16795.153617] [<c10841c5>] ? getnstimeofday+0x55/0x120
[16795.153622] [<c14f4de7>] tcp_transmit_skb+0x2d7/0x4a0
[16795.153626] [<c14f5786>] tcp_write_xmit+0x146/0x3a0
[16795.153630] [<c14f5a4c>] __tcp_push_pending_frames+0x2c/0x90
[16795.153634] [<c14e7d2b>] tcp_sendmsg+0x71b/0xae0
[16795.153638] [<c104a33d>] ? update_curr+0x1ed/0x360
[16795.153642] [<c1509c23>] ? inet_recvmsg+0x73/0x90
[16795.153646] [<c1509ca0>] inet_sendmsg+0x60/0xa0
[16795.153650] [<c149ae27>] sock_sendmsg+0xf7/0x120
[16795.153655] [<c1044648>] ? ttwu_do_wakeup+0x28/0x130
[16795.153660] [<c1036a98>] ? default_spin_lock_flags+0x8/0x10
[16795.153667] [<c149ce7e>] sys_sendto+0x10e/0x150
[16795.153672] [<c1117e7f>] ? handle_pte_fault+0x28f/0x2c0
[16795.153675] [<c111809e>] ? handle_mm_fault+0x15e/0x2c0
[16795.153679] [<c15ab9c7>] ? do_page_fault+0x227/0x490
[16795.153681] [<c149cefb>] sys_send+0x3b/0x40
[16795.153684] [<c149d842>] sys_socketcall+0x162/0x2c0
[16795.153687] [<c15af55f>] sysenter_do_call+0x12/0x28
[16795.153689] ---[ end trace 3170256120cbbc8f ]---
|
Have you tried following backwards from end of stack trace with addr2line?
For example looking at the last line sysenter_do_call+0x12/0x28
It tells us that the offset is 0x12 and the length is 0x28
$ addr2line -e [path-to-kernel-module-with-issue] 0xc15af55f
and so on...gdb is another alternative in terms of breaking down the stack trace into lines.
However, I am not completely sure how you are arriving at a kernel-panic, as all I am seeing in the log excerpt you provided is a warning. Does it result in a crash/kernel-panic message after the stack-trace you posted?
-------as far as the stack trace posted: it has to do with the general segmentation offload and the skbuffer not being happy with the ip_summed checksum, disabling large\general receiver offload with
$ethtool -k [NIC] lro off
$ethtool -k [NIC] gro off
might be a possible workaround. Also, skipping checksum check with skb->ip_summed = CHECKSUM_UNNECESSARY might also solve this issue, depending on the purpose of the setup.
| Understanding a dmesg kernel warning message |
1,582,051,348,000 |
I installed Arch Linux from arch linux evolution-image to a virtual device.
I tested the installation with GRUB MBR and GRUB efi.
Inside virtualbox, I can see the grub menu, but when I select Arch Linux it gives me a
Kernel panic - not syncing: VFS: unable to mount root fs on unknown block(0,0)
What is going wrong?
|
I had a wrong fstab generated by genfstab (as pointed out here). So the kernel (please correct me, if this is wrong) didn't find my root-partition.
I generated fstab with labels and had a partition with a space in it. In fstab this must be written with \040. genfstab wrote garbage for the space.
Other answeres suggest to run update-initramfs -u -k version, however this command is replaced by mkinitcpio.
To get the system running I did this:
I ran grub-mkcofnig -o /boot/grub/grub.cfg (probably not important in this case)
after that I booted into grub-menu and pressed c for the grub-shell
I started Arch Linux manually by entering the following commands:
insmod linux
insmod ext2 (this works for ext3 and ext4, too or enter your filesystem-driver)
set root=(hd0, 2) (enter your partiton-number starting from 1)
linux /boot/vmlinuz-linux root=/dev/sda2 (again select your partition)
initrd /boot/initramfs-linux.img
boot
correct /etc/fstab (make sure spaces are expressed as \040)
Finished!
| Arch Linux in virutalbox: kernel panic-not syncing: VFS: unable to mount root fs on unknown block(0,0) |
1,582,051,348,000 |
to install Arch on a PC I have to make partition of the HDD
boot
swap
/
The swap is used by virtual memory, right?
What's up if I make a too small or a too big swap partition? Could I have as result some kernel panic?
|
Actually you don't need the swap partition and the /boot partition.
But returning to your question: yes, the swap is used as virtual memory (and also for hibernation). If both the swap file and the physical RAM fill up, you most likely won't have a kernel panic: applications will just start to be killed by the kernel's out-of-memory killer.
But at this point your system will be unbearably slow (which might lead you to think that it has crashed) due to the heavy swapping.
If you have a too-big swap partition, it just won't be used and will be wasted disk space.
| Arch installation and swap partition |
1,582,051,348,000 |
Suppose we are working in environment where you can't be sure that your computer won't just suddenly shut off. What measures can be taken to improve system's (unix) resist to such failures? And how to ensure that risk of data loss (on hard drive) is as low as possible?
|
Use a journaling file system and make sure the flush to disk frequency is set pretty high.
If you are having frequent kernel panics, don't use the machine for anything important! It's broken. Fix it. Remove whatever modules or hardware is a problem before using it in a production environment.
If power or other physical issues are present, get a UPS or fix the environment.
| What are the ways to improve system stability and prevent data loss in conditions of frequent hard reboots and/or kernel panics? |
1,582,051,348,000 |
Few days ago, after I did an apt upgrade, I got something like this in the log, multiple times
Error 24 : Write error : cannot write compressed block
E: mkinitramfs failure cpio 141 lz4 -9 -I 24
update-initramfs: failed for /boot/initrd.img-5.4.0-52-generic with 1.
dpkg: error processing package initramfs-tools (--configure):
This is not the exact message I was getting cause I already reboot my computer.
After I got the message, I tried to search for solution, and I ran this code, after the upgrade: sudo dpkg -P `dpkg --list | grep linux-image | grep ^rc | awk {'print $2'}`
Then after reboot I got this
I can't boot from the "linux mint 20" option in boot manager, though I could still use recovery options in "Advanced option for linux Mint", but not the first one, which is "linux 5.4.0-65-generic".
I tried to login to my system, with different version of linux image, recovery mode other than 5.4.0-65, and reinstall the linux-image(I think that command was for deleting linux image right?) with sudo apt install --reinstall linux-image-5.4.0-65-generic 5.4.0-65.73, but I'm getting errors
E: Unable to locate package 5.4.0-65.73
E: Couldn't find any package by glob '5.4.0-65.73'
Sorry I'm pretty bad at this, what should I do... I'm using linux mint distro
This is my linux-image list with dpkg --list | grep linux-image
ii linux-image-5.4.0-26-generic 5.4.0-26.30 amd64 Signed kernel image generic
ii linux-image-5.4.0-59-generic 5.4.0-59.65 amd64 Signed kernel image generic
ii linux-image-5.4.0-60-generic 5.4.0-60.67 amd64 Signed kernel image generic
ii linux-image-5.4.0-62-generic 5.4.0-62.70 amd64 Signed kernel image generic
iF linux-image-5.4.0-65-generic 5.4.0-65.73 amd64 Signed kernel image generic
iU linux-image-generic 5.4.0.65.68 amd64 Generic Linux kernel image
Also, Im wondering what does this do grep ^rc | awk {'print $2'}
#####################################################
I ran into the same error again, when I was removing old kernels.
Error 24 : Write error : cannot write compressed block
E: mkinitramfs failure cpio 141 lz4 -9 -l 24
update-initramfs: failed for /boot/initrd.img-5.4.0-65-generic with 1.
dpkg: error processing package initramfs-tools (--configure):
installed initramfs-tools package post-installation script subprocess returne
d error exit status 1
and I think the below part is new
Errors were encountered while processing:
initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)
And somehow removing linux-image ver 5.4.0-26 only free up 8mb of space on /boot
By checking apt-cache policy intel-microcode, it says installed
intel-microcode:
Installed: 3.20201110.0ubuntu0.20.04.2
Candidate: 3.20201110.0ubuntu0.20.04.2
Version table:
*** 3.20201110.0ubuntu0.20.04.2 500
500 http://mirror.0x.sg/ubuntu focal-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
100 /var/lib/dpkg/status
3.20191115.1ubuntu3 500
500 http://mirror.0x.sg/ubuntu focal/main amd64 Packages
##############################################
This is the message I got by running apt-cache policy linux-image-5.4.0.65:
linux-image-5.4.0-65-lowlatency:
Installed: (none)
Candidate: 5.4.0-65.73
Version table:
5.4.0-65.73 500
500 http://mirror.0x.sg/ubuntu focal-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
linux-image-5.4.0-65-generic:
Installed: 5.4.0-65.73
Candidate: 5.4.0-65.73
Version table:
*** 5.4.0-65.73 500
500 http://mirror.0x.sg/ubuntu focal-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
100 /var/lib/dpkg/status
Now that I have enough space on my /boot, I'll try to change source and do sudo apt install --reinstall linux-image-5.4.0-65-generic 5.4.0-65.73
(My CPU is Intel(R) Core(TM) i5-4590 CPU @ 3.30GHz if relevant.)
|
First let's have a look at:
I just checked my /boot, it seems that there's no more available space left...
So, now you could basically run the Mint Update manager, and uninstall the oldest kernel(s) in order to install a new one:
Also, please check if you have intel-microcode package installed for your Haswell CPU, a simple check could be with:
apt-cache policy intel-microcode
The grep ^rc filters out uninstalled packages with remained configuration.
There could be data not exactly in sync in your source mirror too, which would explain why you got the message about:
Unable to locate package 5.4.0-65.73
which is in central archive:
apt-cache policy linux-image-5.4.0.65
linux-image-5.4.0-65-lowlatency:
Installed: (none)
Candidate: 5.4.0-65.73
Version table:
5.4.0-65.73 500
500 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
linux-image-5.4.0-65-generic:
Installed: 5.4.0-65.73
Candidate: 5.4.0-65.73
Version table:
*** 5.4.0-65.73 500
500 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
100 /var/lib/dpkg/status
Please remove one more old kernel and reset sources:
| end Kernel panic - not syncing |
1,582,051,348,000 |
Is it possible to cause kernel panic by removing a device driver and then making a system call that uses that driver so that kernel goes in panic?
|
It is possible when driver is not properly removed and application tried to use. If driver is removed properly kernel will give error like driver not found but never crash(In 99.99% cases until it hit any bug).
| How to cause kernel panic by deleting a device driver (module)? |
1,582,051,348,000 |
Having some problems with booting in Centos 7 since the last update. The Centos 7 partition does not boot due to a soft kernel panic after the following error is thrown *ERROR* atombios stuck in loop for more than 5secs aborting. I cannot find back the trace of the error in /var/log/messages. Also, there is no hardware error as far as I know since I can boot perfectly well in an older version of Centos.
Below are the specifics about the particular situation, but first more in general: How should I proceed in troubleshooting kernel panic during boot (when there are no logs stored)?
Here are screenshots of the kernel panic message:
Note: A lot of similar problems are mentioned in other posts at first boot after the installation. This is not the case for me, I have been working perfectly fine on Centos for a couple of months now. I would like to avoid reinstalling Centos for exactly this reason.
As I told before, I have several versions of Centos 7 to choose from during boot time, see particular kernel versions below. The upper one (newest) is the one failing to boot. Unable to find a solution, I'm using the second from the top already for some time now.
possible solutions taken into account already:
selinux is disabled (from this post)
choose legacy boot mode in bios (from another post)
The last one didn't help since I get the following error at boot time:
|
I found an ongoing discussion on this issue on Red Hat discussions and the CentOS bug tracker. It has to do with the graphics driver of my pc (AMD driver, working on a DELL computer). Bug appears for the 3.10.0-693 kernel version.
A workaround for the moment is to add nomodeset to the grub boot command line, as suggested in the links. A good explanation on the meaning of this option and on how to change the grub boot command line (with some small adjustments on CentOS) can be found on this Ubuntu forum discussion.
| troubleshooting kernel panic during boot (centos7) |
1,582,051,348,000 |
I installed and configured Debian 7.2 Wheezy AMD64 few days ago, I spent days configuring everything out and installing useful apps etc, so finally I tried to install Wine.
And what happened?
Dependency problem - libc6 is version 2.13 but it should be 2.17 to satisfy Wine.
Unfortunately, there is no stable version available so I used sid to install libc6 2.17.
It got installed, but, after finishing installation, all commands stopped working.
I was unable to call any command, it just reports that command is NOT found.
I thought that reboot may fix the problem, so I done hard-reboot and after GRUB menu it stucks:
switch_root can't execute '/sbin/init' no such file or directory
Kernel Panic - not syncing
And my Debian is now is in unusable state. I have Dual Boot with Windows 7 64-bit.
I also have Debian 7.2 Wheezy AMD64 live on USB flash so I can use it for repair.
I do not have enough experience with Debian based distros to solve this. Can someone give me step-by-step guide?
|
To repair libc6, start your Debian-based rescue system from the USB flash, mount your broken system partition and prepare a chroot environment using
mount --bind /proc MOUNTPATH/proc
mount --rbind /dev MOUNTPATH/dev
mount --bind /sys MOUNTPATH/sys
Download the libc6 2.13-38 package for your architecture (probably amd64) from http://packages.debian.org/wheezy/libc6 and install it using dpkg -root=MOUNTPATH PATH_TO_DEBFILE. Probably you need to add some --force- flags. See the man page of dpkg for details. If this does not work, you can extract files using dpkg-deb -X and then copy it to the correct folder and run ldconfig -r MOUNTPATH.
After this you should be able to chroot to MOUNTPATH and run update-initramfs -u to update your initrd. Now your system should boot again. The package dependencies are probably still broken and need to be fixed by uninstalling/downgrading packages.
| Debian 7 - Kernel Panic after libc6 update |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.