顯示具有 電腦雜談 標籤的文章。 顯示所有文章
顯示具有 電腦雜談 標籤的文章。 顯示所有文章

2010/05/08

mount: mounting /sys on /root/sys failed: No such file or directory - 續

在試過 個人說的 方法後,發現無效......

而高手同事也認為這個和 AppArmor 沒有關係,應該是 initramfs 搞的鬼,不過說也奇怪,如果是 initramfs 的問題,應該在網路上找的到才是,我找半天竟然都找不到,難不成全世界只有我遇到...@@

/usr/share/initramfs-tools/init :
maybe_break mount
log_begin_msg "Mounting root file system... ,alextu:. /scripts/${BOOT}"
. /scripts/${BOOT}
parse_numeric ${ROOT}
mountroot
log_end_msg

maybe_break bottom
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/init-bottom"
run_scripts /scripts/init-bottom
[ "$quiet" != "y" ] && log_end_msg

在 init 中可看到 "Running /scripts/init-bottom" 之前執行的是 mountroot
然後在 scripts/local 中的 mountroot function中,看到兩個 FIXME ....@@

# FIXME This has no error checking
modprobe ${FSTYPE}

# FIXME This has no error checking
# Mount root
mount ${roflag} -t ${FSTYPE} ${ROOTFLAGS} ${ROOT} ${rootmnt}
mountroot_status="$?"
if [ "$LOOP" ]; then
if [ "$mountroot_status" != 0 ]; then
if [ ${FSTYPE} = ntfs ] || [ ${FSTYPE} = vfat ]; then
panic "
.........
因為在 error 出現後可以進去 initramfs shell 下指指令,用 ls 看了一下 /root 下根本沒東西,
所以應該是 /root 還沒有準備好,就急著要mount,當然失敗囉。

一開始我笨笨的想說,它明明就有明準備 check $mountroot_status 只要將 $LOOP 設為1就會進入檢查了呀,為何不用...就手動加了 LOOP=1 結果....原本有時可以進os有時進initramfs shell的情況變成每次都進initramfs ....真慘,只好用live cd 重新安裝 initramfs ,果然是 "FIXME"

在 mount 失敗後加上 delay 再重 mount 的 code 後執行 sudo update-initramfs -u 將改好的 script update 進 initramfs 中再重新開機,就是用新的initramfs跑囉。

試過幾次後,發現情況不錯,雖然後來還有幾次會進去initramfs shell 我想可能是我delay不夠久吧....
以上分享給跟我遇到同樣情況的苦主~

2010/05/01

mount: mounting /sys on /root/sys failed: No such file or directory

我在解決掉搬動ubuntu 9.10 的 root partition後,又出現一個難解的問題,就是我在開機時會出現如下畫面:


一開始我以為是apparmor的問題,而且聽同事說它沒有什麼作用所以就把它移徐了。

除了執行了 "sudo remove apparmor" 之外,我也照著wiki上面作法作了一次:
  • AppArmor can be disabled, and the kernel module unloaded by entering the following:

    <span class="command"><strong>sudo /etc/init.d/apparmor stop</strong></span> <span class="command"><strong>sudo update-rc.d -f apparmor remove</strong></span> 

結果還是有時後會出現這個問題,奇怪的是...為何我移除了,還是會自已執行...真的找不到....
$ dpkg -l | grep AppArmor
rc apparmor 2.3.1+1403-0ubuntu27.3 User-space parser utility for AppArmor
rc apparmor-utils 2.3.1+1403-0ubuntu27.3 Utilities for controlling AppArmor
ii libapparmor-perl 2.3.1+1403-0ubuntu27.3 AppArmor library Perl bindings
ii libapparmor1 2.3.1+1403-0ubuntu27.3 changehat AppArmor library

接下來我會試看看 這個人說的 方法在重新安裝grub2之前,先sudo fsck /dev/sda8看看。
另外有人建議將root另外放一個partition,然後作 image 只要root 發生問題,就將partition用image蓋過去,這樣就不用再為 boot 的問題煩惱了,真是爆力的好方法呀...XD

搬動ubuntu 9.10 的 root partition

一直以來,搬動root partition 對我來說都是一個大工程,原因是經常搞不定 grub 照成無法開機,但不知為何每次在用linux 時,都會有移動root partition的需求,不是因為換硬碟,就是root partition 給的太小,應該是我一開始沒有規畫好.....

在之前 grub 時期,網上有各種的解決方法可以參考,花點時間找找也就解了,但Ubuntu 9.10 後將grub 改為 grub 2.0 ,事情對我來說就沒那麼單純了.....

先來個環境說明吧,我的"fstable -l"如下:

所用裝置 Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        6376    51215188+   7  HPFS/NTFS
/dev/sda2            6377       19457   105073132+   f  W95 Ext'd (LBA)
/dev/sda5            6377       17191    86871456    7  HPFS/NTFS
/dev/sda6           18403       19405     8056566   83  Linux
/dev/sda7           19406       19457      417658+  82  Linux swap / Solaris
/dev/sda8           17192       18402     9727326   83  Linux

而我原本的 / 是放在 sda6 中,然後在sda8中再安裝了ubuntu netbook remix,結果 netbook remix 版是用grub2 所以取代了 sda6 中原本的grub,我也偷懶一直沒有動它...直到最近 sda6 的空間不夠了沒辨法才對它開刀,結果花了我好多時間...@@..待我慢慢道來..

我的目的是希望將 root 從 sda6 移到 sda8 如下图:

首先用 再生龍clonezilla(謎:開發者國家高速網路的clonezilla專屬網頁反而進不去.....) 將 sda6 直接整塊 clone 到 sda8,接下來我就很衝動對 sda6 作了 "sudo rm -rf *" ya~ 然後開機時它就抱怨找不到 grub ,所以要重裝grub ,這個動作很常見,像之前我們在 linux 安裝完後,再安裝 win xp 就會遇到 .....

接著我就按照論壇上的方法用光碟安裝,

sudo mount /dev/sda8 /mnt
sudo mount --bind /dev/ /mnt/dev
sudo chroot /mnt
sudo grub-install /dev/sda
reboot

結果是....失敗...只看到boot menu 點選進去,永遠都是ERR 15
依這邊的說法是:
File Not Found (Error 15) 此錯誤為 GRUB 2 安裝至 /boot 但主開機磁區(MBR)依然為傳統 Grub。此狀況發生在當您執行 sudo update-from-grub-legacy 時未選擇您的磁碟。
但是我沒有執行過 sudo update-from-grub-legacy ,而且用它教的方法 從開機光碟重新安裝 還是一樣的error出現,這可讓我傷腦筋了,還好後在英文版 grub2 wiki中看到 對從live 重新安裝Grub2 之METHOD 3 - CHROOT如下照作,就可以開機進去了..^^..我認為關鍵是在第7點,確定安裝時是使用live cd上的grub2,可能我原本usr下的grub2問題,所以之前重裝才會無法解決問題。
-------------------------------------------------------------------

METHOD 3 - CHROOT

This method of installation uses the chroot command to gain access to the broken system's files. Once the chroot command is issued, the LiveCD treats the broken system's / as its own. Commands run in a chroot environment will affect the broken systems filesystems and not those of the LiveCD.

  1. Boot to the LiveCD Desktop (Ubuntu 9.10 or later).
  2. Open a terminal - Applications, Accessories, Terminal.

  3. Determine your normal system partition - (the switch is a lowercase "L")

    sudo fdisk -l

    • If you aren't sure, run

      df -Th. Look for the correct disk size and ext3 or ext4 format.

  4. Mount your normal system partition:
    • Substitute the correct partition: sda1, sdb5, etc.

    sudo mount /dev/sdXX /mnt # Example: sudo mount /dev/sda1 /mnt

  5. Only if you have a separate boot partition:

    • sdYY is the /boot partition designation (for example sdb3)
    • sudo mount /dev/sdYY /mnt/boot

  6. Mount the critical virtual filesystems:

    sudo mount --bind /dev  /mnt/dev
    sudo mount --bind /proc /mnt/proc
    sudo mount --bind /sys  /mnt/sys

  7. To ensure that only the grub utilities from the LiveCD get executed, mount /usr

    sudo mount --bind /usr/ /mnt/usr

  8. Chroot into your normal system device:

    sudo chroot /mnt

  9. If there is no /boot/grub/grub.cfg or it's not correct, create one using

    update-grub

  10. Reinstall GRUB 2:
    • Substitute the correct device - sda, sdb, etc. Do not specify a partition number.

    grub-install /dev/sdX

  11. Verify the install (use the correct device, for example sda. Do not specify a partition): sudo grub-install --recheck /dev/sdX

  12. Exit chroot: CTRL-D on keyboard

  13. Unmount virtual filesystems:

    sudo umount /mnt/dev
    sudo umount /mnt/proc
    sudo umount /mnt/sys

    • If you mounted a separate /boot partition:

      sudo umount /mnt/boot

  14. Unmount the LiveCD's /usr directory:

    sudo umount /mnt/usr

  15. Unmount last device:

    sudo umount /mnt

  16. Reboot.

    sudo reboot

2010/04/25

威寶電信請不要亂改VPN

最近真是流年不順,才剛將grub2的問題給解決,馬上我的威寶3G上網又給我上演罷工戲碼。

之前因為ubuntu內建的network-manager 不隱定,時常抓不到我的3g網卡,因此我一直使用wvdial 來播接上網,我原本的wvdial.conf為

[Dialer Defaults]
Phone = *99***#
Init1 = AT+CGDCONT=1,"ip","vibo"
Username = vibo
Password = vibo
Stupid Mode = 1
Dial Command = ATDT
Modem = /dev/ttyUSB3
;Modem = /dev/ttyUSB0
Modem Type = Analog Modem
Baud = 460800
Init2 = ATZ
Init3 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init4 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ISDN = 0

這個設定已經伴我良久且運作正常,但就在今天,它卻任性了起來,每次執行" sudo wvdial "都給我出現下面的錯誤。

sconnecting at Sun Apr 25 15:43:24 2010
--> The PPP daemon has died: A modem hung up the phone (exit code = 16)
--> man pppd explains pppd error codes in more detail.
--> Try again and look into /var/log/messages and the wvdial and pppd man pages for more information.

不過網上好像沒有類似的討論,看來在linux上用vibo 3g上網的,都是高手,好不容易找到一些消息
http://forums.opensuse.org/get-help-here/network-internet/398615-ppp-daemon-has-died.html
http://ubuntuforums.org/showthread.php?t=351882

原來是威宝把vpn給偷換了,然後windows上的utility會動更新,所以上次才會出現無法連線,重開後又好了的事件。
再來就是要知道其vpn是什麼了,在windows的utility中可以查到新的 vpn 為 internet。

所以更改後的wvdial.conf(如下) 就又可以正常上網啦,真是可喜可賀呀~
[Dialer Defaults]
Phone = *99***#
Init1 = AT+CGDCONT=1,"ip","internet"
Username = vibo
Password = vibo
Stupid Mode = 1
Dial Command = ATDT
Modem = /dev/ttyUSB3
;Modem = /dev/ttyUSB0
Modem Type = Analog Modem
Baud = 460800
Init2 = ATZ
Init3 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init4 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ISDN = 0

2009/06/14

好久沒中毒之lhgiyit0.dll 及 cdaudio.sys

好久沒磁到病毒的我,自以為就此跟病毒無 緣了,
沒想到才剛幫母親解完毒,自已馬上就又中毒,
真是太不小心了,話說現在病毒還滿厲害的,
只是拿隨身碟點兩下,就中了...@"@

2008/12/07

我的 Ram Disk

話說之前安照網上教學作了個ram disk 放暫存檔,
聽說這樣會較快 (實際好像有快一點吧..)
不過我在使用上一直有一個問題,
就是Temp裡面的東西,到底要不要留著,依Mobile 01上面大大的回應是 "不用"

不過,我認為應該是網頁的Temp留,而其他的不用留。
因此我之前設定好的自動貯存及載入部份就要稍作修改了~

C:\WINDOWS\RamdiskSave.bat
修改前:

xcopy r:\*.* c:\ramdisk\*.* /e /y

修改後:

rd /s /q c:\ramdisk
rd R:\TEMP /s /q
mkdir c:\ramdisk
mkdir R:\TEMP
xcopy r:\*.* c:\ramdisk\*.* /e /y

C:\WINDOWS\RamdiskLoad.bat
修改前:

xcopy c:\ramdisk\*.* r:\*.* /e /y
del c:\ramdisk\*.* /q

修改後:

xcopy c:\ramdisk\*.* r:\*.* /e /y

[Reference]

[1.]設定開機/關機自動執行:
gpedit.msc -> 電腦設定 -> Windows 設定 ->指令碼 (啟動/關機)

2008/10/31

電腦小技 For windows XP

  1. 想要對沒用到的開機自動執行程式,取消自動執行。
    1. Ans: 開始>執行>輸入"msconfig"選"啟動"不要執行的就不打勾.