Friday, 31 October 2014

fstab mount bind error - SOLVED and EXPLAINED!

In case that you are using mount --bind option for something(in my case this was a must for sftp user action logs), you want this mount --bind survive reboot. So you will put this mount point in /etc/fstab.
First I mount it "by hand"

server:#mount --binb /dev/log /opt/sftp_test/boris/dev/log

This worked so I need it put make it mount automaticly after reboot.  
My fstab options was like this

/dev/log  /opt/sftp_test/boris/dev/log    none    bind

So, I test it if this works!
"False" test pass. Why I called it false test? I umount /opt/sftp_test/boris/dev/log and automaticly mounted it.

server:#umount /opt/sftp_test/boris/dev/log
server:#mount -a
server:#mount
/dev/mapper/ubuntu-root on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
/dev/sda1 on /boot type ext2 (rw)
rpc_pipefs on /run/rpc_pipefs type rpc_pipefs (rw)
/dev/log on /opt/sftp_test/boris/dev/log type none (rw,bind) 

 

Fstab mount bind error

Ok, now only true and real test! Reboot! As I was waiting for ping to start again so that I can ssh log to my test server, think that nothing can go wrong... Ping started to pass but I could not ssh connect. Ok,ssh service did not started yet.10 seconds, 20 seconds, 30 seconds... Ok, now I know that something is wrong! I looked at my VirtualBox server and there is was black stale screen.
fstab mount bind error solved explained
Error was:
The disk drive for /opt/sftp_test/boris/dev/log is not ready yet or not present.
So I just pressed S and boot process continued. This is why reboot is real test! :)
What can be reason for this? I suspect that reason is that mounting partitions from fstab is one of the first thing that OS during boot process do. There is still no /dev/log location at this point. Error message The disk drive for...  is pretty clear.
How to resolve this? In /etc/rc.local insert following line

mount --bind /dev/log /opt/sftp_test/boris/dev/log

Reboot!!!
root@ubuntu:/opt/sftp_test/boris/dev# reboot
root@ubuntu:/opt/sftp_test/boris/dev#
Broadcast message from root@ubuntu
        (/dev/pts/0) at 12:53 ...

The system is going down for reboot NOW!
login as: root
root@x.x.x.x's password:
Welcome to Ubuntu 12.04.4 LTS (GNU/Linux 3.5.0-23-generic i686)
Last login: Fri Oct 31 12:47:43 2014 from .x.x.x.x
root@ubuntu:~# mount
/dev/mapper/ubuntu-root on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
/dev/sda1 on /boot type ext2 (rw)
rpc_pipefs on /run/rpc_pipefs type rpc_pipefs (rw)
/dev/log on /opt/sftp_test/boris/dev/log type none (rw,bind)

Problem solved!

Wednesday, 15 October 2014

Huawei U8650 sim unlock and cyanogenmod issue

A few days ago I wanted to insert another operator SIM card into my old HUAWEI U8650. I already wrote about rooting this phone and installing custom rom. I installed Cyanogenmod 7.2! I have to say that this is one of the best custom roms out there for this phone and generaly for older andoroid phones.

SIM Unlock - what does this means?


When you buy phone from telecom operator, SIM slot is locked to work only with that operator SIM cards. This way operator protect his investment because when you sigh contract for some time period that includes phone you usually get phone very cheap or for free. If you want to unlock SIM by yourself you would loose warranty, if you go to telecom operator they will tell you that they cannot SIM unlock your phone until contract expires! When you insert SIM card from other telecom operator, phone will report that SIM is not inserted and then ask for NETWORK UNLOCK CODE. You will be prompted to insert this code. By inserting SIM unlock code, you will unlock your phone to SIM cards from other telecom operators. You will not be able to use it until you unlock SIM protection.

How to get SIM unlock code?


Depending of policies of your telecom operator, sim unlock code you can get from your telecom operator for free or not when contract expires. If you lost your contract papers you can buy sim unlock code from ebay. SIM unlock code is generated by using phone IMEI and telecom operator "key". How to do this, I do not know but those information is only thing (besides money) that you need to get SIM unlock code! I takes a few days to receive code.


Cyanogenmod SIM unlock issue


In case you have already installed Cyanogenmod ROM, there is a problem.
This is from one forum:
"I had this problem. Cyanogenmod does not prompt you for an unlock code when putting in a different sim.

You have to flash back to a stock rom, and then put in your unlock code. Then flash back to Cyanogenmod.
"

What to do?


1. Find stock rom for your telephone! For Huawei U8650 here is stock custom rom!
2. http://sysadmin-tricks.blogspot.com/2013/12/huawei-u8650-rooting-and-downgrade-from.html
    part about rooting and downgrade
3.This will install, stock custom rom. When you insert SIM card from another telecom operator and turn on the phone, you will prompted with this
NETWORK UNLOCK CODE
Insert code.
You will be prompted that network is unlocked!

That is it! You phone is now SIM unlocked! 

Only bad thing about stock rom installing is that wipes up CWM recovery so if you want to install some custom rom, you have to first install CWM!