Monday, November 26, 2012

dpkg: Input/output error

This error is usually not hardware-wise (some say your hard disk has bad blocks). Actually, the dpkg database (/var/lib/dpkg/status) is not remembering things well. This leads package management to fail in any case, automatic repairs don't work.
dpkg: unrecoverable fatal error, aborting:
 reading files list for package 'emacs23-common': Input/output error
Due to an archive post by gartss (Refer link), it is repairable by manually removing the error-causing package records in status file.
Here is the sketch.
cd /var/lib/dpkg
sudo cp status status.backup
sudo vi status //remove the error package records (not those of dependencies)
sudo dpkg --configure -a
sudo apt-get -f install

Monday, November 12, 2012

LyX Goes With Tikz

To load tikz package, just like all the other $\mathrm{\LaTeX}$ packages, try set $\mathrm{\LaTeX}$ preamble under Lyx > Document > Settings > LaTeX Preamble, put
\usepackage{tikz}
And in LyX, Press Ctrl + L to insert TeX/LaTeX code. e.g.
\begin{tikzpicture}[thick,minimum size=2.3cm]
\path (0,0) 
 (0.8,1) node (c) [circle,fill=red,fill opacity=0.5]{}
 (-0.8,1) node (b) [circle,fill=green,fill opacity=0.5]{}
 (0,-0.4) node (a) [circle,fill=blue,fill opacity=0.5]{};
\path (0,-0.4) node (a1) {$C$}
      (-0.8,1) node (b1) {$B_0$}
      (0.8,1) node (c1) {$A$};
\end{tikzpicture}
And finally, use File > Export -> PDF (pdfLaTeX).