There has been an OS Mint 16 on the /dev/sda1 of the PC's disk. Now I need to install the 2nd OS, ArchLinux. First create a new partition, then install Arch on it.
Install Network
The ethernet card can't be detected (there is no enp... in output of ip addr
). So the first step is fix this problem.
root@archiso# lspci -v
...
02:00.0 Ethernet controller: Broadcom Corporation NetLink BCM57780 Gigabit Ethernet PCIe (rev 01)
Subsystem: Dell Device 0400
Flags: fast devsel, IRQ 16
Memory at ...
Capabilities: ...
...
Capabilities: ...
Kernel modules: tg3
root@archiso# dmesg|grep tg3
...
[ 3.129088] tg3.c:v3.136 (Jan 03, 2014)
[ 3.137277] libphy: tg3 mdio bus: probed
[ 3.137281] tg3 0000:02:00.0: No PHY devices
[ 3.137316] tg3 0000:02:00.0: Problem fetching invariants of chip, aborting
root@archiso# uname -a
Linux archiso 3.15.3-1-ARCH #1 SMP PREEMPT Tue Jul 1 07:34:20 CEST 2014 i686 GNU/Linux
So I google "kernel 3.15.3 tg3 bcm57780" and got No Connection with BCM57780 After Installing and BCM57760 don't work with Arch for me:
# rmmod broadcom
# rmmod tg3
# modprobe broadcom
# modprobe tg3
# systemctl stop dhcpcd.service // got the NIC name enp2s0
# dhcpcd enp2s0
# ping www.baidu.com
Create Partition & Install System
# fdisk /dev/sda
m // for help
p
n
... // press <Enter> to accept default values
Partition number (1-4, default 3): press <Enter>
... // press <Enter> to accept default values
Last sector, ...: +40G // the volume of the new partition is 40GB
p // verify the new scheme
w // write to disk
Note the new partition is /dev/sda3.
# mkfs.ext4 /dev/sda3
# mount /dev/sda3 /mnt
# mkdir /mnt/home
# mount /dev/sda1 /mnt/home
# vi /etc/pacman.d/mirrorlist // only choose 163 and ustc, delete others
# pacstrap -i /mnt base base-devel
# genfstab -U -p /mnt >> /mnt/etc/fstab
# arch-chroot /mnt /bin/bash
# vi /etc/locale.gen
# locale-gen
# echo LANG=en_US.UTF-8 > /etc/locale.conf
# export LANG=en_US.UTF-8
# ln -s /usr/share/zoneinfo/Hongkong /etc/localtime
# hwclock --systohc --utc
# echo pcserver > /etc/hostname
# systemctl enable dhcpcd@enp2s0.service
# passwd
# exit
# reboot
Start system with Mint, and run update-grub
as root. Then reboot, you get the "Arch" entry in Grub menu.
Make Second the First OS
Some days past, your Arch works well, and you think the first OS Mint 16 is no longer useful. So now we remove it and make Arch the only OS.
# pacman -S grub
# grub-install --target=i386-pc --recheck /dev/sda
After this step, you can find folder "/boot/grub/i386-pc" is created. The "stage 2" file /boot/grub/i386-pc/core.img, which invoked by "stage 1" file boot.img in MBR during system boot procedure, is created as well. See GNU GRUB for details.
# grub-mkconfig -o /boot/grub/grub.cfg
Now reboot to verify the new grub works. If it is, you can format /dev/sda1 to remove Mint OS, then regenerate grub:
# mkfs.ext4 /dev/sda1
# grub-install --target=i386-pc --recheck /dev/sda
# grub-mkconfig -o /boot/grub/grub.cfg
Reboot, that's it. If you want to resize this partition, you can remove then create it again:
# fdisk /dev/sda
d
...
n
...
If you delete /dev/sda1 without recreating it, an error will araise when regenerating grub.