While I was opening my Ubuntu system the electricity went off. When electricity was back I reopened the system and I faced with a crash of the system telling me unable to mount /proc etc.
I followed
http://art.ubuntuforums.org/showthread.php?t=1601810&highlight=mounting+dev+on+root+dev+failed+no+such+file+OR+directory&page=2
but it did not solve so I then reopen the system with a ubuntu livecd and made fsck -fC /dev/sdb1 command multiple times.
Yeah everything is back.
When I tried to install gentoo and finally open my system I realized that the ethernet connection was broken. After a search I saw that it was due to lack of the hdpc packet so I had to go back to the live CD and emerge it. If I want to emerge a packet on my system with a live CD then I should chroot. I simply adopted something from the installation guide of gentoo.
I opened the system with a live CD and fell into the gentoo live session then I did the following (I assume that you have configured eth0)
mkdir /mnt/temp
mount /dev/sda3 /mnt/temp
mirrorselect -i -o >> /mnt/temp/etc/make.conf
mirrorselect -i -r -o >> /mnt/temp/etc/make.conf
cp -L /etc/resolv.conf /mnt/temp/etc/
mount -t proc none /mnt/temp/proc
mount -o bind /dev /mnt/temp/dev
chroot /mnt/temp /bin/bash
env-update
>> Regenerating /etc/ld.so.cache...
source /etc/profile
export PS1="(chroot) $PS1" |
mkdir /mnt/temp
mount /dev/sda3 /mnt/temp
mirrorselect -i -o >> /mnt/temp/etc/make.conf
mirrorselect -i -r -o >> /mnt/temp/etc/make.conf
cp -L /etc/resolv.conf /mnt/temp/etc/
mount -t proc none /mnt/temp/proc
mount -o bind /dev /mnt/temp/dev
chroot /mnt/temp /bin/bash
env-update
>> Regenerating /etc/ld.so.cache...
source /etc/profile
export PS1="(chroot) $PS1"
now you have chroot and have an alive internet connection
emerge hdpc
>> when everything finishes
reboot |
emerge hdpc
>> when everything finishes
reboot
if you eject the live CD and permit the system start then you will have a system on which hdpc is installed.
go to http://hplipopensource.com/hplip-web/install_wizard/index.html
However still I could not manage to solve the problem.
Hey back again did what it said here and yes everything is fine again.
http://ubuntuforums.org/showpost.php?p=4888291&postcount=9
Adopted from http://www.linux.org/docs/ldp/howto/Bash-Prompt-HOWTO/x237.html Let’s see :
When a file is sourced (by typing either source filename or . filename at the command line), the lines of code in the file are executed as if they were printed at the command line. This is particularly useful with complex prompts, to allow them to be stored in files and called up by sourcing the file they are in.
In examples, you will find that I often include
at the beginning of files including functions. This is not necessary if you are sourcing a file, just as it isn’t necessary to
a file that is going to be sourced. I do this because it makes Vim (my editor of choice, no flames please – you use what you like) think I’m editing a shell script and turn on colour syntax highlighting.
I am using Ubuntu since 8.10 and in recent months I started to use more frequently. However as I upgraded to 10.04 it really started to respond slower. I am looking for an advice on the net for this situation apart from a fresh install. As I find a solution I will share here.
Here again. I applied the things in here and well now it is faster. Actually I could not follow the updates whether if an update fixed the problem but in my opinion etc/hosts fixes it.
Write binary numbers to a file. This is helpful if you want to test your VHDL code with numbers generated by Matlab.
function [] = bin2text(a,hedef)
% bin2text(a,hedef)
% a : the array of binary numbers
% hedef : the target file name
fid = fopen(hedef,'wt');
len = length(a(:,1));
for ii = 1:len
fprintf(fid, '%s\n',a(ii,:));
end
fclose(fid); |
function [] = bin2text(a,hedef)
% bin2text(a,hedef)
% a : the array of binary numbers
% hedef : the target file name
fid = fopen(hedef,'wt');
len = length(a(:,1));
for ii = 1:len
fprintf(fid, '%s\n',a(ii,:));
end
fclose(fid);
Again Matlab does something that is not processable when you convert signed numbers to binary numbers. This function is for this purpose. Compatible with R2007 some small retouches needed for R2009
function [result] = signed2bin(a,len)
% signed2bin(a,len)
% a : an array of the signed decimal number
% len : the length of the bits you want to represent the signed numbers
b = dec2bin(a,len);
slas = find(b == '/');
if isempty(slas)
result = b;
else
b(slas) = '1';
result = b;
end |
function [result] = signed2bin(a,len)
% signed2bin(a,len)
% a : an array of the signed decimal number
% len : the length of the bits you want to represent the signed numbers
b = dec2bin(a,len);
slas = find(b == '/');
if isempty(slas)
result = b;
else
b(slas) = '1';
result = b;
end
As I am doing some signal processing stuff on FPGA I needed a function showing me the signed version of the binary numbers. In simulator it is easy but in Matlab it is not. I hope you find it useful.
function [result] = bin2signed(a)
% bin2signed(a)
% a is a matrix of binary numbers and result is signed representation of a
birler = find(a == '1');
sifirlar = find(a == '0');
len = length(a(1,:));
cikan = 2^(len-1)-1;
b = bin2dec(a);
cokbuyukler = find(b>cikan);
if isempty(cokbuyukler)
else
b(cokbuyukler) = b(cokbuyukler)-2^len;
end
eksitamlar = find(b == 2^(len-1));
if isempty(eksitamlar)
else
b(eksitamlar) = -2^(len-1);
end
result = b; |
function [result] = bin2signed(a)
% bin2signed(a)
% a is a matrix of binary numbers and result is signed representation of a
birler = find(a == '1');
sifirlar = find(a == '0');
len = length(a(1,:));
cikan = 2^(len-1)-1;
b = bin2dec(a);
cokbuyukler = find(b>cikan);
if isempty(cokbuyukler)
else
b(cokbuyukler) = b(cokbuyukler)-2^len;
end
eksitamlar = find(b == 2^(len-1));
if isempty(eksitamlar)
else
b(eksitamlar) = -2^(len-1);
end
result = b;
taken from http://doctus.org/showthread.php?t=41474
a good lesson about use of bashrc. Functions and aliases a final code snippet is here.
echo -en "\033[1;36m"
echo " /\ _ _ _ "
echo " / \ __ _ _ __ ___| |__ | (_)_ __ _ ___ __ "
echo " /' \ / _\` | '__/ __| '_ \| | | '_ \| | | \ \/ / "
echo " /_- ~ -\ | (_| | | | (__| | | | | | | | | |_| |> < "
echo " / \ \__,_|_| \___|_| |_|_|_|_| |_|\__,_/_/\_\ "
echo " / _- - _ '\ "
echo " /_-' '-_\ "
echo -en "\033[0m\n"
# Fortune
echo
fortune
echo
# Check for an interactive session
[ -z "$PS1" ] && return
PS1='\[\e[0;32m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[m\] '
#bash completion.
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
# Aliases
# General Aliases
alias fontup="sudo fc-cache -v"
alias ls="ls --color=auto"
alias reboot="sudo reboot"
alias rconf="sudo nano /etc/rc.conf"
alias shutdown="sudo shutdown -h now"
alias source="source /home/wargasm/.bashrc"
alias xorgconf="sudo nano /etc/X11/xorg.conf"
# Pacman Aliases
alias ins="sudo pacman -S"
alias pacclean="sudo pacman -Rs $(pacman -Qtdq)"
alias pacinfo="pacman -Qi"
alias paclocs="sudo pacman -Qs"
alias pacs="pacsearch"
alias rem="sudo pacman -R"
alias syscl="sudo pacman -Scc"
alias sync="sudo pacman -Sy"
alias sysup="sudo pacman -Syu"
# Yaourt Aliases
alias yains="yaourt -S"
alias yarem="yaourt -R"
alias yainfo="yaourt -Qi"
alias yaup="yaourt -Syu --aur"
# Functions
arsivle () {
FILE=$1
case $FILE in
*.tar.bz2) shift && tar cjf $FILE $* ;;
*.tar.gz) shift && tar czf $FILE $* ;;
*.tar.lzma) shift && tar --lzma cf $FILE $* ;;
*.tgz) shift && tar czf $FILE $* ;;
*.zip) shift && zip $FILE $* ;;
*.rar) shift && rar $FILE $* ;;
esac
}
ayikla () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x -v $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xvf $1 ;;
*.tbz2) tar xvjf $1 ;;
*.tgz) tar xvzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "don't know how to extract '$1'..." ;;
esac
else
echo "'$1' is not a valid file!"
fi
}
pacsearch () {
echo -e "$(pacman -Ss $@ | sed \
-e 's#core/.*#\\033[1;31m&\\033[0;37m#g' \
-e 's#extra/.*#\\033[0;32m&\\033[0;37m#g' \
-e 's#community/.*#\\033[1;35m&\\033[0;37m#g' \
-e 's#^.*/.* [0-9].*#\\033[0;36m&\\033[0;37m#g' )"
}
twit () {
echo "User: "
read user
echo "Pass: "
read -s pass
echo ""
curl -u $user:$pass -d status="$1" http://twitter.com/statuses/update.xml
} |
echo -en "\033[1;36m"
echo " /\ _ _ _ "
echo " / \ __ _ _ __ ___| |__ | (_)_ __ _ ___ __ "
echo " /' \ / _\` | '__/ __| '_ \| | | '_ \| | | \ \/ / "
echo " /_- ~ -\ | (_| | | | (__| | | | | | | | | |_| |> < "
echo " / \ \__,_|_| \___|_| |_|_|_|_| |_|\__,_/_/\_\ "
echo " / _- - _ '\ "
echo " /_-' '-_\ "
echo -en "\033[0m\n"
# Fortune
echo
fortune
echo
# Check for an interactive session
[ -z "$PS1" ] && return
PS1='\[\e[0;32m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[m\] '
#bash completion.
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
# Aliases
# General Aliases
alias fontup="sudo fc-cache -v"
alias ls="ls --color=auto"
alias reboot="sudo reboot"
alias rconf="sudo nano /etc/rc.conf"
alias shutdown="sudo shutdown -h now"
alias source="source /home/wargasm/.bashrc"
alias xorgconf="sudo nano /etc/X11/xorg.conf"
# Pacman Aliases
alias ins="sudo pacman -S"
alias pacclean="sudo pacman -Rs $(pacman -Qtdq)"
alias pacinfo="pacman -Qi"
alias paclocs="sudo pacman -Qs"
alias pacs="pacsearch"
alias rem="sudo pacman -R"
alias syscl="sudo pacman -Scc"
alias sync="sudo pacman -Sy"
alias sysup="sudo pacman -Syu"
# Yaourt Aliases
alias yains="yaourt -S"
alias yarem="yaourt -R"
alias yainfo="yaourt -Qi"
alias yaup="yaourt -Syu --aur"
# Functions
arsivle () {
FILE=$1
case $FILE in
*.tar.bz2) shift && tar cjf $FILE $* ;;
*.tar.gz) shift && tar czf $FILE $* ;;
*.tar.lzma) shift && tar --lzma cf $FILE $* ;;
*.tgz) shift && tar czf $FILE $* ;;
*.zip) shift && zip $FILE $* ;;
*.rar) shift && rar $FILE $* ;;
esac
}
ayikla () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x -v $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xvf $1 ;;
*.tbz2) tar xvjf $1 ;;
*.tgz) tar xvzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "don't know how to extract '$1'..." ;;
esac
else
echo "'$1' is not a valid file!"
fi
}
pacsearch () {
echo -e "$(pacman -Ss $@ | sed \
-e 's#core/.*#\\033[1;31m&\\033[0;37m#g' \
-e 's#extra/.*#\\033[0;32m&\\033[0;37m#g' \
-e 's#community/.*#\\033[1;35m&\\033[0;37m#g' \
-e 's#^.*/.* [0-9].*#\\033[0;36m&\\033[0;37m#g' )"
}
twit () {
echo "User: "
read user
echo "Pass: "
read -s pass
echo ""
curl -u $user:$pass -d status="$1" http://twitter.com/statuses/update.xml
}