Raspberry Pi 3 安裝 Arch Linux 記實 – 兼論 sync 指令

今天把典藏已經很久的 Raspberry Pi 3 拿出來把玩,當然要配上 Linux distrobution 中最潮的 Arch Linux 才行囉 (極潮的還有 gentoo、LFS,可惜沒用過)。

不過,看著 Arch Linux ARM 官方的 Installation,心先涼了一半:

Note: The current installation uses the 32-bit Raspberry Pi 2 armv7h root filesystem. This will be changing eventually to use our AArch64 repository to take full advantage of the ARMv8 Cortex-A53 cores. If you want an AArch64 system, consider the ODROID-C2.

好,沒有關係,效能沒有辦法完全解放沒有關係,畢竟在 Cortex-M 上翻滾那麼久,一點點的效能損失不算什麼。


  1. Start fdisk to partition the SD card:
  2. At the fdisk prompt, delete old partitions and create a new one:
    1. Type o. This will clear out any partitions on the drive.
    2. Type p to list partitions. There should be no partitions left.
    3. Type n, then p for primary, 1 for the first partition on the drive, press ENTER to accept the default first sector, then type +100M for the last sector.
    4. Type t, then c to set the first partition to type W95 FAT32 (LBA).
    5. Type n, then p for primary, 2 for the second partition on the drive, and then press ENTER twice to accept the default first and last sector.
    6. Write the partition table and exit by typing w.
  3. Create and mount the FAT filesystem:
  4. Create and mount the ext4 filesystem:
  5. Download and extract the root filesystem (as root, not via sudo):
  6. Move boot files to the first partition:
  7. Unmount the two partitions:
  8. Insert the SD card into the Raspberry Pi, connect ethernet, and apply 5V power.
  9. Use the serial console or SSH to the IP address given to the board by your router.
    • Login as the default user alarm with the password alarm.
    • The default root password is root.

我咧,看到第五步傻眼,首先換成 root,用 wget 下載安裝檔,接著解壓縮到 root,這我都可以理解,第3個 sync 是怎麼回事……無法理解。

第一次跑 sync 跑5秒還沒跑完,我就把 shell 關掉直接繼續下面的步驟,拿到 rpi3 上就不動了、不動了、不動了。


回頭去找真男人問 sync 是什麼 (https://linux.die.net/man/2/sync),告訴我是:

sync, syncfs – commit buffer cache to disk


sync() causes all buffered modifications to file metadata and data to be written to the underlying file systems.

syncfs() is like sync(), but synchronizes just the file system containing file referred to by the open file descriptor fd.

原來是要把上一步驟解壓縮的動作完全從 cache 移動到 disk 啊。難怪上次會失敗,因為根本還沒移動完成。




BTH: 35QooNA82isrmQLmpEnqXpJoxeZmaPubPf



Leave a reply:

Your email address will not be published.

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料